SVN_SILENT made messages (.desktop file)
[rsibreak.git] / src / rsidock.h
blob7f38df20b345b8db2daeeab4c4ef1978c3ac846f
1 /* This file is part of the KDE project
3 Copyright (C) 2005-2006 Tom Albers <tomalbers@kde.nl>
5 The base was copied from ksynaptics:
6 Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
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 GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef RSIDOCK_H
25 #define RSIDOCK_H
27 #include <kdialog.h>
28 #include <qsystemtrayicon.h>
29 //Added by qt3to4:
30 #include <QMouseEvent>
31 #include <QShowEvent>
32 #include <QEvent>
35 class KHelpMenu;
37 class RSIStatWidget;
39 /**
40 * @class RSIDock
41 * This class is responsible for putting rsibreak in the system tray
42 * and provide a proper menu when right clicked on the icon.
44 * Originally this file was copied from KSynaptics
45 * @author Nadeem Hasan <nhasan@kde.org>
46 * @author Tom Albers <tomalbers@kde.nl>
48 class RSIDock : public QSystemTrayIcon
50 Q_OBJECT
52 public:
53 /**
54 * Contructor
55 * @param parent Parent Widget
56 * @param name Name
58 RSIDock( QWidget *parent );
60 /**
61 * Destructor
63 ~RSIDock();
65 signals:
66 /**
67 * This signal is emitted when the user has left
68 * the settings.
69 * @param restart Defines whether the timer should
70 * immediately restarted. This should not happen
71 * when RSIBreak is suspended.
73 void configChanged( bool restart );
75 /**
76 * This signal is emitted when the user enters a dialog
77 * this can be an about X screen or the settings.
79 void dialogEntered();
81 /**
82 * This signal is emitted when the user leaves one of the
83 * about X dialogs, it will not beemitted when the settings
84 * dialog is left, the configChanged() is emitted.
86 void dialogLeft();
88 /**
89 * This signal is emitted when the user wishes to take the break
90 * at this moment, either via the shortcut or the menu (lmb)
92 void breakRequest();
94 /**
95 * This signal is emitted when the user wishes to see all
96 * debug timing info. Needs a --enable-debug comiled RSIBreak
98 void debugRequest();
101 * Suspend RSIBreak on user's request.
103 void suspend( bool );
106 Shows the tooltip.
108 void showToolTip();
110 protected:
112 * Reimplemented because we do not want an action on left click
114 void mousePressEvent( QMouseEvent *e );
117 * Reimplemented to catch the tooltip event.
119 virtual bool event( QEvent * event );
121 private slots:
122 void slotActivated( QSystemTrayIcon::ActivationReason );
123 void slotConfigure();
124 void slotConfigureNotifications();
125 void slotSuspend();
126 void slotBreakRequest();
127 void slotDebugRequest();
128 void slotShowStatistics();
129 void slotResetStats();
130 void slotQuit();
132 private:
133 KHelpMenu* m_help;
135 QAction* m_suspendItem;
136 bool m_suspended;
138 KDialog *m_statsDialog;
139 RSIStatWidget *m_statsWidget;
142 #endif // RSIDOCK_H