kalarm
prefdlg.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PREFDLG_H
00022 #define PREFDLG_H
00023
00024 #include <qsize.h>
00025 #include <qdatetime.h>
00026 #include <ktabctl.h>
00027 #include <kdialogbase.h>
00028
00029 #include "preferences.h"
00030 #include "recurrenceedit.h"
00031 #include "soundpicker.h"
00032
00033 class QButtonGroup;
00034 class QCheckBox;
00035 class QRadioButton;
00036 class QPushButton;
00037 class QComboBox;
00038 class QLineEdit;
00039 class KColorCombo;
00040 class FontColourChooser;
00041 class ButtonGroup;
00042 class TimeEdit;
00043 class SpinBox;
00044 class SpecialActionsButton;
00045
00046 class FontColourPrefTab;
00047 class EditPrefTab;
00048 class EmailPrefTab;
00049 class ViewPrefTab;
00050 class MiscPrefTab;
00051
00052
00053
00054 class KAlarmPrefDlg : public KDialogBase
00055 {
00056 Q_OBJECT
00057 public:
00058 KAlarmPrefDlg();
00059 ~KAlarmPrefDlg();
00060
00061 FontColourPrefTab* mFontColourPage;
00062 EditPrefTab* mEditPage;
00063 EmailPrefTab* mEmailPage;
00064 ViewPrefTab* mViewPage;
00065 MiscPrefTab* mMiscPage;
00066
00067 protected slots:
00068 virtual void slotOk();
00069 virtual void slotApply();
00070 virtual void slotHelp();
00071 virtual void slotDefault();
00072 virtual void slotCancel();
00073
00074 private:
00075 void restore();
00076 bool mValid;
00077 };
00078
00079
00080 class PrefsTabBase : public QWidget
00081 {
00082 Q_OBJECT
00083 public:
00084 PrefsTabBase(QVBox*);
00085
00086 void setPreferences();
00087 virtual void restore() = 0;
00088 virtual void apply(bool syncToDisc) = 0;
00089 virtual void setDefaults() = 0;
00090 static int indentWidth() { return mIndentWidth; }
00091
00092 protected:
00093 QVBox* mPage;
00094
00095 private:
00096 static int mIndentWidth;
00097 };
00098
00099
00100
00101 class MiscPrefTab : public PrefsTabBase
00102 {
00103 Q_OBJECT
00104 public:
00105 MiscPrefTab(QVBox*);
00106
00107 virtual void restore();
00108 virtual void apply(bool syncToDisc);
00109 virtual void setDefaults();
00110
00111 private slots:
00112 void slotAutostartDaemonClicked();
00113 void slotRunModeToggled(bool);
00114 void slotDisableIfStoppedToggled(bool);
00115 void slotExpiredToggled(bool);
00116 void slotClearExpired();
00117 void slotOtherTerminalToggled(bool);
00118
00119 void slotAutostartToggled(bool);
00120
00121
00122 private:
00123 void setExpiredControls(int purgeDays);
00124
00125 QCheckBox* mAutostartDaemon;
00126 QRadioButton* mRunInSystemTray;
00127 QRadioButton* mRunOnDemand;
00128 QCheckBox* mDisableAlarmsIfStopped;
00129 QCheckBox* mQuitWarn;
00130 QCheckBox* mAutostartTrayIcon;
00131 QCheckBox* mConfirmAlarmDeletion;
00132 QCheckBox* mKeepExpired;
00133 QCheckBox* mPurgeExpired;
00134 SpinBox* mPurgeAfter;
00135 QLabel* mPurgeAfterLabel;
00136 QPushButton* mClearExpired;
00137 TimeEdit* mStartOfDay;
00138 QButtonGroup* mXtermType;
00139 QLineEdit* mXtermCommand;
00140 int mXtermCount;
00141 };
00142
00143
00144
00145 class EmailPrefTab : public PrefsTabBase
00146 {
00147 Q_OBJECT
00148 public:
00149 EmailPrefTab(QVBox*);
00150
00151 QString validate();
00152 virtual void restore();
00153 virtual void apply(bool syncToDisc);
00154 virtual void setDefaults();
00155
00156 private slots:
00157 void slotEmailClientChanged(int);
00158 void slotFromAddrChanged(int);
00159 void slotBccAddrChanged(int);
00160 void slotAddressChanged() { mAddressChanged = true; }
00161
00162 private:
00163 void setEmailAddress(Preferences::MailFrom, const QString& address);
00164 void setEmailBccAddress(bool useControlCentre, const QString& address);
00165 QString validateAddr(ButtonGroup*, QLineEdit* addr, const QString& msg);
00166
00167 ButtonGroup* mEmailClient;
00168 ButtonGroup* mFromAddressGroup;
00169 QLineEdit* mEmailAddress;
00170 ButtonGroup* mBccAddressGroup;
00171 QLineEdit* mEmailBccAddress;
00172 QCheckBox* mEmailQueuedNotify;
00173 QCheckBox* mEmailCopyToKMail;
00174 bool mAddressChanged;
00175 bool mBccAddressChanged;
00176 };
00177
00178
00179
00180 class EditPrefTab : public PrefsTabBase
00181 {
00182 Q_OBJECT
00183 public:
00184 EditPrefTab(QVBox*);
00185
00186 QString validate();
00187 virtual void restore();
00188 virtual void apply(bool syncToDisc);
00189 virtual void setDefaults();
00190
00191 private slots:
00192 void slotBrowseSoundFile();
00193
00194 private:
00195 QCheckBox* mAutoClose;
00196 QCheckBox* mConfirmAck;
00197 QComboBox* mReminderUnits;
00198 SpecialActionsButton* mSpecialActionsButton;
00199 QCheckBox* mCmdScript;
00200 QCheckBox* mCmdXterm;
00201 QCheckBox* mEmailBcc;
00202 QComboBox* mSound;
00203 QLabel* mSoundFileLabel;
00204 QLineEdit* mSoundFile;
00205 QPushButton* mSoundFileBrowse;
00206 QCheckBox* mSoundRepeat;
00207 QCheckBox* mCopyToKOrganizer;
00208 QCheckBox* mLateCancel;
00209 QComboBox* mRecurPeriod;
00210 QButtonGroup* mFeb29;
00211
00212 static int soundIndex(SoundPicker::Type);
00213 static int recurIndex(RecurrenceEdit::RepeatType);
00214 };
00215
00216
00217
00218 class ViewPrefTab : public PrefsTabBase
00219 {
00220 Q_OBJECT
00221 public:
00222 ViewPrefTab(QVBox*);
00223
00224 virtual void restore();
00225 virtual void apply(bool syncToDisc);
00226 virtual void setDefaults();
00227
00228 private slots:
00229 void slotListTimeToggled(bool);
00230 void slotListTimeToToggled(bool);
00231 void slotTooltipAlarmsToggled(bool);
00232 void slotTooltipMaxToggled(bool);
00233 void slotTooltipTimeToggled(bool);
00234 void slotTooltipTimeToToggled(bool);
00235
00236 private:
00237 void setList(bool time, bool timeTo);
00238 void setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix);
00239
00240 QCheckBox* mListShowTime;
00241 QCheckBox* mListShowTimeTo;
00242 QCheckBox* mTooltipShowAlarms;
00243 QCheckBox* mTooltipMaxAlarms;
00244 SpinBox* mTooltipMaxAlarmCount;
00245 QCheckBox* mTooltipShowTime;
00246 QCheckBox* mTooltipShowTimeTo;
00247 QLineEdit* mTooltipTimeToPrefix;
00248 QLabel* mTooltipTimeToPrefixLabel;
00249 QCheckBox* mModalMessages;
00250 QCheckBox* mShowExpiredAlarms;
00251 SpinBox* mDaemonTrayCheckInterval;
00252 };
00253
00254
00255
00256 class FontColourPrefTab : public PrefsTabBase
00257 {
00258 Q_OBJECT
00259 public:
00260 FontColourPrefTab(QVBox*);
00261
00262 virtual void restore();
00263 virtual void apply(bool syncToDisc);
00264 virtual void setDefaults();
00265
00266 private:
00267 FontColourChooser* mFontChooser;
00268 KColorCombo* mDisabledColour;
00269 KColorCombo* mExpiredColour;
00270 };
00271
00272 #endif // PREFDLG_H
|