kalarm
preferences.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PREFERENCES_H
00022 #define PREFERENCES_H
00023
00024 #include "kalarm.h"
00025
00026 #include <qobject.h>
00027 #include <qcolor.h>
00028 #include <qfont.h>
00029 #include <qdatetime.h>
00030 #include <qvaluelist.h>
00031 class QWidget;
00032
00033 #include "colourlist.h"
00034 #include "editdlg.h"
00035 #include "karecurrence.h"
00036 #include "recurrenceedit.h"
00037 #include "soundpicker.h"
00038 #include "timeperiod.h"
00039
00040
00041
00042 class Preferences : public QObject
00043 {
00044 Q_OBJECT
00045 public:
00046 enum MailClient { SENDMAIL, KMAIL };
00047 enum MailFrom { MAIL_FROM_KMAIL, MAIL_FROM_CONTROL_CENTRE, MAIL_FROM_ADDR };
00048 enum CmdLogType { DISCARD_OUTPUT, LOG_TO_FILE, EXEC_IN_TERMINAL };
00049
00050 static void initialise();
00051 static void save(bool syncToDisc = true);
00052 static void syncToDisc();
00053 static void updateStartOfDayCheck();
00054 static void connect(const char* signal, const QObject* receiver, const char* member);
00055
00056
00057 static const ColourList& messageColours() { return mMessageColours; }
00058 static QColor defaultBgColour() { return mDefaultBgColour; }
00059 static QColor defaultFgColour() { return default_defaultFgColour; }
00060 static const QFont& messageFont() { return mMessageFont; }
00061 static const QTime& startOfDay() { return mStartOfDay; }
00062 static bool hasStartOfDayChanged() { return mStartOfDayChanged; }
00063 static bool autostartDaemon() { return mAutostartDaemon; }
00064 static bool runInSystemTray() { return mRunInSystemTray; }
00065 static bool disableAlarmsIfStopped() { return mDisableAlarmsIfStopped; }
00066 static bool quitWarn() { return notifying(QUIT_WARN); }
00067 static void setQuitWarn(bool yes) { setNotify(QUIT_WARN, yes); }
00068 static bool autostartTrayIcon() { return mAutostartTrayIcon; }
00069 static bool confirmAlarmDeletion() { return notifying(CONFIRM_ALARM_DELETION); }
00070 static void setConfirmAlarmDeletion(bool yes){ setNotify(CONFIRM_ALARM_DELETION, yes); }
00071 static bool modalMessages() { return mModalMessages; }
00072 static int messageButtonDelay() { return mMessageButtonDelay; }
00073 static bool showExpiredAlarms() { return mShowExpiredAlarms; }
00074 static bool showAlarmTime() { return mShowAlarmTime; }
00075 static bool showTimeToAlarm() { return mShowTimeToAlarm; }
00076 static int tooltipAlarmCount() { return mTooltipAlarmCount; }
00077 static bool showTooltipAlarmTime() { return mShowTooltipAlarmTime; }
00078 static bool showTooltipTimeToAlarm() { return mShowTooltipTimeToAlarm; }
00079 static const QString& tooltipTimeToPrefix() { return mTooltipTimeToPrefix; }
00080 static int daemonTrayCheckInterval() { return mDaemonTrayCheckInterval; }
00081 static MailClient emailClient() { return mEmailClient; }
00082 static bool emailCopyToKMail() { return mEmailCopyToKMail && mEmailClient == SENDMAIL; }
00083 static bool emailQueuedNotify() { return notifying(EMAIL_QUEUED_NOTIFY); }
00084 static void setEmailQueuedNotify(bool yes) { setNotify(EMAIL_QUEUED_NOTIFY, yes); }
00085 static MailFrom emailFrom() { return mEmailFrom; }
00086 static bool emailBccUseControlCentre() { return mEmailBccFrom == MAIL_FROM_CONTROL_CENTRE; }
00087 static QString emailAddress();
00088 static QString emailBccAddress();
00089 static QString cmdXTermCommand() { return mCmdXTermCommand; }
00090 static QColor disabledColour() { return mDisabledColour; }
00091 static QColor expiredColour() { return mExpiredColour; }
00092 static int expiredKeepDays() { return mExpiredKeepDays; }
00093 static bool defaultSound() { return mDefaultSound; }
00094 static SoundPicker::Type defaultSoundType() { return mDefaultSoundType; }
00095 static const QString& defaultSoundFile() { return mDefaultSoundFile; }
00096 static float defaultSoundVolume() { return mDefaultSoundVolume; }
00097 static bool defaultSoundRepeat() { return mDefaultSoundRepeat; }
00098 static int defaultLateCancel() { return mDefaultLateCancel; }
00099 static bool defaultAutoClose() { return mDefaultAutoClose; }
00100 static bool defaultConfirmAck() { return mDefaultConfirmAck; }
00101 static bool defaultCopyToKOrganizer() { return mDefaultCopyToKOrganizer; }
00102 static bool defaultCmdScript() { return mDefaultCmdScript; }
00103 static EditAlarmDlg::CmdLogType
00104 defaultCmdLogType() { return mDefaultCmdLogType; }
00105 static QString defaultCmdLogFile() { return mDefaultCmdLogFile; }
00106 static bool defaultEmailBcc() { return mDefaultEmailBcc; }
00107 static RecurrenceEdit::RepeatType
00108 defaultRecurPeriod() { return mDefaultRecurPeriod; }
00109 static KARecurrence::Feb29Type
00110 defaultFeb29Type() { return mDefaultFeb29Type; }
00111 static TimePeriod::Units defaultReminderUnits() { return mDefaultReminderUnits; }
00112 static const QString& defaultPreAction() { return mDefaultPreAction; }
00113 static const QString& defaultPostAction() { return mDefaultPostAction; }
00114
00115
00116 static const QString QUIT_WARN;
00117 static const QString CONFIRM_ALARM_DELETION;
00118 static const QString EMAIL_QUEUED_NOTIFY;
00119
00120
00121 static const ColourList default_messageColours;
00122 static const QColor default_defaultBgColour;
00123 static const QColor default_defaultFgColour;
00124 static const QFont& default_messageFont() { return mDefault_messageFont; };
00125 static const QTime default_startOfDay;
00126 static const bool default_autostartDaemon;
00127 static const bool default_runInSystemTray;
00128 static const bool default_disableAlarmsIfStopped;
00129 static const bool default_quitWarn;
00130 static const bool default_autostartTrayIcon;
00131 static const bool default_confirmAlarmDeletion;
00132 static const bool default_modalMessages;
00133 static const int default_messageButtonDelay;
00134 static const bool default_showExpiredAlarms;
00135 static const bool default_showAlarmTime;
00136 static const bool default_showTimeToAlarm;
00137 static const int default_tooltipAlarmCount;
00138 static const bool default_showTooltipAlarmTime;
00139 static const bool default_showTooltipTimeToAlarm;
00140 static const QString default_tooltipTimeToPrefix;
00141 static const int default_daemonTrayCheckInterval;
00142 static const MailClient default_emailClient;
00143 static const bool default_emailCopyToKMail;
00144 static MailFrom default_emailFrom();
00145 static const bool default_emailQueuedNotify;
00146 static const MailFrom default_emailBccFrom;
00147 static const QString default_emailAddress;
00148 static const QString default_emailBccAddress;
00149 static const QColor default_disabledColour;
00150 static const QColor default_expiredColour;
00151 static const int default_expiredKeepDays;
00152 static const QString default_defaultSoundFile;
00153 static const float default_defaultSoundVolume;
00154 static const int default_defaultLateCancel;
00155 static const bool default_defaultAutoClose;
00156 static const bool default_defaultCopyToKOrganizer;
00157 static const bool default_defaultSound;
00158 static const SoundPicker::Type default_defaultSoundType;
00159 static const bool default_defaultSoundRepeat;
00160 static const bool default_defaultConfirmAck;
00161 static const bool default_defaultCmdScript;
00162 static const EditAlarmDlg::CmdLogType default_defaultCmdLogType;
00163 static const bool default_defaultEmailBcc;
00164 static const RecurrenceEdit::RepeatType default_defaultRecurPeriod;
00165 static const KARecurrence::Feb29Type default_defaultFeb29Type;
00166 static const TimePeriod::Units default_defaultReminderUnits;
00167 static const QString default_defaultPreAction;
00168 static const QString default_defaultPostAction;
00169
00170 signals:
00171 void preferencesChanged();
00172 void startOfDayChanged(const QTime& oldStartOfDay);
00173
00174 private:
00175 Preferences() { }
00176 void emitPreferencesChanged();
00177 void emitStartOfDayChanged();
00178
00179 static void read();
00180 static void convertOldPrefs();
00181 static int startOfDayCheck();
00182 static QString emailFrom(MailFrom, bool useAddress, bool bcc);
00183 static MailFrom emailFrom(const QString&);
00184 static void setNotify(const QString& messageID, bool notify);
00185 static bool notifying(const QString& messageID);
00186
00187 static Preferences* mInstance;
00188 static QFont mDefault_messageFont;
00189 static QString mEmailAddress;
00190 static QString mEmailBccAddress;
00191
00192
00193 friend class MiscPrefTab;
00194 friend class EditPrefTab;
00195 friend class ViewPrefTab;
00196 friend class FontColourPrefTab;
00197 friend class EmailPrefTab;
00198 static void setEmailAddress(MailFrom, const QString& address);
00199 static void setEmailBccAddress(bool useControlCentre, const QString& address);
00200 static ColourList mMessageColours;
00201 static QColor mDefaultBgColour;
00202 static QFont mMessageFont;
00203 static QTime mStartOfDay;
00204 static bool mAutostartDaemon;
00205 static bool mRunInSystemTray;
00206 static bool mDisableAlarmsIfStopped;
00207 static bool mAutostartTrayIcon;
00208 static bool mModalMessages;
00209 static int mMessageButtonDelay;
00210 static bool mShowExpiredAlarms;
00211 static bool mShowAlarmTime;
00212 static bool mShowTimeToAlarm;
00213 static int mTooltipAlarmCount;
00214 static bool mShowTooltipAlarmTime;
00215 static bool mShowTooltipTimeToAlarm;
00216 static QString mTooltipTimeToPrefix;
00217 static int mDaemonTrayCheckInterval;
00218 static MailClient mEmailClient;
00219 static MailFrom mEmailFrom;
00220 static MailFrom mEmailBccFrom;
00221 static bool mEmailCopyToKMail;
00222 static QString mCmdXTermCommand;
00223 static QColor mDisabledColour;
00224 static QColor mExpiredColour;
00225 static int mExpiredKeepDays;
00226
00227 static QString mDefaultSoundFile;
00228 static float mDefaultSoundVolume;
00229 static int mDefaultLateCancel;
00230 static bool mDefaultAutoClose;
00231 static bool mDefaultCopyToKOrganizer;
00232 static bool mDefaultSound;
00233 static SoundPicker::Type mDefaultSoundType;
00234 static bool mDefaultSoundRepeat;
00235 static bool mDefaultConfirmAck;
00236 static bool mDefaultEmailBcc;
00237 static bool mDefaultCmdScript;
00238 static EditAlarmDlg::CmdLogType mDefaultCmdLogType;
00239 static QString mDefaultCmdLogFile;
00240 static RecurrenceEdit::RepeatType mDefaultRecurPeriod;
00241 static KARecurrence::Feb29Type mDefaultFeb29Type;
00242 static TimePeriod::Units mDefaultReminderUnits;
00243 static QString mDefaultPreAction;
00244 static QString mDefaultPostAction;
00245
00246 static QTime mOldStartOfDay;
00247 static bool mStartOfDayChanged;
00248 static bool mOldAutostartDaemon;
00249 };
00250
00251 #endif // PREFERENCES_H
|