summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-28 14:42:16 (UTC)
committer zecke <zecke>2003-08-28 14:42:16 (UTC)
commit2765a1008ca0ea05af1762616a827d1f3c35431e (patch) (side-by-side diff)
tree385268125d4f12dc2f0bc3cb1f02216d29cffbb6
parentfcc9c16cbd679ebc459ff0ec6228bbdedbfdfe1d (diff)
downloadopie-2765a1008ca0ea05af1762616a827d1f3c35431e.zip
opie-2765a1008ca0ea05af1762616a827d1f3c35431e.tar.gz
opie-2765a1008ca0ea05af1762616a827d1f3c35431e.tar.bz2
Opiefy and include Opie changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/server.cpp145
-rw-r--r--core/launcher/server.h13
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
@@ -33,32 +33,27 @@
#include "shutdownimpl.h"
#include "applauncher.h"
+#if 0
#include "suspendmonitor.h"
+#endif
#include "documentlist.h"
#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>
#include <qtopia/version.h>
#include <qtopia/storage.h>
-#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#include <qwindowsystem_qws.h>
#include <qgfx_qws.h>
-#endif
#include <qtopia/global.h>
#include <qtopia/custom.h>
-#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>
#include <qmessagebox.h>
@@ -70,4 +65,6 @@
extern QRect qt_maxWindowRect;
+using namespace Opie;
+
static QWidget *calibrate(bool)
{
@@ -110,9 +107,10 @@ static Global::Command builtins[] = {
#endif
+ /* 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
#endif
@@ -137,9 +135,12 @@ 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
serverGui = new Launcher;
@@ -160,5 +161,6 @@ 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)));
setGeometry( -10, -10, 9, 9 );
@@ -191,5 +193,7 @@ Server::~Server()
delete transferServer;
delete serverGui;
+#if 0
delete tsmMonitor;
+#endif
}
@@ -219,15 +223,21 @@ 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() ) {
QString app = sr.app();
@@ -242,4 +252,5 @@ void Server::activate(const DeviceButton* button, bool held)
sr.send();
}
+#endif
}
@@ -308,9 +319,14 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
if ( qcopBridge )
qcopBridge->authorizeConnections();
- } else if ( msg == "setTempScreenSaverMode(int,int)" ) {
+ }
+ /* ### FIXME support TempScreenSaverMode */
+#if 0
+ else if ( msg == "setTempScreenSaverMode(int,int)" ) {
int mode, pid;
stream >> mode >> pid;
tsmMonitor->setTempMode(mode, pid);
- } else if ( msg == "linkChanged(QString)" ) {
+ }
+#endif
+ else if ( msg == "linkChanged(QString)" ) {
QString link;
stream >> link;
@@ -361,8 +377,15 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
#endif
- } 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()" ) {
#ifndef QT_NO_COP
@@ -456,4 +479,47 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
cfg.setGroup("Keyboard");
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 {
+ }
}
#endif
@@ -467,13 +533,18 @@ void Server::receiveTaskBar(const QCString &msg, const QByteArray &data)
docList->reloadAppLnks();
} else if ( msg == "soundAlarm()" ) {
- soundAlarm();
+ ServerApplication::soundAlarm();
}
-#ifdef CUSTOM_LEDS
else if ( msg == "setLed(int,bool)" ) {
int led, status;
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
}
@@ -571,5 +642,8 @@ void Server::timerEvent( QTimerEvent *e )
tid_xfer = 0;
startTransferServer();
- } else if ( e->timerId() == tid_today ) {
+ }
+ /* ### FIXME today startin */
+#if 0
+ else if ( e->timerId() == tid_today ) {
QDate today = QDate::currentDate();
if ( today != last_today_show ) {
@@ -585,4 +659,5 @@ void Server::timerEvent( QTimerEvent *e )
}
}
+#endif
}
@@ -604,4 +679,5 @@ void Server::syncConnectionClosed( const QHostAddress & )
void Server::pokeTimeMonitors()
{
+#if 0
// inform all TimeMonitors
QStrList tms = Service::channels("TimeMonitor");
@@ -611,4 +687,5 @@ void Server::pokeTimeMonitors()
e << t;
}
+#endif
}
@@ -621,5 +698,7 @@ void Server::applicationTerminated(int pid, const QString &app)
{
serverGui->applicationStateChanged( app, ServerInterface::Terminated );
+#if 0
tsmMonitor->applicationTerminated( pid );
+#endif
}
@@ -637,10 +716,4 @@ void Server::storageChanged()
-void Server::soundAlarm()
-{
-#ifdef CUSTOM_SOUND_ALARM
- CUSTOM_SOUND_ALARM;
-#endif
-}
void Server::preloadApps()
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
@@ -30,5 +30,4 @@ class QHostAddress;
class TransferServer;
class PackageHandler;
-class DeviceButton;
class ServiceRequest;
class TempScreenSaverMonitor;
@@ -39,4 +38,7 @@ class SyncDialog;
class DocumentList;
class ServerInterface;
+namespace Opie {
+ class ODeviceButton;
+}
class Server : public QWidget {
@@ -50,5 +52,4 @@ public:
void show();
- static void soundAlarm();
static bool setKeyboardLayout( const QString &kb );
@@ -60,5 +61,5 @@ public slots:
private slots:
- void activate(const DeviceButton*,bool);
+ void activate(const Opie::ODeviceButton*,bool);
void syncConnectionClosed( const QHostAddress & );
void applicationLaunched(int pid, const QString &app);
@@ -73,4 +74,5 @@ protected:
private:
+ void layout();
void startTransferServer();
void preloadApps();
@@ -81,6 +83,7 @@ private:
QDate last_today_show;
int tid_xfer;
- int tid_today;
- TempScreenSaverMonitor *tsmMonitor;
+ /* ### FIXME two below### */
+// int tid_today;
+// TempScreenSaverMonitor *tsmMonitor;
StorageInfo *storage;
SyncDialog *syncDialog;