Diffstat (limited to 'noncore/settings/netsystemtime') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/netsystemtime.pro | 6 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 38 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.h | 52 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.cpp | 33 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.h | 4 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.ui | 62 |
6 files changed, 106 insertions, 89 deletions
diff --git a/noncore/settings/netsystemtime/netsystemtime.pro b/noncore/settings/netsystemtime/netsystemtime.pro index 898e400..a849431 100644 --- a/noncore/settings/netsystemtime/netsystemtime.pro +++ b/noncore/settings/netsystemtime/netsystemtime.pro | |||
@@ -3,4 +3,4 @@ CONFIG = qt warn_on debug | |||
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = ntp.h settime.h ntpbase.h | 4 | HEADERS = ntp.h settime.h |
5 | SOURCES = main.cpp ntp.cpp settime.cpp ntpbase.cpp | 5 | SOURCES = main.cpp ntp.cpp settime.cpp |
6 | INCLUDEPATH+= $(OPIEDIR)/include | 6 | INCLUDEPATH+= $(OPIEDIR)/include |
@@ -8,3 +8,3 @@ DEPENDPATH += $(OPIEDIR)/include | |||
8 | LIBS += -lqpe -lopie | 8 | LIBS += -lqpe -lopie |
9 | INTERFACES= | 9 | INTERFACES= ntpbase.ui |
10 | DESTDIR = $(OPIEDIR)/bin | 10 | DESTDIR = $(OPIEDIR)/bin |
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 40805a0..111f7d4 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -48,2 +48,19 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
48 | 48 | ||
49 | //make tab order | ||
50 | |||
51 | TabWidgetMain->removePage( tabMain ); | ||
52 | TabWidgetMain->removePage( tabManualSetTime ); | ||
53 | TabWidgetMain->removePage( TabSettings ); | ||
54 | TabWidgetMain->removePage( tabPredict ); | ||
55 | TabWidgetMain->removePage( tabNtp ); | ||
56 | |||
57 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); | ||
58 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); | ||
59 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); | ||
60 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); | ||
61 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); | ||
62 | NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); | ||
63 | |||
64 | |||
65 | |||
49 | bool advMode = cfg.readBoolEntry("advancedFeatures", false ); | 66 | bool advMode = cfg.readBoolEntry("advancedFeatures", false ); |
@@ -114,3 +131,3 @@ void Ntp::slotRunNtp() | |||
114 | { | 131 | { |
115 | if ( !ntpDelayElapsed() ) | 132 | if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() ) |
116 | { | 133 | { |
@@ -135,2 +152,4 @@ void Ntp::slotRunNtp() | |||
135 | if ( !ret ) { | 152 | if ( !ret ) { |
153 | QMessageBox::critical(this, tr("ntp error"), | ||
154 | tr("Error while getting time form network!")); | ||
136 | qDebug("Error while executing ntpdate"); | 155 | qDebug("Error while executing ntpdate"); |
@@ -142,2 +161,3 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | |||
142 | { | 161 | { |
162 | if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null"); | ||
143 | QString lineStr, lineStrOld; | 163 | QString lineStr, lineStrOld; |
@@ -155,6 +175,12 @@ void Ntp::ntpFinished(OProcess *p) | |||
155 | { | 175 | { |
156 | //qDebug("p->exitStatus() %i",p->exitStatus()); | 176 | qDebug("p->exitStatus() %i",p->exitStatus()); |
157 | if (p->exitStatus()!=0 || !p->normalExit()) | 177 | if (p->exitStatus()!=0 || !p->normalExit()) |
158 | { | 178 | { |
159 | slotProbeNtpServer(); | 179 | QMessageBox::critical(this, tr("ntp error"), |
180 | tr("Error while getting time form\n server")+ | ||
181 | getNtpServer()+"\n"+ | ||
182 | _ntpOutput ); | ||
183 | // TabWidgetMain->setCurrentPage( 1 ); | ||
184 | TabWidgetMain->showPage( tabManualSetTime ); | ||
185 | |||
160 | return; | 186 | return; |
@@ -309,2 +335,3 @@ void Ntp::ntpOutPut(QString out) | |||
309 | { | 335 | { |
336 | |||
310 | MultiLineEditntpOutPut->append(out); | 337 | MultiLineEditntpOutPut->append(out); |
@@ -340,3 +367,3 @@ void Ntp::setDocument(const QString &fileName) | |||
340 | { | 367 | { |
341 | 368 | qDebug("Ntp::setDocument( %s )",fileName.latin1()); | |
342 | } | 369 | } |
@@ -346,2 +373,3 @@ void Ntp::showAdvancedFeatures(bool advMode) | |||
346 | if (advMode) { | 373 | if (advMode) { |
374 | |||
347 | TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); | 375 | TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); |
diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h index fe0bae6..f6694c9 100644 --- a/noncore/settings/netsystemtime/ntp.h +++ b/noncore/settings/netsystemtime/ntp.h | |||
@@ -17,35 +17,35 @@ public: | |||
17 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 17 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
18 | ~Ntp(); | 18 | ~Ntp(); |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | void setDocument (const QString &); | 21 | void setDocument (const QString &); |
22 | protected: | 22 | protected: |
23 | QDateTime predictedTime; | 23 | QDateTime predictedTime; |
24 | void makeChannel(); | 24 | void makeChannel(); |
25 | protected slots: | 25 | protected slots: |
26 | void receive(const QCString &msg, const QByteArray &arg); | 26 | void receive(const QCString &msg, const QByteArray &arg); |
27 | private: | 27 | private: |
28 | QString _ntpOutput; | 28 | QString _ntpOutput; |
29 | float _shiftPerSec; | 29 | float _shiftPerSec; |
30 | int _lookupDiff; | 30 | int _lookupDiff; |
31 | OProcess *ntpProcess; | 31 | OProcess *ntpProcess; |
32 | QTimer *ntpTimer; | 32 | QTimer *ntpTimer; |
33 | QSocket *ntpSock; | 33 | QSocket *ntpSock; |
34 | QCopChannel *channel; | 34 | QCopChannel *channel; |
35 | 35 | ||
36 | float getTimeShift(); | 36 | float getTimeShift(); |
37 | void readLookups(); | 37 | void readLookups(); |
38 | void ntpOutPut(QString); | 38 | void ntpOutPut(QString); |
39 | bool ntpDelayElapsed(); | 39 | bool ntpDelayElapsed(); |
40 | QString getNtpServer(); | 40 | QString getNtpServer(); |
41 | private slots: | 41 | private slots: |
42 | void slotRunNtp(); | 42 | void slotRunNtp(); |
43 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); | 43 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); |
44 | void ntpFinished(OProcess*); | 44 | void ntpFinished(OProcess*); |
45 | void preditctTime(); | 45 | void preditctTime(); |
46 | void slotCheckNtp(int); | 46 | void slotCheckNtp(int); |
47 | void setPredictTime(); | 47 | void setPredictTime(); |
48 | void showAdvancedFeatures(bool); | 48 | void showAdvancedFeatures(bool); |
49 | void slotProbeNtpServer(); | 49 | void slotProbeNtpServer(); |
50 | void slotNtpDelayChanged(int); | 50 | void slotNtpDelayChanged(int); |
51 | }; | 51 | }; |
diff --git a/noncore/settings/netsystemtime/ntpbase.cpp b/noncore/settings/netsystemtime/ntpbase.cpp index 8d44f17..0a7a57e 100644 --- a/noncore/settings/netsystemtime/ntpbase.cpp +++ b/noncore/settings/netsystemtime/ntpbase.cpp | |||
@@ -3,3 +3,3 @@ | |||
3 | ** | 3 | ** |
4 | ** Created: Mon Oct 21 21:32:47 2002 | 4 | ** Created: Sun Nov 10 17:59:14 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
@@ -33,3 +33,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
33 | setName( "NtpBase" ); | 33 | setName( "NtpBase" ); |
34 | resize( 320, 411 ); | 34 | resize( 317, 411 ); |
35 | setCaption( tr( "Network Time" ) ); | 35 | setCaption( tr( "Network Time" ) ); |
@@ -46,7 +46,6 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
46 | 46 | ||
47 | FrameSystemTime = new QWidget( tabMain, "FrameSystemTime" ); | 47 | FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" ); |
48 | // FrameSystemTime->setFrameShape( QFrame::StyledPanel ); | ||
49 | //FrameSystemTime->setFrameShadow( QFrame::Raised ); | ||
50 | 48 | ||
51 | tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); | 49 | tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); |
50 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); | ||
52 | 51 | ||
@@ -63,4 +62,2 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
63 | FrameNtp = new QWidget( tabNtp, "FrameNtp" ); | 62 | FrameNtp = new QWidget( tabNtp, "FrameNtp" ); |
64 | // FrameNtp->setFrameShape( QFrame::StyledPanel ); | ||
65 | // FrameNtp->setFrameShadow( QFrame::Raised ); | ||
66 | FrameNtpLayout = new QGridLayout( FrameNtp ); | 63 | FrameNtpLayout = new QGridLayout( FrameNtp ); |
@@ -112,2 +109,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
112 | tabNtpLayout->addWidget( FrameNtp, 0, 0 ); | 109 | tabNtpLayout->addWidget( FrameNtp, 0, 0 ); |
110 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); | ||
113 | 111 | ||
@@ -176,2 +174,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
176 | tabPredictLayout->addLayout( Layout11, 2, 0 ); | 174 | tabPredictLayout->addLayout( Layout11, 2, 0 ); |
175 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); | ||
177 | 176 | ||
@@ -183,4 +182,2 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
183 | FrameSettings = new QWidget( TabSettings, "FrameSettings" ); | 182 | FrameSettings = new QWidget( TabSettings, "FrameSettings" ); |
184 | // FrameSettings->setFrameShape( QFrame::StyledPanel ); | ||
185 | // FrameSettings->setFrameShadow( QFrame::Raised ); | ||
186 | FrameSettingsLayout = new QVBoxLayout( FrameSettings ); | 183 | FrameSettingsLayout = new QVBoxLayout( FrameSettings ); |
@@ -218,3 +215,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
218 | CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); | 215 | CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); |
219 | CheckBoxAdvSettings->setText( tr( "Advanced features" ) ); | 216 | CheckBoxAdvSettings->setText( tr( "Advanced settings" ) ); |
220 | FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); | 217 | FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); |
@@ -287,2 +284,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
287 | TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); | 284 | TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); |
285 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); | ||
288 | 286 | ||
@@ -290,8 +288,7 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
290 | tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); | 288 | tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); |
291 | tabManualSetTimeLayout->setSpacing( 2 ); | 289 | tabManualSetTimeLayout->setSpacing( 6 ); |
292 | tabManualSetTimeLayout->setMargin( 2 ); | 290 | tabManualSetTimeLayout->setMargin( 11 ); |
293 | 291 | ||
294 | FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); | 292 | FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); |
295 | // FrameSetTime->setFrameShape( QFrame::StyledPanel ); | 293 | FrameSetTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, FrameSetTime->sizePolicy().hasHeightForWidth() ) ); |
296 | // FrameSetTime->setFrameShadow( QFrame::Raised ); | ||
297 | tabManualSetTimeLayout->addWidget( FrameSetTime ); | 294 | tabManualSetTimeLayout->addWidget( FrameSetTime ); |
@@ -301,9 +298,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | |||
301 | tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); | 298 | tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); |
302 | 299 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | |
303 | 300 | tabManualSetTimeLayout->addItem( spacer_4 ); | |
304 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); | ||
305 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); | 301 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); |
306 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); | ||
307 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); | ||
308 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); | ||
309 | 302 | ||
diff --git a/noncore/settings/netsystemtime/ntpbase.h b/noncore/settings/netsystemtime/ntpbase.h index a443495..543cac1 100644 --- a/noncore/settings/netsystemtime/ntpbase.h +++ b/noncore/settings/netsystemtime/ntpbase.h | |||
@@ -3,3 +3,3 @@ | |||
3 | ** | 3 | ** |
4 | ** Created: Mon Oct 21 21:32:43 2002 | 4 | ** Created: Sun Nov 10 17:58:48 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
@@ -36,3 +36,3 @@ public: | |||
36 | QWidget* tabMain; | 36 | QWidget* tabMain; |
37 | QWidget* FrameSystemTime; | 37 | QFrame* FrameSystemTime; |
38 | QWidget* tabNtp; | 38 | QWidget* tabNtp; |
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui index 465bba0..6c38588 100644 --- a/noncore/settings/netsystemtime/ntpbase.ui +++ b/noncore/settings/netsystemtime/ntpbase.ui | |||
@@ -13,3 +13,3 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>320</width> | 14 | <width>317</width> |
15 | <height>411</height> | 15 | <height>411</height> |
@@ -73,10 +73,2 @@ | |||
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | ||
75 | <name>frameShape</name> | ||
76 | <enum>StyledPanel</enum> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>frameShadow</name> | ||
80 | <enum>Raised</enum> | ||
81 | </property> | ||
82 | </widget> | 74 | </widget> |
@@ -120,10 +112,2 @@ | |||
120 | </property> | 112 | </property> |
121 | <property stdset="1"> | ||
122 | <name>frameShape</name> | ||
123 | <enum>StyledPanel</enum> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>frameShadow</name> | ||
127 | <enum>Raised</enum> | ||
128 | </property> | ||
129 | <property> | 113 | <property> |
@@ -465,10 +449,2 @@ | |||
465 | </property> | 449 | </property> |
466 | <property stdset="1"> | ||
467 | <name>frameShape</name> | ||
468 | <enum>StyledPanel</enum> | ||
469 | </property> | ||
470 | <property stdset="1"> | ||
471 | <name>frameShadow</name> | ||
472 | <enum>Raised</enum> | ||
473 | </property> | ||
474 | <property> | 450 | <property> |
@@ -804,3 +780,3 @@ | |||
804 | <name>margin</name> | 780 | <name>margin</name> |
805 | <number>2</number> | 781 | <number>11</number> |
806 | </property> | 782 | </property> |
@@ -808,3 +784,3 @@ | |||
808 | <name>spacing</name> | 784 | <name>spacing</name> |
809 | <number>2</number> | 785 | <number>6</number> |
810 | </property> | 786 | </property> |
@@ -817,8 +793,7 @@ | |||
817 | <property stdset="1"> | 793 | <property stdset="1"> |
818 | <name>frameShape</name> | 794 | <name>sizePolicy</name> |
819 | <enum>StyledPanel</enum> | 795 | <sizepolicy> |
820 | </property> | 796 | <hsizetype>5</hsizetype> |
821 | <property stdset="1"> | 797 | <vsizetype>3</vsizetype> |
822 | <name>frameShadow</name> | 798 | </sizepolicy> |
823 | <enum>Raised</enum> | ||
824 | </property> | 799 | </property> |
@@ -836,2 +811,23 @@ | |||
836 | </widget> | 811 | </widget> |
812 | <spacer> | ||
813 | <property> | ||
814 | <name>name</name> | ||
815 | <cstring>Spacer4_2</cstring> | ||
816 | </property> | ||
817 | <property stdset="1"> | ||
818 | <name>orientation</name> | ||
819 | <enum>Vertical</enum> | ||
820 | </property> | ||
821 | <property stdset="1"> | ||
822 | <name>sizeType</name> | ||
823 | <enum>Expanding</enum> | ||
824 | </property> | ||
825 | <property> | ||
826 | <name>sizeHint</name> | ||
827 | <size> | ||
828 | <width>20</width> | ||
829 | <height>20</height> | ||
830 | </size> | ||
831 | </property> | ||
832 | </spacer> | ||
837 | </vbox> | 833 | </vbox> |