summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 9572993..fbd65a2 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -85,49 +85,49 @@ Ntp::~Ntp()
85 cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); 85 cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() );
86 cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); 86 cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() );
87} 87}
88 88
89bool Ntp::ntpDelayElapsed() 89bool Ntp::ntpDelayElapsed()
90{ 90{
91 Config cfg("ntp",Config::User); 91 Config cfg("ntp",Config::User);
92 cfg.setGroup("lookups"); 92 cfg.setGroup("lookups");
93 _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); 93 _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0);
94 return (_lookupDiff - (SpinBoxNtpDelay->value()*60)) > -60; 94 return (_lookupDiff - (SpinBoxNtpDelay->value()*60)) > -60;
95} 95}
96 96
97QString Ntp::getNtpServer() 97QString Ntp::getNtpServer()
98{ 98{
99 return ComboNtpSrv->currentText(); 99 return ComboNtpSrv->currentText();
100} 100}
101 101
102void Ntp::slotRunNtp() 102void Ntp::slotRunNtp()
103{ 103{
104 if ( !ntpDelayElapsed() ) 104 if ( !ntpDelayElapsed() )
105 { 105 {
106 switch ( 106 switch (
107 QMessageBox::warning(this, tr("Run NTP?"), 107 QMessageBox::warning(this, tr("Run NTP?"),
108 tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ 108 tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+
109 QString::number(_lookupDiff/60)+tr(" minutes elapsed since last loopup.")+ 109 QString::number(_lookupDiff/60)+tr(" minutes elapsed since last lookup.")+
110 "<br>"+tr("Rerun NTP?"), 110 "<br>"+tr("Rerun NTP?"),
111 QMessageBox::Ok,QMessageBox::Cancel) 111 QMessageBox::Ok,QMessageBox::Cancel)
112 ) { 112 ) {
113 case QMessageBox::Ok: break; 113 case QMessageBox::Ok: break;
114 case QMessageBox::Cancel: return; 114 case QMessageBox::Cancel: return;
115 default: return; 115 default: return;
116 } 116 }
117 } 117 }
118 TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); 118 TextLabelStartTime->setText(QDateTime::currentDateTime().toString());
119 ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); 119 ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() );
120 120
121 ntpProcess->clearArguments(); 121 ntpProcess->clearArguments();
122 *ntpProcess << "ntpdate" << getNtpServer(); 122 *ntpProcess << "ntpdate" << getNtpServer();
123 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 123 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
124 if ( !ret ) { 124 if ( !ret ) {
125 qDebug("Error while executing ntpdate"); 125 qDebug("Error while executing ntpdate");
126 ntpOutPut( tr("Error while executing ntpdate")); 126 ntpOutPut( tr("Error while executing ntpdate"));
127 } 127 }
128} 128}
129 129
130void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) 130void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
131{ 131{
132 QString lineStr, lineStrOld; 132 QString lineStr, lineStrOld;
133 lineStr = buffer; 133 lineStr = buffer;