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