Diffstat (limited to 'korganizer/koeditorrecurrence.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorrecurrence.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h index 75e0c73..6c012bd 100644 --- a/korganizer/koeditorrecurrence.h +++ b/korganizer/koeditorrecurrence.h | |||
@@ -1,327 +1,329 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOEDITORRECURRENCE_H | 23 | #ifndef _KOEDITORRECURRENCE_H |
24 | #define _KOEDITORRECURRENCE_H | 24 | #define _KOEDITORRECURRENCE_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <q3frame.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qgroupbox.h> | 30 | #include <q3groupbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qmultilineedit.h> | 33 | #include <q3multilineedit.h> |
34 | #include <qlistview.h> | 34 | #include <q3listview.h> |
35 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
36 | #include <qbuttongroup.h> | 36 | #include <q3buttongroup.h> |
37 | #include <Q3ListBox> | ||
38 | #include <Q3ComboBox> | ||
37 | 39 | ||
38 | #include <kdialogbase.h> | 40 | #include <kdialogbase.h> |
39 | 41 | ||
40 | #include <libkcal/event.h> | 42 | #include <libkcal/event.h> |
41 | 43 | ||
42 | #include "ktimeedit.h" | 44 | #include "ktimeedit.h" |
43 | 45 | ||
44 | class QWidgetStack; | 46 | class Q3WidgetStack; |
45 | class QSpinBox; | 47 | class QSpinBox; |
46 | 48 | ||
47 | class KDateEdit; | 49 | class KDateEdit; |
48 | 50 | ||
49 | using namespace KCal; | 51 | using namespace KCal; |
50 | 52 | ||
51 | class RecurBase : public QWidget | 53 | class RecurBase : public QWidget |
52 | { | 54 | { |
53 | public: | 55 | public: |
54 | RecurBase( QWidget *parent = 0, const char *name = 0 ); | 56 | RecurBase( QWidget *parent = 0, const char *name = 0 ); |
55 | 57 | ||
56 | void setFrequency( int ); | 58 | void setFrequency( int ); |
57 | int frequency(); | 59 | int frequency(); |
58 | 60 | ||
59 | QWidget *frequencyEdit(); | 61 | QWidget *frequencyEdit(); |
60 | 62 | ||
61 | private: | 63 | private: |
62 | QSpinBox *mFrequencyEdit; | 64 | QSpinBox *mFrequencyEdit; |
63 | }; | 65 | }; |
64 | 66 | ||
65 | class RecurDaily : public RecurBase | 67 | class RecurDaily : public RecurBase |
66 | { | 68 | { |
67 | public: | 69 | public: |
68 | RecurDaily( QWidget *parent = 0, const char *name = 0 ); | 70 | RecurDaily( QWidget *parent = 0, const char *name = 0 ); |
69 | }; | 71 | }; |
70 | 72 | ||
71 | class RecurWeekly : public RecurBase | 73 | class RecurWeekly : public RecurBase |
72 | { | 74 | { |
73 | public: | 75 | public: |
74 | RecurWeekly( QWidget *parent = 0, const char *name = 0 ); | 76 | RecurWeekly( QWidget *parent = 0, const char *name = 0 ); |
75 | 77 | ||
76 | void setDays( const QBitArray & ); | 78 | void setDays( const QBitArray & ); |
77 | QBitArray days(); | 79 | QBitArray days(); |
78 | 80 | ||
79 | private: | 81 | private: |
80 | QCheckBox *mDayBoxes[7]; | 82 | QCheckBox *mDayBoxes[7]; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | class RecurMonthly : public RecurBase | 85 | class RecurMonthly : public RecurBase |
84 | { | 86 | { |
85 | public: | 87 | public: |
86 | RecurMonthly( QWidget *parent = 0, const char *name = 0 ); | 88 | RecurMonthly( QWidget *parent = 0, const char *name = 0 ); |
87 | 89 | ||
88 | void setByDay( int day ); | 90 | void setByDay( int day ); |
89 | void setByPos( int count, int weekday ); | 91 | void setByPos( int count, int weekday ); |
90 | 92 | ||
91 | bool byDay(); | 93 | bool byDay(); |
92 | bool byPos(); | 94 | bool byPos(); |
93 | 95 | ||
94 | int day(); | 96 | int day(); |
95 | 97 | ||
96 | int count(); | 98 | int count(); |
97 | int weekday(); | 99 | int weekday(); |
98 | 100 | ||
99 | private: | 101 | private: |
100 | QRadioButton *mByDayRadio; | 102 | QRadioButton *mByDayRadio; |
101 | QComboBox *mByDayCombo; | 103 | Q3ComboBox *mByDayCombo; |
102 | 104 | ||
103 | QRadioButton *mByPosRadio; | 105 | QRadioButton *mByPosRadio; |
104 | QComboBox *mByPosCountCombo; | 106 | QComboBox *mByPosCountCombo; |
105 | QComboBox *mByPosWeekdayCombo; | 107 | QComboBox *mByPosWeekdayCombo; |
106 | }; | 108 | }; |
107 | 109 | ||
108 | class RecurYearly : public RecurBase | 110 | class RecurYearly : public RecurBase |
109 | { | 111 | { |
110 | public: | 112 | public: |
111 | RecurYearly( QWidget *parent = 0, const char *name = 0 ); | 113 | RecurYearly( QWidget *parent = 0, const char *name = 0 ); |
112 | 114 | ||
113 | void setByDay( int doy ); | 115 | void setByDay( int doy ); |
114 | void setByMonth( int month, int day ); | 116 | void setByMonth( int month, int day ); |
115 | 117 | ||
116 | bool byMonth(); | 118 | bool byMonth(); |
117 | bool byDay(); | 119 | bool byDay(); |
118 | 120 | ||
119 | int month(); | 121 | int month(); |
120 | int day(); | 122 | int day(); |
121 | 123 | ||
122 | private: | 124 | private: |
123 | int mDay; | 125 | int mDay; |
124 | QRadioButton *mByMonthRadio; | 126 | QRadioButton *mByMonthRadio; |
125 | QComboBox *mByMonthCombo; | 127 | Q3ComboBox *mByMonthCombo; |
126 | QLabel* mByDayLabel; | 128 | QLabel* mByDayLabel; |
127 | QLabel* mDayOfLabel; | 129 | QLabel* mDayOfLabel; |
128 | QRadioButton *mByDayRadio; | 130 | QRadioButton *mByDayRadio; |
129 | }; | 131 | }; |
130 | 132 | ||
131 | class RecurrenceChooser : public QWidget | 133 | class RecurrenceChooser : public QWidget |
132 | { | 134 | { |
133 | Q_OBJECT | 135 | Q_OBJECT |
134 | public: | 136 | public: |
135 | RecurrenceChooser( QWidget *parent = 0, const char *name = 0 ); | 137 | RecurrenceChooser( QWidget *parent = 0, const char *name = 0 ); |
136 | 138 | ||
137 | enum { Daily, Weekly, Monthly, Yearly }; | 139 | enum { Daily, Weekly, Monthly, Yearly }; |
138 | 140 | ||
139 | void setType( int ); | 141 | void setType( int ); |
140 | int type(); | 142 | int type(); |
141 | 143 | ||
142 | signals: | 144 | signals: |
143 | void chosen( int ); | 145 | void chosen( int ); |
144 | 146 | ||
145 | protected slots: | 147 | protected slots: |
146 | void emitChoice(); | 148 | void emitChoice(); |
147 | 149 | ||
148 | private: | 150 | private: |
149 | QComboBox *mTypeCombo; | 151 | QComboBox *mTypeCombo; |
150 | 152 | ||
151 | QRadioButton *mDailyButton; | 153 | QRadioButton *mDailyButton; |
152 | QRadioButton *mWeeklyButton; | 154 | QRadioButton *mWeeklyButton; |
153 | QRadioButton *mMonthlyButton; | 155 | QRadioButton *mMonthlyButton; |
154 | QRadioButton *mYearlyButton; | 156 | QRadioButton *mYearlyButton; |
155 | }; | 157 | }; |
156 | 158 | ||
157 | class ExceptionsBase | 159 | class ExceptionsBase |
158 | { | 160 | { |
159 | public: | 161 | public: |
160 | virtual void setDefaults( const QDateTime &from ) = 0; | 162 | virtual void setDefaults( const QDateTime &from ) = 0; |
161 | virtual void setDates( const DateList & ) = 0; | 163 | virtual void setDates( const DateList & ) = 0; |
162 | virtual DateList dates() = 0; | 164 | virtual DateList dates() = 0; |
163 | }; | 165 | }; |
164 | 166 | ||
165 | class ExceptionsWidget : public QWidget, public ExceptionsBase | 167 | class ExceptionsWidget : public QWidget, public ExceptionsBase |
166 | { | 168 | { |
167 | Q_OBJECT | 169 | Q_OBJECT |
168 | public: | 170 | public: |
169 | ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); | 171 | ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); |
170 | 172 | ||
171 | void setDefaults( const QDateTime &from ); | 173 | void setDefaults( const QDateTime &from ); |
172 | 174 | ||
173 | void setDates( const DateList & ); | 175 | void setDates( const DateList & ); |
174 | DateList dates(); | 176 | DateList dates(); |
175 | 177 | ||
176 | protected slots: | 178 | protected slots: |
177 | void addException(); | 179 | void addException(); |
178 | void changeException(); | 180 | void changeException(); |
179 | void deleteException(); | 181 | void deleteException(); |
180 | 182 | ||
181 | private: | 183 | private: |
182 | KDateEdit *mExceptionDateEdit; | 184 | KDateEdit *mExceptionDateEdit; |
183 | QListBox *mExceptionList; | 185 | Q3ListBox *mExceptionList; |
184 | DateList mExceptionDates; | 186 | DateList mExceptionDates; |
185 | }; | 187 | }; |
186 | 188 | ||
187 | class ExceptionsDialog : public KDialogBase, public ExceptionsBase | 189 | class ExceptionsDialog : public KDialogBase, public ExceptionsBase |
188 | { | 190 | { |
189 | public: | 191 | public: |
190 | ExceptionsDialog( QWidget *parent, const char *name = 0 ); | 192 | ExceptionsDialog( QWidget *parent, const char *name = 0 ); |
191 | 193 | ||
192 | void setDefaults( const QDateTime &from ); | 194 | void setDefaults( const QDateTime &from ); |
193 | 195 | ||
194 | void setDates( const DateList & ); | 196 | void setDates( const DateList & ); |
195 | DateList dates(); | 197 | DateList dates(); |
196 | 198 | ||
197 | private: | 199 | private: |
198 | ExceptionsWidget *mExceptions; | 200 | ExceptionsWidget *mExceptions; |
199 | }; | 201 | }; |
200 | 202 | ||
201 | class RecurrenceRangeBase | 203 | class RecurrenceRangeBase |
202 | { | 204 | { |
203 | public: | 205 | public: |
204 | virtual void setDefaults( const QDateTime &from ) = 0; | 206 | virtual void setDefaults( const QDateTime &from ) = 0; |
205 | 207 | ||
206 | virtual void setDuration( int ) = 0; | 208 | virtual void setDuration( int ) = 0; |
207 | virtual int duration() = 0; | 209 | virtual int duration() = 0; |
208 | 210 | ||
209 | virtual void setEndDate( const QDate & ) = 0; | 211 | virtual void setEndDate( const QDate & ) = 0; |
210 | virtual QDate endDate() = 0; | 212 | virtual QDate endDate() = 0; |
211 | 213 | ||
212 | virtual void setDateTimes( const QDateTime &start, | 214 | virtual void setDateTimes( const QDateTime &start, |
213 | const QDateTime &end = QDateTime() ) = 0; | 215 | const QDateTime &end = QDateTime() ) = 0; |
214 | }; | 216 | }; |
215 | 217 | ||
216 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase | 218 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase |
217 | { | 219 | { |
218 | Q_OBJECT | 220 | Q_OBJECT |
219 | public: | 221 | public: |
220 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); | 222 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); |
221 | ~RecurrenceRangeWidget(); | 223 | ~RecurrenceRangeWidget(); |
222 | 224 | ||
223 | void setDefaults( const QDateTime &from ); | 225 | void setDefaults( const QDateTime &from ); |
224 | 226 | ||
225 | void setDuration( int ); | 227 | void setDuration( int ); |
226 | int duration(); | 228 | int duration(); |
227 | 229 | ||
228 | void setEndDate( const QDate & ); | 230 | void setEndDate( const QDate & ); |
229 | QDate endDate(); | 231 | QDate endDate(); |
230 | 232 | ||
231 | void setDateTimes( const QDateTime &start, | 233 | void setDateTimes( const QDateTime &start, |
232 | const QDateTime &end = QDateTime() ); | 234 | const QDateTime &end = QDateTime() ); |
233 | 235 | ||
234 | protected slots: | 236 | protected slots: |
235 | void showCurrentRange(); | 237 | void showCurrentRange(); |
236 | 238 | ||
237 | private: | 239 | private: |
238 | QButtonGroup *mRangeButtonGroup; | 240 | Q3ButtonGroup *mRangeButtonGroup; |
239 | QGroupBox *mRangeGroupBox; | 241 | Q3GroupBox *mRangeGroupBox; |
240 | QLabel *mStartDateLabel; | 242 | QLabel *mStartDateLabel; |
241 | QRadioButton *mNoEndDateButton; | 243 | QRadioButton *mNoEndDateButton; |
242 | QRadioButton *mEndDurationButton; | 244 | QRadioButton *mEndDurationButton; |
243 | QSpinBox *mEndDurationEdit; | 245 | QSpinBox *mEndDurationEdit; |
244 | QRadioButton *mEndDateButton; | 246 | QRadioButton *mEndDateButton; |
245 | KDateEdit *mEndDateEdit; | 247 | KDateEdit *mEndDateEdit; |
246 | }; | 248 | }; |
247 | 249 | ||
248 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase | 250 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase |
249 | { | 251 | { |
250 | public: | 252 | public: |
251 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); | 253 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); |
252 | 254 | ||
253 | void setDefaults( const QDateTime &from ); | 255 | void setDefaults( const QDateTime &from ); |
254 | 256 | ||
255 | void setDuration( int ); | 257 | void setDuration( int ); |
256 | int duration(); | 258 | int duration(); |
257 | 259 | ||
258 | void setEndDate( const QDate & ); | 260 | void setEndDate( const QDate & ); |
259 | QDate endDate(); | 261 | QDate endDate(); |
260 | 262 | ||
261 | void setDateTimes( const QDateTime &start, | 263 | void setDateTimes( const QDateTime &start, |
262 | const QDateTime &end = QDateTime() ); | 264 | const QDateTime &end = QDateTime() ); |
263 | 265 | ||
264 | private: | 266 | private: |
265 | RecurrenceRangeWidget *mRecurrenceRangeWidget; | 267 | RecurrenceRangeWidget *mRecurrenceRangeWidget; |
266 | }; | 268 | }; |
267 | 269 | ||
268 | class KOEditorRecurrence : public QWidget | 270 | class KOEditorRecurrence : public QWidget |
269 | { | 271 | { |
270 | Q_OBJECT | 272 | Q_OBJECT |
271 | public: | 273 | public: |
272 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); | 274 | KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); |
273 | virtual ~KOEditorRecurrence(); | 275 | virtual ~KOEditorRecurrence(); |
274 | 276 | ||
275 | enum { Daily, Weekly, Monthly, Yearly }; | 277 | enum { Daily, Weekly, Monthly, Yearly }; |
276 | 278 | ||
277 | /** Read event object and setup widgets accordingly */ | 279 | /** Read event object and setup widgets accordingly */ |
278 | void readEvent( Incidence * ); | 280 | void readEvent( Incidence * ); |
279 | /** Write event settings to event object */ | 281 | /** Write event settings to event object */ |
280 | void writeEvent( Incidence * ); | 282 | void writeEvent( Incidence * ); |
281 | 283 | ||
282 | /** Check if the input is valid. */ | 284 | /** Check if the input is valid. */ |
283 | bool validateInput(); | 285 | bool validateInput(); |
284 | 286 | ||
285 | public slots: | 287 | public slots: |
286 | void setDefaultsDates( QDateTime from, QDateTime to ); | 288 | void setDefaultsDates( QDateTime from, QDateTime to ); |
287 | void setDefaults( QDateTime from, QDateTime to ); | 289 | void setDefaults( QDateTime from, QDateTime to ); |
288 | void setEnabled( bool ); | 290 | void setEnabled( bool ); |
289 | void setDateTimes( QDateTime start, QDateTime end ); | 291 | void setDateTimes( QDateTime start, QDateTime end ); |
290 | void setDateTimeStr( const QString & ); | 292 | void setDateTimeStr( const QString & ); |
291 | 293 | ||
292 | signals: | 294 | signals: |
293 | void dateTimesChanged( QDateTime start, QDateTime end ); | 295 | void dateTimesChanged( QDateTime start, QDateTime end ); |
294 | 296 | ||
295 | protected slots: | 297 | protected slots: |
296 | void showCurrentRule( int ); | 298 | void showCurrentRule( int ); |
297 | void showExceptionsDialog(); | 299 | void showExceptionsDialog(); |
298 | void showRecurrenceRangeDialog(); | 300 | void showRecurrenceRangeDialog(); |
299 | 301 | ||
300 | private: | 302 | private: |
301 | QCheckBox *mEnabledCheck; | 303 | QCheckBox *mEnabledCheck; |
302 | 304 | ||
303 | QGroupBox *mTimeGroupBox; | 305 | Q3GroupBox *mTimeGroupBox; |
304 | QLabel *mDateTimeLabel; | 306 | QLabel *mDateTimeLabel; |
305 | 307 | ||
306 | QGroupBox *mRuleBox; | 308 | Q3GroupBox *mRuleBox; |
307 | QWidgetStack *mRuleStack; | 309 | Q3WidgetStack *mRuleStack; |
308 | RecurrenceChooser *mRecurrenceChooser; | 310 | RecurrenceChooser *mRecurrenceChooser; |
309 | 311 | ||
310 | RecurDaily *mDaily; | 312 | RecurDaily *mDaily; |
311 | RecurWeekly *mWeekly; | 313 | RecurWeekly *mWeekly; |
312 | RecurMonthly *mMonthly; | 314 | RecurMonthly *mMonthly; |
313 | RecurYearly *mYearly; | 315 | RecurYearly *mYearly; |
314 | 316 | ||
315 | RecurrenceRangeBase *mRecurrenceRange; | 317 | RecurrenceRangeBase *mRecurrenceRange; |
316 | RecurrenceRangeWidget *mRecurrenceRangeWidget; | 318 | RecurrenceRangeWidget *mRecurrenceRangeWidget; |
317 | RecurrenceRangeDialog *mRecurrenceRangeDialog; | 319 | RecurrenceRangeDialog *mRecurrenceRangeDialog; |
318 | QPushButton *mRecurrenceRangeButton; | 320 | QPushButton *mRecurrenceRangeButton; |
319 | 321 | ||
320 | ExceptionsBase *mExceptions; | 322 | ExceptionsBase *mExceptions; |
321 | ExceptionsDialog *mExceptionsDialog; | 323 | ExceptionsDialog *mExceptionsDialog; |
322 | ExceptionsWidget *mExceptionsWidget; | 324 | ExceptionsWidget *mExceptionsWidget; |
323 | QPushButton *mExceptionsButton; | 325 | QPushButton *mExceptionsButton; |
324 | 326 | ||
325 | }; | 327 | }; |
326 | 328 | ||
327 | #endif | 329 | #endif |