summaryrefslogtreecommitdiff
authorzecke <zecke>2004-07-15 18:58:59 (UTC)
committer zecke <zecke>2004-07-15 18:58:59 (UTC)
commitc96296038ac74083c5bf8009449cb22392cd02dc (patch) (side-by-side diff)
tree0ab461a85b9ab0e13e1382cacc109fd6df277c9c
parent323e9a7472a110b4befba7320540263147505bae (diff)
downloadopie-c96296038ac74083c5bf8009449cb22392cd02dc.zip
opie-c96296038ac74083c5bf8009449cb22392cd02dc.tar.gz
opie-c96296038ac74083c5bf8009449cb22392cd02dc.tar.bz2
Start removing #if 0 which originates from a sync and libqtopia dependency
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp56
-rw-r--r--core/launcher/serverapp.cpp28
2 files changed, 1 insertions, 83 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index a86aca6..b119399 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -27,179 +27,125 @@
#include "calibrate.h"
#include "server.h"
#include "serverapp.h"
#include "stabmon.h"
#include "firstuse.h"
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/odevice.h>
#include <opie2/oglobal.h>
#include <qtopia/network.h>
#include <qtopia/alarmserver.h>
using namespace Opie::Core;
/* QT */
#include <qdir.h>
#include <qmessagebox.h>
#ifdef QWS
#include <qwindowsystem_qws.h>
#include <qtopia/qcopenvelope_qws.h>
#endif
#ifdef Q_WS_QWS
#include <qkeyboard_qws.h>
#endif
/* STD */
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#ifndef Q_OS_WIN32
#include <unistd.h>
#else
#include <process.h>
#endif
static void cleanup()
{
QDir dir( "/tmp", "qcop-msg-*" );
QStringList stale = dir.entryList();
QStringList::Iterator it;
for ( it = stale.begin(); it != stale.end(); ++it ) {
dir.remove( *it );
}
}
static void refreshTimeZoneConfig()
{
- /* ### FIXME timezone handling */
-#if 0
- // We need to help WorldTime in setting up its configuration for
- // the current translation
- // BEGIN no tr
- const char *defaultTz[] = {
- "America/New_York",
- "America/Los_Angeles",
- "Europe/Oslo",
- "Asia/Tokyo",
- "Asia/Hong_Kong",
- "Australia/Brisbane",
- 0
- };
- // END no tr
-
- TimeZone curZone;
- QString zoneID;
- int zoneIndex;
- Config cfg = Config( "WorldTime" );
- cfg.setGroup( "TimeZones" );
- if (!cfg.hasKey( "Zone0" )){
- // We have no existing timezones use the defaults which are untranslated strings
- QString currTz = TimeZone::current().id();
- QStringList zoneDefaults;
- zoneDefaults.append( currTz );
- for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) {
- if ( defaultTz[i] != currTz )
- zoneDefaults.append( defaultTz[i] );
- }
- zoneIndex = 0;
- for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){
- cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it);
- zoneIndex++;
- }
- }
- // We have an existing list of timezones refresh the
- // translations of TimeZone name
- zoneIndex = 0;
- while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){
- zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex ));
- curZone = TimeZone( zoneID );
- if ( !curZone.isValid() ){
- odebug << "initEnvironment() Invalid TimeZone " << zoneID << "" << oendl;
- break;
- }
- cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() );
- zoneIndex++;
- }
-#endif
+ /* ### FIXME timezone handling for qtopia */
}
void initEnvironment()
{
#ifdef Q_OS_WIN32
// Config file requires HOME dir which uses QDir which needs the winver
qt_init_winver();
#endif
Config config("locale");
config.setGroup( "Location" );
QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace();
// if not timezone set, pick New York
if (tz.isNull() || tz.isEmpty())
tz = "America/New_York";
setenv( "TZ", tz, 1 );
config.writeEntry( "Timezone", tz);
config.setGroup( "Language" );
QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace();
if( lang.isNull() || lang.isEmpty())
lang = "en_US";
setenv( "LANG", lang, 1 );
config.writeEntry("Language", lang);
config.write();
-#if 0
- setenv( "QWS_SIZE", "240x320", 0 );
-#endif
-
-
QString env(getenv("QWS_DISPLAY"));
if (env.contains("Transformed")) {
int rot;
// transformed driver default rotation is controlled by the hardware.
Config config("qpe");
config.setGroup( "Rotation" );
if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 )
rot = ODevice::inst ( )-> rotation ( ) * 90;
setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */
}
}
static void initKeyboard()
{
Config config("qpe");
config.setGroup( "Keyboard" );
int ard = config.readNumEntry( "RepeatDelay" );
int arp = config.readNumEntry( "RepeatPeriod" );
if ( ard > 0 && arp > 0 )
qwsSetKeyboardAutoRepeat( ard, arp );
QString layout = config.readEntry( "Layout", "us101" );
Server::setKeyboardLayout( layout );
}
static bool firstUse()
{
bool needFirstUse = FALSE;
if ( QWSServer::mouseHandler() &&
QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
if ( !QFile::exists( "/etc/pointercal" ) )
needFirstUse = TRUE;
}
{
Config config( "qpe" );
config.setGroup( "Startup" );
needFirstUse |= config.readBoolEntry( "FirstUse", TRUE );
}
if ( !needFirstUse )
return FALSE;
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index 54cc313..3d88873 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -471,124 +471,96 @@ void ServerApplication::launcherMessage( const QCString & msg, const QByteArray
{
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "deviceButton(int,int,int)" ) {
int keycode, press, autoRepeat;
stream >> keycode >> press >> autoRepeat;
kf->checkButtonAction ( true, keycode, press, autoRepeat );
}
else if ( msg == "keyRegister(int,QCString,QCString)" ) {
int k;
QCString c, m;
stream >> k >> c >> m;
kf -> registerKey( QCopKeyRegister(k, c, m) );
}
}
bool ServerApplication::screenLocked()
{
return loggedin == 0;
}
void ServerApplication::login(bool at_poweron)
{
if ( !loggedin ) {
Global::terminateBuiltin("calibrate"); // No tr
Password::authenticate(at_poweron);
loggedin=1;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "unlocked()" );
#endif
}
}
#if defined(QPE_HAVE_TOGGLELIGHT)
#include <qtopia/config.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <linux/ioctl.h>
#include <time.h>
#endif
-#if 0
-static bool blanked=FALSE;
-
-static void blankScreen()
-{
-#ifdef QWS
- QWidget w(0, 0, Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WStyle_StaysOnTop | Qt::WPaintUnclipped);
- w.resize( qt_screen->width(), qt_screen->height() );
- w.move(0, 0);
-
- QPainter p(&w);
- p.fillRect(w.rect(), QBrush(QColor(255,255,255)) );
- p.end();
- w.repaint();
-
- blanked = TRUE;
-#endif
-}
-
-static void darkScreen()
-{
- /* ### Screen blanking ODevice */
-#if 0
- qpe_setBacklight(0); // force off
-#endif
-}
-#endif
-
namespace {
void execAutoStart(const QDateTime& suspendTime ) {
QString appName;
int delay;
QDateTime now = QDateTime::currentDateTime();
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
appName = cfg.readEntry( "Apps", "" );
delay = cfg.readNumEntry( "Delay", 0 );
// If the time between suspend and resume was longer then the
// value saved as delay, start the app
if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( appName );
}
}
}
void ServerApplication::togglePower()
{
static bool excllock = false;
if ( excllock )
return ;
excllock = true;
bool wasloggedin = loggedin;
loggedin = 0;
m_suspendTime = QDateTime::currentDateTime();
#ifdef QWS
if ( Password::needToAuthenticate ( true ) && qt_screen ) {
// Should use a big black window instead.
// But this would not show up fast enough
QGfx *g = qt_screen-> screenGfx ( );
g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
delete g;
}
#endif
ODevice::inst ( )-> suspend ( );
ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call