2 * prefdlg_p.h - private classes for program preferences dialog
4 * Copyright © 2001-2009 by David Jarvie <djarvie@kde.org>
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.
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.
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.
24 #include "preferences.h"
26 #include "stackedwidgets.h"
29 class QAbstractButton
;
38 class FontColourChooser
;
45 class SpecialActionsButton
;
49 // Base class for each tab in the Preferences dialog
50 class PrefsTabBase
: public StackedScrollWidget
53 PrefsTabBase(StackedScrollGroup
*);
55 void setPreferences();
56 virtual void restore(bool defaults
) = 0;
57 virtual void apply(bool syncToDisc
) = 0;
58 void addAlignedLabel(QLabel
*);
59 KVBox
* topWidget() const { return mTopWidget
; }
60 QVBoxLayout
* topLayout() const { return mTopLayout
; }
61 static int indentWidth() { return mIndentWidth
; }
64 virtual void showEvent(QShowEvent
*);
67 static int mIndentWidth
; // indent width for checkboxes etc.
69 QVBoxLayout
* mTopLayout
;
70 QList
<QLabel
*> mLabels
; // labels to right-align
71 bool mLabelsAligned
; // labels have been aligned
75 // Miscellaneous tab of the Preferences dialog
76 class MiscPrefTab
: public PrefsTabBase
80 MiscPrefTab(StackedScrollGroup
*);
82 virtual void restore(bool defaults
);
83 virtual void apply(bool syncToDisc
);
86 void slotAutostartClicked();
87 void slotOtherTerminalToggled(bool);
90 void setTimeZone(const KTimeZone
&);
92 QCheckBox
* mAutoStart
;
94 QCheckBox
* mConfirmAlarmDeletion
;
95 TimeSpinBox
* mDefaultDeferTime
;
96 ButtonGroup
* mXtermType
;
97 KLineEdit
* mXtermCommand
;
98 int mXtermFirst
; // id of first terminal window radio button
99 int mXtermCount
; // number of terminal window types
103 // Date/time tab of the Preferences dialog
104 class TimePrefTab
: public PrefsTabBase
108 TimePrefTab(StackedScrollGroup
*);
110 virtual void restore(bool defaults
);
111 virtual void apply(bool syncToDisc
);
114 void setWorkDays(const QBitArray
& days
);
116 TimeZoneCombo
* mTimeZone
;
117 KComboBox
* mHolidays
;
118 QMap
<QString
, QString
> mHolidayNames
;
119 TimeEdit
* mStartOfDay
;
120 QCheckBox
* mWorkDays
[7];
121 TimeEdit
* mWorkStart
;
123 TimeSpinBox
* mKOrgEventDuration
;
127 // Storage tab of the Preferences dialog
128 class StorePrefTab
: public PrefsTabBase
132 StorePrefTab(StackedScrollGroup
*);
134 virtual void restore(bool defaults
);
135 virtual void apply(bool syncToDisc
);
138 void slotArchivedToggled(bool);
139 void slotClearArchived();
142 void setArchivedControls(int purgeDays
);
144 QRadioButton
* mDefaultResource
;
145 QRadioButton
* mAskResource
;
146 QCheckBox
* mKeepArchived
;
147 QCheckBox
* mPurgeArchived
;
148 SpinBox
* mPurgeAfter
;
149 QLabel
* mPurgeAfterLabel
;
150 QPushButton
* mClearArchived
;
151 bool mOldKeepArchived
; // previous setting of keep-archived
152 bool mCheckKeepChanges
;
156 // Email tab of the Preferences dialog
157 class EmailPrefTab
: public PrefsTabBase
161 EmailPrefTab(StackedScrollGroup
*);
164 virtual void restore(bool defaults
);
165 virtual void apply(bool syncToDisc
);
168 void slotEmailClientChanged(QAbstractButton
*);
169 void slotFromAddrChanged(QAbstractButton
*);
170 void slotBccAddrChanged(QAbstractButton
*);
171 void slotAddressChanged() { mAddressChanged
= true; }
174 void setEmailAddress(Preferences::MailFrom
, const QString
& address
);
175 void setEmailBccAddress(bool useSystemSettings
, const QString
& address
);
176 QString
validateAddr(ButtonGroup
*, KLineEdit
* addr
, const QString
& msg
);
178 ButtonGroup
* mEmailClient
;
179 RadioButton
* mKMailButton
;
180 RadioButton
* mSendmailButton
;
181 ButtonGroup
* mFromAddressGroup
;
182 RadioButton
* mFromAddrButton
;
183 RadioButton
* mFromCCentreButton
;
184 RadioButton
* mFromKMailButton
;
185 KLineEdit
* mEmailAddress
;
186 ButtonGroup
* mBccAddressGroup
;
187 RadioButton
* mBccAddrButton
;
188 RadioButton
* mBccCCentreButton
;
189 KLineEdit
* mEmailBccAddress
;
190 QCheckBox
* mEmailQueuedNotify
;
191 QCheckBox
* mEmailCopyToKMail
;
192 bool mAddressChanged
;
193 bool mBccAddressChanged
;
197 // Edit defaults tab of the Preferences dialog
198 class EditPrefTab
: public PrefsTabBase
202 EditPrefTab(StackedScrollGroup
*);
205 virtual void restore(bool defaults
);
206 virtual void apply(bool syncToDisc
);
209 void slotBrowseSoundFile();
212 QCheckBox
* mAutoClose
;
213 QCheckBox
* mConfirmAck
;
214 KComboBox
* mReminderUnits
;
215 SpecialActionsButton
* mSpecialActionsButton
;
216 QCheckBox
* mCmdScript
;
217 QCheckBox
* mCmdXterm
;
218 QCheckBox
* mEmailBcc
;
220 QLabel
* mSoundFileLabel
;
221 KLineEdit
* mSoundFile
;
222 QPushButton
* mSoundFileBrowse
;
223 QCheckBox
* mSoundRepeat
;
224 QCheckBox
* mCopyToKOrganizer
;
225 QCheckBox
* mLateCancel
;
226 KComboBox
* mRecurPeriod
;
228 FontColourChooser
* mFontChooser
;
230 static int soundIndex(Preferences::SoundType
);
234 // View tab of the Preferences dialog
235 class ViewPrefTab
: public PrefsTabBase
239 ViewPrefTab(StackedScrollGroup
*);
241 virtual void restore(bool defaults
);
242 virtual void apply(bool syncToDisc
);
245 void slotTooltipAlarmsToggled(bool);
246 void slotTooltipMaxToggled(bool);
247 void slotTooltipTimeToggled(bool);
248 void slotTooltipTimeToToggled(bool);
249 void slotWindowPosChanged(QAbstractButton
*);
252 void setTooltip(int maxAlarms
, bool time
, bool timeTo
, const QString
& prefix
);
254 ColourButton
* mDisabledColour
;
255 ColourButton
* mArchivedColour
;
256 QCheckBox
* mShowInSystemTray
;
257 QCheckBox
* mTooltipShowAlarms
;
258 QCheckBox
* mTooltipMaxAlarms
;
259 SpinBox
* mTooltipMaxAlarmCount
;
260 QCheckBox
* mTooltipShowTime
;
261 QCheckBox
* mTooltipShowTimeTo
;
262 KLineEdit
* mTooltipTimeToPrefix
;
263 QLabel
* mTooltipTimeToPrefixLabel
;
264 ButtonGroup
* mWindowPosition
;
265 QSpinBox
* mWindowButtonDelay
;
266 QLabel
* mWindowButtonDelayLabel
;
267 QCheckBox
* mModalMessages
;
270 #endif // PREFDLG_P_H