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