/* Copyright (C) 2005-2009 by Olivier Goffart This program 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, or (at your option) any later version. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KNOTIFY_H #define KNOTIFY_H #include #include #include #include "knotifyconfig.h" typedef QHash Dict; class KNotifyPlugin; class KNotify : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify") public: using QObject::event; KNotify(QObject *parent=0l); ~KNotify(); void addPlugin( KNotifyPlugin *p ); public Q_SLOTS: void reconfigure(); void closeNotification( int id); int event(const QString &event, const QString &fromApp, const ContextList& contexts , const QString &title, const QString &text, const KNotifyImage& image, const QStringList& actions, int timeout, WId winId = 0); void update(int id, const QString &title, const QString &text, const KNotifyImage& image, const QStringList& actions); void reemit(int id, const ContextList& contexts); Q_SIGNALS: void notificationClosed( int id); void notificationActivated(int id,int action); private Q_SLOTS: void slotPluginFinished(int id); private: struct Event { Event(const QString &appname, const ContextList &contexts , const QString &eventid) : config(appname, contexts , eventid) {} int id; int ref; KNotifyConfig config; }; int m_counter; QHash m_plugins; QHash m_notifications; void loadConfig(); void emitEvent(Event *e); }; class KNotifyAdaptor : public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify") Q_CLASSINFO("D-Bus Introspection", "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ) public: KNotifyAdaptor(QObject *parent); using QObject::event; public Q_SLOTS: void reconfigure(); void closeNotification( int id); int event(const QString &event, const QString &fromApp, const QVariantList& contexts , const QString &title, const QString &text, const QByteArray& pixmap, const QStringList& actions , int timeout, qlonglong winId ); void reemit(int id, const QVariantList& contexts); void update(int id, const QString &title, const QString &text, const QByteArray& pixmap, const QStringList& actions ); Q_SIGNALS: void notificationClosed( int id); void notificationActivated( int id,int action); }; #endif