• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.12
  • kdepim
  • kalarm
mainwindow.h
Go to the documentation of this file.
1 /*
2  * mainwindow.h - main application window
3  * Program: kalarm
4  * Copyright © 2001-2011 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 #ifndef USE_AKONADI
27 #include "alarmresources.h"
28 #endif
29 #include "editdlg.h"
30 #include "mainwindowbase.h"
31 #include "undo.h"
32 
33 #include <kalarmcal/kaevent.h>
34 
35 #ifdef USE_AKONADI
36 #include <akonadi/item.h>
37 #include <kcalcore/calendar.h>
38 #else
39 #include <kcal/calendar.h>
40 #endif
41 
42 #include <QList>
43 #include <QMap>
44 
45 class QDragEnterEvent;
46 class QHideEvent;
47 class QShowEvent;
48 class QResizeEvent;
49 class QDropEvent;
50 class QCloseEvent;
51 class QSplitter;
52 class QMenu;
53 class KAction;
54 class KToggleAction;
55 class KToolBarPopupAction;
56 #ifdef USE_AKONADI
57 class AlarmListModel;
58 #else
59 class AlarmListFilterModel;
60 #endif
61 class AlarmListView;
62 class NewAlarmAction;
63 class TemplateDlg;
64 class TemplateMenuAction;
65 class ResourceSelector;
66 
67 
68 #ifdef USE_AKONADI
69 class MainWindow : public MainWindowBase, public KCalCore::Calendar::CalendarObserver
70 #else
71 class MainWindow : public MainWindowBase, public KCal::Calendar::CalendarObserver
72 #endif
73 {
74  Q_OBJECT
75 
76  public:
77  static MainWindow* create(bool restored = false);
78  ~MainWindow();
79  bool isTrayParent() const;
80  bool isHiddenTrayParent() const { return mHiddenTrayParent; }
81  bool showingArchived() const { return mShowArchived; }
82 #ifdef USE_AKONADI
83  void selectEvent(Akonadi::Item::Id);
84  KAEvent selectedEvent() const;
85  void editAlarm(EditAlarmDlg*, const KAEvent&);
86 #else
87  void selectEvent(const QString& eventID);
88  KAEvent* selectedEvent() const;
89  void editAlarm(EditAlarmDlg*, const KAEvent&, AlarmResource*);
90 #endif
91  void clearSelection();
92  virtual bool eventFilter(QObject*, QEvent*);
93 
94  static void refresh();
95  static void executeDragEnterEvent(QDragEnterEvent*);
96  static void executeDropEvent(MainWindow*, QDropEvent*);
97  static void closeAll();
98  static MainWindow* toggleWindow(MainWindow*);
99  static MainWindow* mainMainWindow();
100  static MainWindow* firstWindow() { return mWindowList.isEmpty() ? 0 : mWindowList[0]; }
101  static int count() { return mWindowList.count(); }
102 
103  static QString i18n_a_ShowAlarmTimes(); // text of 'Show Alarm Times' action, with 'A' shortcut
104  static QString i18n_chk_ShowAlarmTime(); // text of 'Show alarm time' checkbox
105  static QString i18n_o_ShowTimeToAlarms(); // text of 'Show Time to Alarms' action, with 'O' shortcut
106  static QString i18n_chk_ShowTimeToAlarm(); // text of 'Show time until alarm' checkbox
107 
108  public slots:
109  virtual void show();
110 
111  signals:
112  void selectionChanged();
113 
114  protected:
115  virtual void resizeEvent(QResizeEvent*);
116  virtual void showEvent(QShowEvent*);
117  virtual void hideEvent(QHideEvent*);
118  virtual void closeEvent(QCloseEvent*);
119  virtual void dragEnterEvent(QDragEnterEvent* e) { executeDragEnterEvent(e); }
120  virtual void dropEvent(QDropEvent*);
121  virtual void saveProperties(KConfigGroup&);
122  virtual void readProperties(const KConfigGroup&);
123 
124  private slots:
125  void slotNew(EditAlarmDlg::Type);
126  void slotNewDisplay() { slotNew(EditAlarmDlg::DISPLAY); }
127  void slotNewCommand() { slotNew(EditAlarmDlg::COMMAND); }
128  void slotNewEmail() { slotNew(EditAlarmDlg::EMAIL); }
129  void slotNewAudio() { slotNew(EditAlarmDlg::AUDIO); }
130  void slotNewFromTemplate(const KAEvent*);
131  void slotNewTemplate();
132  void slotCopy();
133  void slotModify();
134  void slotDeleteIf() { slotDelete(false); }
135  void slotDeleteForce() { slotDelete(true); }
136  void slotReactivate();
137  void slotEnable();
138  void slotToggleTrayIcon();
139  void slotRefreshAlarms();
140  void slotImportAlarms();
141  void slotExportAlarms();
142  void slotBirthdays();
143  void slotTemplates();
144  void slotTemplatesEnd();
145  void slotPreferences();
146  void slotConfigureKeys();
147  void slotConfigureToolbar();
148  void slotNewToolbarConfig();
149  void slotQuit();
150  void slotSelection();
151  void slotContextMenuRequested(const QPoint& globalPos);
152  void slotShowTime();
153  void slotShowTimeTo();
154  void slotShowArchived();
155  void slotSpreadWindowsShortcut();
156  void slotWakeFromSuspend();
157  void updateKeepArchived(int days);
158  void slotUndo();
159  void slotUndoItem(QAction* id);
160  void slotRedo();
161  void slotRedoItem(QAction* id);
162  void slotInitUndoMenu();
163  void slotInitRedoMenu();
164  void slotUndoStatus(const QString&, const QString&);
165  void slotFindActive(bool);
166  void updateTrayIconAction();
167  void slotToggleResourceSelector();
168  void slotCalendarStatusChanged();
169  void resourcesResized();
170  void showErrorMessage(const QString&);
171  void editAlarmOk();
172  void editAlarmDeleted(QObject*);
173 
174  private:
175  typedef QList<MainWindow*> WindowList;
176 
177  explicit MainWindow(bool restored);
178  void createListView(bool recreate);
179  void initActions();
180  void initCalendarResources();
181  void selectionCleared();
182  void setEnableText(bool enable);
183  void initUndoMenu(QMenu*, Undo::Type);
184  void slotDelete(bool force);
185  static KAEvent::SubAction getDropAction(QDropEvent*, QString& text);
186  static void setUpdateTimer();
187  static void enableTemplateMenuItem(bool);
188 
189  static WindowList mWindowList; // active main windows
190  static TemplateDlg* mTemplateDlg; // the one and only template dialog
191 
192 #ifdef USE_AKONADI
193  AlarmListModel* mListFilterModel;
194 #else
195  AlarmListFilterModel* mListFilterModel;
196 #endif
197  AlarmListView* mListView;
198  ResourceSelector* mResourceSelector; // resource selector widget
199  QSplitter* mSplitter; // splits window into list and resource selector
200 #ifndef USE_AKONADI
201  AlarmResources* mAlarmResources; // calendar resources to use for this window
202 #endif
203  QMap<EditAlarmDlg*, KAEvent> mEditAlarmMap; // edit alarm dialogs to be handled by this window
204  KToggleAction* mActionToggleResourceSel;
205  KAction* mActionImportAlarms;
206  KAction* mActionExportAlarms;
207  KAction* mActionExport;
208  KAction* mActionImportBirthdays;
209  KAction* mActionTemplates;
210  NewAlarmAction* mActionNew;
211  KAction* mActionCreateTemplate;
212  KAction* mActionCopy;
213  KAction* mActionModify;
214  KAction* mActionDelete;
215  KAction* mActionDeleteForce;
216  KAction* mActionReactivate;
217  KAction* mActionEnable;
218  KAction* mActionFindNext;
219  KAction* mActionFindPrev;
220  KToolBarPopupAction* mActionUndo;
221  KToolBarPopupAction* mActionRedo;
222  KToggleAction* mActionToggleTrayIcon;
223  KToggleAction* mActionShowTime;
224  KToggleAction* mActionShowTimeTo;
225  KToggleAction* mActionShowArchived;
226  KToggleAction* mActionSpreadWindows;
227  KMenu* mActionsMenu;
228  KMenu* mContextMenu;
229  QMap<QAction*, int> mUndoMenuIds; // items in the undo/redo menu, in order of appearance
230  int mResourcesWidth; // width of resource selector widget
231  bool mHiddenTrayParent; // on session restoration, hide this window
232  bool mShowResources; // show resource selector
233  bool mShowArchived; // include archived alarms in the displayed list
234  bool mShowTime; // show alarm times
235  bool mShowTimeTo; // show time-to-alarms
236  bool mShown; // true once the window has been displayed
237  bool mActionEnableEnable; // Enable/Disable action is set to "Enable"
238  bool mMenuError; // error occurred creating menus: need to show error message
239  bool mResizing; // window resize is in progress
240 };
241 
242 #endif // MAINWINDOW_H
243 
244 // vim: et sw=4:
MainWindow::selectionChanged
void selectionChanged()
MainWindow::dropEvent
virtual void dropEvent(QDropEvent *)
Definition: mainwindow.cpp:1365
MainWindow::hideEvent
virtual void hideEvent(QHideEvent *)
Definition: mainwindow.cpp:445
AlarmListFilterModel
Definition: alarmlistfiltermodel.h:31
EditAlarmDlg::EMAIL
Definition: editdlg.h:65
MainWindow::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *e)
Definition: mainwindow.h:119
undo.h
undo/redo facility
MainWindow::count
static int count()
Definition: mainwindow.h:101
EditAlarmDlg::DISPLAY
Definition: editdlg.h:65
EditAlarmDlg::COMMAND
Definition: editdlg.h:65
text
virtual QByteArray text(quint32 serialNumber) const =0
MainWindow::executeDragEnterEvent
static void executeDragEnterEvent(QDragEnterEvent *)
Definition: mainwindow.cpp:1350
MainWindowBase
The MainWindowBase class is a base class for KAlarm's main window and message window.
Definition: mainwindowbase.h:36
MainWindow::clearSelection
void clearSelection()
Definition: mainwindow.cpp:735
MainWindow::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: mainwindow.cpp:375
AlarmListView
Definition: alarmlistview.h:31
editdlg.h
QObject
MainWindow::firstWindow
static MainWindow * firstWindow()
Definition: mainwindow.h:100
MainWindow::closeEvent
virtual void closeEvent(QCloseEvent *)
Definition: mainwindow.cpp:1328
MainWindow::i18n_a_ShowAlarmTimes
static QString i18n_a_ShowAlarmTimes()
Definition: mainwindow.cpp:126
MainWindow::closeAll
static void closeAll()
Definition: mainwindow.cpp:319
MainWindow::isTrayParent
bool isTrayParent() const
Definition: mainwindow.cpp:306
Undo::Type
Type
Definition: undo.h:47
MainWindow::editAlarm
void editAlarm(EditAlarmDlg *, const KAEvent &, AlarmResource *)
Definition: mainwindow.cpp:1725
CalendarObserver
MainWindow::selectEvent
void selectEvent(const QString &eventID)
Definition: mainwindow.cpp:704
MainWindow::isHiddenTrayParent
bool isHiddenTrayParent() const
Definition: mainwindow.h:80
MainWindow::create
static MainWindow * create(bool restored=false)
Definition: mainwindow.cpp:137
TemplateDlg
Definition: templatedlg.h:37
MainWindow::readProperties
virtual void readProperties(const KConfigGroup &)
Definition: mainwindow.cpp:273
TemplateMenuAction
Definition: templatemenuaction.h:29
ResourceSelector
This class provides a view of alarm calendar resources.
Definition: resourceselector.h:70
MainWindow::toggleWindow
static MainWindow * toggleWindow(MainWindow *)
Definition: mainwindow.cpp:1688
MainWindow::i18n_o_ShowTimeToAlarms
static QString i18n_o_ShowTimeToAlarms()
Definition: mainwindow.cpp:128
QMenu
EditAlarmDlg::Type
Type
Definition: editdlg.h:65
MainWindow::eventFilter
virtual bool eventFilter(QObject *, QEvent *)
Definition: mainwindow.cpp:328
EditAlarmDlg
Definition: editdlg.h:61
MainWindow::i18n_chk_ShowAlarmTime
static QString i18n_chk_ShowAlarmTime()
Definition: mainwindow.cpp:127
MainWindow::executeDropEvent
static void executeDropEvent(MainWindow *, QDropEvent *)
Definition: mainwindow.cpp:1380
MainWindow::refresh
static void refresh()
Definition: mainwindow.cpp:676
NewAlarmAction
Definition: newalarmaction.h:31
MainWindow::~MainWindow
~MainWindow()
Definition: mainwindow.cpp:232
EditAlarmDlg::AUDIO
Definition: editdlg.h:65
MainWindow::show
virtual void show()
Definition: mainwindow.cpp:429
MainWindow::showingArchived
bool showingArchived() const
Definition: mainwindow.h:81
MainWindow::mainMainWindow
static MainWindow * mainMainWindow()
Definition: mainwindow.cpp:288
MainWindow::saveProperties
virtual void saveProperties(KConfigGroup &)
Definition: mainwindow.cpp:259
MainWindow
Definition: mainwindow.h:71
AlarmListModel
Definition: itemlistmodel.h:87
MainWindow::i18n_chk_ShowTimeToAlarm
static QString i18n_chk_ShowTimeToAlarm()
Definition: mainwindow.cpp:129
QList
MainWindow::selectedEvent
KAEvent * selectedEvent() const
Definition: mainwindow.cpp:726
mainwindowbase.h
MainWindow::showEvent
virtual void showEvent(QShowEvent *)
Definition: mainwindow.cpp:413
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal