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 runInSystemTray() { return mRunInSystemTray; }
00064 static bool disableAlarmsIfStopped() { return mDisableAlarmsIfStopped; }
00065 static bool quitWarn() { return notifying(QUIT_WARN); }
00066 static void setQuitWarn(bool yes) { setNotify(QUIT_WARN, yes); }
00067 static bool autostartTrayIcon() { return mAutostartTrayIcon; }
00068 static bool confirmAlarmDeletion() { return notifying(CONFIRM_ALARM_DELETION); }
00069 static void setConfirmAlarmDeletion(bool yes){ setNotify(CONFIRM_ALARM_DELETION, yes); }
00070 static bool modalMessages() { return mModalMessages; }
00071 static int messageButtonDelay() { return mMessageButtonDelay; }
00072 static bool showExpiredAlarms() { return mShowExpiredAlarms; }
00073 static bool showAlarmTime() { return mShowAlarmTime; }
00074 static bool showTimeToAlarm() { return mShowTimeToAlarm; }
00075 static int tooltipAlarmCount() { return mTooltipAlarmCount; }
00076 static bool showTooltipAlarmTime() { return mShowTooltipAlarmTime; }
00077 static bool showTooltipTimeToAlarm() { return mShowTooltipTimeToAlarm; }
00078 static const QString& tooltipTimeToPrefix() { return mTooltipTimeToPrefix; }
00079 static int daemonTrayCheckInterval() { return mDaemonTrayCheckInterval; }
00080 static MailClient emailClient() { return mEmailClient; }
00081 static bool emailCopyToKMail() { return mEmailCopyToKMail && mEmailClient == SENDMAIL; }
00082 static bool emailQueuedNotify() { return notifying(EMAIL_QUEUED_NOTIFY); }
00083 static void setEmailQueuedNotify(bool yes) { setNotify(EMAIL_QUEUED_NOTIFY, yes); }
00084 static MailFrom emailFrom() { return mEmailFrom; }
00085 static bool emailBccUseControlCentre() { return mEmailBccFrom == MAIL_FROM_CONTROL_CENTRE; }
00086 static QString emailAddress();
00087 static QString emailBccAddress();
00088 static QString cmdXTermCommand() { return mCmdXTermCommand; }
00089 static QColor disabledColour() { return mDisabledColour; }
00090 static QColor expiredColour() { return mExpiredColour; }
00091 static int expiredKeepDays() { return mExpiredKeepDays; }
00092 static SoundPicker::Type defaultSoundType() { return mDefaultSoundType; }
00093 static const QString& defaultSoundFile() { return mDefaultSoundFile; }
00094 static float defaultSoundVolume() { return mDefaultSoundVolume; }
00095 static bool defaultSoundRepeat() { return mDefaultSoundRepeat; }
00096 static int defaultLateCancel() { return mDefaultLateCancel; }
00097 static bool defaultAutoClose() { return mDefaultAutoClose; }
00098 static bool defaultConfirmAck() { return mDefaultConfirmAck; }
00099 static bool defaultCopyToKOrganizer() { return mDefaultCopyToKOrganizer; }
00100 static bool defaultCmdScript() { return mDefaultCmdScript; }
00101 static EditAlarmDlg::CmdLogType
00102 defaultCmdLogType() { return mDefaultCmdLogType; }
00103 static QString defaultCmdLogFile() { return mDefaultCmdLogFile; }
00104 static bool defaultEmailBcc() { return mDefaultEmailBcc; }
00105 static RecurrenceEdit::RepeatType
00106 defaultRecurPeriod() { return mDefaultRecurPeriod; }
00107 static KARecurrence::Feb29Type
00108 defaultFeb29Type() { return mDefaultFeb29Type; }
00109 static TimePeriod::Units defaultReminderUnits() { return mDefaultReminderUnits; }
00110 static const QString& defaultPreAction() { return mDefaultPreAction; }
00111 static const QString& defaultPostAction() { return mDefaultPostAction; }
00112
00113
00114 static const QString QUIT_WARN;
00115 static const QString CONFIRM_ALARM_DELETION;
00116 static const QString EMAIL_QUEUED_NOTIFY;
00117
00118
00119 static const ColourList default_messageColours;
00120 static const QColor default_defaultBgColour;
00121 static const QColor default_defaultFgColour;
00122 static const QFont& default_messageFont() { return mDefault_messageFont; };
00123 static const QTime default_startOfDay;
00124 static const bool default_runInSystemTray;
00125 static const bool default_disableAlarmsIfStopped;
00126 static const bool default_quitWarn;
00127 static const bool default_autostartTrayIcon;
00128 static const bool default_confirmAlarmDeletion;
00129 static const bool default_modalMessages;
00130 static const int default_messageButtonDelay;
00131 static const bool default_showExpiredAlarms;
00132 static const bool default_showAlarmTime;
00133 static const bool default_showTimeToAlarm;
00134 static const int default_tooltipAlarmCount;
00135 static const bool default_showTooltipAlarmTime;
00136 static const bool default_showTooltipTimeToAlarm;
00137 static const QString default_tooltipTimeToPrefix;
00138 static const int default_daemonTrayCheckInterval;
00139 static const MailClient default_emailClient;
00140 static const bool default_emailCopyToKMail;
00141 static MailFrom default_emailFrom();
00142 static const bool default_emailQueuedNotify;
00143 static const MailFrom default_emailBccFrom;
00144 static const QString default_emailAddress;
00145 static const QString default_emailBccAddress;
00146 static const QColor default_disabledColour;
00147 static const QColor default_expiredColour;
00148 static const int default_expiredKeepDays;
00149 static const QString default_defaultSoundFile;
00150 static const float default_defaultSoundVolume;
00151 static const int default_defaultLateCancel;
00152 static const bool default_defaultAutoClose;
00153 static const bool default_defaultCopyToKOrganizer;
00154 static const SoundPicker::Type default_defaultSoundType;
00155 static const bool default_defaultSoundRepeat;
00156 static const bool default_defaultConfirmAck;
00157 static const bool default_defaultCmdScript;
00158 static const EditAlarmDlg::CmdLogType default_defaultCmdLogType;
00159 static const bool default_defaultEmailBcc;
00160 static const RecurrenceEdit::RepeatType default_defaultRecurPeriod;
00161 static const KARecurrence::Feb29Type default_defaultFeb29Type;
00162 static const TimePeriod::Units default_defaultReminderUnits;
00163 static const QString default_defaultPreAction;
00164 static const QString default_defaultPostAction;
00165
00166 signals:
00167 void preferencesChanged();
00168 void startOfDayChanged(const QTime& oldStartOfDay);
00169
00170 private:
00171 Preferences() { }
00172 void emitPreferencesChanged();
00173 void emitStartOfDayChanged();
00174
00175 static void read();
00176 static void convertOldPrefs();
00177 static int startOfDayCheck();
00178 static QString emailFrom(MailFrom, bool useAddress, bool bcc);
00179 static MailFrom emailFrom(const QString&);
00180 static void setNotify(const QString& messageID, bool notify);
00181 static bool notifying(const QString& messageID);
00182
00183 static Preferences* mInstance;
00184 static QFont mDefault_messageFont;
00185 static QString mEmailAddress;
00186 static QString mEmailBccAddress;
00187
00188
00189 friend class MiscPrefTab;
00190 friend class EditPrefTab;
00191 friend class ViewPrefTab;
00192 friend class FontColourPrefTab;
00193 friend class EmailPrefTab;
00194 static void setEmailAddress(MailFrom, const QString& address);
00195 static void setEmailBccAddress(bool useControlCentre, const QString& address);
00196 static ColourList mMessageColours;
00197 static QColor mDefaultBgColour;
00198 static QFont mMessageFont;
00199 static QTime mStartOfDay;
00200 static bool mRunInSystemTray;
00201 static bool mDisableAlarmsIfStopped;
00202 static bool mAutostartTrayIcon;
00203 static bool mModalMessages;
00204 static int mMessageButtonDelay;
00205 static bool mShowExpiredAlarms;
00206 static bool mShowAlarmTime;
00207 static bool mShowTimeToAlarm;
00208 static int mTooltipAlarmCount;
00209 static bool mShowTooltipAlarmTime;
00210 static bool mShowTooltipTimeToAlarm;
00211 static QString mTooltipTimeToPrefix;
00212 static int mDaemonTrayCheckInterval;
00213 static MailClient mEmailClient;
00214 static MailFrom mEmailFrom;
00215 static MailFrom mEmailBccFrom;
00216 static bool mEmailCopyToKMail;
00217 static QString mCmdXTermCommand;
00218 static QColor mDisabledColour;
00219 static QColor mExpiredColour;
00220 static int mExpiredKeepDays;
00221
00222 static QString mDefaultSoundFile;
00223 static float mDefaultSoundVolume;
00224 static int mDefaultLateCancel;
00225 static bool mDefaultAutoClose;
00226 static bool mDefaultCopyToKOrganizer;
00227 static SoundPicker::Type mDefaultSoundType;
00228 static bool mDefaultSoundRepeat;
00229 static bool mDefaultConfirmAck;
00230 static bool mDefaultEmailBcc;
00231 static bool mDefaultCmdScript;
00232 static EditAlarmDlg::CmdLogType mDefaultCmdLogType;
00233 static QString mDefaultCmdLogFile;
00234 static RecurrenceEdit::RepeatType mDefaultRecurPeriod;
00235 static KARecurrence::Feb29Type mDefaultFeb29Type;
00236 static TimePeriod::Units mDefaultReminderUnits;
00237 static QString mDefaultPreAction;
00238 static QString mDefaultPostAction;
00239
00240 static QTime mOldStartOfDay;
00241 static bool mStartOfDayChanged;
00242 };
00243
00244 #endif // PREFERENCES_H
|