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