summaryrefslogtreecommitdiffstats
path: root/src/daemon/NotificationsService.h
blob: 874eda735484de1e1ed5a661273da323da5191a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 *
 *  Notification DBus Service implementation
 *
 *  Copyright (C) 2021  Emanoil Kotsev <[email protected]>
 *
 *
 *  This file is part of kdbusnotification.
 *
 *  kdbusnotification is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  kdbusnotification 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 kdbusnotification; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef NOTIFICATIONSSERVICE_H_
#define NOTIFICATIONSSERVICE_H_

#include <tqdbusconnection.h>
#include <tqdbusvariant.h>
#include <tqstringlist.h>
#include <tqmap.h>

#include "notificationsInterface.h"
#include "NotifyWidget.h"

#define NOTIFICATIONS_DBUS_PATH "/org/freedesktop/Notifications"
#define NOTIFICATIONS_DBUS_SRVC "org.freedesktop.Notifications"

class NotificationsService: public org::freedesktop::NotificationsInterface
{
public:
    NotificationsService(TQT_DBusConnection&);
    virtual ~NotificationsService();

    void closeNotifyWidget(TQ_UINT32 id, TQ_UINT32 reason);

protected: // implement sending signals
    virtual bool handleSignalSend(const TQT_DBusMessage& reply);
    // return the object path
    virtual TQString objectPath() const;

protected:
    // implement DBus calls
    /**
     * Capabilities
     *
     * "body"
     * "body-hyperlinks"
     * "body-images"
     * "body-markup"
     * "icon-static"
     * "persistence"
     * "sound"
     *
     */
    virtual bool GetCapabilities(TQStringList& return_caps, TQT_DBusError& error);
    virtual void CloseNotificationAsync(int asyncCallId, TQ_UINT32 id);
    virtual bool ReloadSettings(TQT_DBusError& error);
    virtual bool GetServerInformation(TQString& return_name, TQString& return_vendor, TQString& return_version, TQString& return_spec_version, TQT_DBusError& error);
    virtual void 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);
    // implement sending replies
    virtual void handleMethodReply(const TQT_DBusMessage& reply);

private:
    TQT_DBusConnection *mConnection;
    TQ_UINT32 mNotificationId;
    TQMap<TQ_UINT32, NotifyWidget*> notificationMap;
};

#endif /* NOTIFICATIONSSERVICE_H_ */