|
|
|
@ -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 );
|
|
|
|
|