korganizer Library API Documentation

koeditorrecurrence.h

00001 /* 00002 This file is part of KOrganizer. 00003 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 #ifndef _KOEDITORRECURRENCE_H 00024 #define _KOEDITORRECURRENCE_H 00025 00026 #include <qframe.h> 00027 #include <qlabel.h> 00028 #include <qcheckbox.h> 00029 #include <qpushbutton.h> 00030 #include <qgroupbox.h> 00031 #include <qlineedit.h> 00032 #include <qcombobox.h> 00033 #include <qmultilineedit.h> 00034 #include <qlistview.h> 00035 #include <qradiobutton.h> 00036 00037 #include <kdialogbase.h> 00038 00039 #include <libkcal/event.h> 00040 00041 #include "ktimeedit.h" 00042 00043 class QWidgetStack; 00044 class QSpinBox; 00045 00046 class KDateEdit; 00047 00048 using namespace KCal; 00049 00050 class RecurBase : public QWidget 00051 { 00052 public: 00053 RecurBase( QWidget *parent = 0, const char *name = 0 ); 00054 00055 void setFrequency( int ); 00056 int frequency(); 00057 void setDateTimes( QDateTime /*start*/, QDateTime /*end*/ ) {} 00058 00059 QWidget *frequencyEdit(); 00060 00061 private: 00062 QSpinBox *mFrequencyEdit; 00063 }; 00064 00065 class RecurDaily : public RecurBase 00066 { 00067 public: 00068 RecurDaily( QWidget *parent = 0, const char *name = 0 ); 00069 }; 00070 00071 class RecurWeekly : public RecurBase 00072 { 00073 public: 00074 RecurWeekly( QWidget *parent = 0, const char *name = 0 ); 00075 00076 void setDays( const QBitArray & ); 00077 QBitArray days(); 00078 00079 private: 00080 QCheckBox *mDayBoxes[7]; 00081 }; 00082 00083 class RecurMonthly : public RecurBase 00084 { 00085 public: 00086 RecurMonthly( QWidget *parent = 0, const char *name = 0 ); 00087 00088 void setByDay( int day ); 00089 void setByPos( int count, int weekday ); 00090 00091 bool byDay(); 00092 bool byPos(); 00093 00094 int day(); 00095 00096 int count(); 00097 int weekday(); 00098 00099 private: 00100 QRadioButton *mByDayRadio; 00101 QComboBox *mByDayCombo; 00102 00103 QRadioButton *mByPosRadio; 00104 QComboBox *mByPosCountCombo; 00105 QComboBox *mByPosWeekdayCombo; 00106 }; 00107 00108 class RecurYearly : public RecurBase 00109 { 00110 public: 00111 RecurYearly( QWidget *parent = 0, const char *name = 0 ); 00112 void setDateTimes( QDateTime start, QDateTime end ); 00113 00114 void setByDay(); 00115 void setByMonth( int month ); 00116 00117 bool byMonth(); 00118 bool byDay(); 00119 00120 int month(); 00121 00122 private: 00123 QRadioButton *mByMonthRadio; 00124 QComboBox *mByMonthCombo; 00125 00126 QRadioButton *mByDayRadio; 00127 }; 00128 00129 class RecurrenceChooser : public QWidget 00130 { 00131 Q_OBJECT 00132 public: 00133 RecurrenceChooser( QWidget *parent = 0, const char *name = 0 ); 00134 00135 enum { Daily, Weekly, Monthly, Yearly }; 00136 00137 void setType( int ); 00138 int type(); 00139 00140 signals: 00141 void chosen( int ); 00142 00143 protected slots: 00144 void emitChoice(); 00145 00146 private: 00147 QComboBox *mTypeCombo; 00148 00149 QRadioButton *mDailyButton; 00150 QRadioButton *mWeeklyButton; 00151 QRadioButton *mMonthlyButton; 00152 QRadioButton *mYearlyButton; 00153 }; 00154 00155 class ExceptionsBase 00156 { 00157 public: 00158 virtual void setDates( const DateList & ) = 0; 00159 virtual DateList dates() = 0; 00160 }; 00161 00162 class ExceptionsWidget : public QWidget, public ExceptionsBase 00163 { 00164 Q_OBJECT 00165 public: 00166 ExceptionsWidget( QWidget *parent = 0, const char *name = 0 ); 00167 00168 void setDates( const DateList & ); 00169 DateList dates(); 00170 00171 protected slots: 00172 void addException(); 00173 void changeException(); 00174 void deleteException(); 00175 00176 private: 00177 KDateEdit *mExceptionDateEdit; 00178 QListBox *mExceptionList; 00179 DateList mExceptionDates; 00180 }; 00181 00182 class ExceptionsDialog : public KDialogBase, public ExceptionsBase 00183 { 00184 public: 00185 ExceptionsDialog( QWidget *parent, const char *name = 0 ); 00186 00187 void setDates( const DateList & ); 00188 DateList dates(); 00189 00190 private: 00191 ExceptionsWidget *mExceptions; 00192 }; 00193 00194 class RecurrenceRangeBase 00195 { 00196 public: 00197 virtual void setDefaults( const QDateTime &from ) = 0; 00198 00199 virtual void setDuration( int ) = 0; 00200 virtual int duration() = 0; 00201 00202 virtual void setEndDate( const QDate & ) = 0; 00203 virtual QDate endDate() = 0; 00204 00205 virtual void setDateTimes( const QDateTime &start, 00206 const QDateTime &end = QDateTime() ) = 0; 00207 }; 00208 00209 class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase 00210 { 00211 Q_OBJECT 00212 public: 00213 RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); 00214 00215 void setDefaults( const QDateTime &from ); 00216 00217 void setDuration( int ); 00218 int duration(); 00219 00220 void setEndDate( const QDate & ); 00221 QDate endDate(); 00222 00223 void setDateTimes( const QDateTime &start, 00224 const QDateTime &end = QDateTime() ); 00225 00226 protected slots: 00227 void showCurrentRange(); 00228 00229 private: 00230 QGroupBox *mRangeGroupBox; 00231 QLabel *mStartDateLabel; 00232 QRadioButton *mNoEndDateButton; 00233 QRadioButton *mEndDurationButton; 00234 QSpinBox *mEndDurationEdit; 00235 QRadioButton *mEndDateButton; 00236 KDateEdit *mEndDateEdit; 00237 }; 00238 00239 class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase 00240 { 00241 public: 00242 RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); 00243 00244 void setDefaults( const QDateTime &from ); 00245 00246 void setDuration( int ); 00247 int duration(); 00248 00249 void setEndDate( const QDate & ); 00250 QDate endDate(); 00251 00252 void setDateTimes( const QDateTime &start, 00253 const QDateTime &end = QDateTime() ); 00254 00255 private: 00256 RecurrenceRangeWidget *mRecurrenceRangeWidget; 00257 }; 00258 00259 class KOEditorRecurrence : public QWidget 00260 { 00261 Q_OBJECT 00262 public: 00263 KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); 00264 virtual ~KOEditorRecurrence(); 00265 00266 enum { Daily, Weekly, Monthly, Yearly }; 00267 00269 void setDefaults( QDateTime from, QDateTime to, bool allday ); 00271 void readEvent( Event * ); 00273 void writeEvent( Event * ); 00274 00276 bool validateInput(); 00277 00278 public slots: 00279 void setEnabled( bool ); 00280 void setDateTimes( QDateTime start, QDateTime end ); 00281 void setDateTimeStr( const QString & ); 00282 00283 signals: 00284 void dateTimesChanged( QDateTime start, QDateTime end ); 00285 00286 protected slots: 00287 void showCurrentRule( int ); 00288 void showExceptionsDialog(); 00289 void showRecurrenceRangeDialog(); 00290 00291 private: 00292 QCheckBox *mEnabledCheck; 00293 00294 QGroupBox *mTimeGroupBox; 00295 QLabel *mDateTimeLabel; 00296 00297 QGroupBox *mRuleBox; 00298 QWidgetStack *mRuleStack; 00299 RecurrenceChooser *mRecurrenceChooser; 00300 00301 RecurDaily *mDaily; 00302 RecurWeekly *mWeekly; 00303 RecurMonthly *mMonthly; 00304 RecurYearly *mYearly; 00305 00306 RecurrenceRangeBase *mRecurrenceRange; 00307 RecurrenceRangeWidget *mRecurrenceRangeWidget; 00308 RecurrenceRangeDialog *mRecurrenceRangeDialog; 00309 QPushButton *mRecurrenceRangeButton; 00310 00311 ExceptionsBase *mExceptions; 00312 ExceptionsDialog *mExceptionsDialog; 00313 ExceptionsWidget *mExceptionsWidget; 00314 QPushButton *mExceptionsButton; 00315 }; 00316 00317 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:13 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003