kalarm

editdlg.h
1/*
2 * editdlg.h - dialogue to create or modify an alarm or alarm template
3 * Program: kalarm
4 * Copyright © 2001-2006,2008 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 <tqdatetime.h>
25#include <tqlineedit.h>
26
27#include <kdialogbase.h>
28
29#include "alarmevent.h"
30#include "alarmtext.h"
31#include "datetime.h"
32#include "soundpicker.h"
33
34class TQButton;
35class TQGroupBox;
36class TQComboBox;
37class TQTabWidget;
38class TQVBox;
39class TQHBox;
40class EmailIdCombo;
41class FontColourButton;
42class ColourCombo;
43class ButtonGroup;
44class TimeEdit;
45class RadioButton;
46class CheckBox;
47class LateCancelSelector;
48class AlarmTimeWidget;
49class RecurrenceEdit;
50class Reminder;
51class SpecialActionsButton;
52class TimeSpinBox;
53class LineEdit;
54class TextEdit;
55class PickAlarmFileRadio;
56
57
58class EditAlarmDlg : public KDialogBase
59{
60 TQ_OBJECT
61
62 public:
63 enum MessageType { MESSAGE, FILE };
64 enum CmdLogType { DISCARD_OUTPUT, LOG_TO_FILE, EXEC_IN_TERMINAL };
65
66 EditAlarmDlg(bool Template, const TQString& caption, TQWidget* parent = 0, const char* name = 0,
67 const KAEvent* = 0, bool readOnly = false);
68 virtual ~EditAlarmDlg();
69 bool getEvent(KAEvent&);
70 void setAction(KAEvent::Action, const AlarmText& = AlarmText());
71
72 static CheckBox* createConfirmAckCheckbox(TQWidget* parent, const char* name = 0);
73
74 static TQString i18n_ConfirmAck(); // plain text of 'Confirm acknowledgement' checkbox
75 static TQString i18n_k_ConfirmAck(); // text of 'Confirm acknowledgement' checkbox, with 'k' shortcut
76 static TQString i18n_SpecialActions(); // plain text of 'Special Actions...' button
77 static TQString i18n_ShowInKOrganizer(); // plain text of 'Show in KOrganizer' checkbox
78 static TQString i18n_g_ShowInKOrganizer(); // text of 'Show in KOrganizer' checkbox, with 'G' shortcut
79 static TQString i18n_EnterScript(); // plain text of 'Enter a script' checkbox
80 static TQString i18n_p_EnterScript(); // text of 'Enter a script' checkbox, with 'P' shortcut
81 static TQString i18n_ExecInTermWindow(); // plain text of 'Execute in terminal window' checkbox
82 static TQString i18n_w_ExecInTermWindow(); // text of 'Execute in terminal window' radio button, with 'W' shortcut
83 static TQString i18n_u_ExecInTermWindow(); // text of 'Execute in terminal window' radio button, with 'U' shortcut
84 static TQString i18n_g_LogToFile(); // text of 'Log to file' radio button, with 'G' shortcut
85 static TQString i18n_CopyEmailToSelf(); // plain text of 'Copy email to self' checkbox
86 static TQString i18n_e_CopyEmailToSelf(); // text of 'Copy email to self' checkbox, with 'E' shortcut
87 static TQString i18n_s_CopyEmailToSelf(); // text of 'Copy email to self' checkbox, with 'S' shortcut
88 static TQString i18n_EmailFrom(); // plain text of 'From:' (email address)
89 static TQString i18n_f_EmailFrom(); // text of 'From:' (email address), with 'F' shortcut
90 static TQString i18n_EmailTo(); // plain text of 'To:' (email addressee)
91 static TQString i18n_EmailSubject(); // plain text of 'Subject:' (email)
92 static TQString i18n_j_EmailSubject(); // text of 'Subject:' (email), with 'J' shortcut
93
94 protected:
95 virtual void resizeEvent(TQResizeEvent*);
96 virtual void showEvent(TQShowEvent*);
97 protected slots:
98 virtual void slotOk();
99 virtual void slotCancel();
100 virtual void slotTry();
101 virtual void slotDefault(); // Load Template
102 private slots:
103 void slotRecurTypeChange(int repeatType);
104 void slotRecurFrequencyChange();
105 void slotAlarmTypeChanged(int id);
106 void slotEditDeferral();
107 void openAddressBook();
108 void slotAddAttachment();
109 void slotRemoveAttachment();
110 void slotShowMainPage();
111 void slotShowRecurrenceEdit();
112 void slotAnyTimeToggled(bool anyTime);
113 void slotTemplateTimeType(int id);
114 void slotSetSubRepetition();
115 void slotCmdScriptToggled(bool);
116
117 private:
118 void initialise(const KAEvent*);
119 void setReadOnly();
120 void setEvent(KAEvent&, const TQString& text, bool trial);
121 KAEvent::Action getAlarmType() const;
122 int getAlarmFlags() const;
123 bool checkText(TQString& result, bool showErrorMessage = true) const;
124 void setSoundPicker();
125 void setRecurTabTitle(const KAEvent* = 0);
126 bool checkCommandData();
127 bool checkEmailData();
128
129 void initDisplayAlarms(TQWidget* parent);
130 void initCommand(TQWidget* parent);
131 void initEmail(TQWidget* parent);
132 void saveState(const KAEvent*);
133 bool stateChanged() const;
134
135 TQTabWidget* mTabs; // the tabs in the dialog
136 int mMainPageIndex;
137 int mRecurPageIndex;
138 bool mMainPageShown; // true once the main tab has been displayed
139 bool mRecurPageShown; // true once the recurrence tab has been displayed
140 bool mRecurSetDefaultEndDate; // adjust default end date/time when recurrence tab is displayed
141
142 ButtonGroup* mActionGroup;
143 RadioButton* mMessageRadio;
144 RadioButton* mCommandRadio;
145 PickAlarmFileRadio* mFileRadio;
146 RadioButton* mEmailRadio;
147 TQWidgetStack* mAlarmTypeStack;
148
149 // Templates
150 TQLineEdit* mTemplateName;
151 ButtonGroup* mTemplateTimeGroup;
152 RadioButton* mTemplateDefaultTime; // no alarm time is specified
153 RadioButton* mTemplateUseTimeAfter;// alarm time is specified as an offset from current
154 RadioButton* mTemplateAnyTime; // alarms have date only, no time
155 RadioButton* mTemplateUseTime; // an alarm time is specified
156 TimeSpinBox* mTemplateTimeAfter; // the specified offset from the current time
157 TimeEdit* mTemplateTime; // the alarm time which is specified
158
159 // Display alarm options widgets
160 TQFrame* mDisplayAlarmsFrame;
161 TQHBox* mFileBox;
162 TQHBox* mFilePadding;
163 SoundPicker* mSoundPicker;
164 CheckBox* mConfirmAck;
165 FontColourButton* mFontColourButton; // for text display option
166 ColourCombo* mBgColourButton; // for file display option
167 TQHBox* mBgColourBox;
168 SpecialActionsButton* mSpecialActionsButton;
169 Reminder* mReminder;
170 bool mReminderDeferral;
171 bool mReminderArchived;
172 // Text message alarm widgets
173 TextEdit* mTextMessageEdit; // text message edit box
174 // Text file alarm widgets
175 LineEdit* mFileMessageEdit; // text file URL edit box
176 TQPushButton* mFileBrowseButton; // text file browse button
177 TQString mFileDefaultDir; // default directory for browse button
178 // Command alarm widgets
179 TQFrame* mCommandFrame;
180 CheckBox* mCmdTypeScript; // entering a script
181 LineEdit* mCmdCommandEdit; // command line edit box
182 TextEdit* mCmdScriptEdit; // script edit box
183 ButtonGroup* mCmdOutputGroup; // what to do with command output
184 LineEdit* mCmdLogFileEdit; // log file URL edit box
185 TQWidget* mCmdPadding;
186 // Email alarm widgets
187 TQFrame* mEmailFrame;
188 EmailIdCombo* mEmailFromList;
189 LineEdit* mEmailToEdit;
190 TQPushButton* mEmailAddressButton; // email open address book button
191 TQLineEdit* mEmailSubjectEdit;
192 TextEdit* mEmailMessageEdit; // email body edit box
193 TQComboBox* mEmailAttachList;
194 TQPushButton* mEmailAddAttachButton;
195 TQPushButton* mEmailRemoveButton;
196 CheckBox* mEmailBcc;
197 TQString mAttachDefaultDir;
198
199 TQGroupBox* mDeferGroup;
200 TQLabel* mDeferTimeLabel;
201 TQPushButton* mDeferChangeButton;
202
203 AlarmTimeWidget* mTimeWidget;
204 LateCancelSelector* mLateCancel;
205 CheckBox* mShowInKorganizer;
206
207 RecurrenceEdit* mRecurrenceEdit;
208
209 TQString mAlarmMessage; // message text/file name/command/email message
210 DateTime mAlarmDateTime;
211 DateTime mDeferDateTime;
212 EmailAddressList mEmailAddresses; // list of addresses to send email to
213 TQStringList mEmailAttachments; // list of email attachment file names
214 unsigned long mKMailSerialNumber; // if email text, message's KMail serial number, else 0
215 int mDeferGroupHeight; // height added by deferred time widget
216 int mDesktop; // desktop to display the dialog in
217 bool mTemplate; // editing an alarm template
218 bool mExpiredRecurrence; // initially a recurrence which has expired
219 mutable bool mChanged; // controls other than deferral have changed since dialog was displayed
220 mutable bool mOnlyDeferred; // the only change made in the dialog was to the existing deferral
221 bool mDesiredReadOnly; // the specified read-only status of the dialogue
222 bool mReadOnly; // the actual read-only status of the dialogue
223
224 // Initial state of all controls
225 KAEvent* mSavedEvent;
226 TQString mSavedTemplateName; // mTemplateName value
227 TQButton* mSavedTemplateTimeType; // selected button in mTemplateTimeGroup
228 TQTime mSavedTemplateTime; // mTemplateTime value
229 int mSavedTemplateAfterTime; // mTemplateAfterTime value
230 TQButton* mSavedTypeRadio; // mMessageRadio, etc
231 SoundPicker::Type mSavedSoundType; // mSoundPicker sound type
232 bool mSavedRepeatSound; // mSoundPicker repeat status
233 TQString mSavedSoundFile; // mSoundPicker sound file
234 float mSavedSoundVolume; // mSoundPicker volume
235 float mSavedSoundFadeVolume;// mSoundPicker fade volume
236 int mSavedSoundFadeSeconds;// mSoundPicker fade time
237 bool mSavedConfirmAck; // mConfirmAck status
238 TQFont mSavedFont; // mFontColourButton font
239 TQColor mSavedBgColour; // mFontColourButton background colour
240 TQColor mSavedFgColour; // mFontColourButton foreground colour
241 TQString mSavedPreAction; // mSpecialActionsButton pre-alarm action
242 TQString mSavedPostAction; // mSpecialActionsButton post-alarm action
243 int mSavedReminder; // mReminder value
244 bool mSavedOnceOnly; // mReminder once-only status
245 TQString mSavedTextFileCommandMessage; // mTextMessageEdit/mFileMessageEdit/mCmdCommandEdit/mEmailMessageEdit value
246 TQString mSavedEmailFrom; // mEmailFromList current value
247 TQString mSavedEmailTo; // mEmailToEdit value
248 TQString mSavedEmailSubject; // mEmailSubjectEdit value
249 TQStringList mSavedEmailAttach; // mEmailAttachList values
250 bool mSavedEmailBcc; // mEmailBcc status
251 bool mSavedCmdScript; // mCmdTypeScript status
252 TQButton* mSavedCmdOutputRadio; // selected button in mCmdOutputGroup
253 TQString mSavedCmdLogFile; // mCmdLogFileEdit value
254 DateTime mSavedDateTime; // mTimeWidget value
255 int mSavedRecurrenceType; // RecurrenceEdit::RepeatType value
256 int mSavedLateCancel; // mLateCancel value
257 bool mSavedAutoClose; // mLateCancel->isAutoClose() value
258 bool mSavedShowInKorganizer; // mShowInKorganizer status
259};
260
261#endif // EDITDLG_H
represents calendar alarms and events
KAEvent corresponds to a KCal::Event instance.
Definition: alarmevent.h:232