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

kalarm

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

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