summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/server.cpp127
1 files changed, 85 insertions, 42 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 5ae517b..3bef36e 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -227,17 +227,16 @@ void Server::activate(const ODeviceButton* button, bool held)
sr.send();
}
#endif
}
#ifdef Q_WS_QWS
-
typedef struct KeyOverride {
ushort scan_code;
QWSServer::KeyMap map;
};
static const KeyOverride jp109keys[] = {
{ 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } },
@@ -276,98 +275,116 @@ bool Server::setKeyboardLayout( const QString &kb )
om->insert( k->scan_code, &k->map );
k++;
}
}
QWSServer::setOverrideKeys( om );
return TRUE;
}
-
#endif
void Server::systemMsg(const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "securityChanged()" ) {
if ( transferServer )
transferServer->authorizeConnections();
+
if ( qcopBridge )
qcopBridge->authorizeConnections();
- }
- /* ### FIXME support TempScreenSaverMode */
+ } else
+
#if 0
- else if ( msg == "setTempScreenSaverMode(int,int)" ) {
+ /* ### FIXME support TempScreenSaverMode */
+ if ( msg == "setTempScreenSaverMode(int,int)" ) {
int mode, pid;
stream >> mode >> pid;
tsmMonitor->setTempMode(mode, pid);
- }
+ } else
#endif
- else if ( msg == "linkChanged(QString)" ) {
+
+ if ( msg == "linkChanged(QString)" ) {
QString link;
stream >> link;
odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl;
docList->linkChanged(link);
- } else if ( msg == "serviceChanged(QString)" ) {
+ } else
+
+ if ( msg == "serviceChanged(QString)" ) {
MimeType::updateApplications();
- } else if ( msg == "mkdir(QString)" ) {
+ } else
+
+ if ( msg == "mkdir(QString)" ) {
QString dir;
stream >> dir;
if ( !dir.isEmpty() )
mkdir( dir );
- } else if ( msg == "rdiffGenSig(QString,QString)" ) {
+ } else
+
+ if ( msg == "rdiffGenSig(QString,QString)" ) {
QString baseFile, sigFile;
stream >> baseFile >> sigFile;
QRsync::generateSignature( baseFile, sigFile );
- } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
+ } else
+
+ if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
QString baseFile, sigFile, deltaFile;
stream >> baseFile >> sigFile >> deltaFile;
QRsync::generateDiff( baseFile, sigFile, deltaFile );
- } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
+ } else
+
+ if ( msg == "rdiffApplyPatch(QString,QString)" ) {
QString baseFile, deltaFile;
stream >> baseFile >> deltaFile;
if ( !QFile::exists( baseFile ) ) {
QFile f( baseFile );
f.open( IO_WriteOnly );
f.close();
}
QRsync::applyDiff( baseFile, deltaFile );
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
e << baseFile;
#endif
- } else if ( msg == "rdiffCleanup()" ) {
+ } else
+
+ if ( msg == "rdiffCleanup()" ) {
mkdir( "/tmp/rdiff" );
QDir dir;
dir.setPath( "/tmp/rdiff" );
QStringList entries = dir.entryList();
for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
dir.remove( *it );
- } else if ( msg == "sendHandshakeInfo()" ) {
+ } else
+
+ if ( msg == "sendHandshakeInfo()" ) {
QString home = getenv( "HOME" );
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
e << home;
int locked = (int) ServerApplication::screenLocked();
e << locked;
#endif
+ } else
- }
/*
* QtopiaDesktop relies on the major number
* to start with 1. We're at 0.9
* so wee need to fake at least 1.4 to be able
* to sync with QtopiaDesktop1.6
*/
- else if ( msg == "sendVersionInfo()" ) {
+ if ( msg == "sendVersionInfo()" ) {
QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" );
/* ### FIXME Architecture ### */
e << QString::fromLatin1("1.7") << "Uncustomized Device";
- } else if ( msg == "sendCardInfo()" ) {
+ } else
+
+ if ( msg == "sendCardInfo()" ) {
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
#endif
storage->update();
const QList<FileSystem> &fs = storage->fileSystems();
QListIterator<FileSystem> it ( fs );
QString s;
QString homeDir = getenv("HOME");
@@ -384,89 +401,110 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
homeFs =
(*it)->name() + "=" + homeDir + "/Documents " // No tr
+ QString::number( (*it)->availBlocks() * k4/4 )
+ "K " + (*it)->options() + ";";
}
}
if ( !homeFs.isEmpty() )
s += homeFs;
-
#ifndef QT_NO_COP
e << s;
#endif
- } else if ( msg == "sendSyncDate(QString)" ) {
+ } else
+
+ if ( msg == "sendSyncDate(QString)" ) {
QString app;
stream >> app;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
e << app << cfg.readEntry( app );
#endif
//odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response "
// << cfg.readEntry( app ).latin1() << oendl;
- } else if ( msg == "setSyncDate(QString,QString)" ) {
+ } else
+
+ if ( msg == "setSyncDate(QString,QString)" ) {
QString app, date;
stream >> app >> date;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
cfg.writeEntry( app, date );
//odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl;
- } else if ( msg == "startSync(QString)" ) {
+ } else
+
+ if ( msg == "startSync(QString)" ) {
QString what;
stream >> what;
delete syncDialog;
syncDialog = new SyncDialog( this, what );
syncDialog->show();
connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) );
- } else if ( msg == "stopSync()") {
+ } else
+
+ if ( msg == "stopSync()") {
delete syncDialog;
syncDialog = 0;
- } else if (msg == "restoreDone(QString)") {
+ } else
+
+ if (msg == "restoreDone(QString)") {
docList->restoreDone();
- } else if ( msg == "getAllDocLinks()" ) {
+ } else
+
+ if ( msg == "getAllDocLinks()" ) {
docList->sendAllDocLinks();
- }
+ } else
+
#ifdef Q_WS_QWS
- else if ( msg == "setMouseProto(QString)" ) {
+ if ( msg == "setMouseProto(QString)" ) {
QString mice;
stream >> mice;
setenv("QWS_MOUSE_PROTO",mice.latin1(),1);
qwsServer->openMouse();
- } else if ( msg == "setKeyboard(QString)" ) {
+ } else
+
+ if ( msg == "setKeyboard(QString)" ) {
QString kb;
stream >> kb;
setenv("QWS_KEYBOARD",kb.latin1(),1);
qwsServer->openKeyboard();
+ } else
- } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) {
+ if ( msg == "setKeyboardAutoRepeat(int,int)" ) {
int delay, period;
stream >> delay >> period;
qwsSetKeyboardAutoRepeat( delay, period );
Config cfg( "qpe" );
cfg.setGroup("Keyboard");
cfg.writeEntry( "RepeatDelay", delay );
cfg.writeEntry( "RepeatPeriod", period );
- } else if ( msg == "setKeyboardLayout(QString)" ) {
+ } else
+
+ if ( msg == "setKeyboardLayout(QString)" ) {
QString kb;
stream >> kb;
setKeyboardLayout( kb );
Config cfg( "qpe" );
cfg.setGroup("Keyboard");
cfg.writeEntry( "Layout", kb );
- } else if ( msg == "autoStart(QString)" ) {
+ } else
+
+ if ( msg == "autoStart(QString)" ) {
QString appName;
stream >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( appName.compare("clear") == 0){
cfg.writeEntry("Apps", "");
}
- } else if ( msg == "autoStart(QString,QString)" ) {
+ } else
+
+ if ( msg == "autoStart(QString,QString)" ) {
QString modifier, appName;
stream >> modifier >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add if appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
@@ -477,44 +515,48 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
// should be multiple apps in autostart possible.
QString checkName;
checkName = cfg.readEntry("Apps", "");
if (checkName == appName) {
cfg.writeEntry("Apps", "");
}
}
// case the autostart feature should be delayed
- } else if ( msg == "autoStart(QString,QString,QString)") {
+ } else
+
+ if ( msg == "autoStart(QString,QString,QString)") {
QString modifier, appName, delay;
stream >> modifier >> appName >> delay;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add it appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
cfg.writeEntry("Delay", delay);
}
- } else {
}
}
#endif
}
void Server::receiveTaskBar(const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "reloadApps()" ) {
docList->reloadAppLnks();
- } else if ( msg == "soundAlarm()" ) {
+ } else
+
+ if ( msg == "soundAlarm()" ) {
ServerApplication::soundAlarm();
- }
- else if ( msg == "setLed(int,bool)" ) {
+ } else
+
+ if ( msg == "setLed(int,bool)" ) {
int led, status;
stream >> led >> status;
QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
if ( ll. count ( )) {
OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
@@ -549,19 +591,19 @@ bool Server::mkdir(const QString &localPath)
// didn't find any seps; weird, use the cur dir instead
if (dirIndex == -1) {
//odebug << "No seperators found in path " << localPath << "" << oendl;
checkedPath = QDir::currentDirPath();
}
while (checkedPath != localPath) {
// no more seperators found, use the local path
- if (dirIndex == -1)
+ if (dirIndex == -1) {
checkedPath = localPath;
- else {
+ } else {
// the next directory to check
checkedPath = localPath.left(dirIndex) + "/";
// advance the iterator; the next dir seperator
dirIndex = localPath.find(dirSeps, dirIndex+1);
}
QDir checkDir(checkedPath);
if (!checkDir.exists()) {
@@ -591,39 +633,41 @@ void Server::startTransferServer()
// ... OK
connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress&)),
this, SLOT(syncConnectionClosed(const QHostAddress&)) );
} else {
delete qcopBridge;
qcopBridge = 0;
}
}
+
if ( !transferServer ) {
// start transfer server
transferServer = new TransferServer( 4242 );
if ( transferServer->ok() ) {
// ... OK
} else {
delete transferServer;
transferServer = 0;
}
- }
- if ( !transferServer || !qcopBridge )
+
+ if ( !qcopBridge )
tid_xfer = startTimer( 2000 );
}
+}
void Server::timerEvent( QTimerEvent *e )
{
if ( e->timerId() == tid_xfer ) {
killTimer( tid_xfer );
tid_xfer = 0;
startTransferServer();
}
- /* ### FIXME today startin */
#if 0
+ /* ### FIXME today startin */
else if ( e->timerId() == tid_today ) {
QDate today = QDate::currentDate();
if ( today != last_today_show ) {
last_today_show = today;
Config cfg("today");
cfg.setGroup("Start");
#ifndef QPE_DEFAULT_TODAY_MODE
#define QPE_DEFAULT_TODAY_MODE "Never"
@@ -699,9 +743,8 @@ void Server::preloadApps()
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
#endif
}
}
-