summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/server.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index ad40536..74965df 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -67,193 +67,193 @@
#include <opie/odevice.h>
using namespace Opie;
static void cleanup()
{
QDir dir( Opie::Global::tempDir(), "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() ){
qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() );
break;
}
cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() );
zoneIndex++;
}
#endif
}
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 !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX)
+#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;
FirstUse *fu = new FirstUse();
fu->exec();
bool rs = fu->restartNeeded();
delete fu;
return rs;
}
int initApplication( int argc, char ** argv )
{
cleanup();
initEnvironment();
//Don't flicker at startup:
#ifdef QWS
QWSServer::setDesktopBackground( QImage() );
#endif
ServerApplication a( argc, argv, QApplication::GuiServer );
refreshTimeZoneConfig();
initKeyboard();
// Don't use first use under Windows
if ( firstUse() ) {
a.restart();
return 0;
}
ODevice::inst ( )-> setSoftSuspend ( true );
{
QCopEnvelope e("QPE/System", "setBacklight(int)" );
e << -3; // Forced on
}
AlarmServer::initialize();
Server *s = new Server();
(void)new SysFileMonitor(s);
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 450d8e5..4c62b78 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -17,193 +17,193 @@
** not clear to you.
**
**********************************************************************/
#include "server.h"
#include "serverapp.h"
#include "launcher.h"
#include "startmenu.h"
#include "transferserver.h"
#include "qcopbridge.h"
#include "irserver.h"
#include "packageslave.h"
#include "calibrate.h"
#include "qrsync.h"
#include "syncdialog.h"
#include "launcher.h"
#include "shutdownimpl.h"
#include "applauncher.h"
#if 0
#include "suspendmonitor.h"
#endif
#include "documentlist.h"
#include <qtopia/applnk.h>
#include <qtopia/private/categories.h>
#include <qtopia/mimetype.h>
#include <qtopia/config.h>
#include <qtopia/resource.h>
#include <qtopia/version.h>
#include <qtopia/storage.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qgfx_qws.h>
#include <qtopia/global.h>
#include <qtopia/custom.h>
#include <opie/odevicebutton.h>
#include <opie/odevice.h>
#include <unistd.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qtextstream.h>
#include <stdlib.h>
extern QRect qt_maxWindowRect;
using namespace Opie;
static QWidget *calibrate(bool)
{
#ifdef Q_WS_QWS
Calibrate *c = new Calibrate;
c->show();
return c;
#else
return 0;
#endif
}
#define FACTORY(T) \
static QWidget *new##T( bool maximized ) { \
QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
if ( maximized ) { \
if ( qApp->desktop()->width() <= 350 ) { \
w->showMaximized(); \
} else { \
w->resize( QSize( 300, 300 ) ); \
} \
} \
w->show(); \
return w; \
}
#ifdef SINGLE_APP
#define APP(a,b,c,d) FACTORY(b)
#include "apps.h"
#undef APP
#endif // SINGLE_APP
static Global::Command builtins[] = {
#ifdef SINGLE_APP
#define APP(a,b,c,d) { a, new##b, c, d },
#include "apps.h"
#undef APP
#endif
/* FIXME defines need to be defined*/
#if defined(QPE_NEED_CALIBRATION)
{ "calibrate", calibrate, 1, 0 }, // No tr
#endif
-#if !defined(QT_QWS_CASSIOPEIA)
+#if !defined(OPIE_NO_BUILTIN_SHUTDOWN)
{ "shutdown", Global::shutdown, 1, 0 }, // No tr
// { "run", run, 1, 0 }, // No tr
#endif
{ 0, calibrate, 0, 0 },
};
//---------------------------------------------------------------------------
//===========================================================================
Server::Server() :
QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
qcopBridge( 0 ),
transferServer( 0 ),
packageHandler( 0 ),
syncDialog( 0 )
{
Global::setBuiltinCommands(builtins);
tid_xfer = 0;
/* ### FIXME ### */
/* tid_today = startTimer(3600*2*1000);*/
last_today_show = QDate::currentDate();
#if 0
tsmMonitor = new TempScreenSaverMode();
connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) );
#endif
serverGui = new Launcher;
serverGui->createGUI();
docList = new DocumentList( serverGui );
appLauncher = new AppLauncher(this);
connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) );
connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) );
connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) );
storage = new StorageInfo( this );
connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
// start services
startTransferServer();
(void) new IrServer( this );
packageHandler = new PackageHandler( this );
connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
this,SLOT(activate(const Opie::ODeviceButton*,bool)));
setGeometry( -10, -10, 9, 9 );
QCopChannel *channel = new QCopChannel("QPE/System", this);
connect(channel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(systemMsg(const QCString &, const QByteArray &)) );
QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) );
connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
preloadApps();
}
void Server::show()
{
ServerApplication::login(TRUE);
QWidget::show();
}
Server::~Server()
{
serverGui->destroyGUI();
delete docList;
delete qcopBridge;
delete transferServer;
delete serverGui;
#if 0
delete tsmMonitor;
#endif
}
static bool hasVisibleWindow(const QString& clientname, bool partial)
{
#ifdef QWS
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
if ( w->client()->identity() == clientname ) {
if ( partial && !w->isFullyObscured() )
return TRUE;
if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {