Make it possible to use a distinct selection model in the foldertreewidget.
[kdepim.git] / kalarm / prefdlg_p.h
blob45c7a6fd9a28d94e4c50ee9b9e10ee06af2d7d5d
1 /*
2 * prefdlg_p.h - private classes for program preferences dialog
3 * Program: kalarm
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.
21 #ifndef PREFDLG_P_H
22 #define PREFDLG_P_H
24 #include "preferences.h"
25 #include "prefdlg.h"
26 #include "stackedwidgets.h"
28 class QCheckBox;
29 class QAbstractButton;
30 class QRadioButton;
31 class QPushButton;
32 class QLabel;
33 class QSpinBox;
34 class KTimeZone;
35 class KLineEdit;
36 class KVBox;
37 class KComboBox;
38 class FontColourChooser;
39 class ColourButton;
40 class ButtonGroup;
41 class RadioButton;
42 class TimeEdit;
43 class SpinBox;
44 class TimeSpinBox;
45 class SpecialActionsButton;
46 class TimeZoneCombo;
49 // Base class for each tab in the Preferences dialog
50 class PrefsTabBase : public StackedScrollWidget
52 public:
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; }
63 protected:
64 virtual void showEvent(QShowEvent*);
66 private:
67 static int mIndentWidth; // indent width for checkboxes etc.
68 KVBox* mTopWidget;
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
78 Q_OBJECT
79 public:
80 MiscPrefTab(StackedScrollGroup*);
82 virtual void restore(bool defaults);
83 virtual void apply(bool syncToDisc);
85 private slots:
86 void slotAutostartClicked();
87 void slotOtherTerminalToggled(bool);
89 private:
90 void setTimeZone(const KTimeZone&);
92 QCheckBox* mAutoStart;
93 QCheckBox* mQuitWarn;
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
106 Q_OBJECT
107 public:
108 TimePrefTab(StackedScrollGroup*);
110 virtual void restore(bool defaults);
111 virtual void apply(bool syncToDisc);
113 private:
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;
122 TimeEdit* mWorkEnd;
123 TimeSpinBox* mKOrgEventDuration;
127 // Storage tab of the Preferences dialog
128 class StorePrefTab : public PrefsTabBase
130 Q_OBJECT
131 public:
132 StorePrefTab(StackedScrollGroup*);
134 virtual void restore(bool defaults);
135 virtual void apply(bool syncToDisc);
137 private slots:
138 void slotArchivedToggled(bool);
139 void slotClearArchived();
141 private:
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
159 Q_OBJECT
160 public:
161 EmailPrefTab(StackedScrollGroup*);
163 QString validate();
164 virtual void restore(bool defaults);
165 virtual void apply(bool syncToDisc);
167 private slots:
168 void slotEmailClientChanged(QAbstractButton*);
169 void slotFromAddrChanged(QAbstractButton*);
170 void slotBccAddrChanged(QAbstractButton*);
171 void slotAddressChanged() { mAddressChanged = true; }
173 private:
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
200 Q_OBJECT
201 public:
202 EditPrefTab(StackedScrollGroup*);
204 QString validate();
205 virtual void restore(bool defaults);
206 virtual void apply(bool syncToDisc);
208 private slots:
209 void slotBrowseSoundFile();
211 private:
212 QCheckBox* mAutoClose;
213 QCheckBox* mConfirmAck;
214 KComboBox* mReminderUnits;
215 SpecialActionsButton* mSpecialActionsButton;
216 QCheckBox* mCmdScript;
217 QCheckBox* mCmdXterm;
218 QCheckBox* mEmailBcc;
219 KComboBox* mSound;
220 QLabel* mSoundFileLabel;
221 KLineEdit* mSoundFile;
222 QPushButton* mSoundFileBrowse;
223 QCheckBox* mSoundRepeat;
224 QCheckBox* mCopyToKOrganizer;
225 QCheckBox* mLateCancel;
226 KComboBox* mRecurPeriod;
227 ButtonGroup* mFeb29;
228 FontColourChooser* mFontChooser;
230 static int soundIndex(Preferences::SoundType);
234 // View tab of the Preferences dialog
235 class ViewPrefTab : public PrefsTabBase
237 Q_OBJECT
238 public:
239 ViewPrefTab(StackedScrollGroup*);
241 virtual void restore(bool defaults);
242 virtual void apply(bool syncToDisc);
244 private slots:
245 void slotTooltipAlarmsToggled(bool);
246 void slotTooltipMaxToggled(bool);
247 void slotTooltipTimeToggled(bool);
248 void slotTooltipTimeToToggled(bool);
249 void slotWindowPosChanged(QAbstractButton*);
251 private:
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