author | tille <tille> | 2002-07-06 13:53:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-06 13:53:48 (UTC) |
commit | ac76e913d1930cdf7903fed344bd7bcc1b7545c0 (patch) (unidiff) | |
tree | 8c71a16a7bc80eccbe1affbc976b795be6807b62 | |
parent | 02b8c37db8d3fd197c8c730451bd7819e65817a1 (diff) | |
download | opie-ac76e913d1930cdf7903fed344bd7bcc1b7545c0.zip opie-ac76e913d1930cdf7903fed344bd7bcc1b7545c0.tar.gz opie-ac76e913d1930cdf7903fed344bd7bcc1b7545c0.tar.bz2 |
clockapplet uses qcop call to open settime dialog
-rw-r--r-- | noncore/settings/netsystemtime/main.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 32 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.h | 9 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/opie-netsystemtime.control | 2 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/opie-netsystemtime.postinst | 7 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/opie-netsystemtime.postrm | 4 |
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 @@ | |||
1 | //#include "settime.h" | 1 | #include <stdio.h> |
2 | #include "ntp.h" | 2 | #include "ntp.h" |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | 4 | ||
5 | int main( int argc, char ** argv ) | 5 | int main( int argc, char ** argv ) |
6 | { | 6 | { |
7 | printf("This is netsystemtime\n"); | ||
8 | printf("$Id$\n"); | ||
9 | |||
7 | QPEApplication a( argc, argv ); | 10 | QPEApplication a( argc, argv ); |
8 | 11 | ||
9 | // SetDateTime mw; | ||
10 | Ntp mw; | 12 | Ntp mw; |
11 | a.showMainWidget( &mw ); | 13 | a.showMainWidget( &mw ); |
12 | 14 | ||
13 | return a.exec(); | 15 | return a.exec(); |
14 | } | 16 | } |
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 @@ | |||
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
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 | ||
26 | Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | 27 | Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) |
27 | : SetDateTime( parent, name, fl ) | 28 | : SetDateTime( parent, name, fl ) |
28 | { | 29 | { |
@@ -37,16 +38,18 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
37 | if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de")); | 38 | if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de")); |
38 | 39 | ||
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 | ||
51 | ntpSock = new QSocket( this ); | 54 | ntpSock = new QSocket( this ); |
52 | connect( ntpSock, SIGNAL( error(int) ), | 55 | connect( ntpSock, SIGNAL( error(int) ), |
@@ -210,24 +213,24 @@ void Ntp::readLookups() | |||
210 | int cw = TableLookups->width()/4; | 213 | int cw = TableLookups->width()/4; |
211 | qDebug("column width %i",cw); | 214 | qDebug("column width %i",cw); |
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; |
232 | TextLabelShift->setText(QString::number(_shiftPerSec*60*60)+tr(" s/h")); | 235 | TextLabelShift->setText(QString::number(_shiftPerSec*60*60)+tr(" s/h")); |
233 | } | 236 | } |
@@ -290,8 +293,33 @@ void Ntp::slotNtpDelayChanged(int delay) | |||
290 | } | 293 | } |
291 | 294 | ||
292 | void Ntp::ntpOutPut(QString out) | 295 | void 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 | |||
302 | void 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 | |||
311 | void 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 | |||
322 | void Ntp::setDocument(const QString &fileName) | ||
323 | { | ||
324 | |||
325 | } \ 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 @@ | |||
2 | #define NTP_H | 2 | #define NTP_H |
3 | #include "settime.h" | 3 | #include "settime.h" |
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | 5 | ||
6 | class OProcess; | 6 | class OProcess; |
7 | class QString; | 7 | class QString; |
8 | class QTimer; | 8 | class QTimer; |
9 | class QSocket; | 9 | class QSocket; |
10 | class QCopChannel; | ||
10 | 11 | ||
11 | class Ntp : public SetDateTime | 12 | class Ntp : public SetDateTime |
12 | { | 13 | { |
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | 15 | ||
15 | public: | 16 | public: |
16 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 17 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
17 | ~Ntp(); | 18 | ~Ntp(); |
18 | 19 | ||
20 | public slots: | ||
21 | void setDocument (const QString &); | ||
19 | protected: | 22 | protected: |
20 | QDateTime predictedTime; | 23 | QDateTime predictedTime; |
21 | 24 | void makeChannel(); | |
22 | 25 | protected slots: | |
26 | void receive(const QCString &msg, const QByteArray &arg); | ||
23 | private: | 27 | private: |
24 | QString _ntpOutput; | 28 | QString _ntpOutput; |
25 | float _shiftPerSec; | 29 | float _shiftPerSec; |
26 | int _lookupDiff; | 30 | int _lookupDiff; |
27 | OProcess *ntpProcess; | 31 | OProcess *ntpProcess; |
28 | QTimer *ntpTimer; | 32 | QTimer *ntpTimer; |
29 | QSocket *ntpSock; | 33 | QSocket *ntpSock; |
34 | QCopChannel *channel; | ||
30 | 35 | ||
31 | float getTimeShift(); | 36 | float getTimeShift(); |
32 | void readLookups(); | 37 | void readLookups(); |
33 | void ntpOutPut(QString); | 38 | void ntpOutPut(QString); |
34 | bool ntpDelayElapsed(); | 39 | bool ntpDelayElapsed(); |
35 | QString getNtpServer(); | 40 | QString getNtpServer(); |
36 | private slots: | 41 | private slots: |
37 | void slotRunNtp(); | 42 | 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 @@ | |||
1 | Packagename: opie-netsystemtime | 1 | Packagename: opie-netsystemtime |
2 | Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop etc/ntpservers | 2 | Files: bin/netsystemtime apps/Settings/netsystemtime.desktop etc/ntpservers |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Conflicts: opie-systemtime | 5 | Conflicts: opie-systemtime |
6 | Maintainer: Patrick S. Vogt <tille@handhelds.org> | 6 | Maintainer: Patrick S. Vogt <tille@handhelds.org> |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Version: $QPE_VERSION-$SUB_VERSION | 8 | Version: $QPE_VERSION-$SUB_VERSION |
9 | Depends: opie-base ($QPE_VERSION), ntpdate | 9 | Depends: opie-base ($QPE_VERSION), ntpdate |
10 | Description: ntp (Network Time Protocol) gui | 10 | 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 @@ | |||
1 | #!/bin/sh -v | ||
2 | |||
3 | systime=`ipkg status | grep Package | grep -i systemtime | sed "s/Package://"` | ||
4 | ipkg remove $pack | ||
5 | |||
6 | cd $QPEDIR/bin/ | ||
7 | 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 @@ | |||
1 | #!/bin/sh -v | ||
2 | |||
3 | cd $QPEDIR/bin/ | ||
4 | rm systemtime | ||