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.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 0b13b6d..2b779fa 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -15,12 +15,13 @@
15#include <qpe/global.h> 15#include <qpe/global.h>
16#include <qpe/timeconversion.h> 16#include <qpe/timeconversion.h>
17#include <qpe/tzselect.h> 17#include <qpe/tzselect.h>
18#include <qpe/timestring.h> 18#include <qpe/timestring.h>
19#include <qpe/qpedialog.h> 19#include <qpe/qpedialog.h>
20#include <qpe/datebookdb.h> 20#include <qpe/datebookdb.h>
21#include <qpe/qcopenvelope_qws.h>
21#include <sys/time.h> 22#include <sys/time.h>
22#include <time.h> 23#include <time.h>
23#include <stdlib.h> 24#include <stdlib.h>
24 25
25 26
26Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) 27Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
@@ -39,12 +40,14 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
39 Config cfg("ntp",Config::User); 40 Config cfg("ntp",Config::User);
40 cfg.setGroup("settings"); 41 cfg.setGroup("settings");
41 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) ); 42 SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) );
42 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) ); 43 SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) );
43 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); 44 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) );
44 45
46 makeChannel();
47
45 ntpTimer = new QTimer(this); 48 ntpTimer = new QTimer(this);
46 49
47 ntpProcess = new OProcess( ); 50 ntpProcess = new OProcess( );
48 connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ), 51 connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ),
49 SLOT(slotNtpDelayChanged(int)) ); 52 SLOT(slotNtpDelayChanged(int)) );
50 53
@@ -212,20 +215,20 @@ void Ntp::readLookups()
212 cw = 50; 215 cw = 50;
213 TableLookups->setColumnWidth( 0, cw+30 ); 216 TableLookups->setColumnWidth( 0, cw+30 );
214 TableLookups->setColumnWidth( 1, cw ); 217 TableLookups->setColumnWidth( 1, cw );
215 TableLookups->setColumnWidth( 2, cw ); 218 TableLookups->setColumnWidth( 2, cw );
216 TableLookups->sortColumn(0, false, true ); 219 TableLookups->sortColumn(0, false, true );
217 // TableLookups->setSorting( true ); 220 // TableLookups->setSorting( true );
221 _shiftPerSec = 0;
218 for (int i=0; i < lookupCount; i++) 222 for (int i=0; i < lookupCount; i++)
219 { 223 {
220 cfg.setGroup("lookup_"+QString::number(i)); 224 cfg.setGroup("lookup_"+QString::number(i));
221 last = cfg.readEntry("secsSinceLast",0).toFloat(); 225 last = cfg.readEntry("secsSinceLast",0).toFloat();
222 shift = QString(cfg.readEntry("timeShift",0)).toFloat(); 226 shift = QString(cfg.readEntry("timeShift",0)).toFloat();
223 // qDebug("%i last %f",i,last);
224 // qDebug("%i shift %f",i,shift);
225 shiftPerSec = shift / last; 227 shiftPerSec = shift / last;
228 qDebug("%i shift %f",i,shiftPerSec);
226 _shiftPerSec += shiftPerSec; 229 _shiftPerSec += shiftPerSec;
227 TableLookups->setText( i,0,QString::number(shiftPerSec*60*60)); 230 TableLookups->setText( i,0,QString::number(shiftPerSec*60*60));
228 TableLookups->setText( i,2,QString::number(shift)); 231 TableLookups->setText( i,2,QString::number(shift));
229 TableLookups->setText( i,1,QString::number(last/(60*60))); 232 TableLookups->setText( i,1,QString::number(last/(60*60)));
230 } 233 }
231 _shiftPerSec /= lookupCount; 234 _shiftPerSec /= lookupCount;
@@ -292,6 +295,31 @@ void Ntp::slotNtpDelayChanged(int delay)
292void Ntp::ntpOutPut(QString out) 295void Ntp::ntpOutPut(QString out)
293{ 296{
294 MultiLineEditntpOutPut->append(out); 297 MultiLineEditntpOutPut->append(out);
295 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); 298 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
296} 299}
297 300
301
302void Ntp::makeChannel()
303 {
304 channel = new QCopChannel( "QPE/Application/netsystemtime", this );
305 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
306 this, SLOT(receive(const QCString&, const QByteArray&)) );
307}
308
309
310
311void Ntp::receive(const QCString &msg, const QByteArray &arg)
312{
313 qDebug("QCop "+msg+" "+QCString(arg));
314 if ( msg == "open(QString)" )
315 {
316 //qApp->exec();
317 }else{
318 qDebug("Ntp::receive: Huh what do ya want");
319 }
320}
321
322void Ntp::setDocument(const QString &fileName)
323{
324
325} \ No newline at end of file