1 /***************************************************************************
2 * Copyright (C) 2005-2010 by the Quassel Project *
3 * devel@quassel-irc.org *
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 of the License, or *
8 * (at your option) version 3. *
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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
28 class SystemTray : public QObject {
44 // same as in QSystemTrayIcon
52 // same as in QSystemTrayIcon
53 enum ActivationReason {
61 SystemTray(QObject *parent = 0);
62 virtual ~SystemTray();
63 virtual void init() {}
65 inline State state() const;
66 inline bool isAlerted() const;
67 virtual inline bool isSystemTrayAvailable() const;
69 void setAlert(bool alerted);
70 inline void setInhibitActivation();
71 inline bool isActivationInhibited() const;
74 virtual void setState(State);
75 virtual void setVisible(bool visible = true);
76 virtual void setToolTip(const QString &title, const QString &subtitle);
77 virtual void showMessage(const QString &title, const QString &message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
80 void activated(SystemTray::ActivationReason);
81 void iconChanged(const Icon &);
82 void toolTipChanged(const QString &title, const QString &subtitle);
83 void messageClicked();
86 virtual void setMode(Mode mode);
87 inline Mode mode() const;
89 virtual Icon stateIcon() const;
90 Icon stateIcon(State state) const;
91 inline QString toolTipTitle() const;
92 inline QString toolTipSubTitle() const;
93 inline QMenu *trayMenu() const;
94 void setTrayMenu(QMenu *);
96 virtual bool eventFilter(QObject *obj, QEvent *event);
104 bool _inhibitActivation;
106 QString _toolTipTitle, _toolTipSubTitle;
107 Icon _passiveIcon, _activeIcon, _needsAttentionIcon;
114 bool SystemTray::isSystemTrayAvailable() const { return false; }
115 bool SystemTray::isAlerted() const { return state() == NeedsAttention; }
116 void SystemTray::setInhibitActivation() { _inhibitActivation = true; }
117 bool SystemTray::isActivationInhibited() const { return _inhibitActivation; }
118 SystemTray::Mode SystemTray::mode() const { return _mode; }
119 SystemTray::State SystemTray::state() const { return _state; }
120 QMenu *SystemTray::trayMenu() const { return _trayMenu; }
121 QString SystemTray::toolTipTitle() const { return _toolTipTitle; }
122 QString SystemTray::toolTipSubTitle() const { return _toolTipSubTitle; }