summaryrefslogtreecommitdiff
authortille <tille>2002-06-26 12:45:03 (UTC)
committer tille <tille>2002-06-26 12:45:03 (UTC)
commit541bbcbb89a9e6a054fb545a82739c0bcf7804fe (patch) (unidiff)
treee2d4278a88226849cc5d46d5f69502499dc94efc
parent4b0e72bed1ead4e3c7af2209a11f34aa9209653c (diff)
downloadopie-541bbcbb89a9e6a054fb545a82739c0bcf7804fe.zip
opie-541bbcbb89a9e6a054fb545a82739c0bcf7804fe.tar.gz
opie-541bbcbb89a9e6a054fb545a82739c0bcf7804fe.tar.bz2
settings...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp60
-rw-r--r--noncore/settings/netsystemtime/ntpbase.ui327
-rw-r--r--noncore/settings/netsystemtime/settime.cpp12
3 files changed, 266 insertions, 133 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index b2f192a..52fc6be 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -8,2 +8,3 @@
8#include <qspinbox.h> 8#include <qspinbox.h>
9#include <qmessagebox.h>
9#include <qmultilineedit.h> 10#include <qmultilineedit.h>
@@ -28,4 +29,4 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
28// _minLookupDiff = cfg.readNumEntry("minLookupDiff",10); 29// _minLookupDiff = cfg.readNumEntry("minLookupDiff",10);
29 SpinBoxMinDelay->setValue( cfg.readNumEntry("minLookupDiff",10) ); 30 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",60) );
30 SpinBoxMinDelay->setMinValue( 7 ); 31 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",60) );
31 LineEditNtpSrv->setText( cfg.readEntry("ntpServer", tr("time.fu-berlin.de")) ); 32 LineEditNtpSrv->setText( cfg.readEntry("ntpServer", tr("time.fu-berlin.de")) );
@@ -54,3 +55,4 @@ Ntp::~Ntp()
54 cfg.writeEntry("ntpServer", LineEditNtpSrv->text()); 55 cfg.writeEntry("ntpServer", LineEditNtpSrv->text());
55 cfg.writeEntry( "minLookupDiff", SpinBoxMinDelay->value() ); 56 cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() );
57 cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() );
56} 58}
@@ -60,2 +62,20 @@ void Ntp::slotRunNtp()
60{ 62{
63 Config cfg("ntp",Config::User);
64 cfg.setGroup("lookups");
65 int lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0);
66
67 if ( lookupDiff < SpinBoxNtpDelay->value()*60 )
68 {
69 switch (
70 QMessageBox::warning(this, tr("Run ntp?"),
71 tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+
72 QString::number(lookupDiff%60)+tr(" minutes elapsed since last loopup.")+
73 "<br>"+tr("Rerun ntp?"),
74 QMessageBox::Ok,QMessageBox::Cancel)
75 ) {
76 case QMessageBox::Ok: break;
77 case QMessageBox::Cancel: return;
78 default: return;
79 }
80 }
61 TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); 81 TextLabelStartTime->setText(QDateTime::currentDateTime().toString());
@@ -97,3 +117,4 @@ void Ntp::ntpFinished(OProcess*)
97 TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); 117 TextLabelNewTime->setText(QDateTime::currentDateTime().toString());
98 if ( lastLookup > 0 && secsSinceLast > 60*24* SpinBoxMinDelay->value()) 118 TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds"));
119 if ( lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value())
99 { 120 {
@@ -110,24 +131,2 @@ void Ntp::ntpFinished(OProcess*)
110 131
111//void Ntp::correctClock()
112//{
113 //qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1());
114 //Config cfg("ntp",Config::User);
115// cfg.setGroup("correction");
116 // int lastTime = cfg.readNumEntry("time",0);
117// if ( lastTime == 0 )
118// {
119 // return;
120// }
121// int now = TimeConversion::toUTC( QDateTime::currentDateTime() );
122// int corr = int((now - lastTime) * _shiftPerSec);
123// struct timeval myTv;
124// myTv.tv_sec = TimeConversion::toUTC( QDateTime::currentDateTime().addSecs(corr) );
125// myTv.tv_usec = 0;
126//
127// if ( myTv.tv_sec != -1 )
128// ::settimeofday( &myTv, 0 );
129// Global::writeHWClock();
130// cfg.writeEntry("time",now);
131 //qDebug("current time: %s",QDateTime::currentDateTime().toString().latin1());
132//}
133 132
@@ -145,3 +144,2 @@ float Ntp::getTimeShift()
145 qDebug("diff = >%s<",diff.latin1()); 144 qDebug("diff = >%s<",diff.latin1());
146 TextLabelTimeShift->setText(diff);
147 return diff.toFloat(); 145 return diff.toFloat();
@@ -166,2 +164,4 @@ void Ntp::readLookups()
166 TableLookups->setColumnWidth( 2, cw ); 164 TableLookups->setColumnWidth( 2, cw );
165 TableLookups->sortColumn(0, false, true );
166 // TableLookups->setSorting( true );
167 for (int i=0; i < lookupCount; i++) 167 for (int i=0; i < lookupCount; i++)
@@ -180,3 +180,3 @@ void Ntp::readLookups()
180 _shiftPerSec /= lookupCount+1; 180 _shiftPerSec /= lookupCount+1;
181 TextLabelShift->setText(QString::number(_shiftPerSec)); 181 TextLabelShift->setText(QString::number(_shiftPerSec)+tr(" seconds"));
182} 182}
@@ -194,3 +194,3 @@ void Ntp::preditctTime()
194 TextLabelPredTime->setText(predictedTime.toString()); 194 TextLabelPredTime->setText(predictedTime.toString());
195 TextLabelMainPredTime->setText(predictedTime.toString()); 195 TextLabelMainPredTime->setText(tr("Predicted time:")+"<br><b>"+predictedTime.toString()+"</b>");
196} 196}
@@ -212,3 +212,3 @@ void Ntp::slotCheckNtp(int i)
212 preditctTime(); 212 preditctTime();
213 ButtonSetTime->setText( tr("Predict time") ); 213 ButtonSetTime->setText( tr("Set predicted time") );
214 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); 214 connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) );
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui
index e444065..8d32849 100644
--- a/noncore/settings/netsystemtime/ntpbase.ui
+++ b/noncore/settings/netsystemtime/ntpbase.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>276</width> 14 <width>330</width>
15 <height>337</height> 15 <height>419</height>
16 </rect> 16 </rect>
@@ -34,3 +34,3 @@
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>1</number> 35 <number>2</number>
36 </property> 36 </property>
@@ -61,3 +61,3 @@
61 <name>margin</name> 61 <name>margin</name>
62 <number>3</number> 62 <number>2</number>
63 </property> 63 </property>
@@ -65,3 +65,3 @@
65 <name>spacing</name> 65 <name>spacing</name>
66 <number>3</number> 66 <number>2</number>
67 </property> 67 </property>
@@ -97,3 +97,3 @@
97 <name>margin</name> 97 <name>margin</name>
98 <number>3</number> 98 <number>1</number>
99 </property> 99 </property>
@@ -101,3 +101,3 @@
101 <name>spacing</name> 101 <name>spacing</name>
102 <number>3</number> 102 <number>2</number>
103 </property> 103 </property>
@@ -131,2 +131,5 @@
131 </property> 131 </property>
132 <property>
133 <name>layoutSpacing</name>
134 </property>
132 <grid> 135 <grid>
@@ -134,3 +137,3 @@
134 <name>margin</name> 137 <name>margin</name>
135 <number>11</number> 138 <number>2</number>
136 </property> 139 </property>
@@ -138,3 +141,3 @@
138 <name>spacing</name> 141 <name>spacing</name>
139 <number>6</number> 142 <number>2</number>
140 </property> 143 </property>
@@ -255,2 +258,8 @@
255 <property stdset="1"> 258 <property stdset="1">
259 <name>font</name>
260 <font>
261 <pointsize>7</pointsize>
262 </font>
263 </property>
264 <property stdset="1">
256 <name>wordWrap</name> 265 <name>wordWrap</name>
@@ -258,2 +267,6 @@
258 </property> 267 </property>
268 <property stdset="1">
269 <name>text</name>
270 <string></string>
271 </property>
259 </widget> 272 </widget>
@@ -384,3 +397,3 @@
384 <name>margin</name> 397 <name>margin</name>
385 <number>3</number> 398 <number>2</number>
386 </property> 399 </property>
@@ -388,3 +401,3 @@
388 <name>spacing</name> 401 <name>spacing</name>
389 <number>3</number> 402 <number>2</number>
390 </property> 403 </property>
@@ -404,2 +417,8 @@
404 </property> 417 </property>
418 <property>
419 <name>layoutMargin</name>
420 </property>
421 <property>
422 <name>layoutSpacing</name>
423 </property>
405 <grid> 424 <grid>
@@ -407,3 +426,3 @@
407 <name>margin</name> 426 <name>margin</name>
408 <number>11</number> 427 <number>3</number>
409 </property> 428 </property>
@@ -411,3 +430,3 @@
411 <name>spacing</name> 430 <name>spacing</name>
412 <number>6</number> 431 <number>11</number>
413 </property> 432 </property>
@@ -428,103 +447,213 @@
428 </property> 447 </property>
429 <spacer row="2" column="0" > 448 <widget row="0" column="0" >
449 <class>QLabel</class>
450 <property stdset="1">
451 <name>name</name>
452 <cstring>TextLabel7_2</cstring>
453 </property>
454 <property stdset="1">
455 <name>text</name>
456 <string>Use</string>
457 </property>
458 </widget>
459 <widget row="0" column="2" >
460 <class>QLabel</class>
461 <property stdset="1">
462 <name>name</name>
463 <cstring>TextLabel2_2</cstring>
464 </property>
465 <property stdset="1">
466 <name>text</name>
467 <string>as</string>
468 </property>
469 </widget>
470 <widget row="1" column="0" rowspan="1" colspan="2" >
471 <class>QLabel</class>
472 <property stdset="1">
473 <name>name</name>
474 <cstring>TextLabel1_3</cstring>
475 </property>
476 <property stdset="1">
477 <name>text</name>
478 <string>NTP server to get the time from the network.</string>
479 </property>
480 <property stdset="1">
481 <name>alignment</name>
482 <set>WordBreak|AlignVCenter|AlignLeft</set>
483 </property>
430 <property> 484 <property>
485 <name>wordwrap</name>
486 </property>
487 </widget>
488 <widget row="0" column="1" >
489 <class>QLineEdit</class>
490 <property stdset="1">
431 <name>name</name> 491 <name>name</name>
432 <cstring>Spacer2</cstring> 492 <cstring>LineEditNtpSrv</cstring>
433 </property> 493 </property>
494 </widget>
495 </grid>
496 </widget>
497 <spacer row="3" column="0" >
498 <property>
499 <name>name</name>
500 <cstring>Spacer2</cstring>
501 </property>
502 <property stdset="1">
503 <name>orientation</name>
504 <enum>Vertical</enum>
505 </property>
506 <property stdset="1">
507 <name>sizeType</name>
508 <enum>Expanding</enum>
509 </property>
510 <property>
511 <name>sizeHint</name>
512 <size>
513 <width>20</width>
514 <height>20</height>
515 </size>
516 </property>
517 </spacer>
518 <widget row="2" column="0" >
519 <class>QLayoutWidget</class>
520 <property stdset="1">
521 <name>name</name>
522 <cstring>Layout7</cstring>
523 </property>
524 <grid>
525 <property stdset="1">
526 <name>margin</name>
527 <number>0</number>
528 </property>
529 <property stdset="1">
530 <name>spacing</name>
531 <number>6</number>
532 </property>
533 <widget row="0" column="0" >
534 <class>QLabel</class>
434 <property stdset="1"> 535 <property stdset="1">
435 <name>orientation</name> 536 <name>name</name>
436 <enum>Vertical</enum> 537 <cstring>TextLabel1_2</cstring>
437 </property> 538 </property>
438 <property stdset="1"> 539 <property stdset="1">
439 <name>sizeType</name> 540 <name>text</name>
440 <enum>Expanding</enum> 541 <string>Insure a delay of</string>
542 </property>
543 </widget>
544 <widget row="0" column="2" >
545 <class>QLabel</class>
546 <property stdset="1">
547 <name>name</name>
548 <cstring>TextLabel2</cstring>
549 </property>
550 <property stdset="1">
551 <name>text</name>
552 <string>minutes until</string>
553 </property>
554 </widget>
555 <widget row="1" column="0" rowspan="1" colspan="3" >
556 <class>QLabel</class>
557 <property stdset="1">
558 <name>name</name>
559 <cstring>TextLabel3_3</cstring>
560 </property>
561 <property stdset="1">
562 <name>text</name>
563 <string>a new NTP lookup will be used to predict the time.</string>
564 </property>
565 <property stdset="1">
566 <name>alignment</name>
567 <set>WordBreak|AlignVCenter|AlignLeft</set>
441 </property> 568 </property>
442 <property> 569 <property>
443 <name>sizeHint</name> 570 <name>wordwrap</name>
444 <size>
445 <width>20</width>
446 <height>20</height>
447 </size>
448 </property> 571 </property>
449 </spacer> 572 </widget>
450 <widget row="1" column="0" > 573 <widget row="0" column="1" >
451 <class>QLayoutWidget</class> 574 <class>QSpinBox</class>
452 <property stdset="1"> 575 <property stdset="1">
453 <name>name</name> 576 <name>name</name>
454 <cstring>Layout6</cstring> 577 <cstring>SpinBoxMinLookupDelay</cstring>
455 </property> 578 </property>
456 <hbox> 579 <property stdset="1">
457 <property stdset="1"> 580 <name>maxValue</name>
458 <name>margin</name> 581 <number>9999999</number>
459 <number>0</number> 582 </property>
460 </property> 583 <property stdset="1">
461 <property stdset="1"> 584 <name>minValue</name>
462 <name>spacing</name> 585 <number>42</number>
463 <number>6</number> 586 </property>
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> 587 </widget>
588 </grid>
589 </widget>
590 <widget row="1" column="0" >
591 <class>QLayoutWidget</class>
592 <property stdset="1">
593 <name>name</name>
594 <cstring>Layout7_2</cstring>
595 </property>
596 <grid>
597 <property stdset="1">
598 <name>margin</name>
599 <number>0</number>
600 </property>
601 <property stdset="1">
602 <name>spacing</name>
603 <number>6</number>
604 </property>
485 <widget row="0" column="0" > 605 <widget row="0" column="0" >
486 <class>QLayoutWidget</class> 606 <class>QLabel</class>
607 <property stdset="1">
608 <name>name</name>
609 <cstring>TextLabel1_2_2</cstring>
610 </property>
611 <property stdset="1">
612 <name>text</name>
613 <string>Wait for</string>
614 </property>
615 </widget>
616 <widget row="0" column="2" >
617 <class>QLabel</class>
618 <property stdset="1">
619 <name>name</name>
620 <cstring>TextLabel2_3</cstring>
621 </property>
622 <property stdset="1">
623 <name>text</name>
624 <string>minutes until</string>
625 </property>
626 </widget>
627 <widget row="1" column="0" rowspan="1" colspan="3" >
628 <class>QLabel</class>
629 <property stdset="1">
630 <name>name</name>
631 <cstring>TextLabel3_3_2</cstring>
632 </property>
633 <property stdset="1">
634 <name>text</name>
635 <string>NTP syncronises the clock with the network</string>
636 </property>
637 <property stdset="1">
638 <name>alignment</name>
639 <set>WordBreak|AlignVCenter|AlignLeft</set>
640 </property>
641 <property>
642 <name>wordwrap</name>
643 </property>
644 </widget>
645 <widget row="0" column="1" >
646 <class>QSpinBox</class>
487 <property stdset="1"> 647 <property stdset="1">
488 <name>name</name> 648 <name>name</name>
489 <cstring>Layout5</cstring> 649 <cstring>SpinBoxNtpDelay</cstring>
490 </property> 650 </property>
491 <hbox> 651 <property stdset="1">
492 <property stdset="1"> 652 <name>maxValue</name>
493 <name>margin</name> 653 <number>9999999</number>
494 <number>0</number> 654 </property>
495 </property> 655 <property stdset="1">
496 <property stdset="1"> 656 <name>minValue</name>
497 <name>spacing</name> 657 <number>0</number>
498 <number>6</number> 658 </property>
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> 659 </widget>
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index b456012..2398c08 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -263,2 +263,6 @@ void SetDateTime::setTime(QDateTime dt)
263 Global::writeHWClock(); 263 Global::writeHWClock();
264 // since time has changed quickly load in the datebookdb
265 // to allow the alarm server to get a better grip on itself
266 // (example re-trigger alarms for when we travel back in time)
267 DateBookDB db;
264} 268}
@@ -269,6 +273,2 @@ void SetDateTime::updateSystem(int i)
269 writeSettings(); 273 writeSettings();
270 // since time has changed quickly load in the datebookdb
271 // to allow the alarm server to get a better grip on itself
272 // (example re-trigger alarms for when we travel back in time)
273 // DateBookDB db;
274 274
@@ -293,2 +293,6 @@ void SetDateTime::updateSystem(int i)
293 enableScreenSaver << -1 << -1 << -1; 293 enableScreenSaver << -1 << -1 << -1;
294 // since time has changed quickly load in the datebookdb
295 // to allow the alarm server to get a better grip on itself
296 // (example re-trigger alarms for when we travel back in time)
297 DateBookDB db;
294 298