author | tille <tille> | 2002-10-21 20:32:05 (UTC) |
---|---|---|
committer | tille <tille> | 2002-10-21 20:32:05 (UTC) |
commit | 1f4ab9228e9e7db275e42a3e7fcf9affdd5c447b (patch) (unidiff) | |
tree | f33d988d7fb7b65637abc563cfae8b76a293ef14 /noncore/settings/netsystemtime/ntp.cpp | |
parent | 9d1a8e414d0c532266297a253e37afe19fa84ccf (diff) | |
download | opie-1f4ab9228e9e7db275e42a3e7fcf9affdd5c447b.zip opie-1f4ab9228e9e7db275e42a3e7fcf9affdd5c447b.tar.gz opie-1f4ab9228e9e7db275e42a3e7fcf9affdd5c447b.tar.bz2 |
now it has adv features
and ntpbase.ui is back since it might be usefull
Diffstat (limited to 'noncore/settings/netsystemtime/ntp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index fbd65a2..6f6316c 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -7,6 +7,9 @@ | |||
7 | #include <qsocket.h> | 7 | #include <qsocket.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qspinbox.h> | 9 | #include <qspinbox.h> |
10 | #include <qcheckbox.h> | ||
11 | #include <qtabwidget.h> | ||
12 | #include <qlayout.h> | ||
10 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
11 | #include <qmultilineedit.h> | 14 | #include <qmultilineedit.h> |
12 | #include <opie/oprocess.h> | 15 | #include <opie/oprocess.h> |
@@ -39,10 +42,16 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
39 | 42 | ||
40 | Config cfg("ntp",Config::User); | 43 | Config cfg("ntp",Config::User); |
41 | cfg.setGroup("settings"); | 44 | cfg.setGroup("settings"); |
42 | SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) ); | 45 | SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",720) ); |
43 | SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) ); | 46 | SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",1440) ); |
44 | ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); | 47 | ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); |
45 | 48 | ||
49 | bool advMode = cfg.readBoolEntry("advancedFeatures", false ); | ||
50 | showAdvancedFeatures(advMode); | ||
51 | CheckBoxAdvSettings->setChecked( advMode ); | ||
52 | connect( CheckBoxAdvSettings, SIGNAL( toggled( bool ) ), | ||
53 | SLOT( showAdvancedFeatures( bool ) ) ); | ||
54 | |||
46 | makeChannel(); | 55 | makeChannel(); |
47 | 56 | ||
48 | ntpTimer = new QTimer(this); | 57 | ntpTimer = new QTimer(this); |
@@ -142,7 +151,7 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | |||
142 | 151 | ||
143 | void Ntp::ntpFinished(OProcess *p) | 152 | void Ntp::ntpFinished(OProcess *p) |
144 | { | 153 | { |
145 | qDebug("p->exitStatus() %i",p->exitStatus()); | 154 | //qDebug("p->exitStatus() %i",p->exitStatus()); |
146 | if (p->exitStatus()!=0 || !p->normalExit()) | 155 | if (p->exitStatus()!=0 || !p->normalExit()) |
147 | { | 156 | { |
148 | slotProbeNtpServer(); | 157 | slotProbeNtpServer(); |
@@ -277,7 +286,7 @@ void Ntp::slotCheckNtp(int i) | |||
277 | } | 286 | } |
278 | }else{ | 287 | }else{ |
279 | preditctTime(); | 288 | preditctTime(); |
280 | ButtonSetTime->setText( tr("Set predicted time") ); | 289 | ButtonSetTime->setText( tr("Set predicted time: ")+predictedTime.toString() ); |
281 | if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer()); | 290 | if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer()); |
282 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); | 291 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); |
283 | connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); | 292 | connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); |
@@ -286,7 +295,6 @@ void Ntp::slotCheckNtp(int i) | |||
286 | 295 | ||
287 | void Ntp::slotProbeNtpServer() | 296 | void Ntp::slotProbeNtpServer() |
288 | { | 297 | { |
289 | qDebug("Ntp::slotProbeNtpServer()"); | ||
290 | ntpSock->connectToHost( getNtpServer() ,123); | 298 | ntpSock->connectToHost( getNtpServer() ,123); |
291 | } | 299 | } |
292 | 300 | ||
@@ -330,3 +338,30 @@ void Ntp::setDocument(const QString &fileName) | |||
330 | { | 338 | { |
331 | 339 | ||
332 | } | 340 | } |
341 | |||
342 | void Ntp::showAdvancedFeatures(bool advMode) | ||
343 | { | ||
344 | if (advMode) { | ||
345 | TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); | ||
346 | TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); | ||
347 | TextLabel1_2_2->show(); | ||
348 | TextLabel2_3->show(); | ||
349 | TextLabel3_3_2->show(); | ||
350 | TextLabel1_2->show(); | ||
351 | SpinBoxMinLookupDelay->show(); | ||
352 | TextLabel2->show(); | ||
353 | TextLabel3_3->show(); | ||
354 | SpinBoxNtpDelay->show(); | ||
355 | }else{ | ||
356 | TabWidgetMain->removePage( tabPredict ); | ||
357 | TabWidgetMain->removePage( tabNtp ); | ||
358 | TextLabel1_2_2->hide(); | ||
359 | TextLabel2_3->hide(); | ||
360 | TextLabel3_3_2->hide(); | ||
361 | TextLabel1_2->hide(); | ||
362 | SpinBoxMinLookupDelay->hide(); | ||
363 | TextLabel2->hide(); | ||
364 | TextLabel3_3->hide(); | ||
365 | SpinBoxNtpDelay->hide(); | ||
366 | }; | ||
367 | } | ||