2 Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org>
3 Copyright (C) 2008 by Dmitry Suzdalev <dimsuz@gmail.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef NOTIFYBYPOPUP_H
23 #define NOTIFYBYPOPUP_H
25 #include "knotifyplugin.h"
31 class NotifyByPopup
: public KNotifyPlugin
34 NotifyByPopup(QObject
*parent
=0l);
35 virtual ~NotifyByPopup();
37 virtual QString
optionName() { return "Popup"; }
38 virtual void notify(int id
, KNotifyConfig
*config
);
39 virtual void close( int id
);
40 virtual void update(int id
, KNotifyConfig
*config
);
42 QMap
<int, KPassivePopup
* > m_popups
;
43 // the y coordinate of the next position popup should appears
46 void fillPopup(KPassivePopup
*,int id
,KNotifyConfig
*config
);
48 * Sends notification to DBus "/Notifications" interface.
49 * @param id knotify-sid identifier of notification
50 * @param replacesId knotify-side notification identifier. If not 0, will
51 * request DBus service to replace existing notification with data in config
52 * @param config notification data
54 void sendNotificationDBus(int id
, int replacesId
, KNotifyConfig
* config
);
56 * Sends request to close Notification with id to DBus "/Notification" interface
57 * @param id knotify-side notification ID to close
59 void closeNotificationDBus(int id
);
61 * Specifies if DBus Notifications interface exists on session bus
63 bool m_dbusServiceExists
;
65 * Find the caption and the icon name of the application
67 void getAppCaptionAndIconName(KNotifyConfig
*config
, QString
*appCaption
, QString
*iconName
);
70 void timerEvent(QTimerEvent
*event
);
73 void slotPopupDestroyed();
74 void slotLinkClicked(const QString
& );
75 // slot to catch appearance or dissapearance of Notifications DBus service
76 void slotServiceOwnerChanged(const QString
&, const QString
&, const QString
&);
77 // slot which gets called when DBus signals that some notification action was invoked
78 void slotDBusNotificationActionInvoked(uint
, const QString
&);
79 // slot which gets called when DBus signals that some notification was closed
80 void slotDBusNotificationClosed(uint
, uint
);
84 * Maps knotify notification IDs to DBus notifications IDs
86 QHash
<int,uint
> m_idMap
;