• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

KNotify

  • sources
  • kde-4.14
  • kde-runtime
  • knotify
knotify.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005-2009 by Olivier Goffart <ogoffart at kde.org>
3 
4 
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.
9 
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.
14 
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.
18 
19  */
20 
21 #ifndef KNOTIFY_H
22 #define KNOTIFY_H
23 
24 #include <QObject>
25 #include <QHash>
26 
27 
28 #include <QtDBus/QtDBus>
29 
30 
31 #include "knotifyconfig.h"
32 
33 
34 typedef QHash<QString,QString> Dict;
35 
36 
37 class KNotifyPlugin;
38 
39 
40 class KNotify : public QObject
41 {
42  Q_OBJECT
43  Q_CLASSINFO("D-Bus Interface", "org.kde.KNotify")
44  public:
45  using QObject::event;
46  KNotify(QObject *parent=0l);
47  ~KNotify();
48  void addPlugin( KNotifyPlugin *p );
49 
50  public Q_SLOTS:
51  void reconfigure();
52  void closeNotification( int id);
53 
54  int event(const QString &event, const QString &fromApp, const ContextList& contexts ,
55  const QString &title, const QString &text, const KNotifyImage& image, const QStringList& actions,
56  int timeout, WId winId = 0);
57 
58  void update(int id, const QString &title, const QString &text, const KNotifyImage& image, 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);
63 
64  private Q_SLOTS:
65  void slotPluginFinished(int id);
66 
67  private:
68 
69  struct Event
70  {
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;
76  };
77 
78  int m_counter;
79  QHash<QString, KNotifyPlugin *> m_plugins;
80  QHash<int , Event* > m_notifications;
81  void loadConfig();
82  void emitEvent(Event *e);
83 };
84 
85 class KNotifyAdaptor : public QDBusAbstractAdaptor
86 {
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=\"title\" type=\"s\" direction=\"in\"/>"
109  "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
110  "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
111  "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
112  "<arg name=\"timeout\" type=\"i\" direction=\"in\"/>"
113  "<arg name=\"winId\" type=\"x\" direction=\"in\"/>"
114  "</method>"
115  "<method name=\"update\">"
116  "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
117  "<arg name=\"title\" type=\"s\" direction=\"in\"/>"
118  "<arg name=\"text\" type=\"s\" direction=\"in\"/>"
119  "<arg name=\"pixmap\" type=\"ay\" direction=\"in\"/>"
120  "<arg name=\"actions\" type=\"as\" direction=\"in\"/>"
121  "</method>"
122  "<method name=\"reemit\">"
123  "<arg name=\"id\" type=\"i\" direction=\"in\"/>"
124  "<arg name=\"contexts\" type=\"av\" direction=\"in\"/>"
125  "</method>"
126 
127  "</interface>" )
128 
129  public:
130  KNotifyAdaptor(QObject *parent);
131  using QObject::event;
132 
133  public Q_SLOTS:
134 
135  void reconfigure();
136  void closeNotification( int id);
137 
138  int event(const QString &event, const QString &fromApp, const QVariantList& contexts ,
139  const QString &title, const QString &text, const QByteArray& pixmap, const QStringList& actions , int timeout,
140  qlonglong winId );
141 
142  void reemit(int id, const QVariantList& contexts);
143  void update(int id, const QString &title, const QString &text, const QByteArray& pixmap, const QStringList& actions );
144 
145  Q_SIGNALS:
146  void notificationClosed( int id);
147  void notificationActivated( int id,int action);
148 };
149 
150 #endif
151 
KNotifyAdaptor::reemit
void reemit(int id, const QVariantList &contexts)
Definition: knotify.cpp:292
QByteArray
KNotifyAdaptor::event
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)
Definition: knotify.cpp:261
KNotifyPlugin
abstract class for KNotify actions
Definition: knotifyplugin.h:44
KNotifyAdaptor::update
void update(int id, const QString &title, const QString &text, const QByteArray &pixmap, const QStringList &actions)
Definition: knotify.cpp:310
KNotify::update
void update(int id, const QString &title, const QString &text, const KNotifyImage &image, const QStringList &actions)
Definition: knotify.cpp:162
knotifyconfig.h
KNotifyAdaptor::reconfigure
void reconfigure()
Definition: knotify.cpp:251
QObject::event
virtual bool event(QEvent *e)
QDBusAbstractAdaptor
KNotifyImage
An image with lazy loading from the byte array.
Definition: knotifyconfig.h:37
KNotify::notificationClosed
void notificationClosed(int id)
Dict
QHash< QString, QString > Dict
Definition: knotify.h:34
KNotifyAdaptor
Definition: knotify.h:85
QHash
QObject
QString
QList< QPair< QString, QString > >
QStringList
KNotify
Definition: knotify.h:40
KNotify::notificationActivated
void notificationActivated(int id, int action)
KNotify::addPlugin
void addPlugin(KNotifyPlugin *p)
Definition: knotify.cpp:94
KNotify::reconfigure
void reconfigure()
Definition: knotify.cpp:103
KNotify::reemit
void reemit(int id, const ContextList &contexts)
Definition: knotify.cpp:179
KNotify::closeNotification
void closeNotification(int id)
Definition: knotify.cpp:110
KNotify::~KNotify
~KNotify()
Definition: knotify.cpp:55
KNotifyAdaptor::notificationActivated
void notificationActivated(int id, int action)
KNotify::KNotify
KNotify(QObject *parent=0l)
Definition: knotify.cpp:44
KNotifyAdaptor::closeNotification
void closeNotification(int id)
Definition: knotify.cpp:256
QObject::parent
QObject * parent() const
KNotifyConfig
Represent the configuration for an event.
Definition: knotifyconfig.h:60
KNotifyAdaptor::notificationClosed
void notificationClosed(int id)
KNotify::event
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)
Definition: knotify.cpp:134
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNotify

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

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal