1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
/*
* editdlgtypes.h - dialogues to create or edit alarm or alarm template types
* Program: kalarm
* Copyright © 2001-2008 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef EDITDLGTYPES_H
#define EDITDLGTYPES_H
#include <kurl.h>
#include "alarmevent.h"
#include "alarmtext.h"
#include "editdlg.h"
class QAbstractButton;
class QHBoxLayout;
class QGroupBox;
class KComboBox;
class KHBox;
class EmailIdCombo;
class CheckBox;
class ComboBox;
class FontColourButton;
class ColourButton;
class ButtonGroup;
class RadioButton;
class Reminder;
class SoundPicker;
class SpecialActionsButton;
class CommandEdit;
class LineEdit;
class TextEdit;
class EditDisplayAlarmDlg : public EditAlarmDlg
{
Q_OBJECT
public:
// enum MessageType { TEXT, FILE, COMMAND };
EditDisplayAlarmDlg(bool Template, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT);
EditDisplayAlarmDlg(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT, bool readOnly = false);
virtual void setAction(KAEvent::Action, const AlarmText& = AlarmText());
virtual Reminder* createReminder(QWidget* parent);
static CheckBox* createConfirmAckCheckbox(QWidget* parent);
static QString i18n_chk_ConfirmAck(); // text of 'Confirm acknowledgement' checkbox
protected:
virtual QString type_caption(bool newAlarm) const;
virtual void type_init(QWidget* parent, QVBoxLayout* frameLayout);
virtual void type_initValues(const KAEvent*);
virtual void type_showOptions(bool more);
virtual void setReadOnly(bool readOnly);
virtual void saveState(const KAEvent*);
virtual bool type_stateChanged() const;
virtual void type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial);
virtual int getAlarmFlags() const;
virtual bool type_validate(bool trial) { Q_UNUSED(trial); return true; }
virtual void type_trySuccessMessage(ShellProcess*, const QString&) {}
virtual CheckBox* type_createConfirmAckCheckbox(QWidget* parent) { mConfirmAck = createConfirmAckCheckbox(parent); return mConfirmAck; }
virtual bool checkText(QString& result, bool showErrorMessage = true) const;
private slots:
void slotAlarmTypeChanged(int index);
void slotPickFile();
void slotCmdScriptToggled(bool);
void setColours(const QColor& fg, const QColor& bg);
private:
void setSoundPicker();
// Display alarm options
ComboBox* mTypeCombo;
KHBox* mFileBox;
KHBox* mFilePadding;
SoundPicker* mSoundPicker;
CheckBox* mConfirmAck;
FontColourButton* mFontColourButton;
SpecialActionsButton* mSpecialActionsButton;
unsigned long mKMailSerialNumber; // if email text, message's KMail serial number, else 0
bool mReminderDeferral;
bool mReminderArchived;
// Text message alarm widgets
TextEdit* mTextMessageEdit; // text message edit box
// Text file alarm widgets
LineEdit* mFileMessageEdit; // text file URL edit box
QPushButton* mFileBrowseButton; // text file browse button
QString mFileDefaultDir; // default directory for browse button
// Command output alarm widgets
CommandEdit* mCmdEdit;
// Initial state of all controls
int mSavedType; // mTypeCombo index
Preferences::SoundType mSavedSoundType; // mSoundPicker sound type
bool mSavedSound; // mSoundPicker sound status
bool mSavedRepeatSound; // mSoundPicker repeat status
KUrl mSavedSoundFile; // mSoundPicker sound file
float mSavedSoundVolume; // mSoundPicker volume
float mSavedSoundFadeVolume; // mSoundPicker fade volume
int mSavedSoundFadeSeconds; // mSoundPicker fade time
bool mSavedCmdScript; // mCmdEdit->isScript() status
bool mSavedConfirmAck; // mConfirmAck status
QFont mSavedFont; // mFontColourButton font
QColor mSavedBgColour; // mBgColourChoose selection
QColor mSavedFgColour; // mFontColourButton foreground colour
QString mSavedPreAction; // mSpecialActionsButton pre-alarm action
QString mSavedPostAction; // mSpecialActionsButton post-alarm action
int mSavedReminder; // mReminder value
bool mSavedAutoClose; // mLateCancel->isAutoClose() value
bool mSavedOnceOnly; // mReminder once-only status
bool mSavedPreActionCancel; // mSpecialActionsButton cancel on pre-alarm action error
};
class EditCommandAlarmDlg : public EditAlarmDlg
{
Q_OBJECT
public:
EditCommandAlarmDlg(bool Template, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT);
EditCommandAlarmDlg(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT, bool readOnly = false);
virtual void setAction(KAEvent::Action, const AlarmText& = AlarmText());
static QString i18n_chk_EnterScript(); // text of 'Enter a script' checkbox
static QString i18n_radio_ExecInTermWindow(); // text of 'Execute in terminal window' radio button
static QString i18n_chk_ExecInTermWindow(); // text of 'Execute in terminal window' checkbox
protected:
virtual QString type_caption(bool newAlarm) const;
virtual void type_init(QWidget* parent, QVBoxLayout* frameLayout);
virtual void type_initValues(const KAEvent*);
virtual void type_showOptions(bool more);
virtual void setReadOnly(bool readOnly);
virtual void saveState(const KAEvent*);
virtual bool type_stateChanged() const;
virtual void type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial);
virtual int getAlarmFlags() const;
virtual bool type_validate(bool trial);
virtual void type_trySuccessMessage(ShellProcess*, const QString& text);
virtual bool checkText(QString& result, bool showErrorMessage = true) const;
private slots:
void slotCmdScriptToggled(bool);
private:
// Command alarm options
CommandEdit* mCmdEdit;
QGroupBox* mCmdOutputBox;
ButtonGroup* mCmdOutputGroup; // what to do with command output
RadioButton* mCmdExecInTerm;
RadioButton* mCmdLogToFile;
RadioButton* mCmdDiscardOutput;
LineEdit* mCmdLogFileEdit; // log file URL edit box
KHBox* mCmdPadding;
// Initial state of all controls
bool mSavedCmdScript; // mCmdEdit->isScript() status
QAbstractButton* mSavedCmdOutputRadio; // selected button in mCmdOutputGroup
QString mSavedCmdLogFile; // mCmdLogFileEdit value
};
class EditEmailAlarmDlg : public EditAlarmDlg
{
Q_OBJECT
public:
EditEmailAlarmDlg(bool Template, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT);
EditEmailAlarmDlg(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
GetResourceType = RES_PROMPT, bool readOnly = false);
virtual void setAction(KAEvent::Action, const AlarmText& = AlarmText());
static QString i18n_chk_CopyEmailToSelf(); // text of 'Copy email to self' checkbox
protected:
virtual QString type_caption(bool newAlarm) const;
virtual void type_init(QWidget* parent, QVBoxLayout* frameLayout);
virtual void type_initValues(const KAEvent*);
virtual void type_showOptions(bool) {}
virtual void setReadOnly(bool readOnly);
virtual void saveState(const KAEvent*);
virtual bool type_stateChanged() const;
virtual void type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial);
virtual int getAlarmFlags() const;
virtual bool type_validate(bool trial);
virtual void type_trySuccessMessage(ShellProcess*, const QString& text);
virtual bool checkText(QString& result, bool showErrorMessage = true) const;
private slots:
void openAddressBook();
void slotAddAttachment();
void slotRemoveAttachment();
private:
// Email alarm options
EmailIdCombo* mEmailFromList;
LineEdit* mEmailToEdit;
QPushButton* mEmailAddressButton; // email open address book button
LineEdit* mEmailSubjectEdit;
TextEdit* mEmailMessageEdit; // email body edit box
KComboBox* mEmailAttachList;
QPushButton* mEmailAddAttachButton;
QPushButton* mEmailRemoveButton;
CheckBox* mEmailBcc;
QString mAttachDefaultDir;
EmailAddressList mEmailAddresses; // list of addresses to send email to
QStringList mEmailAttachments; // list of email attachment file names
// Initial state of all controls
QString mSavedEmailFrom; // mEmailFromList current value
QString mSavedEmailTo; // mEmailToEdit value
QString mSavedEmailSubject; // mEmailSubjectEdit value
QStringList mSavedEmailAttach; // mEmailAttachList values
bool mSavedEmailBcc; // mEmailBcc status
};
#endif // EDITDLGTYPES_H
|