summaryrefslogtreecommitdiff
authorhrw <hrw>2005-07-25 14:21:11 (UTC)
committer hrw <hrw>2005-07-25 14:21:11 (UTC)
commitee25393f06291c3d7a1e64f146abc5e5fbadaf60 (patch) (unidiff)
tree110377f4eb42731974048854bbad0c1a34583565
parentb74ea9f8de39d355e2d16b4b685e9de54e2f0b0d (diff)
downloadopie-ee25393f06291c3d7a1e64f146abc5e5fbadaf60.zip
opie-ee25393f06291c3d7a1e64f146abc5e5fbadaf60.tar.gz
opie-ee25393f06291c3d7a1e64f146abc5e5fbadaf60.tar.bz2
Show 'Predict' tab only once - close #1543
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp16
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a32023..ba355ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,58 +1,59 @@
1 2005-??-??Opie 1.2.1 1 2005-??-??Opie 1.2.1
2 2
3 3
4 New Features 4 New Features
5 ------------ 5 ------------
6 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) 6 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
7 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) 7 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
8 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) 8 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
9 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) 9 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
10 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) 10 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
11 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) 11 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
12 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw) 12 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw)
13 * ZSafe: Made UI conform to Opie standards (drw) 13 * ZSafe: Made UI conform to Opie standards (drw)
14 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw) 14 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw)
15 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl) 15 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl)
16 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl) 16 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl)
17 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl) 17 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl)
18 18
19 Fixed Bugs 19 Fixed Bugs
20 ---------- 20 ----------
21 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) 21 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
22 - We actually suspend the complete Opie now in that case. 22 - We actually suspend the complete Opie now in that case.
23 * #1384 - Battery status updated improperly when charging (skyhusker) 23 * #1384 - Battery status updated improperly when charging (skyhusker)
24 * #1476 - Wrong order of application entries in the O-menu (skyhusker) 24 * #1476 - Wrong order of application entries in the O-menu (skyhusker)
25 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) 25 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
26 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) 26 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
27 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw)
27 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) 28 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
28 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) 29 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
29 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) 30 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
30 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) 31 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
31 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) 32 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
32 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) 33 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
33 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) 34 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker)
34 * #1667 - Opie-IRC does not show messages from !channel (skyhusker) 35 * #1667 - Opie-IRC does not show messages from !channel (skyhusker)
35 * #1679 - Security PIN plugin is QVGA sized (hrw) 36 * #1679 - Security PIN plugin is QVGA sized (hrw)
36 * n.a.- always show volume and wireless applet popups inside visible screen (deller) 37 * n.a.- always show volume and wireless applet popups inside visible screen (deller)
37 * n.a. - scale O-Menu-Applets appropriately (mickeyl) 38 * n.a. - scale O-Menu-Applets appropriately (mickeyl)
38 * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) 39 * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
39 * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) 40 * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl)
40 * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) 41 * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl)
41 * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) 42 * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
42 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) 43 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
43 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) 44 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
44 * n.a. - remove hardcoded font size from netsystemtime (hrw) 45 * n.a. - remove hardcoded font size from netsystemtime (hrw)
45 * n.a. - remove hardcoded font size from checkbook graphs (hrw) 46 * n.a. - remove hardcoded font size from checkbook graphs (hrw)
46 47
47 Internal 48 Internal
48 -------- 49 --------
49 * Make BluezApplet use OTaskbarApplet (mickeyl) 50 * Make BluezApplet use OTaskbarApplet (mickeyl)
50 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) 51 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl)
51 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) 52 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl)
52 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) 53 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl)
53 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) 54 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl)
54 * libopienet: Miscellaneous API cleanups (mickeyl) 55 * libopienet: Miscellaneous API cleanups (mickeyl)
55 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) 56 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl)
56 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl) 57 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl)
57 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl) 58 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl)
58 59
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 35d4105..c1cd796 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -38,70 +38,70 @@
38#include <qpe/config.h> 38#include <qpe/config.h>
39#include <qpe/datebookdb.h> 39#include <qpe/datebookdb.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41#include <qpe/qpedialog.h> 41#include <qpe/qpedialog.h>
42 42
43#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)
44#include <qpe/qcopenvelope_qws.h> 44#include <qpe/qcopenvelope_qws.h>
45#endif 45#endif
46 46
47#include <qlayout.h> 47#include <qlayout.h>
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qsocket.h> 49#include <qsocket.h>
50#include <qstring.h> 50#include <qstring.h>
51#include <qtimer.h> 51#include <qtimer.h>
52 52
53using namespace Opie::Ui; 53using namespace Opie::Ui;
54using namespace Opie::Core; 54using namespace Opie::Core;
55MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) 55MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
56 : QDialog( parent, name, modal, f ) 56 : QDialog( parent, name, modal, f )
57{ 57{
58 setCaption( tr( "SystemTime" ) ); 58 setCaption( tr( "SystemTime" ) );
59 59
60 QVBoxLayout *layout = new QVBoxLayout( this ); 60 QVBoxLayout *layout = new QVBoxLayout( this );
61 layout->setMargin( 2 ); 61 layout->setMargin( 2 );
62 layout->setSpacing( 4 ); 62 layout->setSpacing( 4 );
63 63
64 // Create main tabbed control 64 // Create main tabbed control
65 mainWidget = new OTabWidget( this ); 65 mainWidget = new OTabWidget( this );
66 66
67 // Default object pointers to null 67 // Default object pointers to null
68 ntpProcess = 0x0; 68 ntpProcess = 0x0;
69 ntpTab = 0x0; 69 ntpTab = 0x0;
70 predictTab = 0x0;
70 71
71 // Add tab widgets 72 // Add tab widgets
72 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); 73 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
73 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); 74 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
74 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); 75 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
75 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
76 Config config( "ntp" ); 76 Config config( "ntp" );
77 config.setGroup( "settings" ); 77 config.setGroup( "settings" );
78 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) ); 78 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) );
79 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) ); 79 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) );
80 80
81 mainWidget->setCurrentTab( tr( "Time" ) ); 81 mainWidget->setCurrentTab( tr( "Time" ) );
82 layout->addWidget( mainWidget ); 82 layout->addWidget( mainWidget );
83 83
84 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 84 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
85 this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) ); 85 this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) );
86 86
87 87
88 // Create NTP socket 88 // Create NTP socket
89 ntpSock = new QSocket( this ); 89 ntpSock = new QSocket( this );
90 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); 90 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) );
91 slotProbeNTPServer(); 91 slotProbeNTPServer();
92 92
93 // Create timer for automatic time lookups 93 // Create timer for automatic time lookups
94 ntpTimer = new QTimer( this ); 94 ntpTimer = new QTimer( this );
95 95
96 // Connect everything together 96 // Connect everything together
97 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); 97 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
98 connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) ); 98 connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) );
99 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); 99 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) );
100 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) ); 100 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) );
101 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)), 101 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)),
102 timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) ); 102 timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) );
103 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); 103 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) );
104 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); 104 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) );
105 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); 105 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) );
106 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); 106 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) );
107 connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) ); 107 connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) );
@@ -246,64 +246,65 @@ void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & )
246 ntpInteractive = false; 246 ntpInteractive = false;
247 runNTP(); 247 runNTP();
248 } 248 }
249 if ( msg == "setPredictedTime(QString)" ) 249 if ( msg == "setPredictedTime(QString)" )
250 { 250 {
251 //setPredictTime(); 251 //setPredictTime();
252 } 252 }
253} 253}
254 254
255void MainWindow::slotDisplayNTPTab( bool display ) 255void MainWindow::slotDisplayNTPTab( bool display )
256{ 256{
257 ntpTabEnabled = display; 257 ntpTabEnabled = display;
258 258
259 // Create widget if it hasn't needed 259 // Create widget if it hasn't needed
260 if ( display && !ntpTab ) 260 if ( display && !ntpTab )
261 { 261 {
262 ntpTab = new NTPTabWidget( mainWidget ); 262 ntpTab = new NTPTabWidget( mainWidget );
263 connect( ntpTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); 263 connect( ntpTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
264 } 264 }
265 265
266 // Display/hide tab 266 // Display/hide tab
267 display ? mainWidget->addTab( ntpTab, "netsystemtime/ntptab", tr( "Time Server" ) ) 267 display ? mainWidget->addTab( ntpTab, "netsystemtime/ntptab", tr( "Time Server" ) )
268 : mainWidget->removePage( ntpTab ); 268 : mainWidget->removePage( ntpTab );
269} 269}
270 270
271void MainWindow::slotDisplayPredictTab( bool display ) 271void MainWindow::slotDisplayPredictTab( bool display )
272{ 272{
273 predictTabEnabled = display; 273 predictTabEnabled = display;
274 274
275 // Create widget if it hasn't needed 275 // Create widget if it hasn't needed
276 if ( display && !predictTab ) 276 if ( display && !predictTab )
277 { 277 {
278 predictTab = new PredictTabWidget( mainWidget );
278 } 279 }
279 // Display/hide tab 280 // Display/hide tab
280 display ? mainWidget->addTab( predictTab, "netsystemtime/predicttab", tr( "Predict" ) ) 281 display ? mainWidget->addTab( predictTab, "netsystemtime/predicttab", tr( "Predict" ) )
281 : mainWidget->removePage( predictTab ); 282 : mainWidget->removePage( predictTab );
282} 283}
283 284
284void MainWindow::slotGetNTPTime() 285void MainWindow::slotGetNTPTime()
285{ 286{
286 ntpInteractive = true; 287 ntpInteractive = true;
287 runNTP(); 288 runNTP();
288} 289}
289 290
290void MainWindow::slotTimerGetNTPTime() 291void MainWindow::slotTimerGetNTPTime()
291{ 292{
292 ntpInteractive = false; 293 ntpInteractive = false;
293 runNTP(); 294 runNTP();
294} 295}
295 296
296void MainWindow::slotProbeNTPServer() 297void MainWindow::slotProbeNTPServer()
297{ 298{
298 ntpSock->connectToHost( settingsTab->ntpServer(), 123 ); 299 ntpSock->connectToHost( settingsTab->ntpServer(), 123 );
299} 300}
300 301
301void MainWindow::slotNtpOutput( OProcess *, char *buffer, int buflen ) 302void MainWindow::slotNtpOutput( OProcess *, char *buffer, int buflen )
302{ 303{
303 QString output = QString( buffer ).left( buflen ); 304 QString output = QString( buffer ).left( buflen );
304 ntpOutput.append( output ); 305 ntpOutput.append( output );
305 306
306 if ( ntpTabEnabled ) 307 if ( ntpTabEnabled )
307 ntpTab->addNtpOutput( output ); 308 ntpTab->addNtpOutput( output );
308} 309}
309 310
@@ -342,77 +343,86 @@ void MainWindow::slotNtpFinished( OProcess *p )
342 bool lastNtp = config.readBoolEntry( "lastNtp", false ); 343 bool lastNtp = config.readBoolEntry( "lastNtp", false );
343 int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); 344 int time = TimeConversion::toUTC( QDateTime::currentDateTime() );
344 config.writeEntry( "time", time ); 345 config.writeEntry( "time", time );
345 346
346 // Calculate new time/time shift 347 // Calculate new time/time shift
347 QString _offset = "offset"; 348 QString _offset = "offset";
348 QString _sec = "sec"; 349 QString _sec = "sec";
349 QRegExp _reOffset = QRegExp( _offset ); 350 QRegExp _reOffset = QRegExp( _offset );
350 QRegExp _reEndOffset = QRegExp( _sec ); 351 QRegExp _reEndOffset = QRegExp( _sec );
351 int posOffset = _reOffset.match( ntpOutput ); 352 int posOffset = _reOffset.match( ntpOutput );
352 int posEndOffset = _reEndOffset.match( ntpOutput, posOffset ); 353 int posEndOffset = _reEndOffset.match( ntpOutput, posOffset );
353 posOffset += _offset.length() + 1; 354 posOffset += _offset.length() + 1;
354 QString diff = ntpOutput.mid( posOffset, posEndOffset - posOffset - 1 ); 355 QString diff = ntpOutput.mid( posOffset, posEndOffset - posOffset - 1 );
355 356
356 float timeShift = diff.toFloat(); 357 float timeShift = diff.toFloat();
357 if ( timeShift == 0.0 ) 358 if ( timeShift == 0.0 )
358 return; 359 return;
359 int secsSinceLast = time - lastLookup; 360 int secsSinceLast = time - lastLookup;
360 output = tr( "%1 seconds").arg(QString::number( timeShift )); 361 output = tr( "%1 seconds").arg(QString::number( timeShift ));
361 362
362 // Display information on time server tab 363 // Display information on time server tab
363 if ( ntpTabEnabled ) 364 if ( ntpTabEnabled )
364 { 365 {
365 ntpTab->setTimeShift( output ); 366 ntpTab->setTimeShift( output );
366 ntpTab->setNewTime( dt.toString() ); 367 ntpTab->setNewTime( dt.toString() );
367 } 368 }
368 369
369 if ( lastNtp && lastLookup > 0 && secsSinceLast > 60 * ntpDelay ) 370 if ( lastNtp && lastLookup > 0 && secsSinceLast > 60 * ntpDelay )
370 { 371 {
371 QString grpname = QString( "lookup_" ).append( QString::number( lookupCount ) ); 372 QString grpname = QString( "lookup_" ).append( QString::number( lookupCount ) );
372 config.setGroup( grpname ); 373 config.setGroup( grpname );
373 lookupCount++; 374 lookupCount++;
374 predictTab->setShiftPerSec( (int)(timeShift / secsSinceLast) ); 375
376 if(predictTab)
377 {
378 predictTab->setShiftPerSec( (int)(timeShift / secsSinceLast) );
379 }
380
375 config.writeEntry( "secsSinceLast", secsSinceLast ); 381 config.writeEntry( "secsSinceLast", secsSinceLast );
376 config.writeEntry( "timeShift", QString::number( timeShift ) ); 382 config.writeEntry( "timeShift", QString::number( timeShift ) );
377 config.setGroup( "lookups" ); 383 config.setGroup( "lookups" );
378 config.writeEntry( "count", lookupCount ); 384 config.writeEntry( "count", lookupCount );
379 config.writeEntry( "lastNtp", true ); 385 config.writeEntry( "lastNtp", true );
380 } 386 }
381} 387}
382 388
383void MainWindow::slotNTPDelayChanged( int delay ) 389void MainWindow::slotNTPDelayChanged( int delay )
384{ 390{
385 ntpTimer->changeInterval( delay * 1000 * 60 ); 391 ntpTimer->changeInterval( delay * 1000 * 60 );
386 ntpDelay = delay; 392 ntpDelay = delay;
387} 393}
388 394
389void MainWindow::slotCheckNtp( int i ) 395void MainWindow::slotCheckNtp( int i )
390{ 396{
391 if ( i == 0 ) 397 if ( i == 0 )
392 { 398 {
393 if ( ntpDelayElapsed() ) 399 if ( ntpDelayElapsed() )
394 { 400 {
395 runNTP(); 401 runNTP();
396 disconnect( ntpTimer, SIGNAL(timeout()), this, SLOT(slotProbeNTPServer()) ); 402 disconnect( ntpTimer, SIGNAL(timeout()), this, SLOT(slotProbeNTPServer()) );
397 connect( ntpTimer, SIGNAL(timeout()), SLOT(slotTimerGetNTPTime()) ); 403 connect( ntpTimer, SIGNAL(timeout()), SLOT(slotTimerGetNTPTime()) );
398 } 404 }
399 else 405 else
400 { 406 {
401 disconnect(ntpTimer, SIGNAL(timeout()), this, SLOT(slotTimerGetNTPTime()) ); 407 disconnect(ntpTimer, SIGNAL(timeout()), this, SLOT(slotTimerGetNTPTime()) );
402 connect(ntpTimer, SIGNAL(timeout()), SLOT(slotProbeNTPServer()) ); 408 connect(ntpTimer, SIGNAL(timeout()), SLOT(slotProbeNTPServer()) );
403 } 409 }
404 } 410 }
405 else 411 else
406 { 412 {
407 predictTab->slotPredictTime(); 413 if(predictTab)
414 {
415 predictTab->slotPredictTime();
416 }
417
408 if ( i > 0 ) 418 if ( i > 0 )
409 { 419 {
410 QString output = tr( "Could not connect to server " ); 420 QString output = tr( "Could not connect to server " );
411 output.append( settingsTab->ntpServer() ); 421 output.append( settingsTab->ntpServer() );
412 ntpOutput.append( output ); 422 ntpOutput.append( output );
413 if ( ntpTabEnabled ) 423 if ( ntpTabEnabled )
414 ntpTab->addNtpOutput( output ); 424 ntpTab->addNtpOutput( output );
415 } 425 }
416 connect( ntpTimer, SIGNAL(timeout()), SLOT(slotProbeNTPServer()) ); 426 connect( ntpTimer, SIGNAL(timeout()), SLOT(slotProbeNTPServer()) );
417 } 427 }
418} 428}