kalarm
recurrenceedit.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RECURRENCEEDIT_H
00025 #define RECURRENCEEDIT_H
00026
00027 #include <qframe.h>
00028 #include <qdatetime.h>
00029 #include <qvaluelist.h>
00030
00031 #include "datetime.h"
00032 class QWidgetStack;
00033 class QGroupBox;
00034 class QLabel;
00035 class QListBox;
00036 class QButton;
00037 class QPushButton;
00038 class QBoxLayout;
00039 class SpinBox;
00040 class CheckBox;
00041 class RadioButton;
00042 class DateEdit;
00043 class TimeEdit;
00044 class ButtonGroup;
00045 class KAEvent;
00046 class Rule;
00047 class NoRule;
00048 class SubDailyRule;
00049 class DailyRule;
00050 class WeeklyRule;
00051 class MonthlyRule;
00052 class YearlyRule;
00053
00054
00055 class RecurrenceEdit : public QFrame
00056 {
00057 Q_OBJECT
00058 public:
00059
00060 enum RepeatType { INVALID_RECUR = -1, NO_RECUR, AT_LOGIN, SUBDAILY, DAILY, WEEKLY, MONTHLY, ANNUAL };
00061
00062 RecurrenceEdit(bool readOnly, QWidget* parent, const char* name = 0);
00063 virtual ~RecurrenceEdit() { }
00064
00066 void setDefaults(const QDateTime& from);
00068 void set(const KAEvent&);
00070 void updateEvent(KAEvent&, bool adjustStart);
00071 QWidget* checkData(const QDateTime& startDateTime, QString& errorMessage) const;
00072 RepeatType repeatType() const { return mRuleButtonType; }
00073 bool isTimedRepeatType() const { return mRuleButtonType >= SUBDAILY; }
00074 void setStartDate(const QDate&, const QDate& today);
00075 void setDefaultEndDate(const QDate&);
00076 void setEndDateTime(const DateTime&);
00077 DateTime endDateTime() const;
00078 bool stateChanged() const;
00079
00080 static QString i18n_Norecur();
00081 static QString i18n_NoRecur();
00082 static QString i18n_AtLogin();
00083 static QString i18n_l_Atlogin();
00084 static QString i18n_HourlyMinutely();
00085 static QString i18n_u_HourlyMinutely();
00086 static QString i18n_Daily();
00087 static QString i18n_d_Daily();
00088 static QString i18n_Weekly();
00089 static QString i18n_w_Weekly();
00090 static QString i18n_Monthly();
00091 static QString i18n_m_Monthly();
00092 static QString i18n_Yearly();
00093 static QString i18n_y_Yearly();
00094
00095 public slots:
00096 void setDateTime(const QDateTime& start) { mCurrStartDateTime = start; }
00097
00098 signals:
00099 void shown();
00100 void typeChanged(int recurType);
00101 void frequencyChanged();
00102
00103 protected:
00104 virtual void showEvent(QShowEvent*);
00105
00106 private slots:
00107 void periodClicked(int);
00108 void rangeTypeClicked();
00109 void repeatCountChanged(int value);
00110 void slotAnyTimeToggled(bool);
00111 void addException();
00112 void changeException();
00113 void deleteException();
00114 void enableExceptionButtons();
00115
00116 private:
00117 void setRuleDefaults(const QDate& start);
00118 void saveState();
00119
00120
00121 QWidgetStack* mRuleStack;
00122 Rule* mRule;
00123 NoRule* mNoRule;
00124 SubDailyRule* mSubDailyRule;
00125 DailyRule* mDailyRule;
00126 WeeklyRule* mWeeklyRule;
00127 MonthlyRule* mMonthlyRule;
00128 YearlyRule* mYearlyRule;
00129
00130 ButtonGroup* mRuleButtonGroup;
00131 RadioButton* mNoneButton;
00132 RadioButton* mAtLoginButton;
00133 RadioButton* mSubDailyButton;
00134 RadioButton* mDailyButton;
00135 RadioButton* mWeeklyButton;
00136 RadioButton* mMonthlyButton;
00137 RadioButton* mYearlyButton;
00138 int mNoneButtonId;
00139 int mAtLoginButtonId;
00140 int mSubDailyButtonId;
00141 int mDailyButtonId;
00142 int mWeeklyButtonId;
00143 int mMonthlyButtonId;
00144 int mYearlyButtonId;
00145 RepeatType mRuleButtonType;
00146 bool mDailyShown;
00147 bool mWeeklyShown;
00148 bool mMonthlyShown;
00149 bool mYearlyShown;
00150
00151
00152 ButtonGroup* mRangeButtonGroup;
00153 RadioButton* mNoEndDateButton;
00154 RadioButton* mRepeatCountButton;
00155 SpinBox* mRepeatCountEntry;
00156 QLabel* mRepeatCountLabel;
00157 RadioButton* mEndDateButton;
00158 DateEdit* mEndDateEdit;
00159 TimeEdit* mEndTimeEdit;
00160 CheckBox* mEndAnyTimeCheckBox;
00161
00162
00163 QGroupBox* mExceptionGroup;
00164 QListBox* mExceptionDateList;
00165 DateEdit* mExceptionDateEdit;
00166 QPushButton* mChangeExceptionButton;
00167 QPushButton* mDeleteExceptionButton;
00168 QValueList<QDate> mExceptionDates;
00169
00170
00171 QDateTime mCurrStartDateTime;
00172 bool mNoEmitTypeChanged;
00173 bool mReadOnly;
00174
00175
00176 QButton* mSavedRuleButton;
00177 QButton* mSavedRangeButton;
00178 int mSavedRepeatCount;
00179 DateTime mSavedEndDateTime;
00180 QValueList<QDate> mSavedExceptionDates;
00181 };
00182
00183 #endif // RECURRENCEEDIT_H
|