summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-21 14:23:32 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-21 14:23:32 -0500
commit8814698e3f5134f697025e5fad2ed940637e9272 (patch)
treeae5ea38bf5a5919072dea99073be8e0e2726d4de
parent83a46b83d9f57e80bcb82260619b562ffde7e81d (diff)
downloadkdbusnotification-8814698e.tar.gz
kdbusnotification-8814698e.zip
Use notifier stack class in tdeui
-rw-r--r--src/daemon/daemon.cpp74
-rw-r--r--src/daemon/daemon.h25
2 files changed, 4 insertions, 95 deletions
diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp
index 1c582ab..957541e 100644
--- a/src/daemon/daemon.cpp
+++ b/src/daemon/daemon.cpp
@@ -35,6 +35,7 @@
#include <tdeapplication.h>
#include <kiconloader.h>
#include <tdeglobalsettings.h>
+#include <tdepassivepopupstack.h>
#include <stdlib.h>
#include <errno.h>
@@ -43,77 +44,9 @@
#include "daemon.h"
-NotifierContainer* GTKNotifierContainer = NULL;
+TDEPassivePopupStackContainer* GTKNotifierContainer = NULL;
void real_handleGTKMain();
-NotifierContainer::NotifierContainer() : TQWidget() {
- mPopupList.clear();
-
- // Determine bottom of desktop
- TQPoint cursorPos = TQCursor::pos();
- TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
- mTopOfStack = r.height();
- mRightOfStack = r.width();
-}
-
-NotifierContainer::~NotifierContainer() {
-}
-
-void NotifierContainer::handleGTKMain() {
- real_handleGTKMain();
-}
-
-void NotifierContainer::displayMessage(TQString title, TQString message, TQString icon, int x, int y) {
- TQPixmap px;
- TDEIconLoader* il = TDEGlobal::iconLoader();
- px = il->loadIcon( icon, TDEIcon::NoGroup );
-// if (px.isNull()) {
-// px = il->loadIcon( "gnome_apps", TDEIcon::NoGroup );
-// }
-
- KPassivePopup *pop = new KPassivePopup( KPassivePopup::Boxed, this, "" );
- pop->setAutoDelete( true );
- pop->setView( title, message, icon );
- pop->setTimeout( -1 );
- TQPoint leftCorner( x, y);
- if (leftCorner.isNull()) {
- if (mPopupList.isEmpty()) {
- // Determine bottom of desktop
- TQPoint cursorPos = TQCursor::pos();
- TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
- mTopOfStack = r.height();
- mRightOfStack = r.width();
- }
- TQSize popupSize = pop->sizeHint();
- mTopOfStack = mTopOfStack-popupSize.height();
- if (mTopOfStack < 0) mTopOfStack = 0;
- leftCorner.setX(mRightOfStack-popupSize.width());
- leftCorner.setY(mTopOfStack);
- }
- connect(pop, SIGNAL(hidden(KPassivePopup*)), this, SLOT(popupClosed(KPassivePopup*)));
- mPopupList.append(pop);
- pop->show(leftCorner);
-
- processEvents();
-}
-
-void NotifierContainer::processEvents() {
- tqApp->processEvents();
-}
-
-void NotifierContainer::popupClosed(KPassivePopup* popup) {
- // Remove the popup from our list of popups
- mPopupList.remove(popup);
-
- if (mPopupList.isEmpty()) {
- // Determine bottom of desktop
- TQPoint cursorPos = TQCursor::pos();
- TQRect r = TDEGlobalSettings::desktopGeometry(cursorPos);
- mTopOfStack = r.height();
- mRightOfStack = r.width();
- }
-}
-
#undef signals
#include <dbus/dbus.h>
@@ -235,6 +168,7 @@ notify_daemon_notify_handler(NotifyDaemon *daemon,
TQString messageText = TQString::fromLocal8Bit(body);
GTKNotifierContainer->displayMessage(messageCaption, messageText, TQString(icon), x, y);
+ GTKNotifierContainer->processEvents();
return_id = 0;
@@ -353,7 +287,7 @@ main(int argc, char **argv)
TDECmdLineArgs::init(argc, argv, &aboutData);
TDEApplication app;
- NotifierContainer nc;
+ TDEPassivePopupStackContainer nc;
app.setMainWidget(&nc);
GTKNotifierContainer = &nc;
TQTimer *gtkEventProcessor = new TQTimer( &app );
diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h
index 092242d..8931293 100644
--- a/src/daemon/daemon.h
+++ b/src/daemon/daemon.h
@@ -22,31 +22,6 @@
#ifndef NOTIFY_DAEMON_H
#define NOTIFY_DAEMON_H
-#include <tqwidget.h>
-#include <kpassivepopup.h>
-
-class NotifierContainer : public TQWidget
-{
- Q_OBJECT
-
-
-public:
- NotifierContainer();
- ~NotifierContainer();
-
- void displayMessage(TQString title, TQString message, TQString icon, int x, int y);
- void processEvents();
-
-public slots:
- void handleGTKMain();
- void popupClosed(KPassivePopup*);
-
-private:
- TQPtrList<KPassivePopup> mPopupList;
- long mTopOfStack;
- long mRightOfStack;
-};
-
#include <glib.h>
#include <glib-object.h>