diff options
author | Emanoil Kotsev <[email protected]> | 2021-12-18 01:28:51 +0100 |
---|---|---|
committer | Emanoil Kotsev <[email protected]> | 2024-11-09 18:49:26 +0000 |
commit | 8cc56c2bc61fd61882a19b7cca1849511a1bdfdf (patch) | |
tree | 9edfdc3765f868fe7aa90d0e21b3cb39674b3c8b | |
parent | 5916f27b6416d7c0080a941c0a4c2a9f61f3b808 (diff) | |
download | kdbusnotification-8cc56c2bc61fd61882a19b7cca1849511a1bdfdf.tar.gz kdbusnotification-8cc56c2bc61fd61882a19b7cca1849511a1bdfdf.zip |
Moving window working
Signed-off-by: Emanoil Kotsev <[email protected]>
-rw-r--r-- | src/daemon/NotificationsService.cpp | 12 | ||||
-rw-r--r-- | src/daemon/NotifyWidget.cpp | 14 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp index 1fefa11..f2992c7 100644 --- a/src/daemon/NotificationsService.cpp +++ b/src/daemon/NotificationsService.cpp @@ -101,7 +101,12 @@ void NotificationsService::NotifyAsync( const TQStringList& actions, const TQMap<TQString, TQT_DBusVariant>& hints, TQ_INT32 timeout) { - + if (notificationMap.contains(id)) + { + NotifyAsyncError(asyncCallId, TQT_DBusError::stdFailed("Requested id already displayed")); + tqDebug("Requested id %i already in use", id); + return; + } notificationMap[id] = new NotifyWidget(0, app_name.ascii(), this, id ); notificationMap[id]->setFrameStyle( TQFrame::NoFrame ); @@ -115,15 +120,12 @@ void NotificationsService::NotifyAsync( notificationMap[id]->setActions(actions); notificationMap[id]->setHints(hints); notificationMap[id]->setTimeout(timeout); - TQPoint p( 100, 100 ); - notificationMap[id]->move( p ); + notificationMap[id]->adjustSize(); notificationMap[id]->raise(); notificationMap[id]->show(); - notificationMap[id]->adjustSize(); notificationMap[id]->setActiveWindow(); NotifyAsyncReply(asyncCallId, id); - } void NotificationsService::handleMethodReply(const TQT_DBusMessage& reply) { diff --git a/src/daemon/NotifyWidget.cpp b/src/daemon/NotifyWidget.cpp index a153a3e..fee959b 100644 --- a/src/daemon/NotifyWidget.cpp +++ b/src/daemon/NotifyWidget.cpp @@ -28,6 +28,8 @@ #include "NotifyWidget.h" #include "NotificationsService.h" +#define FADE_SPEED 5 + NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsService *ns, TQ_INT32 id ) : TQLabel( parent, name, WStyle_Customize | TQt::WStyle_StaysOnTop | TQt::WStyle_NoBorder), mName(TQString(name)), notificationService(ns), mId(id) @@ -35,6 +37,7 @@ NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsServ // TODO Auto-generated constructor stub TQDesktopWidget *d = TQApplication::desktop(); mPosition=TQPoint(d->width()-50, d->height()-20); + move(mPosition); TQTimer::singleShot(100, this, TQT_SLOT(fadeAway())); } @@ -59,9 +62,9 @@ void NotifyWidget::timeout() void NotifyWidget::fadeAway() { - mPosition.setY(mPosition.y()-10); + mPosition.setY(mPosition.y()-1); move(mPosition); - TQTimer::singleShot(10, this, TQT_SLOT(fadeAway())); + TQTimer::singleShot(FADE_SPEED, this, TQT_SLOT(fadeAway())); } void NotifyWidget::setAutoMask(bool b) @@ -97,13 +100,6 @@ void NotifyWidget::setHints(const TQMap< TQString, TQT_DBusVariant >& hints) { void NotifyWidget::setTimeout(TQ_INT32 t) { TDEApplication::kApplication()->setTopWidget(this); -// update(0,0,width(),height()); -// -// int extraWidth = width() - minimumWidth(); -// int extraHeight = height() - minimumHeight(); -// setGeometry(70, 10, 50 + extraWidth, 20 + extraHeight); -// adjustSize(); - TQTimer::singleShot(t, this, TQT_SLOT(timeout())); } |