since seezer was too slow: fixing double click buffer switches in the chatmonitor
[quassel.git] / src / qtui / statusnotifieritem.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2010 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This contains code from KStatusNotifierItem, part of the KDE libs     *
6  *   Copyright (C) 2009 Marco Martin <notmart@gmail.com>                   *
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) version 3.                                           *
12  *                                                                         *
13  *   This program is distributed in the hope that it will be useful,       *
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
16  *   GNU General Public License for more details.                          *
17  *                                                                         *
18  *   You should have received a copy of the GNU General Public License     *
19  *   along with this program; if not, write to the                         *
20  *   Free Software Foundation, Inc.,                                       *
21  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
22  ***************************************************************************/
23
24 #ifndef STATUSNOTIFIERITEM_H_
25 #define STATUSNOTIFIERITEM_H_
26
27 #ifdef HAVE_DBUS
28
29 #include "systemtray.h"
30 #include "statusnotifierwatcher.h"
31
32 #ifdef QT_NO_SYSTEMTRAYICON
33 #  define StatusNotifierItemParent SystemTray
34 #else
35 #  define StatusNotifierItemParent LegacySystemTray
36 #  include "legacysystemtray.h"
37 #endif
38
39 class StatusNotifierItemDBus;
40
41 class StatusNotifierItem : public StatusNotifierItemParent {
42   Q_OBJECT
43
44 public:
45   explicit StatusNotifierItem(QWidget *parent);
46   virtual ~StatusNotifierItem();
47
48 public slots:
49   virtual void setState(State state);
50
51 protected:
52   virtual void init();
53   virtual void setMode(Mode mode);
54
55   QString title() const;
56   QString iconName() const;
57   QString attentionIconName() const;
58   QString toolTipIconName() const;
59
60   virtual bool eventFilter(QObject *watched, QEvent *event);
61
62 private slots:
63   void activated(const QPoint &pos);
64   void serviceChange(const QString& name, const QString& oldOwner, const QString& newOwner);
65
66 private:
67   void registerToDaemon();
68
69   static const int _protocolVersion;
70   StatusNotifierItemDBus *_statusNotifierItemDBus;
71
72   org::kde::StatusNotifierWatcher *_statusNotifierWatcher;
73   //org::freedesktop::Notifications *_notificationsClient;
74
75   friend class StatusNotifierItemDBus;
76 };
77
78 #endif /* HAVE_DBUS */
79 #endif /* STATUSNOTIFIERITEM_H_ */