kalarm
editdlg.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef EDITDLG_H
00022 #define EDITDLG_H
00023
00024 #include <kdialog.h>
00025
00026 #include "alarmevent.h"
00027 #include "alarmtext.h"
00028 #include "datetime.h"
00029
00030 class QLabel;
00031 class QShowEvent;
00032 class QResizeEvent;
00033 class QAbstractButton;
00034 class QGroupBox;
00035 class QVBoxLayout;
00036 class KTabWidget;
00037 class KLineEdit;
00038 class AlarmResource;
00039 class ButtonGroup;
00040 class TimeEdit;
00041 class RadioButton;
00042 class CheckBox;
00043 class LateCancelSelector;
00044 class AlarmTimeWidget;
00045 class RecurrenceEdit;
00046 class Reminder;
00047 class ShellProcess;
00048 class TimeSpinBox;
00049
00050
00051 class EditAlarmDlg : public KDialog
00052 {
00053 Q_OBJECT
00054 public:
00055 enum Type { DISPLAY, COMMAND, EMAIL };
00056 enum GetResourceType {
00057 RES_PROMPT,
00058 RES_USE_EVENT_ID,
00059 RES_IGNORE
00060 };
00061
00062 static EditAlarmDlg* create(bool Template, Type, bool newAlarm, QWidget* parent = 0,
00063 GetResourceType = RES_PROMPT);
00064 static EditAlarmDlg* create(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
00065 GetResourceType = RES_PROMPT, bool readOnly = false);
00066 virtual ~EditAlarmDlg();
00067 bool getEvent(KAEvent&, AlarmResource*&);
00068 virtual void setAction(KAEvent::Action, const AlarmText& = AlarmText()) = 0;
00069 virtual QSize minimumSizeHint() const;
00070
00071 static QString i18n_chk_ShowInKOrganizer();
00072
00073 protected:
00074 EditAlarmDlg(bool Template, KAEvent::Action, QWidget* parent = 0,
00075 GetResourceType = RES_PROMPT);
00076 EditAlarmDlg(bool Template, const KAEvent*, QWidget* parent = 0,
00077 GetResourceType = RES_PROMPT, bool readOnly = false);
00078 void init(const KAEvent* event, bool newAlarm);
00079 virtual void resizeEvent(QResizeEvent*);
00080 virtual void showEvent(QShowEvent*);
00081 virtual QString type_caption(bool newAlarm) const = 0;
00082 virtual void type_init(QWidget* parent, QVBoxLayout* frameLayout) = 0;
00083 virtual void type_initValues(const KAEvent*) = 0;
00084 virtual void setReadOnly(bool readOnly) = 0;
00085 virtual void saveState(const KAEvent*) = 0;
00086 virtual bool type_stateChanged() const = 0;
00087 virtual void type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial) = 0;
00088 virtual int getAlarmFlags() const;
00089 virtual bool type_validate(bool trial) = 0;
00090 virtual void type_trySuccessMessage(ShellProcess*, const QString& text) = 0;
00091 virtual Reminder* createReminder(QWidget* parent) { Q_UNUSED(parent); return 0; }
00092 virtual CheckBox* type_createConfirmAckCheckbox(QWidget* parent) { Q_UNUSED(parent); return 0; }
00093 virtual bool checkText(QString& result, bool showErrorMessage = true) const = 0;
00094
00095 void showMainPage();
00096 bool isTemplate() const { return mTemplate; }
00097 bool dateOnly() const;
00098 bool isTimedRecurrence() const;
00099 Reminder* reminder() const { return mReminder; }
00100 LateCancelSelector* lateCancel() const { return mLateCancel; }
00101
00102 protected slots:
00103 virtual void slotTry();
00104 virtual void slotDefault();
00105 virtual void slotButtonClicked(int button);
00106 private slots:
00107 void slotRecurTypeChange(int repeatType);
00108 void slotRecurFrequencyChange();
00109 void slotEditDeferral();
00110 void slotShowMainPage();
00111 void slotShowRecurrenceEdit();
00112 void slotAnyTimeToggled(bool anyTime);
00113 void slotTemplateTimeType(QAbstractButton*);
00114 void slotSetSubRepetition();
00115 void slotTrySuccess();
00116
00117 private:
00118 void init(const KAEvent* event, GetResourceType getResource);
00119 void initValues(const KAEvent*);
00120 void setEvent(KAEvent&, const QString& text, bool trial);
00121 bool validate();
00122 void setRecurTabTitle(const KAEvent* = 0);
00123 virtual bool stateChanged() const;
00124
00125 protected:
00126 KAEvent::Action mAlarmType;
00127 private:
00128 KTabWidget* mTabs;
00129 int mMainPageIndex;
00130 int mRecurPageIndex;
00131 bool mMainPageShown;
00132 bool mRecurPageShown;
00133 bool mRecurSetDefaultEndDate;
00134
00135
00136 KLineEdit* mTemplateName;
00137 ButtonGroup* mTemplateTimeGroup;
00138 RadioButton* mTemplateDefaultTime;
00139 RadioButton* mTemplateUseTimeAfter;
00140 RadioButton* mTemplateAnyTime;
00141 RadioButton* mTemplateUseTime;
00142 TimeSpinBox* mTemplateTimeAfter;
00143 TimeEdit* mTemplateTime;
00144 QGroupBox* mDeferGroup;
00145 QLabel* mDeferTimeLabel;
00146 QPushButton* mDeferChangeButton;
00147
00148 AlarmTimeWidget* mTimeWidget;
00149 LateCancelSelector* mLateCancel;
00150 Reminder* mReminder;
00151 CheckBox* mShowInKorganizer;
00152
00153 RecurrenceEdit* mRecurrenceEdit;
00154
00155 QString mAlarmMessage;
00156 DateTime mAlarmDateTime;
00157 DateTime mDeferDateTime;
00158 QString mResourceEventId;
00159 AlarmResource* mResource;
00160 int mDeferGroupHeight;
00161 int mDesktop;
00162 bool mTemplate;
00163 bool mExpiredRecurrence;
00164 mutable bool mChanged;
00165 mutable bool mOnlyDeferred;
00166 bool mDesiredReadOnly;
00167 bool mReadOnly;
00168
00169
00170 KAEvent* mSavedEvent;
00171 QString mSavedTemplateName;
00172 QAbstractButton* mSavedTemplateTimeType;
00173 QTime mSavedTemplateTime;
00174 int mSavedTemplateAfterTime;
00175 QString mSavedTextFileCommandMessage;
00176 KDateTime mSavedDateTime;
00177 int mSavedRecurrenceType;
00178 int mSavedLateCancel;
00179 bool mSavedShowInKorganizer;
00180 };
00181
00182 #endif // EDITDLG_H