-rw-r--r-- | core/launcher/server.cpp | 210 |
1 files changed, 106 insertions, 104 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 42186d3..15cd686 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -155,25 +155,25 @@ Server::Server() : | |||
155 | appLauncher = new AppLauncher(this); | 155 | appLauncher = new AppLauncher(this); |
156 | connect(appLauncher, SIGNAL(launched(int,const QString&)), this, SLOT(applicationLaunched(int,const QString&)) ); | 156 | connect(appLauncher, SIGNAL(launched(int,const QString&)), this, SLOT(applicationLaunched(int,const QString&)) ); |
157 | connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) ); | 157 | connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) ); |
158 | connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) ); | 158 | connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) ); |
159 | 159 | ||
160 | storage = new StorageInfo( this ); | 160 | storage = new StorageInfo( this ); |
161 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); | 161 | connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); |
162 | 162 | ||
163 | 163 | ||
164 | #ifdef QPE_HAVE_DIRECT_ACCESS | 164 | #ifdef QPE_HAVE_DIRECT_ACCESS |
165 | QCopChannel *desktopChannel = new QCopChannel( "QPE/Desktop", this ); | 165 | QCopChannel *desktopChannel = new QCopChannel( "QPE/Desktop", this ); |
166 | connect( desktopChannel, SIGNAL(received( const QCString &, const QByteArray & )), | 166 | connect( desktopChannel, SIGNAL(received( const QCString &, const QByteArray & )), |
167 | this, SLOT(desktopMessage( const QCString &, const QByteArray & )) ); | 167 | this, SLOT(desktopMessage( const QCString &, const QByteArray & )) ); |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | // start services | 170 | // start services |
171 | startTransferServer(); | 171 | startTransferServer(); |
172 | (void) new IrServer( this ); | 172 | (void) new IrServer( this ); |
173 | 173 | ||
174 | packageHandler = new PackageHandler( this ); | 174 | packageHandler = new PackageHandler( this ); |
175 | connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), | 175 | connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), |
176 | this,SLOT(activate(const Opie::Core::ODeviceButton*,bool))); | 176 | this,SLOT(activate(const Opie::Core::ODeviceButton*,bool))); |
177 | 177 | ||
178 | setGeometry( -10, -10, 9, 9 ); | 178 | setGeometry( -10, -10, 9, 9 ); |
179 | 179 | ||
@@ -207,38 +207,38 @@ Server::~Server() | |||
207 | #if 0 | 207 | #if 0 |
208 | delete tsmMonitor; | 208 | delete tsmMonitor; |
209 | #endif | 209 | #endif |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | static bool hasVisibleWindow(const QString& clientname, bool partial) | 213 | static bool hasVisibleWindow(const QString& clientname, bool partial) |
214 | { | 214 | { |
215 | #ifdef QWS | 215 | #ifdef QWS |
216 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 216 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
217 | QWSWindow* w; | 217 | QWSWindow* w; |
218 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 218 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
219 | if ( w->client()->identity() == clientname ) { | 219 | if ( w->client()->identity() == clientname ) { |
220 | if ( partial && !w->isFullyObscured() ) | 220 | if ( partial && !w->isFullyObscured() ) |
221 | return TRUE; | 221 | return TRUE; |
222 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { | 222 | if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) { |
223 | # if QT_VERSION < 0x030000 | 223 | # if QT_VERSION < 0x030000 |
224 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, | 224 | QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect, |
225 | QSize(qt_screen->width(),qt_screen->height()) ); | 225 | QSize(qt_screen->width(),qt_screen->height()) ); |
226 | # else | 226 | # else |
227 | QRect mwr = qt_maxWindowRect; | 227 | QRect mwr = qt_maxWindowRect; |
228 | # endif | 228 | # endif |
229 | if ( mwr.contains(w->requested().boundingRect()) ) | 229 | if ( mwr.contains(w->requested().boundingRect()) ) |
230 | return TRUE; | 230 | return TRUE; |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | #endif | 234 | #endif |
235 | return FALSE; | 235 | return FALSE; |
236 | } | 236 | } |
237 | 237 | ||
238 | void Server::activate(const ODeviceButton* button, bool held) | 238 | void Server::activate(const ODeviceButton* button, bool held) |
239 | { | 239 | { |
240 | Global::terminateBuiltin("calibrate"); // No tr | 240 | Global::terminateBuiltin("calibrate"); // No tr |
241 | OQCopMessage om; | 241 | OQCopMessage om; |
242 | if ( held ) { | 242 | if ( held ) { |
243 | om = button->heldAction(); | 243 | om = button->heldAction(); |
244 | } else { | 244 | } else { |
@@ -333,24 +333,26 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
333 | #warning FIXME support TempScreenSaverMode | 333 | #warning FIXME support TempScreenSaverMode |
334 | #if 0 | 334 | #if 0 |
335 | } else if ( msg == "setTempScreenSaverMode(int,int)" ) { | 335 | } else if ( msg == "setTempScreenSaverMode(int,int)" ) { |
336 | int mode, pid; | 336 | int mode, pid; |
337 | stream >> mode >> pid; | 337 | stream >> mode >> pid; |
338 | tsmMonitor->setTempMode(mode, pid); | 338 | tsmMonitor->setTempMode(mode, pid); |
339 | #endif | 339 | #endif |
340 | } else if ( msg == "linkChanged(QString)" ) { | 340 | } else if ( msg == "linkChanged(QString)" ) { |
341 | QString link; | 341 | QString link; |
342 | stream >> link; | 342 | stream >> link; |
343 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; | 343 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; |
344 | docList->linkChanged(link); | 344 | docList->linkChanged(link); |
345 | } else if (msg =="reforceDocuments()") { | ||
346 | docList->reforceDocuments(); | ||
345 | } else if ( msg == "serviceChanged(QString)" ) { | 347 | } else if ( msg == "serviceChanged(QString)" ) { |
346 | MimeType::updateApplications(); | 348 | MimeType::updateApplications(); |
347 | } else if ( msg == "mkdir(QString)" ) { | 349 | } else if ( msg == "mkdir(QString)" ) { |
348 | QString dir; | 350 | QString dir; |
349 | stream >> dir; | 351 | stream >> dir; |
350 | if ( !dir.isEmpty() ) | 352 | if ( !dir.isEmpty() ) |
351 | mkdir( dir ); | 353 | mkdir( dir ); |
352 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 354 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
353 | QString baseFile, sigFile; | 355 | QString baseFile, sigFile; |
354 | stream >> baseFile >> sigFile; | 356 | stream >> baseFile >> sigFile; |
355 | QRsync::generateSignature( baseFile, sigFile ); | 357 | QRsync::generateSignature( baseFile, sigFile ); |
356 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 358 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
@@ -423,26 +425,26 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
423 | (*it)->name() + "=" + homeDir + "/Documents " // No tr | 425 | (*it)->name() + "=" + homeDir + "/Documents " // No tr |
424 | + QString::number( (*it)->availBlocks() * k4/4 ) | 426 | + QString::number( (*it)->availBlocks() * k4/4 ) |
425 | + "K " + (*it)->options() + ";"; | 427 | + "K " + (*it)->options() + ";"; |
426 | } | 428 | } |
427 | } | 429 | } |
428 | if ( !homeFs.isEmpty() ) | 430 | if ( !homeFs.isEmpty() ) |
429 | s += homeFs; | 431 | s += homeFs; |
430 | #ifndef QT_NO_COP | 432 | #ifndef QT_NO_COP |
431 | e << s; | 433 | e << s; |
432 | #endif | 434 | #endif |
433 | } else if ( msg == "sendInstallLocations()" ) { | 435 | } else if ( msg == "sendInstallLocations()" ) { |
434 | #ifndef QT_NO_COP | 436 | #ifndef QT_NO_COP |
435 | QCopEnvelope e( "QPE/Desktop", "installLocations(QString)" ); | 437 | QCopEnvelope e( "QPE/Desktop", "installLocations(QString)" ); |
436 | e << installLocationsString(); | 438 | e << installLocationsString(); |
437 | #endif | 439 | #endif |
438 | } else if ( msg == "sendSyncDate(QString)" ) { | 440 | } else if ( msg == "sendSyncDate(QString)" ) { |
439 | QString app; | 441 | QString app; |
440 | stream >> app; | 442 | stream >> app; |
441 | Config cfg( "qpe" ); | 443 | Config cfg( "qpe" ); |
442 | cfg.setGroup("SyncDate"); | 444 | cfg.setGroup("SyncDate"); |
443 | #ifndef QT_NO_COP | 445 | #ifndef QT_NO_COP |
444 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 446 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
445 | e << app << cfg.readEntry( app ); | 447 | e << app << cfg.readEntry( app ); |
446 | #endif | 448 | #endif |
447 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " | 449 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " |
448 | // << cfg.readEntry( app ).latin1() << oendl; | 450 | // << cfg.readEntry( app ).latin1() << oendl; |
@@ -461,27 +463,27 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
461 | syncDialog->show(); | 463 | syncDialog->show(); |
462 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 464 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
463 | } else if ( msg == "stopSync()") { | 465 | } else if ( msg == "stopSync()") { |
464 | delete syncDialog; | 466 | delete syncDialog; |
465 | syncDialog = 0; | 467 | syncDialog = 0; |
466 | } else if (msg == "restoreDone(QString)") { | 468 | } else if (msg == "restoreDone(QString)") { |
467 | docList->restoreDone(); | 469 | docList->restoreDone(); |
468 | } else if ( msg == "getAllDocLinks()" ) { | 470 | } else if ( msg == "getAllDocLinks()" ) { |
469 | docList->sendAllDocLinks(); | 471 | docList->sendAllDocLinks(); |
470 | } | 472 | } |
471 | #ifdef QPE_HAVE_DIRECT_ACCESS | 473 | #ifdef QPE_HAVE_DIRECT_ACCESS |
472 | else if ( msg == "prepareDirectAccess()" ) { | 474 | else if ( msg == "prepareDirectAccess()" ) { |
473 | prepareDirectAccess(); | 475 | prepareDirectAccess(); |
474 | } else if ( msg == "postDirectAccess()" ) { | 476 | } else if ( msg == "postDirectAccess()" ) { |
475 | postDirectAccess(); | 477 | postDirectAccess(); |
476 | } | 478 | } |
477 | #endif | 479 | #endif |
478 | #ifdef Q_WS_QWS | 480 | #ifdef Q_WS_QWS |
479 | 481 | ||
480 | else if ( msg == "setMouseProto(QString)" ) { | 482 | else if ( msg == "setMouseProto(QString)" ) { |
481 | QString mice; | 483 | QString mice; |
482 | stream >> mice; | 484 | stream >> mice; |
483 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 485 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
484 | qwsServer->openMouse(); | 486 | qwsServer->openMouse(); |
485 | } else if ( msg == "setKeyboard(QString)" ) { | 487 | } else if ( msg == "setKeyboard(QString)" ) { |
486 | QString kb; | 488 | QString kb; |
487 | stream >> kb; | 489 | stream >> kb; |
@@ -548,68 +550,68 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
548 | #endif | 550 | #endif |
549 | } | 551 | } |
550 | 552 | ||
551 | QString Server::cardInfoString() | 553 | QString Server::cardInfoString() |
552 | { | 554 | { |
553 | storage->update(); | 555 | storage->update(); |
554 | const QList<FileSystem> &fs = storage->fileSystems(); | 556 | const QList<FileSystem> &fs = storage->fileSystems(); |
555 | QListIterator<FileSystem> it ( fs ); | 557 | QListIterator<FileSystem> it ( fs ); |
556 | QString s; | 558 | QString s; |
557 | QString homeDir = getenv("HOME"); | 559 | QString homeDir = getenv("HOME"); |
558 | QString homeFs, homeFsPath; | 560 | QString homeFs, homeFsPath; |
559 | for ( ; it.current(); ++it ) { | 561 | for ( ; it.current(); ++it ) { |
560 | int k4 = (*it)->blockSize()/256; | 562 | int k4 = (*it)->blockSize()/256; |
561 | if ( (*it)->isRemovable() ) { | 563 | if ( (*it)->isRemovable() ) { |
562 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr | 564 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr |
563 | + QString::number( (*it)->availBlocks() * k4/4 ) | 565 | + QString::number( (*it)->availBlocks() * k4/4 ) |
564 | + "K " + (*it)->options() + ";"; | 566 | + "K " + (*it)->options() + ";"; |
565 | } else if ( homeDir.contains( (*it)->path() ) && | 567 | } else if ( homeDir.contains( (*it)->path() ) && |
566 | (*it)->path().length() > homeFsPath.length() ) { | 568 | (*it)->path().length() > homeFsPath.length() ) { |
567 | homeFsPath = (*it)->path(); | 569 | homeFsPath = (*it)->path(); |
568 | homeFs = | 570 | homeFs = |
569 | (*it)->name() + "=" + homeDir + "/Documents " // No tr | 571 | (*it)->name() + "=" + homeDir + "/Documents " // No tr |
570 | + QString::number( (*it)->availBlocks() * k4/4 ) | 572 | + QString::number( (*it)->availBlocks() * k4/4 ) |
571 | + "K " + (*it)->options() + ";"; | 573 | + "K " + (*it)->options() + ";"; |
572 | } | 574 | } |
573 | } | 575 | } |
574 | if ( !homeFs.isEmpty() ) | 576 | if ( !homeFs.isEmpty() ) |
575 | s += homeFs; | 577 | s += homeFs; |
576 | return s; | 578 | return s; |
577 | } | 579 | } |
578 | 580 | ||
579 | QString Server::installLocationsString() | 581 | QString Server::installLocationsString() |
580 | { | 582 | { |
581 | storage->update(); | 583 | storage->update(); |
582 | const QList<FileSystem> &fs = storage->fileSystems(); | 584 | const QList<FileSystem> &fs = storage->fileSystems(); |
583 | QListIterator<FileSystem> it ( fs ); | 585 | QListIterator<FileSystem> it ( fs ); |
584 | QString s; | 586 | QString s; |
585 | QString homeDir = getenv("HOME"); | 587 | QString homeDir = getenv("HOME"); |
586 | QString homeFs, homeFsPath; | 588 | QString homeFs, homeFsPath; |
587 | for ( ; it.current(); ++it ) { | 589 | for ( ; it.current(); ++it ) { |
588 | int k4 = (*it)->blockSize()/256; | 590 | int k4 = (*it)->blockSize()/256; |
589 | if ( (*it)->isRemovable() ) { | 591 | if ( (*it)->isRemovable() ) { |
590 | s += (*it)->name() + "=" + (*it)->path() + " " // No tr | 592 | s += (*it)->name() + "=" + (*it)->path() + " " // No tr |
591 | + QString::number( (*it)->availBlocks() * k4/4 ) | 593 | + QString::number( (*it)->availBlocks() * k4/4 ) |
592 | + "K " + (*it)->options() + ";"; | 594 | + "K " + (*it)->options() + ";"; |
593 | } else if ( homeDir.contains( (*it)->path() ) && | 595 | } else if ( homeDir.contains( (*it)->path() ) && |
594 | (*it)->path().length() > homeFsPath.length() ) { | 596 | (*it)->path().length() > homeFsPath.length() ) { |
595 | homeFsPath = (*it)->path(); | 597 | homeFsPath = (*it)->path(); |
596 | homeFs = | 598 | homeFs = |
597 | (*it)->name() + "=" + homeDir + " " // No tr | 599 | (*it)->name() + "=" + homeDir + " " // No tr |
598 | + QString::number( (*it)->availBlocks() * k4/4 ) | 600 | + QString::number( (*it)->availBlocks() * k4/4 ) |
599 | + "K " + (*it)->options() + ";"; | 601 | + "K " + (*it)->options() + ";"; |
600 | } | 602 | } |
601 | } | 603 | } |
602 | if ( !homeFs.isEmpty() ) | 604 | if ( !homeFs.isEmpty() ) |
603 | s = homeFs + s; | 605 | s = homeFs + s; |
604 | return s; | 606 | return s; |
605 | } | 607 | } |
606 | 608 | ||
607 | void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) | 609 | void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) |
608 | { | 610 | { |
609 | QDataStream stream( data, IO_ReadOnly ); | 611 | QDataStream stream( data, IO_ReadOnly ); |
610 | 612 | ||
611 | if ( msg == "reloadApps()" ) { | 613 | if ( msg == "reloadApps()" ) { |
612 | docList->reloadAppLnks(); | 614 | docList->reloadAppLnks(); |
613 | } else if ( msg == "soundAlarm()" ) { | 615 | } else if ( msg == "soundAlarm()" ) { |
614 | ServerApplication::soundAlarm(); | 616 | ServerApplication::soundAlarm(); |
615 | } else if ( msg == "setLed(int,bool)" ) { | 617 | } else if ( msg == "setLed(int,bool)" ) { |
@@ -815,170 +817,170 @@ void Server::prepareDirectAccess() | |||
815 | { | 817 | { |
816 | qDebug( "Server::prepareDirectAccess()" ); | 818 | qDebug( "Server::prepareDirectAccess()" ); |
817 | // Put up a pretty dialog | 819 | // Put up a pretty dialog |
818 | syncDialog = new SyncDialog( this, tr("USB Lock") ); | 820 | syncDialog = new SyncDialog( this, tr("USB Lock") ); |
819 | syncDialog->show(); | 821 | syncDialog->show(); |
820 | 822 | ||
821 | // Prevent the PDA from acting as a PDA | 823 | // Prevent the PDA from acting as a PDA |
822 | terminateServers(); | 824 | terminateServers(); |
823 | 825 | ||
824 | // suspend the mtab monitor | 826 | // suspend the mtab monitor |
825 | #ifndef QT_NO_COP | 827 | #ifndef QT_NO_COP |
826 | { | 828 | { |
827 | QCopEnvelope e( "QPE/Stabmon", "suspendMonitor()" ); | 829 | QCopEnvelope e( "QPE/Stabmon", "suspendMonitor()" ); |
828 | } | 830 | } |
829 | #endif | 831 | #endif |
830 | 832 | ||
831 | // send out a flush message | 833 | // send out a flush message |
832 | // once flushes are done call runDirectAccess() | 834 | // once flushes are done call runDirectAccess() |
833 | // We just count the number of apps and set a timer. | 835 | // We just count the number of apps and set a timer. |
834 | // Either the timer expires or the correct number of apps responds. | 836 | // Either the timer expires or the correct number of apps responds. |
835 | // Note: quicklauncher isn't in the runningApps list but it responds | 837 | // Note: quicklauncher isn't in the runningApps list but it responds |
836 | // to the flush so we start the counter at 1 | 838 | // to the flush so we start the counter at 1 |
837 | pendingFlushes = 1; | 839 | pendingFlushes = 1; |
838 | directAccessRun = FALSE; | 840 | directAccessRun = FALSE; |
839 | for ( QMap<int,QString>::ConstIterator it = | 841 | for ( QMap<int,QString>::ConstIterator it = |
840 | appLauncher->runningApplications().begin(); | 842 | appLauncher->runningApplications().begin(); |
841 | it != appLauncher->runningApplications().end(); | 843 | it != appLauncher->runningApplications().end(); |
842 | ++it ) { | 844 | ++it ) { |
843 | pendingFlushes++; | 845 | pendingFlushes++; |
844 | } | 846 | } |
845 | #ifndef QT_NO_COP | 847 | #ifndef QT_NO_COP |
846 | QCopEnvelope e1( "QPE/System", "flush()" ); | 848 | QCopEnvelope e1( "QPE/System", "flush()" ); |
847 | #endif | 849 | #endif |
848 | QTimer::singleShot( 10000, this, SLOT(runDirectAccess()) ); | 850 | QTimer::singleShot( 10000, this, SLOT(runDirectAccess()) ); |
849 | #warning FIXME support TempScreenSaverMode | 851 | #warning FIXME support TempScreenSaverMode |
850 | #if 0 | 852 | #if 0 |
851 | QPEApplication::setTempScreenSaverMode(QPEApplication::DisableSuspend); | 853 | QPEApplication::setTempScreenSaverMode(QPEApplication::DisableSuspend); |
852 | #endif | 854 | #endif |
853 | } | 855 | } |
854 | 856 | ||
855 | // This is only connected if QPE_HAVE_DIRECT_ACCESS is defined | 857 | // This is only connected if QPE_HAVE_DIRECT_ACCESS is defined |
856 | // It fakes the presence of Qtopia Desktop | 858 | // It fakes the presence of Qtopia Desktop |
857 | void Server::desktopMessage( const QCString &message, const QByteArray &data ) | 859 | void Server::desktopMessage( const QCString &message, const QByteArray &data ) |
858 | { | 860 | { |
859 | QDataStream stream( data, IO_ReadOnly ); | 861 | QDataStream stream( data, IO_ReadOnly ); |
860 | if ( message == "flushDone(QString)" ) { | 862 | if ( message == "flushDone(QString)" ) { |
861 | QString app; | 863 | QString app; |
862 | stream >> app; | 864 | stream >> app; |
863 | qDebug( "flushDone from %s", app.latin1() ); | 865 | qDebug( "flushDone from %s", app.latin1() ); |
864 | if ( --pendingFlushes == 0 ) { | 866 | if ( --pendingFlushes == 0 ) { |
865 | qDebug( "pendingFlushes == 0, all the apps responded" ); | 867 | qDebug( "pendingFlushes == 0, all the apps responded" ); |
866 | runDirectAccess(); | 868 | runDirectAccess(); |
867 | } | 869 | } |
868 | } else if ( message == "installStarted(QString)" ) { | 870 | } else if ( message == "installStarted(QString)" ) { |
869 | QString package; | 871 | QString package; |
870 | stream >> package; | 872 | stream >> package; |
871 | qDebug( "\tInstall Started for package %s", package.latin1() ); | 873 | qDebug( "\tInstall Started for package %s", package.latin1() ); |
872 | } else if ( message == "installStep(QString)" ) { | 874 | } else if ( message == "installStep(QString)" ) { |
873 | QString step; | 875 | QString step; |
874 | stream >> step; | 876 | stream >> step; |
875 | qDebug( "\tInstall Step %s", step.latin1() ); | 877 | qDebug( "\tInstall Step %s", step.latin1() ); |
876 | } else if ( message == "installDone(QString)" ) { | 878 | } else if ( message == "installDone(QString)" ) { |
877 | QString package; | 879 | QString package; |
878 | stream >> package; | 880 | stream >> package; |
879 | qDebug( "\tInstall Finished for package %s", package.latin1() ); | 881 | qDebug( "\tInstall Finished for package %s", package.latin1() ); |
880 | } else if ( message == "installFailed(QString,int,QString)" ) { | 882 | } else if ( message == "installFailed(QString,int,QString)" ) { |
881 | QString package, error; | 883 | QString package, error; |
882 | int status; | 884 | int status; |
883 | stream >> package >> status >> error; | 885 | stream >> package >> status >> error; |
884 | qDebug( "\tInstall Failed for package %s with error code %d and error message %s", | 886 | qDebug( "\tInstall Failed for package %s with error code %d and error message %s", |
885 | package.latin1(), status, error.latin1() ); | 887 | package.latin1(), status, error.latin1() ); |
886 | } else if ( message == "removeStarted(QString)" ) { | 888 | } else if ( message == "removeStarted(QString)" ) { |
887 | QString package; | 889 | QString package; |
888 | stream >> package; | 890 | stream >> package; |
889 | qDebug( "\tRemove Started for package %s", package.latin1() ); | 891 | qDebug( "\tRemove Started for package %s", package.latin1() ); |
890 | } else if ( message == "removeDone(QString)" ) { | 892 | } else if ( message == "removeDone(QString)" ) { |
891 | QString package; | 893 | QString package; |
892 | stream >> package; | 894 | stream >> package; |
893 | qDebug( "\tRemove Finished for package %s", package.latin1() ); | 895 | qDebug( "\tRemove Finished for package %s", package.latin1() ); |
894 | } else if ( message == "removeFailed(QString)" ) { | 896 | } else if ( message == "removeFailed(QString)" ) { |
895 | QString package; | 897 | QString package; |
896 | stream >> package; | 898 | stream >> package; |
897 | qDebug( "\tRemove Failed for package %s", package.latin1() ); | 899 | qDebug( "\tRemove Failed for package %s", package.latin1() ); |
898 | } | 900 | } |
899 | 901 | ||
900 | if ( qrr && qrr->waitingForMessages ) | 902 | if ( qrr && qrr->waitingForMessages ) |
901 | qrr->desktopMessage( message, data ); | 903 | qrr->desktopMessage( message, data ); |
902 | } | 904 | } |
903 | 905 | ||
904 | 906 | ||
905 | // This is only connected if QPE_HAVE_DIRECT_ACCESS is defined | 907 | // This is only connected if QPE_HAVE_DIRECT_ACCESS is defined |
906 | void Server::runDirectAccess() | 908 | void Server::runDirectAccess() |
907 | { | 909 | { |
908 | #ifdef QPE_HAVE_DIRECT_ACCESS | 910 | #ifdef QPE_HAVE_DIRECT_ACCESS |
909 | // The timer must have fired after all the apps responded | 911 | // The timer must have fired after all the apps responded |
910 | // with flushDone(). Just ignore it. | 912 | // with flushDone(). Just ignore it. |
911 | if ( directAccessRun ) | 913 | if ( directAccessRun ) |
912 | return; | 914 | return; |
913 | 915 | ||
914 | directAccessRun = TRUE; | 916 | directAccessRun = TRUE; |
915 | ::readyDirectAccess(cardInfoString(), installLocationsString()); | 917 | ::readyDirectAccess(cardInfoString(), installLocationsString()); |
916 | #endif | 918 | #endif |
917 | } | 919 | } |
918 | 920 | ||
919 | // This is only called if QPE_HAVE_DIRECT_ACCESS is defined | 921 | // This is only called if QPE_HAVE_DIRECT_ACCESS is defined |
920 | void Server::postDirectAccess() | 922 | void Server::postDirectAccess() |
921 | { | 923 | { |
922 | #ifdef QPE_HAVE_DIRECT_ACCESS | 924 | #ifdef QPE_HAVE_DIRECT_ACCESS |
923 | qDebug( "Server::postDirectAccess()" ); | 925 | qDebug( "Server::postDirectAccess()" ); |
924 | 926 | ||
925 | // Categories may have changed | 927 | // Categories may have changed |
926 | QCopEnvelope e1( "QPE/System", "categoriesChanged()" ); | 928 | QCopEnvelope e1( "QPE/System", "categoriesChanged()" ); |
927 | // Apps need to reload their data | 929 | // Apps need to reload their data |
928 | QCopEnvelope e2( "QPE/System", "reload()" ); | 930 | QCopEnvelope e2( "QPE/System", "reload()" ); |
929 | // Reload DocLinks | 931 | // Reload DocLinks |
930 | docList->storageChanged(); | 932 | docList->storageChanged(); |
931 | // Restart the PDA server stuff | 933 | // Restart the PDA server stuff |
932 | startTransferServer(); | 934 | startTransferServer(); |
933 | 935 | ||
934 | // restart the mtab monitor | 936 | // restart the mtab monitor |
935 | #ifndef QT_NO_COP | 937 | #ifndef QT_NO_COP |
936 | { | 938 | { |
937 | QCopEnvelope e( "QPE/Stabmon", "restartMonitor()" ); | 939 | QCopEnvelope e( "QPE/Stabmon", "restartMonitor()" ); |
938 | } | 940 | } |
939 | #endif | 941 | #endif |
940 | 942 | ||
941 | // Process queued requests | 943 | // Process queued requests |
942 | const char *queueFile = ::directAccessQueueFile(); | 944 | const char *queueFile = ::directAccessQueueFile(); |
943 | QFile *file = new QFile( queueFile ); | 945 | QFile *file = new QFile( queueFile ); |
944 | if ( !file->exists() ) { | 946 | if ( !file->exists() ) { |
945 | delete file; | 947 | delete file; |
946 | // Get rid of the dialog | 948 | // Get rid of the dialog |
947 | if ( syncDialog ) { | 949 | if ( syncDialog ) { |
948 | delete syncDialog; | 950 | delete syncDialog; |
949 | syncDialog = 0; | 951 | syncDialog = 0; |
950 | } | 952 | } |
951 | #warning FIXME support TempScreenSaverMode | 953 | #warning FIXME support TempScreenSaverMode |
952 | #if 0 | 954 | #if 0 |
953 | QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); | 955 | QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); |
954 | #endif | 956 | #endif |
955 | } else { | 957 | } else { |
956 | qrr = new QueuedRequestRunner( file, syncDialog ); | 958 | qrr = new QueuedRequestRunner( file, syncDialog ); |
957 | connect( qrr, SIGNAL(finished()), | 959 | connect( qrr, SIGNAL(finished()), |
958 | this, SLOT(finishedQueuedRequests()) ); | 960 | this, SLOT(finishedQueuedRequests()) ); |
959 | QTimer::singleShot( 100, qrr, SLOT(process()) ); | 961 | QTimer::singleShot( 100, qrr, SLOT(process()) ); |
960 | // qrr will remove the sync dialog later | 962 | // qrr will remove the sync dialog later |
961 | } | 963 | } |
962 | #endif | 964 | #endif |
963 | } | 965 | } |
964 | 966 | ||
965 | void Server::finishedQueuedRequests() | 967 | void Server::finishedQueuedRequests() |
966 | { | 968 | { |
967 | if ( qrr->readyToDelete ) { | 969 | if ( qrr->readyToDelete ) { |
968 | delete qrr; | 970 | delete qrr; |
969 | qrr = 0; | 971 | qrr = 0; |
970 | // Get rid of the dialog | 972 | // Get rid of the dialog |
971 | if ( syncDialog ) { | 973 | if ( syncDialog ) { |
972 | delete syncDialog; | 974 | delete syncDialog; |
973 | syncDialog = 0; | 975 | syncDialog = 0; |
974 | } | 976 | } |
975 | #warning FIXME support TempScreenSaverMode | 977 | #warning FIXME support TempScreenSaverMode |
976 | #if 0 | 978 | #if 0 |
977 | QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); | 979 | QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); |
978 | #endif | 980 | #endif |
979 | } else { | 981 | } else { |
980 | qrr->readyToDelete = TRUE; | 982 | qrr->readyToDelete = TRUE; |
981 | QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) ); | 983 | QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) ); |
982 | } | 984 | } |
983 | } | 985 | } |
984 | 986 | ||