summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-29 22:09:37 (UTC)
committer sandman <sandman>2002-10-29 22:09:37 (UTC)
commit1e294abab44c96f1fdf4fe0e7083a19fbeb970e0 (patch) (unidiff)
treedaa27f50fcd27d00ef165e46a4ba948346fc7437
parent7c340d2a08601f4d27f6d2a407fc0de437b8efad (diff)
downloadopie-1e294abab44c96f1fdf4fe0e7083a19fbeb970e0.zip
opie-1e294abab44c96f1fdf4fe0e7083a19fbeb970e0.tar.gz
opie-1e294abab44c96f1fdf4fe0e7083a19fbeb970e0.tar.bz2
check if the system date is in a reasonable range (year > 2000) - inform
the user and optionally launch systemtime, if it's not (on iPAQs mostly because of battery drain)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 8974ced..715239f 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -10,48 +10,49 @@
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "desktop.h" 21#include "desktop.h"
22#include "taskbar.h" 22#include "taskbar.h"
23#include "stabmon.h" 23#include "stabmon.h"
24 24
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/network.h> 26#include <qpe/network.h>
27#include <qpe/config.h> 27#include <qpe/config.h>
28#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 28#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
29#include <qpe/custom.h> 29#include <qpe/custom.h>
30#endif 30#endif
31 31
32#include <opie/odevice.h> 32#include <opie/odevice.h>
33 33
34#include <qmessagebox.h>
34#include <qfile.h> 35#include <qfile.h>
35#include <qimage.h> 36#include <qimage.h>
36#include <qwindowsystem_qws.h> 37#include <qwindowsystem_qws.h>
37#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
38#include <qpe/alarmserver.h> 39#include <qpe/alarmserver.h>
39 40
40#include <stdlib.h> 41#include <stdlib.h>
41#include <stdio.h> 42#include <stdio.h>
42#include <signal.h> 43#include <signal.h>
43#include <unistd.h> 44#include <unistd.h>
44 45
45#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 46#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
46#include "../calibrate/calibrate.h" 47#include "../calibrate/calibrate.h"
47#endif 48#endif
48 49
49using namespace Opie; 50using namespace Opie;
50 51
51void initEnvironment() 52void initEnvironment()
52{ 53{
53 Config config("locale"); 54 Config config("locale");
54 config.setGroup( "Location" ); 55 config.setGroup( "Location" );
55 QString tz = config.readEntry( "Timezone", getenv("TZ") ); 56 QString tz = config.readEntry( "Timezone", getenv("TZ") );
56 57
57 // if not timezone set, pick New York 58 // if not timezone set, pick New York
@@ -96,48 +97,60 @@ int initApplication( int argc, char ** argv )
96 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) ); 97 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
97 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) ); 98 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
98 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) ); 99 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
99 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); 100 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
100 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); 101 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
101 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); 102 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
102 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); 103 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
103 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); 104 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
104 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); 105 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
105 106
106 (void)new SysFileMonitor(d); 107 (void)new SysFileMonitor(d);
107 Network::createServer(d); 108 Network::createServer(d);
108 109
109#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 110#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
110 if ( !QFile::exists( "/etc/pointercal" ) ) { 111 if ( !QFile::exists( "/etc/pointercal" ) ) {
111 // Make sure calibration widget starts on top. 112 // Make sure calibration widget starts on top.
112 Calibrate *cal = new Calibrate; 113 Calibrate *cal = new Calibrate;
113 cal->exec(); 114 cal->exec();
114 delete cal; 115 delete cal;
115 } 116 }
116#endif 117#endif
117 118
118 d->show(); 119 d->show();
119 120
121 if ( QDate::currentDate ( ). year ( ) < 2000 ) {
122 if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
123 QCString app;
124 if ( QFile::exists ( QPEApplication::qpeDir ( ) + "/bin/netsystemtime" ))
125 app = "netsystemtime";
126 else
127 app = "systemtime";
128 QCopEnvelope e ( "QPE/Application/" + app, "setDocument(QString)" );
129 e << QString ( );
130 }
131 }
132
120 int rv = a.exec(); 133 int rv = a.exec();
121 134
122 delete d; 135 delete d;
123 136
124 ODevice::inst ( )-> setSoftSuspend ( false ); 137 ODevice::inst ( )-> setSoftSuspend ( false );
125 138
126 return rv; 139 return rv;
127} 140}
128 141
129static const char *pidfile_path = "/var/run/opie.pid"; 142static const char *pidfile_path = "/var/run/opie.pid";
130 143
131void create_pidfile ( ) 144void create_pidfile ( )
132{ 145{
133 FILE *f; 146 FILE *f;
134 147
135 if (( f = ::fopen ( pidfile_path, "w" ))) { 148 if (( f = ::fopen ( pidfile_path, "w" ))) {
136 ::fprintf ( f, "%d", getpid ( )); 149 ::fprintf ( f, "%d", getpid ( ));
137 ::fclose ( f ); 150 ::fclose ( f );
138 } 151 }
139} 152}
140 153
141void remove_pidfile ( ) 154void remove_pidfile ( )
142{ 155{
143 ::unlink ( pidfile_path ); 156 ::unlink ( pidfile_path );