Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
statusnotifieritemdbus.h
Go to the documentation of this file.
1 /***************************************************************************
2  * The original file is part of the KDE libraries *
3  * Copyright (C) 2009 by Marco Martin <notmart@gmail.com> *
4  * Quasselfied 2010 by Manuel Nickschas <sputnick@quassel-irc.org> *
5  * *
6  * This file is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU Library General Public License (LGPL) *
8  * as published by the Free Software Foundation; either version 2 of the *
9  * License, or (at your option) any later version. *
10  * *
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. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20  ***************************************************************************/
21 
22 #ifndef STATUSNOTIFIERITEMDBUS_H_
23 #define STATUSNOTIFIERITEMDBUS_H_
24 
25 #include <QObject>
26 #include <QString>
27 #include <QDBusArgument>
28 #include <QDBusConnection>
29 #include <QPixmap>
30 
31 //Custom message type for DBus
33  int width;
34  int height;
35  QByteArray data;
36 };
37 
38 typedef QVector<DBusImageStruct> DBusImageVector;
39 
41  QString icon;
43  QString title;
44  QString subTitle;
45 };
46 
47 class StatusNotifierItem;
48 
49 class StatusNotifierItemDBus : public QObject
50 {
51  Q_OBJECT
52 
53  Q_PROPERTY(QString Category READ Category)
54  Q_PROPERTY(QString Id READ Id)
55  Q_PROPERTY(QString Title READ Title)
56  Q_PROPERTY(QString Status READ Status)
57  Q_PROPERTY(int WindowId READ WindowId)
58  Q_PROPERTY(QString IconName READ IconName)
60  Q_PROPERTY(QString OverlayIconName READ OverlayIconName)
62  Q_PROPERTY(QString AttentionIconName READ AttentionIconName)
64  Q_PROPERTY(QString AttentionMovieName READ AttentionMovieName)
66  Q_PROPERTY(QString IconThemePath READ IconThemePath)
67  Q_PROPERTY(QDBusObjectPath Menu READ Menu)
68 
69  friend class StatusNotifierItem;
70 public:
71  StatusNotifierItemDBus(StatusNotifierItem *parent);
73 
77  QDBusConnection dbusConnection() const;
78 
82  void registerService();
83 
87  void unregisterService();
88 
92  QString service() const;
93 
98  QString Category() const;
99 
103  QString Id() const;
104 
108  QString Title() const;
109 
114  QString Status() const;
115 
119  int WindowId() const;
120 
125  QString IconName() const;
126 
130  DBusImageVector IconPixmap() const;
131 
136  QString OverlayIconName() const;
137 
142 
148  QString AttentionIconName() const;
149 
154 
158  QString AttentionMovieName() const;
159 
163  DBusToolTipStruct ToolTip() const;
164 
168  QString IconThemePath() const;
169 
173  QDBusObjectPath Menu() const;
174 
175 public Q_SLOTS:
176  //interaction
181  void ContextMenu(int x, int y);
182 
187  void Activate(int x, int y);
188 
192  void SecondaryActivate(int x, int y);
193 
197  void Scroll(int delta, const QString &orientation);
198 
199 Q_SIGNALS:
204  void NewIcon();
205 
209  void NewOverlayIcon();
210 
215  void NewAttentionIcon();
216 
220  void NewToolTip();
221 
226  void NewStatus(const QString &status);
227 
228 private:
229  StatusNotifierItem *m_statusNotifierItem;
230  QString m_service;
231  QDBusConnection m_dbus;
232  static int s_serviceCount;
233 };
234 
235 
236 const QDBusArgument &operator<<(QDBusArgument &argument, const DBusImageStruct &icon);
237 const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImageStruct &icon);
238 
240 
241 const QDBusArgument &operator<<(QDBusArgument &argument, const DBusImageVector &iconVector);
242 const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImageVector &iconVector);
243 
245 
246 const QDBusArgument &operator<<(QDBusArgument &argument, const DBusToolTipStruct &toolTip);
247 const QDBusArgument &operator>>(const QDBusArgument &argument, DBusToolTipStruct &toolTip);
248 
250 
251 #endif