summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/main.cpp6
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp32
-rw-r--r--noncore/settings/netsystemtime/ntp.h9
-rw-r--r--noncore/settings/netsystemtime/opie-netsystemtime.control2
-rw-r--r--noncore/settings/netsystemtime/opie-netsystemtime.postinst7
-rw-r--r--noncore/settings/netsystemtime/opie-netsystemtime.postrm4
6 files changed, 42 insertions, 18 deletions
diff --git a/noncore/settings/netsystemtime/main.cpp b/noncore/settings/netsystemtime/main.cpp
index 5b01408..c6d5f9a 100644
--- a/noncore/settings/netsystemtime/main.cpp
+++ b/noncore/settings/netsystemtime/main.cpp
@@ -1,14 +1,16 @@
-//#include "settime.h"
+#include <stdio.h>
#include "ntp.h"
#include <qpe/qpeapplication.h>
int main( int argc, char ** argv )
{
+ printf("This is netsystemtime\n");
+ printf("$Id$\n");
+
QPEApplication a( argc, argv );
- // SetDateTime mw;
Ntp mw;
a.showMainWidget( &mw );
return a.exec();
}
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
@@ -13,16 +13,17 @@
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#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 )
: SetDateTime( parent, name, fl )
{
@@ -37,16 +38,18 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de"));
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)) );
ntpSock = new QSocket( this );
connect( ntpSock, SIGNAL( error(int) ),
@@ -210,24 +213,24 @@ void Ntp::readLookups()
int cw = TableLookups->width()/4;
qDebug("column width %i",cw);
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;
TextLabelShift->setText(QString::number(_shiftPerSec*60*60)+tr(" s/h"));
}
@@ -290,8 +293,33 @@ 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
diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h
index c78dc55..56e0131 100644
--- a/noncore/settings/netsystemtime/ntp.h
+++ b/noncore/settings/netsystemtime/ntp.h
@@ -2,36 +2,41 @@
#define NTP_H
#include "settime.h"
#include <qdatetime.h>
class OProcess;
class QString;
class QTimer;
class QSocket;
+class QCopChannel;
class Ntp : public SetDateTime
{
Q_OBJECT
public:
Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~Ntp();
+public slots:
+ void setDocument (const QString &);
protected:
QDateTime predictedTime;
-
-
+ void makeChannel();
+protected slots:
+ void receive(const QCString &msg, const QByteArray &arg);
private:
QString _ntpOutput;
float _shiftPerSec;
int _lookupDiff;
OProcess *ntpProcess;
QTimer *ntpTimer;
QSocket *ntpSock;
+ QCopChannel *channel;
float getTimeShift();
void readLookups();
void ntpOutPut(QString);
bool ntpDelayElapsed();
QString getNtpServer();
private slots:
void slotRunNtp();
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.control b/noncore/settings/netsystemtime/opie-netsystemtime.control
index 9251e5c..e4b744d 100644
--- a/noncore/settings/netsystemtime/opie-netsystemtime.control
+++ b/noncore/settings/netsystemtime/opie-netsystemtime.control
@@ -1,10 +1,10 @@
Packagename: opie-netsystemtime
-Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop etc/ntpservers
+Files: bin/netsystemtime apps/Settings/netsystemtime.desktop etc/ntpservers
Priority: optional
Section: opie/settings
Conflicts: opie-systemtime
Maintainer: Patrick S. Vogt <tille@handhelds.org>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
Depends: opie-base ($QPE_VERSION), ntpdate
Description: ntp (Network Time Protocol) gui
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.postinst b/noncore/settings/netsystemtime/opie-netsystemtime.postinst
deleted file mode 100644
index 233cd31..0000000
--- a/noncore/settings/netsystemtime/opie-netsystemtime.postinst
+++ b/dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh -v
-
-systime=`ipkg status | grep Package | grep -i systemtime | sed "s/Package://"`
-ipkg remove $pack
-
-cd $QPEDIR/bin/
-ln -s netsystemtime systemtime
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.postrm b/noncore/settings/netsystemtime/opie-netsystemtime.postrm
deleted file mode 100644
index 4b2ab7c..0000000
--- a/noncore/settings/netsystemtime/opie-netsystemtime.postrm
+++ b/dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh -v
-
-cd $QPEDIR/bin/
-rm systemtime