Waste less space in nested layouts.
[kdepim.git] / kalarm / traywindow.h
blob97aab4d4fe9725b046ddf7b36602f8d516860472
1 /*
2 * traywindow.h - the KDE system tray applet
3 * Program: kalarm
4 * Copyright © 2002-2010 by David Jarvie <djarvie@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef TRAYWINDOW_H
22 #define TRAYWINDOW_H
24 #include "editdlg.h"
25 #include "kaevent.h"
26 #include <ksystemtrayicon.h>
27 #include <QIcon>
29 class QEvent;
30 class QDragEnterEvent;
31 class QDropEvent;
32 class KAction;
33 class KToggleAction;
34 class KAEvent;
35 class MainWindow;
36 class NewAlarmAction;
37 class TemplateMenuAction;
39 class TrayWindow : public KSystemTrayIcon
41 Q_OBJECT
42 public:
43 explicit TrayWindow(MainWindow* parent);
44 ~TrayWindow();
45 void removeWindow(MainWindow*);
46 MainWindow* assocMainWindow() const { return mAssocMainWindow; }
47 void setAssocMainWindow(MainWindow* win) { mAssocMainWindow = win; }
49 signals:
50 void deleted();
52 protected:
53 virtual void dragEnterEvent(QDragEnterEvent*);
54 virtual void dropEvent(QDropEvent*);
55 virtual bool event(QEvent*);
57 private slots:
58 void slotActivated(QSystemTrayIcon::ActivationReason reason);
59 void slotNewAlarm(EditAlarmDlg::Type);
60 void slotNewFromTemplate(const KAEvent*);
61 void slotPreferences();
62 void setEnabledStatus(bool status);
63 void slotHaveDisabledAlarms(bool disabled);
64 void slotResourceStatusChanged();
65 void slotQuit();
67 private:
68 QString tooltipAlarmText() const;
70 MainWindow* mAssocMainWindow; // main window associated with this, or null
71 QIcon mIconEnabled; // normal status icon
72 QIcon mIconDisabled; // icon indicating all alarms disabled
73 QIcon mIconSomeDisabled; // icon indicating individual alarms disabled
74 KToggleAction* mActionEnabled;
75 NewAlarmAction* mActionNew;
76 TemplateMenuAction* mActionNewFromTemplate;
77 bool mHaveDisabledAlarms; // some individually disabled alarms exist
80 #endif // TRAYWINDOW_H