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 RepetitionButton;
00046 class KAEvent;
00047 class Rule;
00048 class NoRule;
00049 class SubDailyRule;
00050 class DailyRule;
00051 class WeeklyRule;
00052 class MonthlyRule;
00053 class YearlyRule;
00054
00055
00056 class RecurrenceEdit : public QFrame
00057 {
00058 Q_OBJECT
00059 public:
00060
00061 enum RepeatType { INVALID_RECUR = -1, NO_RECUR, AT_LOGIN, SUBDAILY, DAILY, WEEKLY, MONTHLY, ANNUAL };
00062
00063 RecurrenceEdit(bool readOnly, QWidget* parent, const char* name = 0);
00064 virtual ~RecurrenceEdit() { }
00065
00067 void setDefaults(const QDateTime& from);
00069 void set(const KAEvent&, bool keepDuration);
00071 void updateEvent(KAEvent&, bool adjustStart);
00072 QWidget* checkData(const QDateTime& startDateTime, QString& errorMessage) const;
00073 RepeatType repeatType() const { return mRuleButtonType; }
00074 bool isTimedRepeatType() const { return mRuleButtonType >= SUBDAILY; }
00075 int subRepeatCount(int* subRepeatInterval = 0) const;
00076 void setSubRepetition(int reminderMinutes, bool dateOnly);
00077 void setStartDate(const QDate&, const QDate& today);
00078 void setDefaultEndDate(const QDate&);
00079 void setEndDateTime(const DateTime&);
00080 DateTime endDateTime() const;
00081 bool stateChanged() const;
00082 void activateSubRepetition();
00083
00084 static QString i18n_Norecur();
00085 static QString i18n_NoRecur();
00086 static QString i18n_AtLogin();
00087 static QString i18n_l_Atlogin();
00088 static QString i18n_HourlyMinutely();
00089 static QString i18n_u_HourlyMinutely();
00090 static QString i18n_Daily();
00091 static QString i18n_d_Daily();
00092 static QString i18n_Weekly();
00093 static QString i18n_w_Weekly();
00094 static QString i18n_Monthly();
00095 static QString i18n_m_Monthly();
00096 static QString i18n_Yearly();
00097 static QString i18n_y_Yearly();
00098
00099 public slots:
00100 void setDateTime(const QDateTime& start) { mCurrStartDateTime = start; }
00101
00102 signals:
00103 void shown();
00104 void typeChanged(int recurType);
00105 void frequencyChanged();
00106 void repeatNeedsInitialisation();
00107
00108 protected:
00109 virtual void showEvent(QShowEvent*);
00110
00111 private slots:
00112 void periodClicked(int);
00113 void rangeTypeClicked();
00114 void repeatCountChanged(int value);
00115 void slotAnyTimeToggled(bool);
00116 void addException();
00117 void changeException();
00118 void deleteException();
00119 void enableExceptionButtons();
00120
00121 private:
00122 void setRuleDefaults(const QDate& start);
00123 void saveState();
00124
00125
00126 QWidgetStack* mRuleStack;
00127 Rule* mRule;
00128 NoRule* mNoRule;
00129 SubDailyRule* mSubDailyRule;
00130 DailyRule* mDailyRule;
00131 WeeklyRule* mWeeklyRule;
00132 MonthlyRule* mMonthlyRule;
00133 YearlyRule* mYearlyRule;
00134
00135 ButtonGroup* mRuleButtonGroup;
00136 RadioButton* mNoneButton;
00137 RadioButton* mAtLoginButton;
00138 RadioButton* mSubDailyButton;
00139 RadioButton* mDailyButton;
00140 RadioButton* mWeeklyButton;
00141 RadioButton* mMonthlyButton;
00142 RadioButton* mYearlyButton;
00143 int mNoneButtonId;
00144 int mAtLoginButtonId;
00145 int mSubDailyButtonId;
00146 int mDailyButtonId;
00147 int mWeeklyButtonId;
00148 int mMonthlyButtonId;
00149 int mYearlyButtonId;
00150 RepeatType mRuleButtonType;
00151 bool mDailyShown;
00152 bool mWeeklyShown;
00153 bool mMonthlyShown;
00154 bool mYearlyShown;
00155
00156
00157 ButtonGroup* mRangeButtonGroup;
00158 RadioButton* mNoEndDateButton;
00159 RadioButton* mRepeatCountButton;
00160 SpinBox* mRepeatCountEntry;
00161 QLabel* mRepeatCountLabel;
00162 RadioButton* mEndDateButton;
00163 DateEdit* mEndDateEdit;
00164 TimeEdit* mEndTimeEdit;
00165 CheckBox* mEndAnyTimeCheckBox;
00166
00167
00168 QGroupBox* mExceptionGroup;
00169 QListBox* mExceptionDateList;
00170 DateEdit* mExceptionDateEdit;
00171 QPushButton* mChangeExceptionButton;
00172 QPushButton* mDeleteExceptionButton;
00173 QValueList<QDate> mExceptionDates;
00174
00175
00176 QDateTime mCurrStartDateTime;
00177 RepetitionButton* mSubRepetition;
00178 bool mNoEmitTypeChanged;
00179 bool mReadOnly;
00180
00181
00182 QButton* mSavedRuleButton;
00183 QButton* mSavedRangeButton;
00184 int mSavedRecurCount;
00185 DateTime mSavedEndDateTime;
00186 QValueList<QDate> mSavedExceptionDates;
00187 int mSavedRepeatInterval;
00188 int mSavedRepeatCount;
00189 };
00190
00191 #endif // RECURRENCEEDIT_H
|