kalarm
recurrenceeditprivate.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RECURRENCEEDITPRIVATE_H
00022 #define RECURRENCEEDITPRIVATE_H
00023
00024 #include <qframe.h>
00025 #include <qvaluelist.h>
00026 #include <qbitarray.h>
00027
00028 class QWidget;
00029 class QVBoxLayout;
00030 class ButtonGroup;
00031 class RadioButton;
00032 class ComboBox;
00033 class CheckBox;
00034 class SpinBox;
00035 class TimeSpinBox;
00036 class QString;
00037
00038
00039 class NoRule : public QFrame
00040 {
00041 public:
00042 NoRule(QWidget* parent, const char* name = 0) : QFrame(parent, name)
00043 { setFrameStyle(QFrame::NoFrame); }
00044 virtual int frequency() const { return 0; }
00045 };
00046
00047 class Rule : public NoRule
00048 {
00049 Q_OBJECT
00050 public:
00051 Rule(const QString& freqText, const QString& freqWhatsThis, bool time, bool readOnly,
00052 QWidget* parent, const char* name = 0);
00053 int frequency() const;
00054 void setFrequency(int);
00055 virtual void setFrequencyFocus() { mSpinBox->setFocus(); }
00056 QVBoxLayout* layout() const { return mLayout; }
00057 virtual QWidget* validate(QString&) { return 0; }
00058 virtual void saveState();
00059 virtual bool stateChanged() const;
00060 signals:
00061 void frequencyChanged();
00062 private:
00063 QWidget* mSpinBox;
00064 SpinBox* mIntSpinBox;
00065 TimeSpinBox* mTimeSpinBox;
00066 QVBoxLayout* mLayout;
00067
00068 int mSavedFrequency;
00069 };
00070
00071
00072 class SubDailyRule : public Rule
00073 {
00074 Q_OBJECT
00075 public:
00076 SubDailyRule(bool readOnly, QWidget* parent, const char* name = 0);
00077 };
00078
00079
00080 class DayWeekRule : public Rule
00081 {
00082 Q_OBJECT
00083 public:
00084 DayWeekRule(const QString& freqText, const QString& freqWhatsThis, const QString& daysWhatsThis,
00085 bool readOnly, QWidget* parent, const char* name = 0);
00086 QBitArray days() const;
00087 void setDays(bool);
00088 void setDays(QBitArray& days);
00089 void setDay(int dayOfWeek);
00090 virtual QWidget* validate(QString& errorMessage);
00091 virtual void saveState();
00092 virtual bool stateChanged() const;
00093 private:
00094 CheckBox* mDayBox[7];
00095
00096 QBitArray mSavedDays;
00097 };
00098
00099
00100 class DailyRule : public DayWeekRule
00101 {
00102 public:
00103 DailyRule(bool readOnly, QWidget* parent, const char* name = 0);
00104 };
00105
00106
00107 class WeeklyRule : public DayWeekRule
00108 {
00109 public:
00110 WeeklyRule(bool readOnly, QWidget* parent, const char* name = 0);
00111 };
00112
00113
00114 class MonthYearRule : public Rule
00115 {
00116 Q_OBJECT
00117 public:
00118 enum DayPosType { DATE, POS };
00119
00120 MonthYearRule(const QString& freqText, const QString& freqWhatsThis, bool allowEveryWeek,
00121 bool readOnly, QWidget* parent, const char* name = 0);
00122 DayPosType type() const;
00123 int date() const;
00124 int week() const;
00125 int dayOfWeek() const;
00126 void setType(DayPosType);
00127 void setDate(int dayOfMonth);
00128 void setPosition(int week, int dayOfWeek);
00129 void setDefaultValues(int dayOfMonth, int dayOfWeek);
00130 virtual void saveState();
00131 virtual bool stateChanged() const;
00132 signals:
00133 void typeChanged(DayPosType);
00134 protected:
00135 DayPosType buttonType(int id) const { return id == mDayButtonId ? DATE : POS; }
00136 virtual void daySelected(int ) { }
00137 protected slots:
00138 virtual void clicked(int id);
00139 private slots:
00140 virtual void slotDaySelected(int index);
00141 private:
00142 void enableSelection(DayPosType);
00143
00144 ButtonGroup* mButtonGroup;
00145 RadioButton* mDayButton;
00146 RadioButton* mPosButton;
00147 ComboBox* mDayCombo;
00148 ComboBox* mWeekCombo;
00149 ComboBox* mDayOfWeekCombo;
00150 int mDayButtonId;
00151 int mPosButtonId;
00152 bool mEveryWeek;
00153
00154 int mSavedType;
00155 int mSavedDay;
00156 int mSavedWeek;
00157 int mSavedWeekDay;
00158 };
00159
00160
00161 class MonthlyRule : public MonthYearRule
00162 {
00163 public:
00164 MonthlyRule(bool readOnly, QWidget* parent, const char* name = 0);
00165 };
00166
00167
00168 class YearlyRule : public MonthYearRule
00169 {
00170 Q_OBJECT
00171 public:
00172 YearlyRule(bool readOnly, QWidget* parent, const char* name = 0);
00173 QValueList<int> months() const;
00174 void setMonths(const QValueList<int>& months);
00175 void setDefaultValues(int dayOfMonth, int dayOfWeek, int month);
00176 KARecurrence::Feb29Type feb29Type() const;
00177 void setFeb29Type(KARecurrence::Feb29Type);
00178 virtual QWidget* validate(QString& errorMessage);
00179 virtual void saveState();
00180 virtual bool stateChanged() const;
00181 protected:
00182 virtual void daySelected(int day);
00183 protected slots:
00184 virtual void clicked(int id);
00185 private slots:
00186 void enableFeb29();
00187 private:
00188 CheckBox* mMonthBox[12];
00189 QLabel* mFeb29Label;
00190 ComboBox* mFeb29Combo;
00191
00192 QValueList<int> mSavedMonths;
00193 int mSavedFeb29Type;
00194 };
00195
00196 #endif // RECURRENCEEDITPRIVATE_H
|