• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KNotify

knotify.h

Go to the documentation of this file.
00001 /*
00002    Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org>
00003 
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 
00019  */
00020 
00021 #ifndef KNOTIFY_H
00022 #define KNOTIFY_H
00023 
00024 #include <QObject>
00025 #include <QPixmap>
00026 #include <QHash>
00027 
00028 
00029 #include <QtDBus/QtDBus>
00030 
00031 
00032 #include "knotifyconfig.h"
00033 
00034 
00035 typedef QHash<QString,QString> Dict;
00036 
00037 
00038 class KNotifyPlugin;
00039 
00040 
00041 class KNotify : public QObject
00042 {
00043     Q_OBJECT
00044     Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
00045     public:
00046         using QObject::event;
00047         KNotify(QObject *parent=0l);
00048         ~KNotify();
00049         void addPlugin( KNotifyPlugin *p );
00050     
00051     public Q_SLOTS:
00052         void reconfigure();
00053         void closeNotification( int id);
00054         
00055         int event(const QString &event, const QString &fromApp, const ContextList& contexts ,
00056                    const QString &text, const QPixmap& pixmap,  const QStringList& actions , WId winId = 0);
00057         
00058         void update(int id, const QString &text, const QPixmap& pixmap,  const QStringList& actions);
00059         void reemit(int id, const ContextList& contexts);
00060     Q_SIGNALS:
00061         void notificationClosed( int id);
00062         void notificationActivated(int id,int action);
00063         
00064     private Q_SLOTS:
00065         void slotPluginFinished(int id);
00066         
00067     private:
00068         
00069         struct Event
00070         {
00071             Event(const QString &appname, const ContextList &contexts , const QString &eventid)
00072                 : config(appname, contexts , eventid) {} 
00073             int id;
00074             int ref;
00075             KNotifyConfig config;
00076         };
00077         
00078         int m_counter;
00079         QHash<QString, KNotifyPlugin *> m_plugins;
00080         QHash<int , Event* > m_notifications;
00081         void loadConfig();
00082         void emitEvent(Event *e);
00083 };
00084 
00085 class KNotifyAdaptor : public QDBusAbstractAdaptor
00086 {
00087     Q_OBJECT
00088     Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
00089     Q_CLASSINFO("D-Bus Introspection", ""
00090                     "<interface name=\"org.kde.KNotify\">"
00091                         "<signal name=\"notificationClosed\">"
00092                             "<arg name=\"id\" type=\"i\" direction=\"out\"/>"
00093                         "</signal>"
00094                         "<signal name=\"notificationActivated\">"
00095                             "<arg name=\"id\" type=\"i\" direction=\"out\"/>"
00096                             "<arg name=\"action\" type=\"i\" direction=\"out\"/>"
00097                         "</signal>"
00098                         "<method name=\"reconfigure\">"
00099                         "</method>"
00100                         "<method name=\"closeNotification\">"
00101                             "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
00102                         "</method>"
00103                         "<method name=\"event\">"
00104                             "<arg type=\"i\" direction=\"out\"/>"
00105                             "<arg name=\"event\" type=\"s\" direction=\"in\"/>"
00106                             "<arg name=\"fromApp\" type=\"s\" direction=\"in\"/>"
00107                             "<arg name=\"contexts\" type=\"a(ss)\" direction=\"in\"/>"
00108                             "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
00109                             "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
00110                             "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
00111                             "<arg name=\"winId\" type=\"x\" direction=\"in\"/>"
00112                         "</method>"
00113                         "<method name=\"update\">"
00114                             "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
00115                             "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
00116                             "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
00117                             "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
00118                         "</method>"
00119                         "<method name=\"reemit\">"
00120                             "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
00121                             "<arg name=\"contexts\" type=\"a(ss)\" direction=\"in\"/>"
00122                         "</method>"
00123 
00124                     "</interface>" )
00125 
00126     public:
00127         KNotifyAdaptor(QObject *parent);
00128         using QObject::event;
00129 
00130     public Q_SLOTS:
00131     
00132         void reconfigure();
00133         void closeNotification( int id);
00134         
00135         int event(const QString &event, const QString &fromApp, const QVariantList& contexts ,
00136                                 const QString &text, const QByteArray& pixmap,  const QStringList& actions , qlonglong winId );
00137         
00138         void reemit(int id, const QVariantList& contexts);
00139         void update(int id, const QString &text, const QByteArray& pixmap,  const QStringList& actions );
00140 
00141     Q_SIGNALS:
00142         void notificationClosed( int id);
00143         void notificationActivated( int id,int action);
00144 };
00145 
00146 #endif
00147 

KNotify

Skip menu "KNotify"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal