From b670a6ae130fdc45b942a864046b9dda17feb2a1 Mon Sep 17 00:00:00 2001 From: Emanoil Kotsev Date: Fri, 14 May 2021 18:32:41 +0200 Subject: Some polishing Signed-off-by: Emanoil Kotsev --- src/daemon/NotificationsService.cpp | 8 ++++---- src/daemon/NotifyWidget.cpp | 15 +++++++++------ src/daemon/NotifyWidget.h | 11 ++++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp index 3fee190..297068f 100644 --- a/src/daemon/NotificationsService.cpp +++ b/src/daemon/NotificationsService.cpp @@ -32,7 +32,6 @@ NotificationsService::NotificationsService(TQT_DBusConnection &conn) : org::freedesktop::NotificationsInterface(), mConnection(&conn) { // TODO Auto-generated constructor stub - } NotificationsService::~NotificationsService() @@ -59,7 +58,8 @@ bool NotificationsService::GetCapabilities(TQStringList& return_caps, TQT_DBusEr } void NotificationsService::CloseNotificationAsync(int asyncCallId, TQ_UINT32 id) { - // Do nothing + + CloseNotificationAsyncReply(asyncCallId); } bool NotificationsService::ReloadSettings(TQT_DBusError& error) { @@ -84,7 +84,7 @@ void NotificationsService::NotifyAsync( const TQMap& hints, TQ_INT32 timeout) { - notificationMap[id] = new NotifyWidget(0, app_name.ascii() ); + notificationMap[id] = new NotifyWidget(0, app_name.ascii(), id ); notificationMap[id]->setFrameStyle( TQFrame::NoFrame ); notificationMap[id]->setIcon(icon); notificationMap[id]->setPaletteBackgroundColor(TQt::black); @@ -102,6 +102,6 @@ void NotificationsService::NotifyAsync( } -void NotificationsService::handleMethodReply(const TQT_DBusMessage& reply){ +void NotificationsService::handleMethodReply(const TQT_DBusMessage& reply) { mConnection->send(reply); } diff --git a/src/daemon/NotifyWidget.cpp b/src/daemon/NotifyWidget.cpp index 9fe506b..0cc9d5d 100644 --- a/src/daemon/NotifyWidget.cpp +++ b/src/daemon/NotifyWidget.cpp @@ -24,15 +24,18 @@ #include "NotifyWidget.h" -NotifyWidget::NotifyWidget( TQWidget *parent, const char *name ) -: TQLabel( parent, name , WStyle_Customize | WStyle_Splash), id(TQString(name)) +NotifyWidget::NotifyWidget( TQWidget *parent, const char *name, TQ_INT32 id ) +: TQLabel( parent, name, WStyle_Customize | WStyle_Splash), + mName(TQString(name)), mId(id) { // TODO Auto-generated constructor stub + } NotifyWidget::~NotifyWidget() { // TODO Auto-generated destructor stub + } void NotifyWidget::mousePressEvent( TQMouseEvent *e ) @@ -43,7 +46,6 @@ void NotifyWidget::mousePressEvent( TQMouseEvent *e ) void NotifyWidget::timeout() { this->close(); - //TODO emit NotificationClosed } void NotifyWidget::setAutoMask(bool b) @@ -65,9 +67,10 @@ void NotifyWidget::setActions(const TQStringList& actions) { // TODO handle actions } -//void NotifyWidget::setHints(const TQMap< TQString, TQT_DBusVariant >& hints) { -// mHints = hints; -//} +void NotifyWidget::setHints(const TQMap< TQString, TQT_DBusVariant >& hints) { + mHints = hints; + // TODO handle hints +} void NotifyWidget::setTimeout(TQ_INT32 t) { TQTimer::singleShot(t, this, TQT_SLOT(timeout())); diff --git a/src/daemon/NotifyWidget.h b/src/daemon/NotifyWidget.h index 17b17b6..c28bcd5 100644 --- a/src/daemon/NotifyWidget.h +++ b/src/daemon/NotifyWidget.h @@ -23,20 +23,21 @@ #define SRC_DAEMON_NOTIFYWIDGET_H_ #include +#include class NotifyWidget: public TQLabel { TQ_OBJECT public: - NotifyWidget( TQWidget *parent=0, const char *name=0 ); + NotifyWidget( TQWidget *parent=0, const char *name=0, TQ_INT32 id=0 ); virtual ~NotifyWidget(); void setAutoMask(bool b); void setIcon(const TQString& icon); void setActions(const TQStringList& actions); -// void setHints(const TQMap< TQString, TQT_DBusVariant >& hints); + void setHints(const TQMap< TQString, TQT_DBusVariant >& hints); void setTimeout(TQ_INT32 t); protected: @@ -46,11 +47,11 @@ private slots: void timeout(); private: + TQString mName; + TQ_INT32 mId; TQString mIcon; TQStringList mActions; -// TQMap< TQString, TQT_DBusVariant > mHints; - TQ_INT32 mTimeout; - TQString id; + TQMap< TQString, TQT_DBusVariant > mHints; }; -- cgit v1.2.1