24 #ifndef _KOEDITORRECURRENCE_H
25 #define _KOEDITORRECURRENCE_H
27 #include <tqdatetime.h>
29 #include <tqbitarray.h>
31 #include <kdialogbase.h>
33 #include <libkcal/incidencebase.h>
47 class RecurBase :
public TQWidget
50 RecurBase( TQWidget *parent = 0,
const char *name = 0 );
52 void setFrequency(
int );
56 void setDateTimes(
const TQDateTime &,
const TQDateTime & ) {}
58 TQWidget *frequencyEdit();
61 static TQComboBox *createWeekCountCombo( TQWidget *parent=0,
const char *name=0 );
62 static TQComboBox *createWeekdayCombo( TQWidget *parent=0,
const char *name=0 );
63 static TQComboBox *createMonthNameCombo( TQWidget *parent=0,
const char *name=0 );
64 TQBoxLayout *createFrequencySpinBar( TQWidget *parent, TQLayout *layout,
65 TQString everyText, TQString unitText );
68 TQSpinBox *mFrequencyEdit;
71 class RecurDaily :
public RecurBase
74 RecurDaily( TQWidget *parent = 0,
const char *name = 0 );
77 class RecurWeekly :
public RecurBase
80 RecurWeekly( TQWidget *parent = 0,
const char *name = 0 );
82 void setDays(
const TQBitArray & );
86 TQCheckBox *mDayBoxes[7];
89 class RecurMonthly :
public RecurBase
92 RecurMonthly( TQWidget *parent = 0,
const char *name = 0 );
94 void setByDay(
int day );
95 void setByPos(
int count,
int weekday );
106 TQRadioButton *mByDayRadio;
107 TQComboBox *mByDayCombo;
109 TQRadioButton *mByPosRadio;
110 TQComboBox *mByPosCountCombo;
111 TQComboBox *mByPosWeekdayCombo;
114 class RecurYearly :
public RecurBase
117 enum YearlyType { byDay, byPos, byMonth };
119 RecurYearly( TQWidget *parent = 0,
const char *name = 0 );
121 void setByDay(
int day );
122 void setByPos(
int count,
int weekday,
int month );
123 void setByMonth(
int day,
int month );
125 YearlyType getType();
135 TQRadioButton *mByMonthRadio;
136 TQRadioButton *mByPosRadio;
137 TQRadioButton *mByDayRadio;
139 TQSpinBox *mByMonthSpin;
140 TQComboBox *mByMonthCombo;
142 TQComboBox *mByPosDayCombo;
143 TQComboBox *mByPosWeekdayCombo;
144 TQComboBox *mByPosMonthCombo;
146 TQSpinBox *mByDaySpin;
149 class RecurrenceChooser :
public TQWidget
154 RecurrenceChooser( TQWidget *parent = 0,
const char *name = 0 );
156 enum { Daily, Weekly, Monthly, Yearly };
168 TQComboBox *mTypeCombo;
170 TQRadioButton *mDailyButton;
171 TQRadioButton *mWeeklyButton;
172 TQRadioButton *mMonthlyButton;
173 TQRadioButton *mYearlyButton;
179 virtual void setDates(
const DateList & ) = 0;
180 virtual DateList dates() = 0;
183 class ExceptionsWidget :
public TQWidget,
public ExceptionsBase
188 ExceptionsWidget( TQWidget *parent = 0,
const char *name = 0 );
190 void setDates(
const DateList & );
195 void changeException();
196 void deleteException();
199 KDateEdit *mExceptionDateEdit;
200 TQListBox *mExceptionList;
201 DateList mExceptionDates;
204 class ExceptionsDialog :
public KDialogBase,
public ExceptionsBase
207 ExceptionsDialog( TQWidget *parent,
const char *name = 0 );
209 void setDates(
const DateList & );
213 ExceptionsWidget *mExceptions;
216 class RecurrenceRangeBase
219 virtual void setDefaults(
const TQDateTime &from ) = 0;
221 virtual void setDuration(
int ) = 0;
222 virtual int duration() = 0;
224 virtual void setEndDate(
const TQDate & ) = 0;
225 virtual TQDate endDate() = 0;
227 virtual void setDateTimes(
const TQDateTime &start,
228 const TQDateTime &end = TQDateTime() ) = 0;
231 class RecurrenceRangeWidget :
public TQWidget,
public RecurrenceRangeBase
236 RecurrenceRangeWidget( TQWidget *parent = 0,
const char *name = 0 );
238 void setDefaults(
const TQDateTime &from );
240 void setDuration(
int );
243 void setEndDate(
const TQDate & );
246 void setDateTimes(
const TQDateTime &start,
247 const TQDateTime &end = TQDateTime() );
250 void showCurrentRange();
253 TQGroupBox *mRangeGroupBox;
254 TQLabel *mStartDateLabel;
255 TQRadioButton *mNoEndDateButton;
256 TQRadioButton *mEndDurationButton;
257 TQSpinBox *mEndDurationEdit;
258 TQRadioButton *mEndDateButton;
259 KDateEdit *mEndDateEdit;
262 class RecurrenceRangeDialog :
public KDialogBase,
public RecurrenceRangeBase
265 RecurrenceRangeDialog( TQWidget *parent = 0,
const char *name = 0 );
267 void setDefaults(
const TQDateTime &from );
269 void setDuration(
int );
272 void setEndDate(
const TQDate & );
275 void setDateTimes(
const TQDateTime &start,
276 const TQDateTime &end = TQDateTime() );
279 RecurrenceRangeWidget *mRecurrenceRangeWidget;
282 class KOEditorRecurrence :
public TQWidget
287 KOEditorRecurrence ( TQWidget *parent = 0,
const char *name = 0 );
288 virtual ~KOEditorRecurrence();
290 enum { Daily, Weekly, Monthly, Yearly };
293 void setDefaults(
const TQDateTime &from,
const TQDateTime &to,
bool allday );
300 bool validateInput();
305 void restoreValues();
308 void setRecurrenceEnabled(
bool );
309 void setDateTimes(
const TQDateTime &start,
const TQDateTime &end );
310 void setDateTimeStr(
const TQString & );
313 void dateTimesChanged(
const TQDateTime &start,
const TQDateTime &end );
316 void showCurrentRule(
int );
317 void showExceptionsDialog();
318 void showRecurrenceRangeDialog();
322 TQCheckBox *mEnabledCheck;
324 TQGroupBox *mTimeGroupBox;
325 TQLabel *mDateTimeLabel;
327 TQGroupBox *mRuleBox;
328 TQWidgetStack *mRuleStack;
329 RecurrenceChooser *mRecurrenceChooser;
332 RecurWeekly *mWeekly;
333 RecurMonthly *mMonthly;
334 RecurYearly *mYearly;
336 RecurrenceRangeBase *mRecurrenceRange;
337 RecurrenceRangeWidget *mRecurrenceRangeWidget;
338 RecurrenceRangeDialog *mRecurrenceRangeDialog;
339 TQPushButton *mRecurrenceRangeButton;
341 ExceptionsBase *mExceptions;
342 ExceptionsDialog *mExceptionsDialog;
343 ExceptionsWidget *mExceptionsWidget;
344 TQPushButton *mExceptionsButton;
346 TQDateTime mEventStartDt;
349 class KOEditorRecurrenceDialog :
public KDialogBase
354 KOEditorRecurrenceDialog( TQWidget *parent );
355 KOEditorRecurrence* editor()
const {
return mRecurrence; }
362 KOEditorRecurrence *mRecurrence;