summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/ntp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/netsystemtime/ntp.cpp') (more/less context) (show 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 @@
#include <qpe/global.h>
#include <qpe/timeconversion.h>
#include <qpe/tzselect.h>
#include <qpe/timestring.h>
#include <qpe/qpedialog.h>
#include <qpe/datebookdb.h>
+#include <qpe/qcopenvelope_qws.h>
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
@@ -39,12 +40,14 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
Config cfg("ntp",Config::User);
cfg.setGroup("settings");
SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) );
SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) );
ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) );
+ makeChannel();
+
ntpTimer = new QTimer(this);
ntpProcess = new OProcess( );
connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ),
SLOT(slotNtpDelayChanged(int)) );
@@ -212,20 +215,20 @@ void Ntp::readLookups()
cw = 50;
TableLookups->setColumnWidth( 0, cw+30 );
TableLookups->setColumnWidth( 1, cw );
TableLookups->setColumnWidth( 2, cw );
TableLookups->sortColumn(0, false, true );
// TableLookups->setSorting( true );
+ _shiftPerSec = 0;
for (int i=0; i < lookupCount; i++)
{
cfg.setGroup("lookup_"+QString::number(i));
last = cfg.readEntry("secsSinceLast",0).toFloat();
shift = QString(cfg.readEntry("timeShift",0)).toFloat();
-// qDebug("%i last %f",i,last);
-// qDebug("%i shift %f",i,shift);
shiftPerSec = shift / last;
+ qDebug("%i shift %f",i,shiftPerSec);
_shiftPerSec += shiftPerSec;
TableLookups->setText( i,0,QString::number(shiftPerSec*60*60));
TableLookups->setText( i,2,QString::number(shift));
TableLookups->setText( i,1,QString::number(last/(60*60)));
}
_shiftPerSec /= lookupCount;
@@ -292,6 +295,31 @@ void Ntp::slotNtpDelayChanged(int delay)
void Ntp::ntpOutPut(QString out)
{
MultiLineEditntpOutPut->append(out);
MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
}
+
+void Ntp::makeChannel()
+{
+ channel = new QCopChannel( "QPE/Application/netsystemtime", this );
+ connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ this, SLOT(receive(const QCString&, const QByteArray&)) );
+}
+
+
+
+void Ntp::receive(const QCString &msg, const QByteArray &arg)
+{
+ qDebug("QCop "+msg+" "+QCString(arg));
+ if ( msg == "open(QString)" )
+ {
+ // qApp->exec();
+ }else{
+ qDebug("Ntp::receive: Huh what do ya want");
+ }
+}
+
+void Ntp::setDocument(const QString &fileName)
+{
+
+} \ No newline at end of file