-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 77 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.h | 13 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.ui | 171 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.h | 10 |
5 files changed, 212 insertions, 86 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 87b20ec..4a7959e 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -3,7 +3,9 @@ | |||
3 | #include <qregexp.h> | 3 | #include <qregexp.h> |
4 | #include <qtable.h> | 4 | #include <qtable.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qsocket.h> | ||
6 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qspinbox.h> | ||
7 | #include <qmultilineedit.h> | 9 | #include <qmultilineedit.h> |
8 | #include <opie/oprocess.h> | 10 | #include <opie/oprocess.h> |
9 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
@@ -22,32 +24,35 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
22 | { | 24 | { |
23 | Config cfg("ntp",Config::User); | 25 | Config cfg("ntp",Config::User); |
24 | cfg.setGroup("settings"); | 26 | cfg.setGroup("settings"); |
25 | _maxOffset = cfg.readNumEntry("maxOffset",5); | 27 | // _maxOffset = cfg.readNumEntry("maxOffset",5); |
26 | _minLookupDiff = cfg.readNumEntry("minLookupDiff",10); | 28 | // _minLookupDiff = cfg.readNumEntry("minLookupDiff",10); |
27 | LineEditNtpServer->setText( cfg.readEntry("ntpServer") ); | 29 | SpinBoxMinDelay->setValue( cfg.readNumEntry("minLookupDiff",10) ); |
30 | SpinBoxMinDelay->setMinValue( 7 ); | ||
31 | LineEditNtpSrv->setText( cfg.readEntry("ntpServer", tr("time.fu-berlin.de")) ); | ||
28 | ntpProcess = new OProcess( ); | 32 | ntpProcess = new OProcess( ); |
33 | |||
34 | QSocket *ntpSock = new QSocket( this ); | ||
35 | ntpSock->connectToHost( LineEditNtpSrv->text() ,123); | ||
36 | connect( ntpSock, SIGNAL( error(int) ), | ||
37 | SLOT(slotCheckNtp(int)) ); | ||
38 | |||
29 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 39 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
30 | this, SLOT(getNtpOutput(OProcess*,char*,int))); | 40 | this, SLOT(getNtpOutput(OProcess*,char*,int))); |
31 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), | 41 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), |
32 | this, SLOT(ntpFinished(OProcess*))); | 42 | this, SLOT(ntpFinished(OProcess*))); |
33 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); | 43 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); |
34 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); | 44 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); |
35 | // _nextCorrection = new QTimer( this ); | 45 | |
36 | // connect( _nextCorrection, SIGNAL(timeout()), SLOT(correctClock()) ); | 46 | // slotRunNtp(); |
37 | slotRunNtp(); | ||
38 | readLookups(); | 47 | readLookups(); |
39 | } | 48 | } |
40 | 49 | ||
41 | Ntp::~Ntp() | 50 | Ntp::~Ntp() |
42 | { | 51 | { |
43 | |||
44 | } | ||
45 | |||
46 | void Ntp::accept() | ||
47 | { | ||
48 | Config cfg("ntp",Config::User); | 52 | Config cfg("ntp",Config::User); |
49 | cfg.setGroup("settings"); | 53 | cfg.setGroup("settings"); |
50 | cfg.writeEntry("ntpServer", LineEditNtpServer->text()); | 54 | cfg.writeEntry("ntpServer", LineEditNtpSrv->text()); |
55 | cfg.writeEntry( "minLookupDiff", SpinBoxMinDelay->value() ); | ||
51 | } | 56 | } |
52 | 57 | ||
53 | 58 | ||
@@ -55,7 +60,7 @@ void Ntp::slotRunNtp() | |||
55 | { | 60 | { |
56 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); | 61 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); |
57 | ntpProcess->clearArguments(); | 62 | ntpProcess->clearArguments(); |
58 | *ntpProcess << "ntpdate" << LineEditNtpServer->text(); | 63 | *ntpProcess << "ntpdate" << LineEditNtpSrv->text(); |
59 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | 64 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); |
60 | if ( !ret ) { | 65 | if ( !ret ) { |
61 | qDebug("Error while executing ntp"); | 66 | qDebug("Error while executing ntp"); |
@@ -69,7 +74,7 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | |||
69 | lineStr=lineStr.left(buflen); | 74 | lineStr=lineStr.left(buflen); |
70 | if (lineStr!=lineStrOld) | 75 | if (lineStr!=lineStrOld) |
71 | { | 76 | { |
72 | // outPut->append(lineStr); | 77 | MultiLineEditntpOutPut->append(lineStr); |
73 | _ntpOutput += lineStr; | 78 | _ntpOutput += lineStr; |
74 | } | 79 | } |
75 | lineStrOld = lineStr; | 80 | lineStrOld = lineStr; |
@@ -90,7 +95,7 @@ void Ntp::ntpFinished(OProcess*) | |||
90 | if (timeShift == 0.0) return; | 95 | if (timeShift == 0.0) return; |
91 | int secsSinceLast = time - lastLookup; | 96 | int secsSinceLast = time - lastLookup; |
92 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); | 97 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); |
93 | if ( lastLookup > 0 && secsSinceLast > 60*_minLookupDiff) | 98 | if ( lastLookup > 0 && secsSinceLast > 60*24* SpinBoxMinDelay->value()) |
94 | { | 99 | { |
95 | lookupCount++; | 100 | lookupCount++; |
96 | cfg.writeEntry("count",lookupCount); | 101 | cfg.writeEntry("count",lookupCount); |
@@ -151,12 +156,12 @@ void Ntp::readLookups() | |||
151 | qDebug("lookupCount = %i",lookupCount); | 156 | qDebug("lookupCount = %i",lookupCount); |
152 | TableLookups->setNumCols( 3 ); | 157 | TableLookups->setNumCols( 3 ); |
153 | TableLookups->setNumRows( lookupCount); | 158 | TableLookups->setNumRows( lookupCount); |
154 | TableLookups->horizontalHeader()->setLabel(2,"secsSinceLast"); | 159 | TableLookups->horizontalHeader()->setLabel(1,"secsSinceLast"); |
155 | TableLookups->horizontalHeader()->setLabel(1,"timeShift"); | 160 | TableLookups->horizontalHeader()->setLabel(2,"timeShift"); |
156 | TableLookups->horizontalHeader()->setLabel(0,"shift/s"); | 161 | TableLookups->horizontalHeader()->setLabel(0,"shift/s"); |
157 | int cw = TableLookups->width()/4; | 162 | int cw = 50;//TableLookups->width()/4; |
158 | qDebug("column width %i",cw); | 163 | qDebug("column width %i",cw); |
159 | TableLookups->setColumnWidth( 0, cw ); | 164 | TableLookups->setColumnWidth( 0, cw+30 ); |
160 | TableLookups->setColumnWidth( 1, cw ); | 165 | TableLookups->setColumnWidth( 1, cw ); |
161 | TableLookups->setColumnWidth( 2, cw ); | 166 | TableLookups->setColumnWidth( 2, cw ); |
162 | for (int i=0; i < lookupCount; i++) | 167 | for (int i=0; i < lookupCount; i++) |
@@ -164,13 +169,13 @@ void Ntp::readLookups() | |||
164 | cfg.setGroup("lookup_"+QString::number(i)); | 169 | cfg.setGroup("lookup_"+QString::number(i)); |
165 | last = cfg.readEntry("secsSinceLast",0).toFloat(); | 170 | last = cfg.readEntry("secsSinceLast",0).toFloat(); |
166 | shift = QString(cfg.readEntry("timeShift",0)).toFloat(); | 171 | shift = QString(cfg.readEntry("timeShift",0)).toFloat(); |
167 | qDebug("%i last %f",i,last); | 172 | // qDebug("%i last %f",i,last); |
168 | qDebug("%i shift %f",i,shift); | 173 | // qDebug("%i shift %f",i,shift); |
169 | shiftPerSec = shift / last; | 174 | shiftPerSec = shift / last; |
170 | _shiftPerSec += shiftPerSec; | 175 | _shiftPerSec += shiftPerSec; |
171 | TableLookups->setText( i,0,QString::number(shiftPerSec)); | 176 | TableLookups->setText( i,0,QString::number(shiftPerSec)); |
172 | TableLookups->setText( i,1,QString::number(shift)); | 177 | TableLookups->setText( i,2,QString::number(shift)); |
173 | TableLookups->setText( i,2,QString::number(last)); | 178 | TableLookups->setText( i,1,QString::number(last)); |
174 | } | 179 | } |
175 | _shiftPerSec /= lookupCount+1; | 180 | _shiftPerSec /= lookupCount+1; |
176 | TextLabelShift->setText(QString::number(_shiftPerSec)); | 181 | TextLabelShift->setText(QString::number(_shiftPerSec)); |
@@ -185,7 +190,27 @@ void Ntp::preditctTime() | |||
185 | setenv( "TZ", tz->currentZone(), 1 ); | 190 | setenv( "TZ", tz->currentZone(), 1 ); |
186 | int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); | 191 | int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); |
187 | int corr = int((now - lastTime) * _shiftPerSec); | 192 | int corr = int((now - lastTime) * _shiftPerSec); |
188 | QDateTime dt = QDateTime::currentDateTime().addSecs(corr); | 193 | predictedTime = QDateTime::currentDateTime().addSecs(corr); |
189 | setTime(dt); | 194 | TextLabelPredTime->setText(predictedTime.toString()); |
190 | TextLabelPredTime->setText(dt.toString()); | 195 | TextLabelMainPredTime->setText(predictedTime.toString()); |
196 | } | ||
197 | |||
198 | void Ntp::setPredictTime() | ||
199 | { | ||
200 | preditctTime(); | ||
201 | setTime( predictedTime ); | ||
202 | } | ||
203 | |||
204 | void Ntp::slotCheckNtp(int i) | ||
205 | { | ||
206 | if (i == 0) | ||
207 | { | ||
208 | TextLabelMainPredTime->hide(); | ||
209 | ButtonSetTime->setText( tr("Get time from network") ); | ||
210 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotRunNtp()) ); | ||
211 | }else{ | ||
212 | preditctTime(); | ||
213 | ButtonSetTime->setText( tr("Predict time") ); | ||
214 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); | ||
215 | }; | ||
191 | } | 216 | } |
diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h index d2e238d..284ae27 100644 --- a/noncore/settings/netsystemtime/ntp.h +++ b/noncore/settings/netsystemtime/ntp.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define NTP_H | 2 | #define NTP_H |
3 | #include "settime.h" | 3 | #include "settime.h" |
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | #include <qtimer.h> | ||
6 | 5 | ||
7 | class OProcess; | 6 | class OProcess; |
8 | class QString; | 7 | class QString; |
@@ -16,17 +15,14 @@ public: | |||
16 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 15 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
17 | ~Ntp(); | 16 | ~Ntp(); |
18 | 17 | ||
19 | OProcess *ntpProcess; | ||
20 | |||
21 | protected: | 18 | protected: |
22 | virtual void accept(); | 19 | QDateTime predictedTime; |
20 | |||
23 | 21 | ||
24 | private: | 22 | private: |
25 | QString _ntpOutput; | 23 | QString _ntpOutput; |
26 | int _maxOffset; | ||
27 | float _shiftPerSec; | 24 | float _shiftPerSec; |
28 | // QTimer *_nextCorrection; | 25 | OProcess *ntpProcess; |
29 | int _minLookupDiff; | ||
30 | 26 | ||
31 | float getTimeShift(); | 27 | float getTimeShift(); |
32 | void readLookups(); | 28 | void readLookups(); |
@@ -34,8 +30,9 @@ private slots: | |||
34 | void slotRunNtp(); | 30 | void slotRunNtp(); |
35 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); | 31 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); |
36 | void ntpFinished(OProcess*); | 32 | void ntpFinished(OProcess*); |
37 | // void correctClock(); | ||
38 | void preditctTime(); | 33 | void preditctTime(); |
34 | void slotCheckNtp(int); | ||
35 | void setPredictTime(); | ||
39 | }; | 36 | }; |
40 | 37 | ||
41 | #endif | 38 | #endif |
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui index ccae5bf..e444065 100644 --- a/noncore/settings/netsystemtime/ntpbase.ui +++ b/noncore/settings/netsystemtime/ntpbase.ui | |||
@@ -1,7 +1,7 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NtpBase</class> | 2 | <class>NtpBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NtpBase</cstring> | 7 | <cstring>NtpBase</cstring> |
@@ -11,7 +11,7 @@ | |||
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>280</width> | 14 | <width>276</width> |
15 | <height>337</height> | 15 | <height>337</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
@@ -247,39 +247,15 @@ | |||
247 | </vbox> | 247 | </vbox> |
248 | </widget> | 248 | </widget> |
249 | <widget row="1" column="0" > | 249 | <widget row="1" column="0" > |
250 | <class>QLayoutWidget</class> | 250 | <class>QMultiLineEdit</class> |
251 | <property stdset="1"> | 251 | <property stdset="1"> |
252 | <name>name</name> | 252 | <name>name</name> |
253 | <cstring>Layout6</cstring> | 253 | <cstring>MultiLineEditntpOutPut</cstring> |
254 | </property> | ||
255 | <property stdset="1"> | ||
256 | <name>wordWrap</name> | ||
257 | <enum>WidgetWidth</enum> | ||
254 | </property> | 258 | </property> |
255 | <hbox> | ||
256 | <property stdset="1"> | ||
257 | <name>margin</name> | ||
258 | <number>0</number> | ||
259 | </property> | ||
260 | <property stdset="1"> | ||
261 | <name>spacing</name> | ||
262 | <number>6</number> | ||
263 | </property> | ||
264 | <widget> | ||
265 | <class>QLabel</class> | ||
266 | <property stdset="1"> | ||
267 | <name>name</name> | ||
268 | <cstring>TextLabel7</cstring> | ||
269 | </property> | ||
270 | <property stdset="1"> | ||
271 | <name>text</name> | ||
272 | <string>NTP Server:</string> | ||
273 | </property> | ||
274 | </widget> | ||
275 | <widget> | ||
276 | <class>QLineEdit</class> | ||
277 | <property stdset="1"> | ||
278 | <name>name</name> | ||
279 | <cstring>LineEditNtpServer</cstring> | ||
280 | </property> | ||
281 | </widget> | ||
282 | </hbox> | ||
283 | </widget> | 259 | </widget> |
284 | </grid> | 260 | </grid> |
285 | </widget> | 261 | </widget> |
@@ -293,7 +269,7 @@ | |||
293 | </property> | 269 | </property> |
294 | <attribute> | 270 | <attribute> |
295 | <name>title</name> | 271 | <name>title</name> |
296 | <string>Auto</string> | 272 | <string>Predict</string> |
297 | </attribute> | 273 | </attribute> |
298 | <grid> | 274 | <grid> |
299 | <property stdset="1"> | 275 | <property stdset="1"> |
@@ -426,6 +402,135 @@ | |||
426 | <name>frameShadow</name> | 402 | <name>frameShadow</name> |
427 | <enum>Raised</enum> | 403 | <enum>Raised</enum> |
428 | </property> | 404 | </property> |
405 | <grid> | ||
406 | <property stdset="1"> | ||
407 | <name>margin</name> | ||
408 | <number>11</number> | ||
409 | </property> | ||
410 | <property stdset="1"> | ||
411 | <name>spacing</name> | ||
412 | <number>6</number> | ||
413 | </property> | ||
414 | <widget row="0" column="0" > | ||
415 | <class>QLayoutWidget</class> | ||
416 | <property stdset="1"> | ||
417 | <name>name</name> | ||
418 | <cstring>Layout6</cstring> | ||
419 | </property> | ||
420 | <grid> | ||
421 | <property stdset="1"> | ||
422 | <name>margin</name> | ||
423 | <number>0</number> | ||
424 | </property> | ||
425 | <property stdset="1"> | ||
426 | <name>spacing</name> | ||
427 | <number>6</number> | ||
428 | </property> | ||
429 | <spacer row="2" column="0" > | ||
430 | <property> | ||
431 | <name>name</name> | ||
432 | <cstring>Spacer2</cstring> | ||
433 | </property> | ||
434 | <property stdset="1"> | ||
435 | <name>orientation</name> | ||
436 | <enum>Vertical</enum> | ||
437 | </property> | ||
438 | <property stdset="1"> | ||
439 | <name>sizeType</name> | ||
440 | <enum>Expanding</enum> | ||
441 | </property> | ||
442 | <property> | ||
443 | <name>sizeHint</name> | ||
444 | <size> | ||
445 | <width>20</width> | ||
446 | <height>20</height> | ||
447 | </size> | ||
448 | </property> | ||
449 | </spacer> | ||
450 | <widget row="1" column="0" > | ||
451 | <class>QLayoutWidget</class> | ||
452 | <property stdset="1"> | ||
453 | <name>name</name> | ||
454 | <cstring>Layout6</cstring> | ||
455 | </property> | ||
456 | <hbox> | ||
457 | <property stdset="1"> | ||
458 | <name>margin</name> | ||
459 | <number>0</number> | ||
460 | </property> | ||
461 | <property stdset="1"> | ||
462 | <name>spacing</name> | ||
463 | <number>6</number> | ||
464 | </property> | ||
465 | <widget> | ||
466 | <class>QLabel</class> | ||
467 | <property stdset="1"> | ||
468 | <name>name</name> | ||
469 | <cstring>TextLabel7_2</cstring> | ||
470 | </property> | ||
471 | <property stdset="1"> | ||
472 | <name>text</name> | ||
473 | <string>NTP Server:</string> | ||
474 | </property> | ||
475 | </widget> | ||
476 | <widget> | ||
477 | <class>QLineEdit</class> | ||
478 | <property stdset="1"> | ||
479 | <name>name</name> | ||
480 | <cstring>LineEditNtpSrv</cstring> | ||
481 | </property> | ||
482 | </widget> | ||
483 | </hbox> | ||
484 | </widget> | ||
485 | <widget row="0" column="0" > | ||
486 | <class>QLayoutWidget</class> | ||
487 | <property stdset="1"> | ||
488 | <name>name</name> | ||
489 | <cstring>Layout5</cstring> | ||
490 | </property> | ||
491 | <hbox> | ||
492 | <property stdset="1"> | ||
493 | <name>margin</name> | ||
494 | <number>0</number> | ||
495 | </property> | ||
496 | <property stdset="1"> | ||
497 | <name>spacing</name> | ||
498 | <number>6</number> | ||
499 | </property> | ||
500 | <widget> | ||
501 | <class>QLabel</class> | ||
502 | <property stdset="1"> | ||
503 | <name>name</name> | ||
504 | <cstring>TextLabel1_2</cstring> | ||
505 | </property> | ||
506 | <property stdset="1"> | ||
507 | <name>text</name> | ||
508 | <string>Min. delay:</string> | ||
509 | </property> | ||
510 | </widget> | ||
511 | <widget> | ||
512 | <class>QSpinBox</class> | ||
513 | <property stdset="1"> | ||
514 | <name>name</name> | ||
515 | <cstring>SpinBoxMinDelay</cstring> | ||
516 | </property> | ||
517 | </widget> | ||
518 | <widget> | ||
519 | <class>QLabel</class> | ||
520 | <property stdset="1"> | ||
521 | <name>name</name> | ||
522 | <cstring>TextLabel2</cstring> | ||
523 | </property> | ||
524 | <property stdset="1"> | ||
525 | <name>text</name> | ||
526 | <string>minutes</string> | ||
527 | </property> | ||
528 | </widget> | ||
529 | </hbox> | ||
530 | </widget> | ||
531 | </grid> | ||
532 | </widget> | ||
533 | </grid> | ||
429 | </widget> | 534 | </widget> |
430 | </grid> | 535 | </grid> |
431 | </widget> | 536 | </widget> |
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp index 01268c9..2cef6e8 100644 --- a/noncore/settings/netsystemtime/settime.cpp +++ b/noncore/settings/netsystemtime/settime.cpp | |||
@@ -60,6 +60,15 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | |||
60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); | 60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); |
61 | QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 ); | 61 | QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 ); |
62 | 62 | ||
63 | TextLabelMainPredTime = new QLabel( FrameSystemTime ); | ||
64 | vb->addWidget( TextLabelMainPredTime, 1, 0 ); | ||
65 | ButtonSetTime = new QPushButton( FrameSystemTime ); | ||
66 | vb->addWidget( ButtonSetTime, 1, 0 ); | ||
67 | |||
68 | QFrame *hline = new QFrame( FrameSystemTime ); | ||
69 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
70 | vb->addWidget( hline ); | ||
71 | |||
63 | QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); | 72 | QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); |
64 | 73 | ||
65 | QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" ); | 74 | QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" ); |
@@ -82,7 +91,7 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | |||
82 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 91 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
83 | vb2->addItem( spacer ); | 92 | vb2->addItem( spacer ); |
84 | 93 | ||
85 | QFrame *hline = new QFrame( FrameSystemTime ); | 94 | hline = new QFrame( FrameSystemTime ); |
86 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 95 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
87 | vb->addWidget( hline ); | 96 | vb->addWidget( hline ); |
88 | 97 | ||
@@ -92,7 +101,6 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | |||
92 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); | 101 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); |
93 | 102 | ||
94 | QLabel *l = new QLabel( tr("Time format"), FrameSystemTime ); | 103 | QLabel *l = new QLabel( tr("Time format"), FrameSystemTime ); |
95 | // l->setAlignment( AlignRight | AlignVCenter ); | ||
96 | hb1->addWidget( l, 1 ); | 104 | hb1->addWidget( l, 1 ); |
97 | 105 | ||
98 | 106 | ||
@@ -177,16 +185,16 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | |||
177 | 185 | ||
178 | vb->addStretch( 0 ); | 186 | vb->addStretch( 0 ); |
179 | 187 | ||
188 | QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), | ||
189 | this, SLOT(commitTime())); | ||
190 | |||
180 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 191 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
181 | timeButton, SLOT( slotTzChange( const QString& ) ) ); | 192 | timeButton, SLOT( slotTzChange( const QString& ) ) ); |
182 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 193 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
183 | SLOT( tzChange( const QString& ) ) ); | 194 | SLOT( tzChange( const QString& ) ) ); |
184 | QObject::connect( PushButtonSetManualTime, SLOT(clicked()), | ||
185 | SLOT(commitTime())); | ||
186 | // dl = new QPEDialogListener(this); | ||
187 | } | 195 | } |
188 | 196 | ||
189 | void SetDateTime::accept() | 197 | SetDateTime::~SetDateTime() |
190 | { | 198 | { |
191 | 199 | ||
192 | Config config("qpe"); | 200 | Config config("qpe"); |
@@ -264,13 +272,6 @@ void SetDateTime::setTime(QDateTime dt) | |||
264 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 272 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
265 | enableScreenSaver << -1 << -1 << -1; | 273 | enableScreenSaver << -1 << -1 << -1; |
266 | 274 | ||
267 | // QDialog::accept(); | ||
268 | } | ||
269 | |||
270 | void SetDateTime::done(int r) | ||
271 | { | ||
272 | // QDialog::done(r); | ||
273 | close(); | ||
274 | } | 275 | } |
275 | 276 | ||
276 | void SetDateTime::tzChange( const QString &tz ) | 277 | void SetDateTime::tzChange( const QString &tz ) |
diff --git a/noncore/settings/netsystemtime/settime.h b/noncore/settings/netsystemtime/settime.h index 729bf4b..60423e7 100644 --- a/noncore/settings/netsystemtime/settime.h +++ b/noncore/settings/netsystemtime/settime.h | |||
@@ -33,7 +33,6 @@ class QLabel; | |||
33 | class TimeZoneSelector; | 33 | class TimeZoneSelector; |
34 | class DateBookMonth; | 34 | class DateBookMonth; |
35 | class QComboBox; | 35 | class QComboBox; |
36 | //class QPEDialogListener; | ||
37 | 36 | ||
38 | class SetTime : public QWidget | 37 | class SetTime : public QWidget |
39 | { | 38 | { |
@@ -69,16 +68,15 @@ class SetDateTime : public NtpBase | |||
69 | Q_OBJECT | 68 | Q_OBJECT |
70 | public: | 69 | public: |
71 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); | 70 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); |
71 | ~SetDateTime(); | ||
72 | 72 | ||
73 | protected slots: | 73 | protected slots: |
74 | void commitTime(); | ||
74 | void tzChange( const QString &tz ); | 75 | void tzChange( const QString &tz ); |
75 | void formatChanged(int); | 76 | void formatChanged(int); |
76 | 77 | ||
77 | protected: | 78 | protected: |
78 | void commitTime(); | ||
79 | void setTime(QDateTime dt); | 79 | void setTime(QDateTime dt); |
80 | virtual void accept(); | ||
81 | virtual void done(int); | ||
82 | 80 | ||
83 | SetTime *timeButton; | 81 | SetTime *timeButton; |
84 | DateButton *dateButton; | 82 | DateButton *dateButton; |
@@ -87,8 +85,8 @@ protected: | |||
87 | QComboBox *ampmCombo; | 85 | QComboBox *ampmCombo; |
88 | QComboBox *dateFormatCombo; | 86 | QComboBox *dateFormatCombo; |
89 | QComboBox *clockAppletCombo; | 87 | QComboBox *clockAppletCombo; |
90 | 88 | QPushButton *ButtonSetTime; | |
91 | // QPEDialogListener *dl; | 89 | QLabel *TextLabelMainPredTime; |
92 | 90 | ||
93 | DateFormat date_formats[4]; | 91 | DateFormat date_formats[4]; |
94 | }; | 92 | }; |