• 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
editdlg.h
Go to the documentation of this file.
1 /*
2  * editdlg.h - dialog to create or modify an alarm or alarm template
3  * Program: kalarm
4  * Copyright © 2001-2015 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 EDITDLG_H
22 #define EDITDLG_H
23 
24 #include <kalarmcal/alarmtext.h>
25 #include <kalarmcal/datetime.h>
26 #include <kalarmcal/kaevent.h>
27 
28 #ifdef USE_AKONADI
29 #include <akonadi/collection.h>
30 #endif
31 
32 #include <kdialog.h>
33 
34 class QLabel;
35 class QShowEvent;
36 class QResizeEvent;
37 class QAbstractButton;
38 class QGroupBox;
39 class QFrame;
40 class QVBoxLayout;
41 class KLineEdit;
42 class KTabWidget;
43 #ifndef USE_AKONADI
44 class AlarmResource;
45 #endif
46 class ButtonGroup;
47 class TimeEdit;
48 class RadioButton;
49 class CheckBox;
50 class LateCancelSelector;
51 class AlarmTimeWidget;
52 class RecurrenceEdit;
53 class Reminder;
54 class StackedScrollGroup;
55 class TimeSpinBox;
56 
57 using namespace KAlarmCal;
58 
59 
60 class EditAlarmDlg : public KDialog
61 {
62  Q_OBJECT
63  public:
64  enum Type { NO_TYPE, DISPLAY, COMMAND, EMAIL, AUDIO };
65  enum GetResourceType {
66  RES_PROMPT, // prompt for resource
67  RES_USE_EVENT_ID, // use resource containing event, or prompt if not found
68  RES_IGNORE // don't get resource
69  };
70 
71  static EditAlarmDlg* create(bool Template, Type, QWidget* parent = 0,
72  GetResourceType = RES_PROMPT);
73  static EditAlarmDlg* create(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
74  GetResourceType = RES_PROMPT, bool readOnly = false);
75  virtual ~EditAlarmDlg();
76 #ifdef USE_AKONADI
77  bool getEvent(KAEvent&, Akonadi::Collection&);
78 #else
79  bool getEvent(KAEvent&, AlarmResource*&);
80 #endif
81 
82  // Methods to initialise values in the New Alarm dialogue.
83  // N.B. setTime() must be called first to set the date-only characteristic,
84  // followed by setRecurrence() if applicable.
85  void setTime(const DateTime&); // must be called first to set date-only value
86  void setRecurrence(const KARecurrence&, int subRepeatInterval, int subRepeatCount);
87  void setRepeatAtLogin();
88  virtual void setAction(KAEvent::SubAction, const AlarmText& = AlarmText()) = 0;
89  void setLateCancel(int minutes);
90  void setShowInKOrganizer(bool);
91 
92  virtual QSize sizeHint() const { return minimumSizeHint(); }
93 
94  static int instanceCount();
95  static QString i18n_chk_ShowInKOrganizer(); // text of 'Show in KOrganizer' checkbox
96 
97  protected:
98  EditAlarmDlg(bool Template, KAEvent::SubAction, QWidget* parent = 0,
99  GetResourceType = RES_PROMPT);
100  EditAlarmDlg(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
101  GetResourceType = RES_PROMPT, bool readOnly = false);
102  void init(const KAEvent* event);
103  virtual void resizeEvent(QResizeEvent*);
104  virtual void showEvent(QShowEvent*);
105  virtual void closeEvent(QCloseEvent*);
106  virtual bool eventFilter(QObject*, QEvent*);
107  virtual QString type_caption() const = 0;
108  virtual void type_init(QWidget* parent, QVBoxLayout* frameLayout) = 0;
109  virtual void type_initValues(const KAEvent*) = 0;
110  virtual void type_showOptions(bool more) = 0;
111  virtual void setReadOnly(bool readOnly) = 0;
112  virtual void saveState(const KAEvent*) = 0;
113  virtual bool type_stateChanged() const = 0;
114  virtual void type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial) = 0;
115  virtual KAEvent::Flags getAlarmFlags() const;
116  virtual bool type_validate(bool trial) = 0;
117  virtual void type_aboutToTry() {}
118  virtual void type_executedTry(const QString& text, void* obj) { Q_UNUSED(text); Q_UNUSED(obj); }
119  virtual Reminder* createReminder(QWidget* parent) { Q_UNUSED(parent); return 0; }
120  virtual CheckBox* type_createConfirmAckCheckbox(QWidget* parent) { Q_UNUSED(parent); return 0; }
121  virtual bool checkText(QString& result, bool showErrorMessage = true) const = 0;
122 
123  void showMainPage();
124  bool isTemplate() const { return mTemplate; }
125  bool isNewAlarm() const { return mNewAlarm; }
126  bool dateOnly() const;
127  bool isTimedRecurrence() const;
128  bool showingMore() const { return mShowingMore; }
129  Reminder* reminder() const { return mReminder; }
130  LateCancelSelector* lateCancel() const { return mLateCancel; }
131 
132  protected slots:
133  virtual void slotTry();
134  virtual void slotHelp(); // Load Template
135  virtual void slotDefault(); // More/Less Options
136  virtual void slotButtonClicked(int button);
137  void contentsChanged();
138 
139  private slots:
140  void slotRecurTypeChange(int repeatType);
141  void slotRecurFrequencyChange();
142  void slotEditDeferral();
143  void slotShowMainPage();
144  void slotShowRecurrenceEdit();
145  void slotAnyTimeToggled(bool anyTime);
146  void slotTemplateTimeType(QAbstractButton*);
147  void slotSetSubRepetition();
148  void slotResize();
149  void focusFixTimer();
150 
151  private:
152  void init(const KAEvent* event, GetResourceType getResource);
153  void initValues(const KAEvent*);
154  void setEvent(KAEvent&, const QString& text, bool trial);
155  bool validate();
156  void setRecurTabTitle(const KAEvent* = 0);
157  virtual bool stateChanged() const;
158  void showOptions(bool more);
159 
160  protected:
161  KAEvent::SubAction mAlarmType; // actual alarm type
162  private:
163  static QList<EditAlarmDlg*> mWindowList; // list of instances
164  KTabWidget* mTabs; // the tabs in the dialog
165  StackedScrollGroup* mTabScrollGroup;
166  int mMainPageIndex;
167  int mRecurPageIndex;
168  bool mMainPageShown; // true once the main tab has been displayed
169  bool mRecurPageShown; // true once the recurrence tab has been displayed
170  bool mRecurSetDefaultEndDate; // adjust default end date/time when recurrence tab is displayed
171 
172  // Templates
173  KLineEdit* mTemplateName;
174  ButtonGroup* mTemplateTimeGroup;
175  RadioButton* mTemplateDefaultTime; // no alarm time is specified
176  RadioButton* mTemplateUseTimeAfter;// alarm time is specified as an offset from current
177  RadioButton* mTemplateAnyTime; // alarms have date only, no time
178  RadioButton* mTemplateUseTime; // an alarm time is specified
179  TimeSpinBox* mTemplateTimeAfter; // the specified offset from the current time
180  TimeEdit* mTemplateTime; // the alarm time which is specified
181  QGroupBox* mDeferGroup;
182  QLabel* mDeferTimeLabel;
183  QPushButton* mDeferChangeButton;
184 
185  AlarmTimeWidget* mTimeWidget;
186  LateCancelSelector* mLateCancel;
187  Reminder* mReminder; // null except for display alarms
188  CheckBox* mShowInKorganizer;
189 
190  QFrame* mMoreOptions; // contains options hidden by default
191 
192  RecurrenceEdit* mRecurrenceEdit;
193 
194  QString mAlarmMessage; // message text/file name/command/email message
195  DateTime mAlarmDateTime;
196  DateTime mDeferDateTime;
197 #ifdef USE_AKONADI
198  Akonadi::Item::Id mCollectionItemId; // if >=0, save alarm in collection containing this item ID
199  Akonadi::Collection mCollection; // collection to save event into, or null
200 #else
201  QString mResourceEventId; // if non-empty, save alarm in resource containing this event ID
202  AlarmResource* mResource; // resource to save event into, or null
203 #endif
204  int mDeferGroupHeight; // height added by deferred time widget
205  int mDesktop; // desktop to display the dialog in
206  QString mEventId; // UID of event being edited, or blank for new event
207  bool mTemplate; // editing an alarm template
208  bool mNewAlarm; // editing a new alarm
209  bool mExpiredRecurrence; // initially a recurrence which has expired
210  mutable bool mChanged; // controls other than deferral have changed since dialog was displayed
211  mutable bool mOnlyDeferred; // the only change made in the dialog was to the existing deferral
212  bool mDesiredReadOnly; // the specified read-only status of the dialog
213  bool mReadOnly; // the actual read-only status of the dialog
214  bool mShowingMore; // the More Options button has been clicked
215 
216  // Initial state of all controls
217  KAEvent* mSavedEvent;
218  QString mSavedTemplateName; // mTemplateName value
219  QAbstractButton* mSavedTemplateTimeType; // selected button in mTemplateTimeGroup
220  QTime mSavedTemplateTime; // mTemplateTime value
221  int mSavedTemplateAfterTime;// mTemplateAfterTime value
222  QString mSavedTextFileCommandMessage; // mTextMessageEdit/mFileMessageEdit/mCmdCommandEdit/mEmailMessageEdit value
223  KDateTime mSavedDateTime; // mTimeWidget value
224  KDateTime mSavedDeferTime; // mDeferDateTime value
225  int mSavedRecurrenceType; // RecurrenceEdit::RepeatType value
226  int mSavedLateCancel; // mLateCancel value
227  bool mSavedShowInKorganizer; // mShowInKorganizer status
228 };
229 
230 #endif // EDITDLG_H
231 
232 // vim: et sw=4:
saveState
KDEPIM_EXPORT void saveState(QWidget *widget, KConfigGroup &config)
QEvent
EditAlarmDlg::isTemplate
bool isTemplate() const
Definition: editdlg.h:124
QResizeEvent
QWidget
EditAlarmDlg::mAlarmType
KAEvent::SubAction mAlarmType
Definition: editdlg.h:161
EditAlarmDlg::RES_PROMPT
Definition: editdlg.h:66
EditAlarmDlg::lateCancel
LateCancelSelector * lateCancel() const
Definition: editdlg.h:130
create
KPrefsWid * create(KConfigSkeletonItem *item, QWidget *parent)
TimeSpinBox
EditAlarmDlg::type_createConfirmAckCheckbox
virtual CheckBox * type_createConfirmAckCheckbox(QWidget *parent)
Definition: editdlg.h:120
text
virtual QByteArray text(quint32 serialNumber) const =0
RadioButton
EditAlarmDlg::showingMore
bool showingMore() const
Definition: editdlg.h:128
AlarmTimeWidget
Definition: alarmtimewidget.h:41
KDialog
QTime
StackedScrollGroup
EditAlarmDlg::type_executedTry
virtual void type_executedTry(const QString &text, void *obj)
Definition: editdlg.h:118
QCloseEvent
TimeEdit
QGroupBox
CheckBox
QShowEvent
QObject
EditAlarmDlg::sizeHint
virtual QSize sizeHint() const
Definition: editdlg.h:92
EditAlarmDlg::type_aboutToTry
virtual void type_aboutToTry()
Definition: editdlg.h:117
QVBoxLayout
QString
QList< EditAlarmDlg * >
LateCancelSelector
Definition: latecancel.h:33
RecurrenceEdit
Definition: recurrenceedit.h:59
QSize
QFrame
QAbstractButton
KLineEdit
EditAlarmDlg::Type
Type
Definition: editdlg.h:64
EditAlarmDlg
Definition: editdlg.h:60
EditAlarmDlg::RES_USE_EVENT_ID
Definition: editdlg.h:67
EditAlarmDlg::reminder
Reminder * reminder() const
Definition: editdlg.h:129
QPushButton
EditAlarmDlg::isNewAlarm
bool isNewAlarm() const
Definition: editdlg.h:125
QLabel
EditAlarmDlg::GetResourceType
GetResourceType
Definition: editdlg.h:65
EditAlarmDlg::createReminder
virtual Reminder * createReminder(QWidget *parent)
Definition: editdlg.h:119
Reminder
Definition: reminder.h:32
ButtonGroup
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