-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 | |||
@@ -33,32 +33,27 @@ | |||
33 | #include "shutdownimpl.h" | 33 | #include "shutdownimpl.h" |
34 | #include "applauncher.h" | 34 | #include "applauncher.h" |
35 | #if 0 | ||
35 | #include "suspendmonitor.h" | 36 | #include "suspendmonitor.h" |
37 | #endif | ||
36 | #include "documentlist.h" | 38 | #include "documentlist.h" |
37 | 39 | ||
38 | #include <qtopia/applnk.h> | 40 | #include <qtopia/applnk.h> |
39 | #include <qtopia/categories.h> | 41 | #include <qtopia/private/categories.h> |
40 | #include <qtopia/mimetype.h> | 42 | #include <qtopia/mimetype.h> |
41 | #include <qtopia/config.h> | 43 | #include <qtopia/config.h> |
42 | #include <qtopia/services.h> | ||
43 | #include <qtopia/devicebuttonmanager.h> | ||
44 | #include <qtopia/pluginloader.h> | ||
45 | #include <qtopia/resource.h> | 44 | #include <qtopia/resource.h> |
46 | #include <qtopia/version.h> | 45 | #include <qtopia/version.h> |
47 | #include <qtopia/storage.h> | 46 | #include <qtopia/storage.h> |
48 | 47 | ||
49 | #ifdef Q_WS_QWS | ||
50 | #include <qtopia/qcopenvelope_qws.h> | 48 | #include <qtopia/qcopenvelope_qws.h> |
51 | #include <qwindowsystem_qws.h> | 49 | #include <qwindowsystem_qws.h> |
52 | #include <qgfx_qws.h> | 50 | #include <qgfx_qws.h> |
53 | #endif | ||
54 | #include <qtopia/global.h> | 51 | #include <qtopia/global.h> |
55 | #include <qtopia/custom.h> | 52 | #include <qtopia/custom.h> |
56 | 53 | ||
57 | #ifdef Q_OS_WIN32 | 54 | #include <opie/odevicebutton.h> |
58 | #include <io.h> | 55 | #include <opie/odevice.h> |
59 | #include <process.h> | 56 | |
60 | #else | ||
61 | #include <unistd.h> | 57 | #include <unistd.h> |
62 | #endif | ||
63 | #include <qmainwindow.h> | 58 | #include <qmainwindow.h> |
64 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
@@ -70,4 +65,6 @@ | |||
70 | extern QRect qt_maxWindowRect; | 65 | extern QRect qt_maxWindowRect; |
71 | 66 | ||
67 | using namespace Opie; | ||
68 | |||
72 | static QWidget *calibrate(bool) | 69 | static QWidget *calibrate(bool) |
73 | { | 70 | { |
@@ -110,9 +107,10 @@ static Global::Command builtins[] = { | |||
110 | #endif | 107 | #endif |
111 | 108 | ||
109 | /* FIXME defines need to be defined*/ | ||
112 | #if defined(QPE_NEED_CALIBRATION) | 110 | #if defined(QPE_NEED_CALIBRATION) |
113 | { "calibrate", calibrate,1, 0 }, // No tr | 111 | { "calibrate", calibrate, 1, 0 }, // No tr |
114 | #endif | 112 | #endif |
115 | #if !defined(QT_QWS_CASSIOPEIA) | 113 | #if !defined(QT_QWS_CASSIOPEIA) |
116 | { "shutdown", Global::shutdown, 1, 0 }, // No tr | 114 | { "shutdown", Global::shutdown, 1, 0 }, // No tr |
117 | // { "run", run, 1, 0 }, // No tr | 115 | // { "run", run, 1, 0 }, // No tr |
118 | #endif | 116 | #endif |
@@ -137,9 +135,12 @@ Server::Server() : | |||
137 | 135 | ||
138 | tid_xfer = 0; | 136 | tid_xfer = 0; |
139 | tid_today = startTimer(3600*2*1000); | 137 | /* ### FIXME ### */ |
138 | /* tid_today = startTimer(3600*2*1000);*/ | ||
140 | last_today_show = QDate::currentDate(); | 139 | last_today_show = QDate::currentDate(); |
141 | 140 | ||
142 | tsmMonitor = new TempScreenSaverMonitor(); | 141 | #if 0 |
142 | tsmMonitor = new TempScreenSaverMode(); | ||
143 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); | 143 | connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) ); |
144 | #endif | ||
144 | 145 | ||
145 | serverGui = new Launcher; | 146 | serverGui = new Launcher; |
@@ -160,5 +161,6 @@ Server::Server() : | |||
160 | 161 | ||
161 | packageHandler = new PackageHandler( this ); | 162 | packageHandler = new PackageHandler( this ); |
162 | connect(qApp, SIGNAL(activate(const DeviceButton*,bool)),this,SLOT(activate(const DeviceButton*,bool))); | 163 | connect(qApp, SIGNAL(activate(const Opie::ODeviceButton*,bool)), |
164 | this,SLOT(activate(const Opie::ODeviceButton*,bool))); | ||
163 | 165 | ||
164 | setGeometry( -10, -10, 9, 9 ); | 166 | setGeometry( -10, -10, 9, 9 ); |
@@ -191,5 +193,7 @@ Server::~Server() | |||
191 | delete transferServer; | 193 | delete transferServer; |
192 | delete serverGui; | 194 | delete serverGui; |
195 | #if 0 | ||
193 | delete tsmMonitor; | 196 | delete tsmMonitor; |
197 | #endif | ||
194 | } | 198 | } |
195 | 199 | ||
@@ -219,15 +223,21 @@ static bool hasVisibleWindow(const QString& clientname, bool partial) | |||
219 | } | 223 | } |
220 | 224 | ||
221 | void Server::activate(const DeviceButton* button, bool held) | 225 | void Server::activate(const Opie::ODeviceButton* button, bool held) |
222 | { | 226 | { |
223 | Global::terminateBuiltin("calibrate"); // No tr | 227 | Global::terminateBuiltin("calibrate"); // No tr |
224 | ServiceRequest sr; | 228 | Opie::OQCopMessage om; |
225 | if ( held ) { | 229 | if ( held ) { |
226 | sr = button->heldAction(); | 230 | om = button->heldAction(); |
227 | } else { | 231 | } else { |
228 | sr = button->pressedAction(); | 232 | om = button->pressedAction(); |
229 | } | 233 | } |
234 | |||
235 | if ( om.channel() != "ignore" ) | ||
236 | om.send(); | ||
237 | |||
230 | // A button with no action defined, will return a null ServiceRequest. Don't attempt | 238 | // A button with no action defined, will return a null ServiceRequest. Don't attempt |
231 | // to send/do anything with this as it will crash | 239 | // to send/do anything with this as it will crash |
240 | /* ### FIXME */ | ||
241 | #if 0 | ||
232 | if ( !sr.isNull() ) { | 242 | if ( !sr.isNull() ) { |
233 | QString app = sr.app(); | 243 | QString app = sr.app(); |
@@ -242,4 +252,5 @@ void Server::activate(const DeviceButton* button, bool held) | |||
242 | sr.send(); | 252 | sr.send(); |
243 | } | 253 | } |
254 | #endif | ||
244 | } | 255 | } |
245 | 256 | ||
@@ -308,9 +319,14 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
308 | if ( qcopBridge ) | 319 | if ( qcopBridge ) |
309 | qcopBridge->authorizeConnections(); | 320 | qcopBridge->authorizeConnections(); |
310 | } else if ( msg == "setTempScreenSaverMode(int,int)" ) { | 321 | } |
322 | /* ### FIXME support TempScreenSaverMode */ | ||
323 | #if 0 | ||
324 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { | ||
311 | int mode, pid; | 325 | int mode, pid; |
312 | stream >> mode >> pid; | 326 | stream >> mode >> pid; |
313 | tsmMonitor->setTempMode(mode, pid); | 327 | tsmMonitor->setTempMode(mode, pid); |
314 | } else if ( msg == "linkChanged(QString)" ) { | 328 | } |
329 | #endif | ||
330 | else if ( msg == "linkChanged(QString)" ) { | ||
315 | QString link; | 331 | QString link; |
316 | stream >> link; | 332 | stream >> link; |
@@ -361,8 +377,15 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
361 | #endif | 377 | #endif |
362 | 378 | ||
363 | } else if ( msg == "sendVersionInfo()" ) { | 379 | } |
380 | /* | ||
381 | * QtopiaDesktop relies on the major number | ||
382 | * to start with 1. We're at 0.9 | ||
383 | * so wee need to fake at least 1.4 to be able | ||
384 | * to sync with QtopiaDesktop1.6 | ||
385 | */ | ||
386 | else if ( msg == "sendVersionInfo()" ) { | ||
364 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); | 387 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); |
365 | QString v = QPE_VERSION; | 388 | /* ### FIXME Architecture ### */ |
366 | e << Global::version() << Global::architecture(); | 389 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; |
367 | } else if ( msg == "sendCardInfo()" ) { | 390 | } else if ( msg == "sendCardInfo()" ) { |
368 | #ifndef QT_NO_COP | 391 | #ifndef QT_NO_COP |
@@ -456,4 +479,47 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
456 | cfg.setGroup("Keyboard"); | 479 | cfg.setGroup("Keyboard"); |
457 | cfg.writeEntry( "Layout", kb ); | 480 | cfg.writeEntry( "Layout", kb ); |
481 | } else if ( msg == "autoStart(QString)" ) { | ||
482 | QString appName; | ||
483 | stream >> appName; | ||
484 | Config cfg( "autostart" ); | ||
485 | cfg.setGroup( "AutoStart" ); | ||
486 | if ( appName.compare("clear") == 0){ | ||
487 | cfg.writeEntry("Apps", ""); | ||
488 | } | ||
489 | } else if ( msg == "autoStart(QString,QString)" ) { | ||
490 | QString modifier, appName; | ||
491 | stream >> modifier >> appName; | ||
492 | Config cfg( "autostart" ); | ||
493 | cfg.setGroup( "AutoStart" ); | ||
494 | if ( modifier.compare("add") == 0 ){ | ||
495 | // only add if appname is entered | ||
496 | if (!appName.isEmpty()) { | ||
497 | cfg.writeEntry("Apps", appName); | ||
498 | } | ||
499 | } else if (modifier.compare("remove") == 0 ) { | ||
500 | // need to change for multiple entries | ||
501 | // actually remove is right now simular to clear, but in future there | ||
502 | // should be multiple apps in autostart possible. | ||
503 | QString checkName; | ||
504 | checkName = cfg.readEntry("Apps", ""); | ||
505 | if (checkName == appName) { | ||
506 | cfg.writeEntry("Apps", ""); | ||
507 | } | ||
508 | } | ||
509 | // case the autostart feature should be delayed | ||
510 | } else if ( msg == "autoStart(QString,QString,QString)") { | ||
511 | QString modifier, appName, delay; | ||
512 | stream >> modifier >> appName >> delay; | ||
513 | Config cfg( "autostart" ); | ||
514 | |||
515 | cfg.setGroup( "AutoStart" ); | ||
516 | if ( modifier.compare("add") == 0 ){ | ||
517 | // only add it appname is entered | ||
518 | if (!appName.isEmpty()) { | ||
519 | cfg.writeEntry("Apps", appName); | ||
520 | cfg.writeEntry("Delay", delay); | ||
521 | } | ||
522 | } else { | ||
523 | } | ||
458 | } | 524 | } |
459 | #endif | 525 | #endif |
@@ -467,13 +533,18 @@ void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) | |||
467 | docList->reloadAppLnks(); | 533 | docList->reloadAppLnks(); |
468 | } else if ( msg == "soundAlarm()" ) { | 534 | } else if ( msg == "soundAlarm()" ) { |
469 | soundAlarm(); | 535 | ServerApplication::soundAlarm(); |
470 | } | 536 | } |
471 | #ifdef CUSTOM_LEDS | ||
472 | else if ( msg == "setLed(int,bool)" ) { | 537 | else if ( msg == "setLed(int,bool)" ) { |
473 | int led, status; | 538 | int led, status; |
474 | stream >> led >> status; | 539 | stream >> led >> status; |
475 | CUSTOM_LEDS( led, status ); | 540 | |
541 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); | ||
542 | if ( ll. count ( )){ | ||
543 | OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0]; | ||
544 | bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow ); | ||
545 | |||
546 | ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off ); | ||
547 | } | ||
476 | } | 548 | } |
477 | #endif | ||
478 | } | 549 | } |
479 | 550 | ||
@@ -571,5 +642,8 @@ void Server::timerEvent( QTimerEvent *e ) | |||
571 | tid_xfer = 0; | 642 | tid_xfer = 0; |
572 | startTransferServer(); | 643 | startTransferServer(); |
573 | } else if ( e->timerId() == tid_today ) { | 644 | } |
645 | /* ### FIXME today startin */ | ||
646 | #if 0 | ||
647 | else if ( e->timerId() == tid_today ) { | ||
574 | QDate today = QDate::currentDate(); | 648 | QDate today = QDate::currentDate(); |
575 | if ( today != last_today_show ) { | 649 | if ( today != last_today_show ) { |
@@ -585,4 +659,5 @@ void Server::timerEvent( QTimerEvent *e ) | |||
585 | } | 659 | } |
586 | } | 660 | } |
661 | #endif | ||
587 | } | 662 | } |
588 | 663 | ||
@@ -604,4 +679,5 @@ void Server::syncConnectionClosed( const QHostAddress & ) | |||
604 | void Server::pokeTimeMonitors() | 679 | void Server::pokeTimeMonitors() |
605 | { | 680 | { |
681 | #if 0 | ||
606 | // inform all TimeMonitors | 682 | // inform all TimeMonitors |
607 | QStrList tms = Service::channels("TimeMonitor"); | 683 | QStrList tms = Service::channels("TimeMonitor"); |
@@ -611,4 +687,5 @@ void Server::pokeTimeMonitors() | |||
611 | e << t; | 687 | e << t; |
612 | } | 688 | } |
689 | #endif | ||
613 | } | 690 | } |
614 | 691 | ||
@@ -621,5 +698,7 @@ void Server::applicationTerminated(int pid, const QString &app) | |||
621 | { | 698 | { |
622 | serverGui->applicationStateChanged( app, ServerInterface::Terminated ); | 699 | serverGui->applicationStateChanged( app, ServerInterface::Terminated ); |
700 | #if 0 | ||
623 | tsmMonitor->applicationTerminated( pid ); | 701 | tsmMonitor->applicationTerminated( pid ); |
702 | #endif | ||
624 | } | 703 | } |
625 | 704 | ||
@@ -637,10 +716,4 @@ void Server::storageChanged() | |||
637 | 716 | ||
638 | 717 | ||
639 | void Server::soundAlarm() | ||
640 | { | ||
641 | #ifdef CUSTOM_SOUND_ALARM | ||
642 | CUSTOM_SOUND_ALARM; | ||
643 | #endif | ||
644 | } | ||
645 | 718 | ||
646 | void Server::preloadApps() | 719 | 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; | |||
30 | class TransferServer; | 30 | class TransferServer; |
31 | class PackageHandler; | 31 | class PackageHandler; |
32 | class DeviceButton; | ||
33 | class ServiceRequest; | 32 | class ServiceRequest; |
34 | class TempScreenSaverMonitor; | 33 | class TempScreenSaverMonitor; |
@@ -39,4 +38,7 @@ class SyncDialog; | |||
39 | class DocumentList; | 38 | class DocumentList; |
40 | class ServerInterface; | 39 | class ServerInterface; |
40 | namespace Opie { | ||
41 | class ODeviceButton; | ||
42 | } | ||
41 | 43 | ||
42 | class Server : public QWidget { | 44 | class Server : public QWidget { |
@@ -50,5 +52,4 @@ public: | |||
50 | void show(); | 52 | void show(); |
51 | 53 | ||
52 | static void soundAlarm(); | ||
53 | static bool setKeyboardLayout( const QString &kb ); | 54 | static bool setKeyboardLayout( const QString &kb ); |
54 | 55 | ||
@@ -60,5 +61,5 @@ public slots: | |||
60 | 61 | ||
61 | private slots: | 62 | private slots: |
62 | void activate(const DeviceButton*,bool); | 63 | void activate(const Opie::ODeviceButton*,bool); |
63 | void syncConnectionClosed( const QHostAddress & ); | 64 | void syncConnectionClosed( const QHostAddress & ); |
64 | void applicationLaunched(int pid, const QString &app); | 65 | void applicationLaunched(int pid, const QString &app); |
@@ -73,4 +74,5 @@ protected: | |||
73 | 74 | ||
74 | private: | 75 | private: |
76 | void layout(); | ||
75 | void startTransferServer(); | 77 | void startTransferServer(); |
76 | void preloadApps(); | 78 | void preloadApps(); |
@@ -81,6 +83,7 @@ private: | |||
81 | QDate last_today_show; | 83 | QDate last_today_show; |
82 | int tid_xfer; | 84 | int tid_xfer; |
83 | int tid_today; | 85 | /* ### FIXME two below### */ |
84 | TempScreenSaverMonitor *tsmMonitor; | 86 | // int tid_today; |
87 | // TempScreenSaverMonitor *tsmMonitor; | ||
85 | StorageInfo *storage; | 88 | StorageInfo *storage; |
86 | SyncDialog *syncDialog; | 89 | SyncDialog *syncDialog; |