kalarm
repetition.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef REPETITION_H
00022 #define REPETITION_H
00023
00024 #include <qpushbutton.h>
00025 #include <kdialogbase.h>
00026
00027 class ButtonGroup;
00028 class RadioButton;
00029 class SpinBox;
00030 class TimeSelector;
00031 class TimePeriod;
00032 class RepetitionDlg;
00033
00034
00035 class RepetitionButton : public QPushButton
00036 {
00037 Q_OBJECT
00038 public:
00039 RepetitionButton(const QString& caption, bool waitForInitialisation, QWidget* parent, const char* name = 0);
00040 void set(int interval, int count) { mInterval = interval; mCount = count; }
00041 void set(int interval, int count, bool dateOnly, int maxDuration = -1);
00042 void initialise(int interval, int count, bool dateOnly, int maxDuration = -1);
00043 void activate() { activate(false); }
00044 int interval() const { return mInterval; }
00045 int count() const { return mCount; }
00046 virtual void setReadOnly(bool ro) { mReadOnly = ro; }
00047 virtual bool isReadOnly() const { return mReadOnly; }
00048
00049 signals:
00050 void needsInitialisation();
00051 void changed();
00052
00053 private slots:
00054 void slotPressed() { activate(mWaitForInit); }
00055
00056 private:
00057 void activate(bool waitForInitialisation);
00058 void displayDialog();
00059
00060 RepetitionDlg* mDialog;
00061 int mInterval;
00062 int mCount;
00063 int mMaxDuration;
00064 bool mDateOnly;
00065 bool mWaitForInit;
00066 bool mReadOnly;
00067 };
00068
00069
00070 class RepetitionDlg : public KDialogBase
00071 {
00072 Q_OBJECT
00073 public:
00074 RepetitionDlg(const QString& caption, bool readOnly, QWidget* parent = 0, const char* name = 0);
00075 void setReadOnly(bool);
00076 void set(int interval, int count, bool dateOnly = false, int maxDuration = -1);
00077 int interval() const;
00078 int count() const;
00079
00080 private slots:
00081 void typeClicked();
00082 void intervalChanged(int);
00083 void countChanged(int);
00084 void durationChanged(int);
00085 void repetitionToggled(bool);
00086
00087 private:
00088 TimeSelector* mTimeSelector;
00089 ButtonGroup* mButtonGroup;
00090 RadioButton* mCountButton;
00091 SpinBox* mCount;
00092 RadioButton* mDurationButton;
00093 TimePeriod* mDuration;
00094 int mMaxDuration;
00095 bool mDateOnly;
00096 bool mReadOnly;
00097 };
00098
00099 #endif // REPETITION_H
|