1 /***************************************************************************
2 * Copyright (C) 2005-09 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 ***************************************************************************/
24 #ifndef QT_NO_SYSTEMTRAYICON
27 # include <KSystemTrayIcon>
29 # include <QSystemTrayIcon>
36 class SystemTray : public QObject {
45 SystemTray(QObject *parent = 0);
48 inline bool isSystemTrayAvailable() const;
49 inline bool isAlerted() const;
51 inline void setInhibitActivation();
55 void setAlert(bool alert = true);
56 void setIconVisible(bool visible = true);
57 void setToolTip(const QString &tip);
58 void showMessage(const QString &title, const QString &message,
59 QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int millisecondsTimeoutHint = 10000);
62 void activated(QSystemTrayIcon::ActivationReason);
63 void iconChanged(const Icon &);
64 void messageClicked();
67 bool eventFilter(QObject *obj, QEvent *event);
71 void on_activated(QSystemTrayIcon::ActivationReason);
74 void loadAnimations();
77 KSystemTrayIcon *_trayIcon;
79 QSystemTrayIcon *_trayIcon;
85 bool _inhibitActivation;
87 int _idxOffStart, _idxOffEnd, _idxOnStart, _idxOnEnd, _idxAlertStart;
89 QTimer _animationTimer;
91 QList<QPixmap> _phases;
96 bool SystemTray::isSystemTrayAvailable() const { return QSystemTrayIcon::isSystemTrayAvailable(); }
97 bool SystemTray::isAlerted() const { return _alert; }
98 void SystemTray::setInhibitActivation() { _inhibitActivation = true; }
100 #endif /* QT_NO_SYSTEMTRAYICON */