kalarm Library API Documentation

recurrenceedit.h

00001 /*
00002  *  recurrenceedit.h  -  widget to edit the event's recurrence definition
00003  *  Program:  kalarm
00004  *  (C) 2002 by David Jarvie  software@astrojar.org.uk
00005  *
00006  *  Based on KOrganizer module koeditorrecurrence.h,
00007     Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; if not, write to the Free Software
00021     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022 
00023     As a special exception, permission is given to link this program
00024     with any edition of Qt, and distribute the resulting executable,
00025     without including the source code for Qt in the source distribution.
00026  */
00027 #ifndef RECURRENCEEDIT_H
00028 #define RECURRENCEEDIT_H
00029 
00030 #include <qradiobutton.h>
00031 #include <qbuttongroup.h>
00032 #include <libkcal/event.h>
00033 
00034 class QWidgetStack;
00035 class QLabel;
00036 class QSpinBox;
00037 class QComboBox;
00038 class QCheckBox;
00039 class DateEdit;
00040 class TimeSpinBox;
00041 class ButtonGroup;
00042 class KAlarmEvent;
00043 
00044 using namespace KCal;
00045 
00046 
00047 class RecurrenceEdit : public QFrame
00048 {
00049                 Q_OBJECT
00050         public:
00051                 enum RepeatType { SUBDAILY, DAILY, WEEKLY, MONTHLY, ANNUAL };
00052 
00053                 RecurrenceEdit(QWidget* parent, const char* name = 0L);
00054                 virtual ~RecurrenceEdit()  { }
00055 
00057                 void          setDefaults(const QDateTime& from);
00059                 void          set(const KAlarmEvent&);
00061                 void          updateEvent(KAlarmEvent&);
00062                 QWidget*      checkData(const QDateTime& startDateTime, bool& noTime) const;
00063                 RepeatType    repeatType() const                    { return ruleButtonType; }
00064                 void          setStartDate(const QDate&);
00065                 void          setEndDate(const QDate&);
00066 
00067         public slots:
00068                 void          setDateTime(const QDateTime& start)   { currStartDateTime = start; }
00069 
00070         signals:
00071                 void          shown();
00072                 void          typeChanged(int recurType);   // returns a RepeatType value
00073 
00074         protected slots:
00075                 void          periodClicked(int);
00076                 void          monthlyClicked(int);
00077                 void          yearlyClicked(int);
00078                 void          disableRange(bool);
00079                 void          enableDurationRange(bool);
00080                 void          enableDateRange(bool);
00081 
00082         protected:
00083                 virtual void  showEvent(QShowEvent*);
00084 
00085         private:
00086                 void          unsetAllCheckboxes();
00087                 void          checkDay(int day);
00088                 void          getCheckedDays(QBitArray& rDays);
00089                 void          setCheckedDays(QBitArray& rDays);
00090 
00091                 void          initNone();
00092                 void          initSubdaily();
00093                 void          initDaily();
00094                 void          initWeekly();
00095                 void          initMonthly();
00096                 void          initYearly();
00097 
00098                 // Main rule box and choices
00099                 QGroupBox*    recurGroup;
00100                 QFrame*       ruleFrame;
00101                 QWidgetStack* ruleStack;
00102 
00103                 ButtonGroup*  ruleButtonGroup;
00104                 QLabel*       recurEveryLabel;
00105                 QRadioButton* subdailyButton;
00106                 QRadioButton* dailyButton;
00107                 QRadioButton* weeklyButton;
00108                 QRadioButton* monthlyButton;
00109                 QRadioButton* yearlyButton;
00110                 int           subdailyButtonId;
00111                 int           dailyButtonId;
00112                 int           weeklyButtonId;
00113                 int           monthlyButtonId;
00114                 int           yearlyButtonId;
00115                 RepeatType    ruleButtonType;
00116 
00117                 QWidgetStack* recurFrequencyStack;
00118                 QSpinBox*     recurFrequency;
00119                 TimeSpinBox*  recurHourMinFrequency;
00120 
00121                 // Rules without choices
00122                 QFrame*       noneFrame;
00123 
00124                 // Weekly rule choices
00125                 QFrame*       weeklyFrame;
00126                 QCheckBox*    dayBox[7];
00127 
00128                 // Monthly rule choices
00129                 QFrame*       monthlyFrame;
00130                 ButtonGroup*  monthlyButtonGroup;
00131                 QRadioButton* onNthDayButton;
00132                 QComboBox*    nthDayEntry;
00133                 QRadioButton* onNthTypeOfDayButton;
00134                 QComboBox*    nthNumberEntry;
00135                 QComboBox*    nthTypeOfDayEntry;
00136                 int           onNthDayButtonId;
00137                 int           onNthTypeOfDayButtonId;
00138 
00139                 // Yearly rule choices
00140                 QFrame*       yearlyFrame;
00141                 ButtonGroup*  yearlyButtonGroup;
00142                 QRadioButton* mYearRuleFeb29Button;
00143                 QRadioButton* yearMonthButton;
00144 //              QRadioButton* yearDayButton;
00145                 QRadioButton* yearlyOnNthTypeOfDayButton;
00146 //              QSpinBox*     yearDayEntry;
00147                 QComboBox*    yearlyNthNumberEntry;
00148                 QComboBox*    yearlyNthTypeOfDayEntry;
00149                 QComboBox*    yeardayMonthComboBox;
00150                 int           mYearRuleFeb29ButtonId;
00151                 int           yearMonthButtonId;
00152 //              int           yearDayButtonId;
00153                 int           yearlyOnNthTypeOfDayButtonId;
00154 
00155                 // Range
00156                 QButtonGroup* rangeButtonGroup;
00157                 QRadioButton* noEndDateButton;
00158                 QRadioButton* repeatCountButton;
00159                 QSpinBox*     repeatCountEntry;
00160                 QLabel*       repeatCountLabel;
00161                 QRadioButton* endDateButton;
00162                 DateEdit*     endDateEdit;
00163                 TimeSpinBox*  endTimeEdit;
00164 
00165                 // Current start date and time
00166                 QDateTime     currStartDateTime;
00167                 bool          noEmitTypeChanged;    // suppress typeChanged() signal
00168 };
00169 
00170 #endif // RECURRENCEEDIT_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:27 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001