kalarm

mainwindow.h
Go to the documentation of this file.
1/*
2 * mainwindow.h - main application window
3 * Program: kalarm
4 * Copyright © 2001-2007 by David Jarvie <djarvie@kde.org>
5 *
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.
10 *
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.
15 *
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.
19 */
20
21#ifndef MAINWINDOW_H
22#define MAINWINDOW_H
23
26#include "alarmevent.h"
27#include "alarmtext.h"
28#include "mainwindowbase.h"
29#include "undo.h"
30
31class TQListViewItem;
32class TDEAction;
33class TDEToggleAction;
34class TDEToolBarPopupAction;
35class TDEPopupMenu;
36class ActionAlarmsEnabled;
37class AlarmListView;
38class TemplateDlg;
39class TemplateMenuAction;
40
41
42class MainWindow : public MainWindowBase
43{
44 TQ_OBJECT
45
46
47 public:
48 static MainWindow* create(bool restored = false);
49 ~MainWindow();
50 bool isTrayParent() const;
51 bool isHiddenTrayParent() const { return mHiddenTrayParent; }
52 bool showingExpired() const { return mShowExpired; }
53 void selectEvent(const TQString& eventID);
54
55 static void refresh();
56 static void updateExpired();
57 static void addEvent(const KAEvent&, MainWindow*);
58 static void executeNew(MainWindow* w = 0, KAEvent::Action a = KAEvent::MESSAGE, const AlarmText& t = AlarmText())
59 { executeNew(w, 0, a, t); }
60 static void executeNew(const KAEvent& e, MainWindow* w = 0)
61 { executeNew(w, &e); }
62 static void executeEdit(KAEvent&, MainWindow* = 0);
63 static void executeDragEnterEvent(TQDragEnterEvent*);
64 static void executeDropEvent(MainWindow*, TQDropEvent*);
65 static void closeAll();
66 static MainWindow* toggleWindow(MainWindow*);
67 static MainWindow* mainMainWindow();
68 static MainWindow* firstWindow() { return mWindowList.first(); }
69 static int count() { return mWindowList.count(); }
70
71 static TQString i18n_a_ShowAlarmTimes(); // text of 'Show Alarm Times' checkbox, with 'A' shortcut
72 static TQString i18n_m_ShowAlarmTime(); // text of 'Show alarm time' checkbox, with 'M' shortcut
73 static TQString i18n_o_ShowTimeToAlarms(); // text of 'Show Time to Alarms' checkbox, with 'O' shortcut
74 static TQString i18n_l_ShowTimeToAlarm(); // text of 'Show time until alarm' checkbox, with 'L' shortcut
75 static TQString i18n_ShowExpiredAlarms(); // plain text of 'Show Expired Alarms' action
76 static TQString i18n_e_ShowExpiredAlarms(); // text of 'Show Expired Alarms' checkbox, with 'E' shortcut
77 static TQString i18n_HideExpiredAlarms(); // plain text of 'Hide Expired Alarms' action
78 static TQString i18n_e_HideExpiredAlarms(); // text of 'Hide Expired Alarms' action, with 'E' shortcut
79
80 public slots:
81 virtual void show();
82
83 protected:
84 virtual void resizeEvent(TQResizeEvent*);
85 virtual void showEvent(TQShowEvent*);
86 virtual void hideEvent(TQHideEvent*);
87 virtual void closeEvent(TQCloseEvent*);
88 virtual void dragEnterEvent(TQDragEnterEvent*);
89 virtual void dropEvent(TQDropEvent*);
90 virtual void saveProperties(TDEConfig*);
91 virtual void readProperties(TDEConfig*);
92
93 private slots:
94 void slotNew();
95 void slotNewFromTemplate(const KAEvent&);
96 void slotNewTemplate();
97 void slotCopy();
98 void slotModify();
99 void slotDelete();
100 void slotReactivate();
101 void slotView();
102 void slotEnable();
103 void slotToggleTrayIcon();
104 void slotResetDaemon();
105 void slotImportAlarms();
106 void slotBirthdays();
107 void slotTemplates();
108 void slotTemplatesEnd();
109 void slotPreferences();
110 void slotConfigureKeys();
111 void slotConfigureToolbar();
112 void slotNewToolbarConfig();
113 void slotQuit();
114 void slotDeletion();
115 void slotSelection();
116 void slotContextMenuRequested(TQListViewItem*, const TQPoint&, int);
117 void slotMouseClicked(int button, TQListViewItem*, const TQPoint&, int);
118 void slotDoubleClicked(TQListViewItem*);
119 void slotShowTime();
120 void slotShowTimeTo();
121 void slotShowExpired();
122 void slotUpdateTimeTo();
123 void slotUndo();
124 void slotUndoItem(int id);
125 void slotRedo();
126 void slotRedoItem(int id);
127 void slotInitUndoMenu();
128 void slotInitRedoMenu();
129 void slotUndoStatus(const TQString&, const TQString&);
130 void slotFindActive(bool);
131 void slotPrefsChanged();
132 void updateTrayIconAction();
133 void updateActionsMenu();
134 void columnsReordered();
135
136 private:
137 typedef TQValueList<MainWindow*> WindowList;
138
139 MainWindow(bool restored);
140 void createListView(bool recreate);
141 void initActions();
142 void setEnableText(bool enable);
143 static KAEvent::Action getDropAction(TQDropEvent*, TQString& text);
144 static void executeNew(MainWindow*, const KAEvent*, KAEvent::Action = KAEvent::MESSAGE, const AlarmText& = AlarmText());
145 static void initUndoMenu(TDEPopupMenu*, Undo::Type);
146 static void setUpdateTimer();
147 static void enableTemplateMenuItem(bool);
148
149 static WindowList mWindowList; // active main windows
150 static TemplateDlg* mTemplateDlg; // the one and only template dialogue
151
152 AlarmListView* mListView;
153 TDEAction* mActionTemplates;
154 TDEAction* mActionNew;
155 TemplateMenuAction* mActionNewFromTemplate;
156 TDEAction* mActionCreateTemplate;
157 TDEAction* mActionCopy;
158 TDEAction* mActionModify;
159 TDEAction* mActionView;
160 TDEAction* mActionDelete;
161 TDEAction* mActionReactivate;
162 TDEAction* mActionEnable;
163 TDEAction* mActionFindNext;
164 TDEAction* mActionFindPrev;
165 TDEToolBarPopupAction* mActionUndo;
166 TDEToolBarPopupAction* mActionRedo;
167 TDEToggleAction* mActionToggleTrayIcon;
168 TDEToggleAction* mActionShowTime;
169 TDEToggleAction* mActionShowTimeTo;
170 TDEToggleAction* mActionShowExpired;
171 TDEPopupMenu* mActionsMenu;
172 TDEPopupMenu* mContextMenu;
173 bool mMinuteTimerActive; // minute timer is active
174 bool mHiddenTrayParent; // on session restoration, hide this window
175 bool mShowExpired; // include expired alarms in the displayed list
176 bool mShowTime; // show alarm times
177 bool mShowTimeTo; // show time-to-alarms
178 bool mActionEnableEnable; // Enable/Disable action is set to "Enable"
179 bool mMenuError; // error occurred creating menus: need to show error message
180};
181
182#endif // MAINWINDOW_H
183
represents calendar alarms and events
KAEvent corresponds to a KCal::Event instance.
Definition: alarmevent.h:232
The MainWindowBase class is a base class for KAlarm's main window and message window.
undo/redo facility