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 <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 TQ_OBJECT
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
00085 static TQString i18n_Norecur();
00086 static TQString i18n_NoRecur();
00087 static TQString i18n_AtLogin();
00088 static TQString i18n_l_Atlogin();
00089 static TQString i18n_HourlyMinutely();
00090 static TQString i18n_u_HourlyMinutely();
00091 static TQString i18n_Daily();
00092 static TQString i18n_d_Daily();
00093 static TQString i18n_Weekly();
00094 static TQString i18n_w_Weekly();
00095 static TQString i18n_Monthly();
00096 static TQString i18n_m_Monthly();
00097 static TQString i18n_Yearly();
00098 static TQString i18n_y_Yearly();
00099
00100 public slots:
00101 void setDateTime(const TQDateTime& start) { mCurrStartDateTime = start; }
00102
00103 signals:
00104 void shown();
00105 void typeChanged(int recurType);
00106 void frequencyChanged();
00107 void repeatNeedsInitialisation();
00108
00109 protected:
00110 virtual void showEvent(TQShowEvent*);
00111
00112 private slots:
00113 void periodClicked(int);
00114 void rangeTypeClicked();
00115 void repeatCountChanged(int value);
00116 void slotAnyTimeToggled(bool);
00117 void addException();
00118 void changeException();
00119 void deleteException();
00120 void enableExceptionButtons();
00121
00122 private:
00123 void setRuleDefaults(const TQDate& start);
00124 void saveState();
00125
00126
00127 TQWidgetStack* mRuleStack;
00128 Rule* mRule;
00129 NoRule* mNoRule;
00130 SubDailyRule* mSubDailyRule;
00131 DailyRule* mDailyRule;
00132 WeeklyRule* mWeeklyRule;
00133 MonthlyRule* mMonthlyRule;
00134 YearlyRule* mYearlyRule;
00135
00136 ButtonGroup* mRuleButtonGroup;
00137 RadioButton* mNoneButton;
00138 RadioButton* mAtLoginButton;
00139 RadioButton* mSubDailyButton;
00140 RadioButton* mDailyButton;
00141 RadioButton* mWeeklyButton;
00142 RadioButton* mMonthlyButton;
00143 RadioButton* mYearlyButton;
00144 int mNoneButtonId;
00145 int mAtLoginButtonId;
00146 int mSubDailyButtonId;
00147 int mDailyButtonId;
00148 int mWeeklyButtonId;
00149 int mMonthlyButtonId;
00150 int mYearlyButtonId;
00151 RepeatType mRuleButtonType;
00152 bool mDailyShown;
00153 bool mWeeklyShown;
00154 bool mMonthlyShown;
00155 bool mYearlyShown;
00156
00157
00158 ButtonGroup* mRangeButtonGroup;
00159 RadioButton* mNoEndDateButton;
00160 RadioButton* mRepeatCountButton;
00161 SpinBox* mRepeatCountEntry;
00162 TQLabel* mRepeatCountLabel;
00163 RadioButton* mEndDateButton;
00164 DateEdit* mEndDateEdit;
00165 TimeEdit* mEndTimeEdit;
00166 CheckBox* mEndAnyTimeCheckBox;
00167
00168
00169 TQGroupBox* mExceptionGroup;
00170 TQListBox* mExceptionDateList;
00171 DateEdit* mExceptionDateEdit;
00172 TQPushButton* mChangeExceptionButton;
00173 TQPushButton* mDeleteExceptionButton;
00174 TQValueList<TQDate> mExceptionDates;
00175
00176
00177 TQDateTime mCurrStartDateTime;
00178 RepetitionButton* mSubRepetition;
00179 bool mNoEmitTypeChanged;
00180 bool mReadOnly;
00181
00182
00183 TQButton* mSavedRuleButton;
00184 TQButton* mSavedRangeButton;
00185 int mSavedRecurCount;
00186 DateTime mSavedEndDateTime;
00187 TQValueList<TQDate> mSavedExceptionDates;
00188 int mSavedRepeatInterval;
00189 int mSavedRepeatCount;
00190 };
00191
00192 #endif // RECURRENCEEDIT_H
|