summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmanoil Kotsev <[email protected]>2021-12-18 00:35:17 +0100
committerEmanoil Kotsev <[email protected]>2024-11-09 18:49:26 +0000
commit5916f27b6416d7c0080a941c0a4c2a9f61f3b808 (patch)
tree6d47d99914dc513df39f8cfa3afd5f40a23f1104 /src
parent1eeb7a3c737487ba0b087520353b51f23063e953 (diff)
downloadkdbusnotification-5916f27b6416d7c0080a941c0a4c2a9f61f3b808.tar.gz
kdbusnotification-5916f27b6416d7c0080a941c0a4c2a9f61f3b808.zip
Moving window
Signed-off-by: Emanoil Kotsev <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/daemon/NotificationsService.cpp3
-rw-r--r--src/daemon/NotifyWidget.cpp21
-rw-r--r--src/daemon/NotifyWidget.h2
3 files changed, 25 insertions, 1 deletions
diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp
index cf3c8a4..1fefa11 100644
--- a/src/daemon/NotificationsService.cpp
+++ b/src/daemon/NotificationsService.cpp
@@ -115,8 +115,11 @@ 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]->raise();
notificationMap[id]->show();
+ notificationMap[id]->adjustSize();
notificationMap[id]->setActiveWindow();
NotifyAsyncReply(asyncCallId, id);
diff --git a/src/daemon/NotifyWidget.cpp b/src/daemon/NotifyWidget.cpp
index 02b40dc..a153a3e 100644
--- a/src/daemon/NotifyWidget.cpp
+++ b/src/daemon/NotifyWidget.cpp
@@ -21,6 +21,7 @@
*/
#include <kdebug.h>
+#include <tdeapplication.h>
#include <tqtimer.h>
#include <tqpixmap.h>
@@ -28,10 +29,13 @@
#include "NotificationsService.h"
NotifyWidget::NotifyWidget(TQWidget *parent, const char *name, NotificationsService *ns, TQ_INT32 id )
-: TQLabel( parent, name, WStyle_Customize | WStyle_Splash),
+: TQLabel( parent, name, WStyle_Customize | TQt::WStyle_StaysOnTop | TQt::WStyle_NoBorder),
mName(TQString(name)), notificationService(ns), mId(id)
{
// TODO Auto-generated constructor stub
+ TQDesktopWidget *d = TQApplication::desktop();
+ mPosition=TQPoint(d->width()-50, d->height()-20);
+ TQTimer::singleShot(100, this, TQT_SLOT(fadeAway()));
}
NotifyWidget::~NotifyWidget()
@@ -53,6 +57,13 @@ void NotifyWidget::timeout()
notificationService->closeNotifyWidget(mId, 1); // The notification expired.
}
+void NotifyWidget::fadeAway()
+{
+ mPosition.setY(mPosition.y()-10);
+ move(mPosition);
+ TQTimer::singleShot(10, this, TQT_SLOT(fadeAway()));
+}
+
void NotifyWidget::setAutoMask(bool b)
{
if (b)
@@ -85,6 +96,14 @@ 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()));
}
diff --git a/src/daemon/NotifyWidget.h b/src/daemon/NotifyWidget.h
index cee8d2e..08a2f9e 100644
--- a/src/daemon/NotifyWidget.h
+++ b/src/daemon/NotifyWidget.h
@@ -49,9 +49,11 @@ protected:
private slots:
void timeout();
+ void fadeAway();
private:
NotificationsService *notificationService;
+ TQPoint mPosition;
TQString mName;
TQ_INT32 mId;
TQString mIcon;