summaryrefslogtreecommitdiff
path: root/core/launcher/server.cpp
Unidiff
Diffstat (limited to 'core/launcher/server.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/server.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 921b790..c45265a 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -322,106 +322,114 @@ bool Server::setKeyboardLayout( const QString &kb )
322 QWSServer::setOverrideKeys( om ); 322 QWSServer::setOverrideKeys( om );
323 323
324 return TRUE; 324 return TRUE;
325} 325}
326#endif 326#endif
327 327
328void Server::systemMsg(const QCString &msg, const QByteArray &data) 328void Server::systemMsg(const QCString &msg, const QByteArray &data)
329{ 329{
330 QDataStream stream( data, IO_ReadOnly ); 330 QDataStream stream( data, IO_ReadOnly );
331 331
332 if ( msg == "securityChanged()" ) { 332 if ( msg == "securityChanged()" ) {
333 if ( transferServer ) 333 if ( transferServer )
334 transferServer->authorizeConnections(); 334 transferServer->authorizeConnections();
335 335
336 if ( qcopBridge ) 336 if ( qcopBridge )
337 qcopBridge->authorizeConnections(); 337 qcopBridge->authorizeConnections();
338#warning FIXME support TempScreenSaverMode 338#warning FIXME support TempScreenSaverMode
339#if 0 339#if 0
340 } else if ( msg == "setTempScreenSaverMode(int,int)" ) { 340 } else if ( msg == "setTempScreenSaverMode(int,int)" ) {
341 int mode, pid; 341 int mode, pid;
342 stream >> mode >> pid; 342 stream >> mode >> pid;
343 tsmMonitor->setTempMode(mode, pid); 343 tsmMonitor->setTempMode(mode, pid);
344#endif 344#endif
345 } else if ( msg == "linkChanged(QString)" ) { 345 } else if ( msg == "linkChanged(QString)" ) {
346 QString link; 346 QString link;
347 stream >> link; 347 stream >> link;
348 odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; 348 odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl;
349 docList->linkChanged(link); 349 docList->linkChanged(link);
350 } else if (msg =="reforceDocuments()") { 350 } else if (msg =="reforceDocuments()") {
351 docList->reforceDocuments(); 351 docList->reforceDocuments();
352 } else if ( msg == "serviceChanged(QString)" ) { 352 } else if ( msg == "serviceChanged(QString)" ) {
353 MimeType::updateApplications(); 353 MimeType::updateApplications();
354 } else if ( msg == "mkdir(QString)" ) { 354 } else if ( msg == "mkdir(QString)" ) {
355 QString dir; 355 QString dir;
356 stream >> dir; 356 stream >> dir;
357 if ( !dir.isEmpty() ) 357 if ( !dir.isEmpty() )
358 mkdir( dir ); 358 mkdir( dir );
359 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 359 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
360 QString baseFile, sigFile; 360 QString baseFile, sigFile;
361 stream >> baseFile >> sigFile; 361 stream >> baseFile >> sigFile;
362 QRsync::generateSignature( baseFile, sigFile ); 362 QRsync::generateSignature( baseFile, sigFile );
363 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 363 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
364 QString baseFile, sigFile, deltaFile; 364 QString baseFile, sigFile, deltaFile;
365 stream >> baseFile >> sigFile >> deltaFile; 365 stream >> baseFile >> sigFile >> deltaFile;
366 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 366 QRsync::generateDiff( baseFile, sigFile, deltaFile );
367 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 367 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
368 QString baseFile, deltaFile; 368 QString baseFile, deltaFile;
369 stream >> baseFile >> deltaFile; 369 stream >> baseFile >> deltaFile;
370 bool fileWasCreated = false;
370 if ( !QFile::exists( baseFile ) ) { 371 if ( !QFile::exists( baseFile ) ) {
371 QFile f( baseFile ); 372 QFile f( baseFile );
372 f.open( IO_WriteOnly ); 373 fileWasCreated = f.open( IO_WriteOnly );
373 f.close(); 374 f.close();
374 } 375 }
375 QRsync::applyDiff( baseFile, deltaFile ); 376 if ( fileWasCreated ) {
377 QRsync::applyDiff( baseFile, deltaFile );
376#ifndef QT_NO_COP 378#ifndef QT_NO_COP
377 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 379 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
378 e << baseFile; 380 e << baseFile;
379#endif 381#endif
382 } else {
383#ifndef QT_NO_COP
384 QCopEnvelope e( "QPE/Desktop", "patchUnapplied(QString)" );
385 e << baseFile;
386#endif
387 }
380 } else if ( msg == "rdiffCleanup()" ) { 388 } else if ( msg == "rdiffCleanup()" ) {
381 mkdir( "/tmp/rdiff" ); 389 mkdir( "/tmp/rdiff" );
382 QDir dir; 390 QDir dir;
383 dir.setPath( "/tmp/rdiff" ); 391 dir.setPath( "/tmp/rdiff" );
384 QStringList entries = dir.entryList(); 392 QStringList entries = dir.entryList();
385 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 393 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
386 dir.remove( *it ); 394 dir.remove( *it );
387 } else if ( msg == "sendHandshakeInfo()" ) { 395 } else if ( msg == "sendHandshakeInfo()" ) {
388 QString home = getenv( "HOME" ); 396 QString home = getenv( "HOME" );
389#ifndef QT_NO_COP 397#ifndef QT_NO_COP
390 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 398 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
391 e << home; 399 e << home;
392 int locked = (int) ServerApplication::screenLocked(); 400 int locked = (int) ServerApplication::screenLocked();
393 e << locked; 401 e << locked;
394#endif 402#endif
395 } else if ( msg == "sendVersionInfo()" ) { 403 } else if ( msg == "sendVersionInfo()" ) {
396 /* 404 /*
397 * @&$*! Qtopiadesktop relies on the major number 405 * @&$*! Qtopiadesktop relies on the major number
398 * to start with 1. (or 2 as the case of version 2.1 will be) 406 * to start with 1. (or 2 as the case of version 2.1 will be)
399 * we need to fake 1.7 to be able 407 * we need to fake 1.7 to be able
400 * to sync with Qtopiadesktop 1.7. 408 * to sync with Qtopiadesktop 1.7.
401 * We'll send it Opie's version in the platform string for now, 409 * We'll send it Opie's version in the platform string for now,
402 * until such time when QD gets rewritten correctly. 410 * until such time when QD gets rewritten correctly.
403 */ 411 */
404 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); 412 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" );
405 413
406 QString opiename = "Opie "+QString(QPE_VERSION); 414 QString opiename = "Opie "+QString(QPE_VERSION);
407 QString QDVersion="1.7"; 415 QString QDVersion="1.7";
408 e << QDVersion << opiename; 416 e << QDVersion << opiename;
409 417
410 } else if ( msg == "sendCardInfo()" ) { 418 } else if ( msg == "sendCardInfo()" ) {
411#ifndef QT_NO_COP 419#ifndef QT_NO_COP
412 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); 420 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
413#endif 421#endif
414 storage->update(); 422 storage->update();
415 const QList<FileSystem> &fs = storage->fileSystems(); 423 const QList<FileSystem> &fs = storage->fileSystems();
416 QListIterator<FileSystem> it ( fs ); 424 QListIterator<FileSystem> it ( fs );
417 QString s; 425 QString s;
418 QString homeDir = getenv("HOME"); 426 QString homeDir = getenv("HOME");
419 QString homeFs, homeFsPath; 427 QString homeFs, homeFsPath;
420 for ( ; it.current(); ++it ) { 428 for ( ; it.current(); ++it ) {
421 int k4 = (*it)->blockSize()/256; 429 int k4 = (*it)->blockSize()/256;
422 if ( (*it)->isRemovable() ) { 430 if ( (*it)->isRemovable() ) {
423 s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr 431 s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr
424 + QString::number( (*it)->availBlocks() * k4/4 ) 432 + QString::number( (*it)->availBlocks() * k4/4 )
425 + "K " + (*it)->options() + ";"; 433 + "K " + (*it)->options() + ";";
426 } else if ( homeDir.contains( (*it)->path() ) && 434 } else if ( homeDir.contains( (*it)->path() ) &&
427 (*it)->path().length() > homeFsPath.length() ) { 435 (*it)->path().length() > homeFsPath.length() ) {
@@ -953,54 +961,55 @@ void Server::postDirectAccess()
953 // Get rid of the dialog 961 // Get rid of the dialog
954 if ( syncDialog ) { 962 if ( syncDialog ) {
955 delete syncDialog; 963 delete syncDialog;
956 syncDialog = 0; 964 syncDialog = 0;
957 } 965 }
958#warning FIXME support TempScreenSaverMode 966#warning FIXME support TempScreenSaverMode
959#if 0 967#if 0
960 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); 968 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
961#endif 969#endif
962 } else { 970 } else {
963 qrr = new QueuedRequestRunner( file, syncDialog ); 971 qrr = new QueuedRequestRunner( file, syncDialog );
964 connect( qrr, SIGNAL(finished()), 972 connect( qrr, SIGNAL(finished()),
965 this, SLOT(finishedQueuedRequests()) ); 973 this, SLOT(finishedQueuedRequests()) );
966 QTimer::singleShot( 100, qrr, SLOT(process()) ); 974 QTimer::singleShot( 100, qrr, SLOT(process()) );
967 // qrr will remove the sync dialog later 975 // qrr will remove the sync dialog later
968 } 976 }
969#endif 977#endif
970} 978}
971 979
972void Server::finishedQueuedRequests() 980void Server::finishedQueuedRequests()
973{ 981{
974 if ( qrr->readyToDelete ) { 982 if ( qrr->readyToDelete ) {
975 delete qrr; 983 delete qrr;
976 qrr = 0; 984 qrr = 0;
977 // Get rid of the dialog 985 // Get rid of the dialog
978 if ( syncDialog ) { 986 if ( syncDialog ) {
979 delete syncDialog; 987 delete syncDialog;
980 syncDialog = 0; 988 syncDialog = 0;
981 } 989 }
982#warning FIXME support TempScreenSaverMode 990#warning FIXME support TempScreenSaverMode
983#if 0 991#if 0
984 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable); 992 QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
985#endif 993#endif
986 } else { 994 } else {
987 qrr->readyToDelete = TRUE; 995 qrr->readyToDelete = TRUE;
988 QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) ); 996 QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) );
989 } 997 }
990} 998}
991 999
992void Server::startSoundServer() { 1000void Server::startSoundServer() {
993 if ( !process ) { 1001 if ( !process ) {
994 process = new Opie::Core::OProcess( this ); 1002 process = new Opie::Core::OProcess( this );
995 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 1003 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
996 SLOT(soundServerExited())); 1004 SLOT(soundServerExited()));
997 } 1005 }
998 1006
999 process->clearArguments(); 1007 process->clearArguments();
1000 *process << QPEApplication::qpeDir() + "bin/qss"; 1008 *process << QPEApplication::qpeDir() + "bin/qss";
1001 process->start(); 1009 if (!process->start())
1010 owarn << "Sound server process did not start" << oendl;
1002} 1011}
1003 1012
1004void Server::soundServerExited() { 1013void Server::soundServerExited() {
1005 QTimer::singleShot(5000, this, SLOT(startSoundServer())); 1014 QTimer::singleShot(5000, this, SLOT(startSoundServer()));
1006} 1015}