-rw-r--r-- | core/launcher/server.cpp | 145 | ||||
-rw-r--r-- | core/launcher/server.h | 13 |
2 files changed, 117 insertions, 41 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 08baa8e..450d8e5 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp @@ -34,3 +34,5 @@ #include "applauncher.h" +#if 0 #include "suspendmonitor.h" +#endif #include "documentlist.h" @@ -38,8 +40,5 @@ #include <qtopia/applnk.h> -#include <qtopia/categories.h> +#include <qtopia/private/categories.h> #include <qtopia/mimetype.h> #include <qtopia/config.h> -#include <qtopia/services.h> -#include <qtopia/devicebuttonmanager.h> -#include <qtopia/pluginloader.h> #include <qtopia/resource.h> @@ -48,3 +47,2 @@ -#ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> @@ -52,3 +50,2 @@ #include <qgfx_qws.h> -#endif #include <qtopia/global.h> @@ -56,8 +53,6 @@ -#ifdef Q_OS_WIN32 -#include <io.h> -#include <process.h> -#else +#include <opie/odevicebutton.h> +#include <opie/odevice.h> + #include <unistd.h> -#endif #include <qmainwindow.h> @@ -71,2 +66,4 @@ extern QRect qt_maxWindowRect; +using namespace Opie; + static QWidget *calibrate(bool) @@ -111,7 +108,8 @@ static Global::Command builtins[] = { + /* FIXME defines need to be defined*/ #if defined(QPE_NEED_CALIBRATION) - { "calibrate", calibrate, 1, 0 }, // No tr + { "calibrate", calibrate, 1, 0 }, // No tr #endif #if !defined(QT_QWS_CASSIOPEIA) - { "shutdown", Global::shutdown, 1, 0 }, // No tr + { "shutdown", Global::shutdown, 1, 0 }, // No tr // { "run", run, 1, 0 }, // No tr @@ -138,7 +136,10 @@ Server::Server() : tid_xfer = 0; - tid_today = startTimer(3600*2*1000); + /* ### FIXME ### */ +/* tid_today = startTimer(3600*2*1000);*/ last_today_show = QDate::currentDate(); - tsmMonitor = new TempScreenSaverMonitor(); +#if 0 + tsmMonitor = new TempScreenSaverMode(); connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); +#endif @@ -161,3 +162,4 @@ Server::Server() : packageHandler = new PackageHandler( this ); - connect(qApp, SIGNAL(activate(const DeviceButton*,bool)),this,SLOT(activate(const DeviceButton*,bool))); + connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), + this,SLOT(activate(const Opie::ODeviceButton*,bool))); @@ -192,3 +194,5 @@ Server::~Server() delete serverGui; +#if 0 delete tsmMonitor; +#endif } @@ -220,13 +224,19 @@ static bool hasVisibleWindow(const QString& clientname, bool partial) -void Server::activate(const DeviceButton* button, bool held) +void Server::activate(const Opie::ODeviceButton* button, bool held) { Global::terminateBuiltin("calibrate"); // No tr - ServiceRequest sr; + Opie::OQCopMessage om; if ( held ) { - sr = button->heldAction(); + om = button->heldAction(); } else { - sr = button->pressedAction(); + om = button->pressedAction(); } + + if ( om.channel() != "ignore" ) + om.send(); + // A button with no action defined, will return a null ServiceRequest. Don't attempt // to send/do anything with this as it will crash + /* ### FIXME */ +#if 0 if ( !sr.isNull() ) { @@ -243,2 +253,3 @@ void Server::activate(const DeviceButton* button, bool held) } +#endif } @@ -309,3 +320,6 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) qcopBridge->authorizeConnections(); - } else if ( msg == "setTempScreenSaverMode(int,int)" ) { + } + /* ### FIXME support TempScreenSaverMode */ +#if 0 + else if ( msg == "setTempScreenSaverMode(int,int)" ) { int mode, pid; @@ -313,3 +327,5 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) tsmMonitor->setTempMode(mode, pid); - } else if ( msg == "linkChanged(QString)" ) { + } +#endif + else if ( msg == "linkChanged(QString)" ) { QString link; @@ -362,6 +378,13 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) - } else if ( msg == "sendVersionInfo()" ) { + } + /* + * 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()" ) { QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); - QString v = QPE_VERSION; - e << Global::version() << Global::architecture(); + /* ### FIXME Architecture ### */ + e << QString::fromLatin1("1.7") << "Uncustomized Device"; } else if ( msg == "sendCardInfo()" ) { @@ -457,2 +480,45 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) cfg.writeEntry( "Layout", kb ); + } 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)" ) { + 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); + } + } else if (modifier.compare("remove") == 0 ) { + // need to change for multiple entries + // actually remove is right now simular to clear, but in future there + // 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)") { + 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 { + } } @@ -468,5 +534,4 @@ void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) } else if ( msg == "soundAlarm()" ) { - soundAlarm(); + ServerApplication::soundAlarm(); } -#ifdef CUSTOM_LEDS else if ( msg == "setLed(int,bool)" ) { @@ -474,5 +539,11 @@ void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) stream >> led >> status; - CUSTOM_LEDS( 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 ); + + ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); + } } -#endif } @@ -572,3 +643,6 @@ void Server::timerEvent( QTimerEvent *e ) startTransferServer(); - } else if ( e->timerId() == tid_today ) { + } + /* ### FIXME today startin */ +#if 0 + else if ( e->timerId() == tid_today ) { QDate today = QDate::currentDate(); @@ -586,2 +660,3 @@ void Server::timerEvent( QTimerEvent *e ) } +#endif } @@ -605,2 +680,3 @@ void Server::pokeTimeMonitors() { +#if 0 // inform all TimeMonitors @@ -612,2 +688,3 @@ void Server::pokeTimeMonitors() } +#endif } @@ -622,3 +699,5 @@ void Server::applicationTerminated(int pid, const QString &app) serverGui->applicationStateChanged( app, ServerInterface::Terminated ); +#if 0 tsmMonitor->applicationTerminated( pid ); +#endif } @@ -638,8 +717,2 @@ void Server::storageChanged() -void Server::soundAlarm() -{ -#ifdef CUSTOM_SOUND_ALARM - CUSTOM_SOUND_ALARM; -#endif -} diff --git a/core/launcher/server.h b/core/launcher/server.h index 21b03af..91bf883 100644 --- a/core/launcher/server.h +++ b/core/launcher/server.h @@ -31,3 +31,2 @@ class TransferServer; class PackageHandler; -class DeviceButton; class ServiceRequest; @@ -40,2 +39,5 @@ class DocumentList; class ServerInterface; +namespace Opie { + class ODeviceButton; +} @@ -51,3 +53,2 @@ public: - static void soundAlarm(); static bool setKeyboardLayout( const QString &kb ); @@ -61,3 +62,3 @@ public slots: private slots: - void activate(const DeviceButton*,bool); + void activate(const Opie::ODeviceButton*,bool); void syncConnectionClosed( const QHostAddress & ); @@ -74,2 +75,3 @@ protected: private: + void layout(); void startTransferServer(); @@ -82,4 +84,5 @@ private: int tid_xfer; - int tid_today; - TempScreenSaverMonitor *tsmMonitor; + /* ### FIXME two below### */ +// int tid_today; +// TempScreenSaverMonitor *tsmMonitor; StorageInfo *storage; |