summaryrefslogtreecommitdiffstats
path: root/src/daemon/NotificationsService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/NotificationsService.cpp')
-rw-r--r--src/daemon/NotificationsService.cpp107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp
new file mode 100644
index 0000000..3fee190
--- /dev/null
+++ b/src/daemon/NotificationsService.cpp
@@ -0,0 +1,107 @@
+/*
+ * PropertiesService.cpp
+ *
+ * Created on: Feb 7, 2021
+ * Author: emanoil
+ *
+ * hardwarecontrol Copyright (C) 2009 hardwarecontrol development team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "NotificationsService.h"
+
+#define NOTIFICATIONS_DBUS_PATH "/org/freedesktop/Notifications"
+#define IMAGE_SIZE 48
+
+#define TDE_VERSION "R14.1.0"
+#define VERSION "0.1"
+
+NotificationsService::NotificationsService(TQT_DBusConnection &conn)
+: org::freedesktop::NotificationsInterface(), mConnection(&conn)
+{
+ // TODO Auto-generated constructor stub
+
+}
+
+NotificationsService::~NotificationsService()
+{
+ // TODO Auto-generated destructor stub
+}
+
+bool NotificationsService::handleSignalSend(const TQT_DBusMessage& reply) {
+
+ return true;
+}
+
+TQString NotificationsService::objectPath() const {
+
+ return TQString(NOTIFICATIONS_DBUS_PATH);
+}
+
+bool NotificationsService::GetCapabilities(TQStringList& return_caps, TQT_DBusError& error) {
+
+ return_caps.clear();
+ return_caps << "actions" << "body" << "body-hyperlinks" << "body-markup" << "icon-static";
+
+ return true;
+}
+
+void NotificationsService::CloseNotificationAsync(int asyncCallId, TQ_UINT32 id) {
+ // Do nothing
+}
+
+bool NotificationsService::ReloadSettings(TQT_DBusError& error) {
+ // Do nothing
+ return true;
+}
+
+bool NotificationsService::GetServerInformation(TQString& return_name, TQString& return_vendor, TQString& return_version, TQString& return_spec_version, TQT_DBusError& error) {
+
+ return_name = TQString("Notification Daemon");
+ return_vendor = TQString("Trinity Desktop Project");
+ return_version = TQString(TDE_VERSION);
+ return_spec_version = TQString(VERSION);
+ return true;
+}
+
+void NotificationsService::NotifyAsync(
+ int asyncCallId,
+ const TQString& app_name, TQ_UINT32 id, const TQString& icon,
+ const TQString& summary, const TQString& body,
+ const TQStringList& actions,
+ const TQMap<TQString, TQT_DBusVariant>& hints, TQ_INT32 timeout)
+{
+
+ notificationMap[id] = new NotifyWidget(0, app_name.ascii() );
+ notificationMap[id]->setFrameStyle( TQFrame::NoFrame );
+ notificationMap[id]->setIcon(icon);
+ notificationMap[id]->setPaletteBackgroundColor(TQt::black);
+ notificationMap[id]->setPaletteForegroundColor(TQt::white);
+ // FXIME: handle hypertext in the body
+ notificationMap[id]->setText(app_name + ": " + summary + "\n" + body);
+ notificationMap[id]->setActions(actions);
+// notificationMap[id]->setHints(hints);
+ notificationMap[id]->setTimeout(timeout);
+ notificationMap[id]->show();
+ notificationMap[id]->raise();
+ notificationMap[id]->setActiveWindow();
+
+ NotifyAsyncReply(asyncCallId, id);
+
+}
+
+void NotificationsService::handleMethodReply(const TQT_DBusMessage& reply){
+ mConnection->send(reply);
+}