delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / knotify / knotify.h
blobd92fddded54c7d7d06bd03750c47ce8c86346254
1 /*
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)
8 any later version.
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.
21 #ifndef KNOTIFY_H
22 #define KNOTIFY_H
24 #include <QObject>
25 #include <QPixmap>
26 #include <QHash>
29 #include <QtDBus/QtDBus>
32 #include "knotifyconfig.h"
35 typedef QHash<QString,QString> Dict;
38 class KNotifyPlugin;
41 class KNotify : public QObject
43 Q_OBJECT
44 Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
45 public:
46 using QObject::event;
47 KNotify(QObject *parent=0l);
48 ~KNotify();
49 void addPlugin( KNotifyPlugin *p );
51 public Q_SLOTS:
52 void reconfigure();
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);
60 Q_SIGNALS:
61 void notificationClosed( int id);
62 void notificationActivated(int id,int action);
64 private Q_SLOTS:
65 void slotPluginFinished(int id);
67 private:
69 struct Event
71 Event(const QString &appname, const ContextList &contexts , const QString &eventid)
72 : config(appname, contexts , eventid) {}
73 int id;
74 int ref;
75 KNotifyConfig config;
78 int m_counter;
79 QHash<QString, KNotifyPlugin *> m_plugins;
80 QHash<int , Event* > m_notifications;
81 void loadConfig();
82 void emitEvent(Event *e);
85 class KNotifyAdaptor : public QDBusAbstractAdaptor
87 Q_OBJECT
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\"/>"
93 "</signal>"
94 "<signal name=\"notificationActivated\">"
95 "<arg name=\"id\" type=\"i\" direction=\"out\"/>"
96 "<arg name=\"action\" type=\"i\" direction=\"out\"/>"
97 "</signal>"
98 "<method name=\"reconfigure\">"
99 "</method>"
100 "<method name=\"closeNotification\">"
101 "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
102 "</method>"
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\"/>"
112 "</method>"
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\"/>"
118 "</method>"
119 "<method name=\"reemit\">"
120 "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
121 "<arg name=\"contexts\" type=\"av\" direction=\"in\"/>"
122 "</method>"
124 "</interface>" )
126 public:
127 KNotifyAdaptor(QObject *parent);
128 using QObject::event;
130 public Q_SLOTS:
132 void reconfigure();
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 );
141 Q_SIGNALS:
142 void notificationClosed( int id);
143 void notificationActivated( int id,int action);
146 #endif