kalarm
alarmtimewidget.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ALARMTIMEWIDGET_H
00022 #define ALARMTIMEWIDGET_H
00023
00024 #include "buttongroup.h"
00025 #include "datetime.h"
00026
00027 class RadioButton;
00028 class CheckBox;
00029 class DateEdit;
00030 class TimeEdit;
00031 class TimeSpinBox;
00032
00033
00034 class AlarmTimeWidget : public ButtonGroup
00035 {
00036 Q_OBJECT
00037 TQ_OBJECT
00038 public:
00039 enum {
00040 AT_TIME = 0x00,
00041 DEFER_TIME = 0x01,
00042 NARROW = 0x02
00043 };
00044 AlarmTimeWidget(const TQString& groupBoxTitle, int mode, TQWidget* parent = 0, const char* name = 0);
00045 AlarmTimeWidget(int mode, TQWidget* parent = 0, const char* name = 0);
00046 DateTime getDateTime(int* minsFromNow = 0, bool checkExpired = true, bool showErrorMessage = true, TQWidget** errorWidget = 0) const;
00047 void setDateTime(const DateTime&);
00048 void setMinDateTimeIsCurrent();
00049 void setMinDateTime(const TQDateTime& = TQDateTime());
00050 void setMaxDateTime(const DateTime& = DateTime());
00051 const TQDateTime& maxDateTime() const { return mMaxDateTime; }
00052 void setReadOnly(bool);
00053 bool anyTime() const { return mAnyTime; }
00054 void enableAnyTime(bool enable);
00055 void selectTimeFromNow(int minutes = 0);
00056 TQSize sizeHint() const { return minimumSizeHint(); }
00057
00058 static TQString i18n_w_TimeFromNow();
00059 static TQString i18n_TimeAfterPeriod();
00060 static const int maxDelayTime;
00061
00062 signals:
00063 void anyTimeToggled(bool anyTime);
00064 void pastMax();
00065
00066 protected slots:
00067 void slotTimer();
00068 void slotButtonSet(int id);
00069 void dateTimeChanged();
00070 void delayTimeChanged(int);
00071 void slotAnyTimeToggled(bool);
00072
00073 private:
00074 void init(int mode);
00075 void setAnyTime();
00076 void setMaxDelayTime(const TQDateTime& now);
00077 void setMaxMinTimeIf(const TQDateTime& now);
00078
00079 RadioButton* mAtTimeRadio;
00080 RadioButton* mAfterTimeRadio;
00081 DateEdit* mDateEdit;
00082 TimeEdit* mTimeEdit;
00083 TimeSpinBox* mDelayTimeEdit;
00084 CheckBox* mAnyTimeCheckBox;
00085 TQDateTime mMinDateTime;
00086 TQDateTime mMaxDateTime;
00087 int mAnyTime;
00088 bool mAnyTimeAllowed;
00089 bool mMinDateTimeIsNow;
00090 bool mPastMax;
00091 bool mMinMaxTimeSet;
00092 bool mTimerSyncing;
00093 };
00094
00095 #endif // ALARMTIMEWIDGET_H
|