00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef dtime_included
00023 #define dtime_included
00024
00025 #include <tqdatetime.h>
00026 #include <tqlineedit.h>
00027 #include <tqspinbox.h>
00028 #include <tqstring.h>
00029 #include <tqtimer.h>
00030 #include <tqvalidator.h>
00031 #include <tqwidget.h>
00032 #include <tqcheckbox.h>
00033
00034 #include <kdatepicker.h>
00035 #include <knuminput.h>
00036
00037 class Kclock;
00038
00039 class HMSTimeWidget : public KIntSpinBox
00040 {
00041 Q_OBJECT
00042 public:
00043 HMSTimeWidget(TQWidget *parent=0, const char *name=0);
00044 protected:
00045 TQString mapValueToText(int);
00046 };
00047
00048 class Dtime : public QWidget
00049 {
00050 Q_OBJECT
00051 public:
00052 Dtime( TQWidget *parent=0, const char* name=0 );
00053
00054 void save();
00055 void load();
00056
00057 TQString quickHelp() const;
00058
00059 signals:
00060 void timeChanged(bool);
00061
00062 private slots:
00063 void configChanged();
00064 void serverTimeCheck();
00065 void timeout();
00066 void set_time();
00067 void changeDate(TQDate);
00068
00069 private:
00070 void findNTPutility();
00071 QString ntpUtility;
00072
00073 TQWidget* privateLayoutWidget;
00074 QCheckBox *setDateTimeAuto;
00075 QComboBox *timeServerList;
00076
00077 KDatePicker *cal;
00078 QComboBox *month;
00079 QSpinBox *year;
00080
00081 HMSTimeWidget *hour;
00082 HMSTimeWidget *minute;
00083 HMSTimeWidget *second;
00084
00085 Kclock *kclock;
00086
00087 QTime time;
00088 QDate date;
00089 QTimer internalTimer;
00090
00091 QString BufS;
00092 int BufI;
00093 bool refresh;
00094 bool ontimeout;
00095 };
00096
00097 class Kclock : public QWidget
00098 {
00099 Q_OBJECT
00100
00101 public:
00102 Kclock( TQWidget *parent=0, const char *name=0 )
00103 : TQWidget(parent, name) {};
00104
00105 void setTime(const TQTime&);
00106
00107 protected:
00108 virtual void paintEvent( TQPaintEvent *event );
00109
00110
00111 private:
00112 QTime time;
00113 };
00114
00115 class KStrictIntValidator : public TQIntValidator
00116 {
00117 public:
00118 KStrictIntValidator(int bottom, int top, TQWidget * parent,
00119 const char * name = 0 )
00120 : TQIntValidator(bottom, top, parent, name) {};
00121
00122 TQValidator::State validate( TQString & input, int & d ) const;
00123 };
00124
00125 #endif // dtime_included