summaryrefslogtreecommitdiff
path: root/core
authorsandman <sandman>2002-10-29 22:09:37 (UTC)
committer sandman <sandman>2002-10-29 22:09:37 (UTC)
commit1e294abab44c96f1fdf4fe0e7083a19fbeb970e0 (patch) (side-by-side diff)
treedaa27f50fcd27d00ef165e46a4ba948346fc7437 /core
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 (limited to 'core') (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 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "desktop.h"
#include "taskbar.h"
#include "stabmon.h"
#include <qpe/qpeapplication.h>
#include <qpe/network.h>
#include <qpe/config.h>
#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
#include <qpe/custom.h>
#endif
#include <opie/odevice.h>
+#include <qmessagebox.h>
#include <qfile.h>
#include <qimage.h>
#include <qwindowsystem_qws.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/alarmserver.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
#include "../calibrate/calibrate.h"
#endif
using namespace Opie;
void initEnvironment()
{
Config config("locale");
config.setGroup( "Location" );
QString tz = config.readEntry( "Timezone", getenv("TZ") );
// if not timezone set, pick New York
@@ -96,48 +97,60 @@ int initApplication( int argc, char ** argv )
QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
(void)new SysFileMonitor(d);
Network::createServer(d);
#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
if ( !QFile::exists( "/etc/pointercal" ) ) {
// Make sure calibration widget starts on top.
Calibrate *cal = new Calibrate;
cal->exec();
delete cal;
}
#endif
d->show();
+ if ( QDate::currentDate ( ). year ( ) < 2000 ) {
+ 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 ) {
+ QCString app;
+ if ( QFile::exists ( QPEApplication::qpeDir ( ) + "/bin/netsystemtime" ))
+ app = "netsystemtime";
+ else
+ app = "systemtime";
+ QCopEnvelope e ( "QPE/Application/" + app, "setDocument(QString)" );
+ e << QString ( );
+ }
+ }
+
int rv = a.exec();
delete d;
ODevice::inst ( )-> setSoftSuspend ( false );
return rv;
}
static const char *pidfile_path = "/var/run/opie.pid";
void create_pidfile ( )
{
FILE *f;
if (( f = ::fopen ( pidfile_path, "w" ))) {
::fprintf ( f, "%d", getpid ( ));
::fclose ( f );
}
}
void remove_pidfile ( )
{
::unlink ( pidfile_path );