2 Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #include <QtDBus/QtDBus>
32 #include "knotifyconfig.h"
35 typedef QHash
<QString
,QString
> Dict
;
41 class KNotify
: public QObject
44 Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
47 KNotify(QObject
*parent
=0l);
49 void addPlugin( KNotifyPlugin
*p
);
53 void closeNotification( int id
);
55 int event(const QString
&event
, const QString
&fromApp
, const ContextList
& contexts
,
56 const QString
&text
, const QPixmap
& pixmap
, const QStringList
& actions
, WId winId
= 0);
58 void update(int id
, const QString
&text
, const QPixmap
& pixmap
, const QStringList
& actions
);
59 void reemit(int id
, const ContextList
& contexts
);
61 void notificationClosed( int id
);
62 void notificationActivated(int id
,int action
);
65 void slotPluginFinished(int id
);
71 Event(const QString
&appname
, const ContextList
&contexts
, const QString
&eventid
)
72 : config(appname
, contexts
, eventid
) {}
79 QHash
<QString
, KNotifyPlugin
*> m_plugins
;
80 QHash
<int , Event
* > m_notifications
;
82 void emitEvent(Event
*e
);
85 class KNotifyAdaptor
: public QDBusAbstractAdaptor
88 Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
89 Q_CLASSINFO("D-Bus Introspection", ""
90 "<interface name=\"org.kde.KNotify\">"
91 "<signal name=\"notificationClosed\">"
92 "<arg name=\"id\" type=\"i\" direction=\"out\"/>"
94 "<signal name=\"notificationActivated\">"
95 "<arg name=\"id\" type=\"i\" direction=\"out\"/>"
96 "<arg name=\"action\" type=\"i\" direction=\"out\"/>"
98 "<method name=\"reconfigure\">"
100 "<method name=\"closeNotification\">"
101 "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
103 "<method name=\"event\">"
104 "<arg type=\"i\" direction=\"out\"/>"
105 "<arg name=\"event\" type=\"s\" direction=\"in\"/>"
106 "<arg name=\"fromApp\" type=\"s\" direction=\"in\"/>"
107 "<arg name=\"contexts\" type=\"av\" direction=\"in\"/>"
108 "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
109 "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
110 "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
111 "<arg name=\"winId\" type=\"x\" direction=\"in\"/>"
113 "<method name=\"update\">"
114 "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
115 "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
116 "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
117 "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
119 "<method name=\"reemit\">"
120 "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
121 "<arg name=\"contexts\" type=\"av\" direction=\"in\"/>"
127 KNotifyAdaptor(QObject
*parent
);
128 using QObject::event
;
133 void closeNotification( int id
);
135 int event(const QString
&event
, const QString
&fromApp
, const QVariantList
& contexts
,
136 const QString
&text
, const QByteArray
& pixmap
, const QStringList
& actions
, qlonglong winId
);
138 void reemit(int id
, const QVariantList
& contexts
);
139 void update(int id
, const QString
&text
, const QByteArray
& pixmap
, const QStringList
& actions
);
142 void notificationClosed( int id
);
143 void notificationActivated( int id
,int action
);