-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index 306117a..ab71463 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp | |||
@@ -1,291 +1,290 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | 4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "timetabwidget.h" | 30 | #include "timetabwidget.h" |
31 | #include "formattabwidget.h" | 31 | #include "formattabwidget.h" |
32 | #include "settingstabwidget.h" | 32 | #include "settingstabwidget.h" |
33 | #include "ntptabwidget.h" | 33 | #include "ntptabwidget.h" |
34 | #include "predicttabwidget.h" | 34 | #include "predicttabwidget.h" |
35 | #include "systemtimeconfig.h" | ||
36 | 35 | ||
37 | #include <opie/oprocess.h> | 36 | #include <opie/oprocess.h> |
38 | #include <opie/otabwidget.h> | 37 | #include <opie/otabwidget.h> |
39 | 38 | ||
40 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
41 | #include <qpe/datebookdb.h> | 40 | #include <qpe/datebookdb.h> |
42 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
43 | 42 | ||
44 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 43 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
45 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
46 | #endif | 45 | #endif |
47 | 46 | ||
48 | #include <qlayout.h> | 47 | #include <qlayout.h> |
49 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
50 | #include <qsocket.h> | 49 | #include <qsocket.h> |
51 | #include <qstring.h> | 50 | #include <qstring.h> |
52 | #include <qtimer.h> | 51 | #include <qtimer.h> |
53 | 52 | ||
54 | MainWindow::MainWindow() | 53 | MainWindow::MainWindow() |
55 | : QDialog( 0x0, 0x0, TRUE, 0 ) | 54 | : QDialog( 0x0, 0x0, TRUE, 0 ) |
56 | { | 55 | { |
57 | setCaption( tr( "SystemTime" ) ); | 56 | setCaption( tr( "SystemTime" ) ); |
58 | 57 | ||
59 | QVBoxLayout *layout = new QVBoxLayout( this ); | 58 | QVBoxLayout *layout = new QVBoxLayout( this ); |
60 | layout->setMargin( 2 ); | 59 | layout->setMargin( 2 ); |
61 | layout->setSpacing( 4 ); | 60 | layout->setSpacing( 4 ); |
62 | 61 | ||
63 | // Create main tabbed control | 62 | // Create main tabbed control |
64 | mainWidget = new OTabWidget( this ); | 63 | mainWidget = new OTabWidget( this ); |
65 | 64 | ||
66 | // Default object pointers to null | 65 | // Default object pointers to null |
67 | ntpProcess = 0x0; | 66 | ntpProcess = 0x0; |
68 | ntpTab = 0x0; | 67 | ntpTab = 0x0; |
69 | 68 | ||
70 | // Add tab widgets | 69 | // Add tab widgets |
71 | mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); | 70 | mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); |
72 | mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); | 71 | mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); |
73 | mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); | 72 | mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); |
74 | mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); | 73 | mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); |
75 | Config config( "ntp" ); | 74 | Config config( "ntp" ); |
76 | config.setGroup( "settings" ); | 75 | config.setGroup( "settings" ); |
77 | slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); | 76 | slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) ); |
78 | slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); | 77 | slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); |
79 | 78 | ||
80 | mainWidget->setCurrentTab( tr( "Time" ) ); | 79 | mainWidget->setCurrentTab( tr( "Time" ) ); |
81 | layout->addWidget( mainWidget ); | 80 | layout->addWidget( mainWidget ); |
82 | 81 | ||
83 | // Create QCOP channel | 82 | // Create QCOP channel |
84 | QCopChannel *channel = new QCopChannel( "QPE/Application/netsystemtime", this ); | 83 | QCopChannel *channel = new QCopChannel( "QPE/Application/netsystemtime", this ); |
85 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 84 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
86 | this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); | 85 | this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); |
87 | 86 | ||
88 | // Create NTP socket | 87 | // Create NTP socket |
89 | ntpSock = new QSocket( this ); | 88 | ntpSock = new QSocket( this ); |
90 | connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); | 89 | connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); |
91 | slotProbeNTPServer(); | 90 | slotProbeNTPServer(); |
92 | 91 | ||
93 | // Create timer for automatic time lookups | 92 | // Create timer for automatic time lookups |
94 | ntpTimer = new QTimer( this ); | 93 | ntpTimer = new QTimer( this ); |
95 | 94 | ||
96 | // Connect everything together | 95 | // Connect everything together |
97 | connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); | 96 | connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); |
98 | connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) ); | 97 | connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) ); |
99 | connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); | 98 | connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); |
100 | connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) ); | 99 | connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) ); |
101 | connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)), | 100 | connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)), |
102 | timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) ); | 101 | timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) ); |
103 | connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); | 102 | connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); |
104 | connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); | 103 | connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); |
105 | connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); | 104 | connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); |
106 | connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); | 105 | connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); |
107 | connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) ); | 106 | connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) ); |
108 | 107 | ||
109 | // Do initial time server check | 108 | // Do initial time server check |
110 | slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); | 109 | slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); |
111 | slotCheckNtp( -1 ); | 110 | slotCheckNtp( -1 ); |
112 | 111 | ||
113 | // Display app | 112 | // Display app |
114 | showMaximized(); | 113 | showMaximized(); |
115 | } | 114 | } |
116 | 115 | ||
117 | MainWindow::~MainWindow() | 116 | MainWindow::~MainWindow() |
118 | { | 117 | { |
119 | if ( ntpProcess ) | 118 | if ( ntpProcess ) |
120 | delete ntpProcess; | 119 | delete ntpProcess; |
121 | } | 120 | } |
122 | 121 | ||
123 | void MainWindow::accept() | 122 | void MainWindow::accept() |
124 | { | 123 | { |
125 | // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) | 124 | // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) |
126 | { | 125 | { |
127 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 126 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
128 | disableScreenSaver << 0 << 0 << 0; | 127 | disableScreenSaver << 0 << 0 << 0; |
129 | } | 128 | } |
130 | 129 | ||
131 | // Update the systemtime | 130 | // Update the systemtime |
132 | timeTab->saveSettings( TRUE ); | 131 | timeTab->saveSettings( TRUE ); |
133 | 132 | ||
134 | // Save format options | 133 | // Save format options |
135 | formatTab->saveSettings( TRUE ); | 134 | formatTab->saveSettings( TRUE ); |
136 | 135 | ||
137 | // Save settings options | 136 | // Save settings options |
138 | settingsTab->saveSettings(); | 137 | settingsTab->saveSettings(); |
139 | 138 | ||
140 | // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better | 139 | // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better |
141 | // grip on itself (example re-trigger alarms for when we travel back in time). | 140 | // grip on itself (example re-trigger alarms for when we travel back in time). |
142 | DateBookDB db; | 141 | DateBookDB db; |
143 | 142 | ||
144 | // Turn back on the screensaver | 143 | // Turn back on the screensaver |
145 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 144 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
146 | enableScreenSaver << -1 << -1 << -1; | 145 | enableScreenSaver << -1 << -1 << -1; |
147 | 146 | ||
148 | // Exit app | 147 | // Exit app |
149 | qApp->quit(); | 148 | qApp->quit(); |
150 | } | 149 | } |
151 | 150 | ||
152 | void MainWindow::reject() | 151 | void MainWindow::reject() |
153 | { | 152 | { |
154 | // Reset time settings | 153 | // Reset time settings |
155 | timeTab->saveSettings( FALSE ); | 154 | timeTab->saveSettings( FALSE ); |
156 | 155 | ||
157 | // Send notifications but do not save settings | 156 | // Send notifications but do not save settings |
158 | formatTab->saveSettings( FALSE ); | 157 | formatTab->saveSettings( FALSE ); |
159 | 158 | ||
160 | // Exit app | 159 | // Exit app |
161 | qApp->quit(); | 160 | qApp->quit(); |
162 | } | 161 | } |
163 | 162 | ||
164 | void MainWindow::runNTP() | 163 | void MainWindow::runNTP() |
165 | { | 164 | { |
166 | if ( !ntpDelayElapsed() && ntpInteractive ) | 165 | if ( !ntpDelayElapsed() && ntpInteractive ) |
167 | { | 166 | { |
168 | QString msg = tr( "You asked for a delay of " ); | 167 | QString msg = tr( "You asked for a delay of " ); |
169 | msg.append( QString::number( ntpDelay ) ); | 168 | msg.append( QString::number( ntpDelay ) ); |
170 | msg.append( tr( " minutes, but only " ) ); | 169 | msg.append( tr( " minutes, but only " ) ); |
171 | msg.append( QString::number( _lookupDiff / 60 ) ); | 170 | msg.append( QString::number( _lookupDiff / 60 ) ); |
172 | msg.append( tr(" minutes elapsed since last lookup.<br>Continue?") ); | 171 | msg.append( tr(" minutes elapsed since last lookup.<br>Continue?") ); |
173 | 172 | ||
174 | switch ( | 173 | switch ( |
175 | QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No ) | 174 | QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No ) |
176 | ) | 175 | ) |
177 | { | 176 | { |
178 | case QMessageBox::Yes: break; | 177 | case QMessageBox::Yes: break; |
179 | case QMessageBox::No: return; | 178 | case QMessageBox::No: return; |
180 | default: return; | 179 | default: return; |
181 | } | 180 | } |
182 | } | 181 | } |
183 | 182 | ||
184 | QString srv = settingsTab->ntpServer(); | 183 | QString srv = settingsTab->ntpServer(); |
185 | 184 | ||
186 | // Send information to time server tab if enabled | 185 | // Send information to time server tab if enabled |
187 | if ( ntpTabEnabled ) | 186 | if ( ntpTabEnabled ) |
188 | { | 187 | { |
189 | ntpTab->setStartTime( QDateTime::currentDateTime().toString() ); | 188 | ntpTab->setStartTime( QDateTime::currentDateTime().toString() ); |
190 | QString output = tr( "Running:\nntpdate " ); | 189 | QString output = tr( "Running:\nntpdate " ); |
191 | output.append( srv ); | 190 | output.append( srv ); |
192 | ntpTab->addNtpOutput( output ); | 191 | ntpTab->addNtpOutput( output ); |
193 | } | 192 | } |
194 | 193 | ||
195 | if ( !ntpProcess ) | 194 | if ( !ntpProcess ) |
196 | { | 195 | { |
197 | ntpProcess = new OProcess(); | 196 | ntpProcess = new OProcess(); |
198 | connect( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 197 | connect( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
199 | this, SLOT(slotNtpOutput(OProcess*,char*,int)) ); | 198 | this, SLOT(slotNtpOutput(OProcess*,char*,int)) ); |
200 | connect( ntpProcess, SIGNAL(processExited(OProcess*)), | 199 | connect( ntpProcess, SIGNAL(processExited(OProcess*)), |
201 | this, SLOT(slotNtpFinished(OProcess*)) ); | 200 | this, SLOT(slotNtpFinished(OProcess*)) ); |
202 | } | 201 | } |
203 | 202 | ||
204 | else | 203 | else |
205 | ntpProcess->clearArguments(); | 204 | ntpProcess->clearArguments(); |
206 | 205 | ||
207 | *ntpProcess << "ntpdate" << srv; | 206 | *ntpProcess << "ntpdate" << srv; |
208 | bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput ); | 207 | bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput ); |
209 | if ( !ret ) | 208 | if ( !ret ) |
210 | { | 209 | { |
211 | QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) ); | 210 | QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) ); |
212 | if ( ntpTabEnabled ) | 211 | if ( ntpTabEnabled ) |
213 | ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); | 212 | ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); |
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | bool MainWindow::ntpDelayElapsed() | 216 | bool MainWindow::ntpDelayElapsed() |
218 | { | 217 | { |
219 | // Determine if time elapsed is greater than time delay | 218 | // Determine if time elapsed is greater than time delay |
220 | Config config( "ntp" ); | 219 | Config config( "ntp" ); |
221 | config.setGroup( "lookups" ); | 220 | config.setGroup( "lookups" ); |
222 | _lookupDiff = TimeConversion::toUTC( QDateTime::currentDateTime() ) - config.readNumEntry( "time", 0 ); | 221 | _lookupDiff = TimeConversion::toUTC( QDateTime::currentDateTime() ) - config.readNumEntry( "time", 0 ); |
223 | if ( _lookupDiff < 0 ) | 222 | if ( _lookupDiff < 0 ) |
224 | return true; | 223 | return true; |
225 | return ( _lookupDiff - ( ntpDelay * 60) ) > 0; | 224 | return ( _lookupDiff - ( ntpDelay * 60) ) > 0; |
226 | } | 225 | } |
227 | 226 | ||
228 | void MainWindow::slotSetTime( const QDateTime &dt ) | 227 | void MainWindow::slotSetTime( const QDateTime &dt ) |
229 | { | 228 | { |
230 | timeTab->setDateTime( dt ); | 229 | timeTab->setDateTime( dt ); |
231 | } | 230 | } |
232 | 231 | ||
233 | void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & ) | 232 | void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & ) |
234 | { | 233 | { |
235 | if ( msg == "ntpLookup(QString)" ) | 234 | if ( msg == "ntpLookup(QString)" ) |
236 | { | 235 | { |
237 | ntpInteractive = false; | 236 | ntpInteractive = false; |
238 | runNTP(); | 237 | runNTP(); |
239 | } | 238 | } |
240 | if ( msg == "setPredictedTime(QString)" ) | 239 | if ( msg == "setPredictedTime(QString)" ) |
241 | { | 240 | { |
242 | //setPredictTime(); | 241 | //setPredictTime(); |
243 | } | 242 | } |
244 | } | 243 | } |
245 | 244 | ||
246 | void MainWindow::slotDisplayNTPTab( bool display ) | 245 | void MainWindow::slotDisplayNTPTab( bool display ) |
247 | { | 246 | { |
248 | ntpTabEnabled = display; | 247 | ntpTabEnabled = display; |
249 | 248 | ||
250 | // Create widget if it hasn't needed | 249 | // Create widget if it hasn't needed |
251 | if ( display && !ntpTab ) | 250 | if ( display && !ntpTab ) |
252 | { | 251 | { |
253 | ntpTab = new NTPTabWidget( mainWidget ); | 252 | ntpTab = new NTPTabWidget( mainWidget ); |
254 | connect( ntpTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); | 253 | connect( ntpTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); |
255 | } | 254 | } |
256 | 255 | ||
257 | // Display/hide tab | 256 | // Display/hide tab |
258 | display ? mainWidget->addTab( ntpTab, "netsystemtime/ntptab", tr( "Time Server" ) ) | 257 | display ? mainWidget->addTab( ntpTab, "netsystemtime/ntptab", tr( "Time Server" ) ) |
259 | : mainWidget->removePage( ntpTab ); | 258 | : mainWidget->removePage( ntpTab ); |
260 | } | 259 | } |
261 | 260 | ||
262 | void MainWindow::slotDisplayPredictTab( bool display ) | 261 | void MainWindow::slotDisplayPredictTab( bool display ) |
263 | { | 262 | { |
264 | predictTabEnabled = display; | 263 | predictTabEnabled = display; |
265 | 264 | ||
266 | // Create widget if it hasn't needed | 265 | // Create widget if it hasn't needed |
267 | if ( display && !predictTab ) | 266 | if ( display && !predictTab ) |
268 | { | 267 | { |
269 | } | 268 | } |
270 | // Display/hide tab | 269 | // Display/hide tab |
271 | display ? mainWidget->addTab( predictTab, "netsystemtime/predicttab", tr( "Predict" ) ) | 270 | display ? mainWidget->addTab( predictTab, "netsystemtime/predicttab", tr( "Predict" ) ) |
272 | : mainWidget->removePage( predictTab ); | 271 | : mainWidget->removePage( predictTab ); |
273 | } | 272 | } |
274 | 273 | ||
275 | void MainWindow::slotGetNTPTime() | 274 | void MainWindow::slotGetNTPTime() |
276 | { | 275 | { |
277 | ntpInteractive = TRUE; | 276 | ntpInteractive = TRUE; |
278 | runNTP(); | 277 | runNTP(); |
279 | } | 278 | } |
280 | 279 | ||
281 | void MainWindow::slotTimerGetNTPTime() | 280 | void MainWindow::slotTimerGetNTPTime() |
282 | { | 281 | { |
283 | ntpInteractive = FALSE; | 282 | ntpInteractive = FALSE; |
284 | runNTP(); | 283 | runNTP(); |
285 | } | 284 | } |
286 | 285 | ||
287 | void MainWindow::slotProbeNTPServer() | 286 | void MainWindow::slotProbeNTPServer() |
288 | { | 287 | { |
289 | ntpSock->connectToHost( settingsTab->ntpServer(), 123 ); | 288 | ntpSock->connectToHost( settingsTab->ntpServer(), 123 ); |
290 | } | 289 | } |
291 | 290 | ||