summaryrefslogtreecommitdiff
path: root/core/launcher/server.cpp
authoralwin <alwin>2004-11-11 21:10:16 (UTC)
committer alwin <alwin>2004-11-11 21:10:16 (UTC)
commitd2d25a3c1e60a34436cd93e5214a35b3edd05c6c (patch) (unidiff)
tree0c1bd62dd09e7a86292399f68c823b7eb6ae031e /core/launcher/server.cpp
parente85cf7184c3444e26c1858d0564fa5d3614dd7b5 (diff)
downloadopie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.zip
opie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.tar.gz
opie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.tar.bz2
- flush icon cache if reloading all documents
- send QCop message when the doctab is enabled/disabled so the disabled widget appears or the doc-list will reread
Diffstat (limited to 'core/launcher/server.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/server.cpp210
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
@@ -164,7 +164,7 @@ Server::Server() :
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
@@ -216,20 +216,20 @@ static bool hasVisibleWindow(const QString& clientname, bool partial)
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;
@@ -342,6 +342,8 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
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)" ) {
@@ -432,8 +434,8 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
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;
@@ -470,9 +472,9 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
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
@@ -557,22 +559,22 @@ QString Server::cardInfoString()
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
@@ -585,22 +587,22 @@ QString Server::installLocationsString()
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
@@ -824,7 +826,7 @@ void Server::prepareDirectAccess()
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
@@ -837,10 +839,10 @@ void Server::prepareDirectAccess()
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()" );
@@ -858,47 +860,47 @@ 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
@@ -909,7 +911,7 @@ void Server::runDirectAccess()
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());
@@ -934,7 +936,7 @@ void Server::postDirectAccess()
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
@@ -942,22 +944,22 @@ void Server::postDirectAccess()
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}
@@ -965,20 +967,20 @@ void Server::postDirectAccess()
965void Server::finishedQueuedRequests() 967void 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