summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/ntp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/netsystemtime/ntp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index b2f5332..6a5c062 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -38,6 +38,4 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
38 Config cfg("ntp",Config::User); 38 Config cfg("ntp",Config::User);
39 cfg.setGroup("settings"); 39 cfg.setGroup("settings");
40 // _maxOffset = cfg.readNumEntry("maxOffset",5);
41// _minLookupDiff = cfg.readNumEntry("minLookupDiff",10);
42 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) ); 40 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) );
43 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) ); 41 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) );
@@ -45,4 +43,5 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
45 43
46 ntpTimer = new QTimer(this); 44 ntpTimer = new QTimer(this);
45 processTimer = new QTimer(this);
47 ntpTimer->start(SpinBoxNtpDelay->value()*1000*60); 46 ntpTimer->start(SpinBoxNtpDelay->value()*1000*60);
48 47
@@ -117,4 +116,7 @@ void Ntp::slotRunNtp()
117 TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); 116 TextLabelStartTime->setText(QDateTime::currentDateTime().toString());
118 ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); 117 ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() );
118 connect( processTimer, SIGNAL( timeout() ), SLOT(slotTimeoutNtpProcess()) );
119 processTimer->start(2*1000*60, true);
120
119 ntpProcess->clearArguments(); 121 ntpProcess->clearArguments();
120 *ntpProcess << "ntpdate" << getNtpServer(); 122 *ntpProcess << "ntpdate" << getNtpServer();
@@ -139,6 +141,12 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
139} 141}
140 142
141void Ntp::ntpFinished(OProcess*) 143void Ntp::ntpFinished(OProcess *p)
142{ 144{
145 if (!p->normalExit())
146 {
147 slotProbeNtpServer();
148 return;
149 }
150 processTimer->stop();
143 Config cfg("ntp",Config::User); 151 Config cfg("ntp",Config::User);
144 cfg.setGroup("lookups"); 152 cfg.setGroup("lookups");
@@ -262,5 +270,4 @@ void Ntp::slotCheckNtp(int i)
262 connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); 270 connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) );
263 } 271 }
264 //ntpTimer->start(SpinBoxNtpDelay->value()*1000*60);
265} 272}
266 273
@@ -280,2 +287,8 @@ void Ntp::ntpOutPut(QString out)
280 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); 287 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
281} 288}
289
290void Ntp::slotTimeoutNtpProcess()
291{
292 ntpProcess->kill();
293 slotProbeNtpServer();
294}