-rw-r--r-- | core/launcher/server.cpp | 127 |
1 files changed, 85 insertions, 42 deletions
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 5ae517b..3bef36e 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -231,9 +231,8 @@ void Server::activate(const ODeviceButton* button, bool held) | |||
231 | 231 | ||
232 | 232 | ||
233 | #ifdef Q_WS_QWS | 233 | #ifdef Q_WS_QWS |
234 | 234 | ||
235 | |||
236 | typedef struct KeyOverride { | 235 | typedef struct KeyOverride { |
237 | ushort scan_code; | 236 | ushort scan_code; |
238 | QWSServer::KeyMap map; | 237 | QWSServer::KeyMap map; |
239 | }; | 238 | }; |
@@ -280,9 +279,8 @@ bool Server::setKeyboardLayout( const QString &kb ) | |||
280 | QWSServer::setOverrideKeys( om ); | 279 | QWSServer::setOverrideKeys( om ); |
281 | 280 | ||
282 | return TRUE; | 281 | return TRUE; |
283 | } | 282 | } |
284 | |||
285 | #endif | 283 | #endif |
286 | 284 | ||
287 | void Server::systemMsg(const QCString &msg, const QByteArray &data) | 285 | void Server::systemMsg(const QCString &msg, const QByteArray &data) |
288 | { | 286 | { |
@@ -290,40 +288,53 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
290 | 288 | ||
291 | if ( msg == "securityChanged()" ) { | 289 | if ( msg == "securityChanged()" ) { |
292 | if ( transferServer ) | 290 | if ( transferServer ) |
293 | transferServer->authorizeConnections(); | 291 | transferServer->authorizeConnections(); |
292 | |||
294 | if ( qcopBridge ) | 293 | if ( qcopBridge ) |
295 | qcopBridge->authorizeConnections(); | 294 | qcopBridge->authorizeConnections(); |
296 | } | 295 | } else |
297 | /* ### FIXME support TempScreenSaverMode */ | 296 | |
298 | #if 0 | 297 | #if 0 |
299 | else if ( msg == "setTempScreenSaverMode(int,int)" ) { | 298 | /* ### FIXME support TempScreenSaverMode */ |
299 | if ( msg == "setTempScreenSaverMode(int,int)" ) { | ||
300 | int mode, pid; | 300 | int mode, pid; |
301 | stream >> mode >> pid; | 301 | stream >> mode >> pid; |
302 | tsmMonitor->setTempMode(mode, pid); | 302 | tsmMonitor->setTempMode(mode, pid); |
303 | } | 303 | } else |
304 | #endif | 304 | #endif |
305 | else if ( msg == "linkChanged(QString)" ) { | 305 | |
306 | if ( msg == "linkChanged(QString)" ) { | ||
306 | QString link; | 307 | QString link; |
307 | stream >> link; | 308 | stream >> link; |
308 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; | 309 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; |
309 | docList->linkChanged(link); | 310 | docList->linkChanged(link); |
310 | } else if ( msg == "serviceChanged(QString)" ) { | 311 | } else |
312 | |||
313 | if ( msg == "serviceChanged(QString)" ) { | ||
311 | MimeType::updateApplications(); | 314 | MimeType::updateApplications(); |
312 | } else if ( msg == "mkdir(QString)" ) { | 315 | } else |
316 | |||
317 | if ( msg == "mkdir(QString)" ) { | ||
313 | QString dir; | 318 | QString dir; |
314 | stream >> dir; | 319 | stream >> dir; |
315 | if ( !dir.isEmpty() ) | 320 | if ( !dir.isEmpty() ) |
316 | mkdir( dir ); | 321 | mkdir( dir ); |
317 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 322 | } else |
323 | |||
324 | if ( msg == "rdiffGenSig(QString,QString)" ) { | ||
318 | QString baseFile, sigFile; | 325 | QString baseFile, sigFile; |
319 | stream >> baseFile >> sigFile; | 326 | stream >> baseFile >> sigFile; |
320 | QRsync::generateSignature( baseFile, sigFile ); | 327 | QRsync::generateSignature( baseFile, sigFile ); |
321 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 328 | } else |
329 | |||
330 | if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | ||
322 | QString baseFile, sigFile, deltaFile; | 331 | QString baseFile, sigFile, deltaFile; |
323 | stream >> baseFile >> sigFile >> deltaFile; | 332 | stream >> baseFile >> sigFile >> deltaFile; |
324 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 333 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
325 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 334 | } else |
335 | |||
336 | if ( msg == "rdiffApplyPatch(QString,QString)" ) { | ||
326 | QString baseFile, deltaFile; | 337 | QString baseFile, deltaFile; |
327 | stream >> baseFile >> deltaFile; | 338 | stream >> baseFile >> deltaFile; |
328 | if ( !QFile::exists( baseFile ) ) { | 339 | if ( !QFile::exists( baseFile ) ) { |
329 | QFile f( baseFile ); | 340 | QFile f( baseFile ); |
@@ -334,36 +345,42 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
334 | #ifndef QT_NO_COP | 345 | #ifndef QT_NO_COP |
335 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 346 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
336 | e << baseFile; | 347 | e << baseFile; |
337 | #endif | 348 | #endif |
338 | } else if ( msg == "rdiffCleanup()" ) { | 349 | } else |
350 | |||
351 | if ( msg == "rdiffCleanup()" ) { | ||
339 | mkdir( "/tmp/rdiff" ); | 352 | mkdir( "/tmp/rdiff" ); |
340 | QDir dir; | 353 | QDir dir; |
341 | dir.setPath( "/tmp/rdiff" ); | 354 | dir.setPath( "/tmp/rdiff" ); |
342 | QStringList entries = dir.entryList(); | 355 | QStringList entries = dir.entryList(); |
343 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 356 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
344 | dir.remove( *it ); | 357 | dir.remove( *it ); |
345 | } else if ( msg == "sendHandshakeInfo()" ) { | 358 | } else |
359 | |||
360 | if ( msg == "sendHandshakeInfo()" ) { | ||
346 | QString home = getenv( "HOME" ); | 361 | QString home = getenv( "HOME" ); |
347 | #ifndef QT_NO_COP | 362 | #ifndef QT_NO_COP |
348 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 363 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
349 | e << home; | 364 | e << home; |
350 | int locked = (int) ServerApplication::screenLocked(); | 365 | int locked = (int) ServerApplication::screenLocked(); |
351 | e << locked; | 366 | e << locked; |
352 | #endif | 367 | #endif |
368 | } else | ||
353 | 369 | ||
354 | } | ||
355 | /* | 370 | /* |
356 | * QtopiaDesktop relies on the major number | 371 | * QtopiaDesktop relies on the major number |
357 | * to start with 1. We're at 0.9 | 372 | * to start with 1. We're at 0.9 |
358 | * so wee need to fake at least 1.4 to be able | 373 | * so wee need to fake at least 1.4 to be able |
359 | * to sync with QtopiaDesktop1.6 | 374 | * to sync with QtopiaDesktop1.6 |
360 | */ | 375 | */ |
361 | else if ( msg == "sendVersionInfo()" ) { | 376 | if ( msg == "sendVersionInfo()" ) { |
362 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); | 377 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" ); |
363 | /* ### FIXME Architecture ### */ | 378 | /* ### FIXME Architecture ### */ |
364 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; | 379 | e << QString::fromLatin1("1.7") << "Uncustomized Device"; |
365 | } else if ( msg == "sendCardInfo()" ) { | 380 | } else |
381 | |||
382 | if ( msg == "sendCardInfo()" ) { | ||
366 | #ifndef QT_NO_COP | 383 | #ifndef QT_NO_COP |
367 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 384 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
368 | #endif | 385 | #endif |
369 | storage->update(); | 386 | storage->update(); |
@@ -388,13 +405,14 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
388 | } | 405 | } |
389 | } | 406 | } |
390 | if ( !homeFs.isEmpty() ) | 407 | if ( !homeFs.isEmpty() ) |
391 | s += homeFs; | 408 | s += homeFs; |
392 | |||
393 | #ifndef QT_NO_COP | 409 | #ifndef QT_NO_COP |
394 | e << s; | 410 | e << s; |
395 | #endif | 411 | #endif |
396 | } else if ( msg == "sendSyncDate(QString)" ) { | 412 | } else |
413 | |||
414 | if ( msg == "sendSyncDate(QString)" ) { | ||
397 | QString app; | 415 | QString app; |
398 | stream >> app; | 416 | stream >> app; |
399 | Config cfg( "qpe" ); | 417 | Config cfg( "qpe" ); |
400 | cfg.setGroup("SyncDate"); | 418 | cfg.setGroup("SyncDate"); |
@@ -403,66 +421,86 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
403 | e << app << cfg.readEntry( app ); | 421 | e << app << cfg.readEntry( app ); |
404 | #endif | 422 | #endif |
405 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " | 423 | //odebug << "QPE/System sendSyncDate for " << app.latin1() << ": response " |
406 | // << cfg.readEntry( app ).latin1() << oendl; | 424 | // << cfg.readEntry( app ).latin1() << oendl; |
407 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 425 | } else |
426 | |||
427 | if ( msg == "setSyncDate(QString,QString)" ) { | ||
408 | QString app, date; | 428 | QString app, date; |
409 | stream >> app >> date; | 429 | stream >> app >> date; |
410 | Config cfg( "qpe" ); | 430 | Config cfg( "qpe" ); |
411 | cfg.setGroup("SyncDate"); | 431 | cfg.setGroup("SyncDate"); |
412 | cfg.writeEntry( app, date ); | 432 | cfg.writeEntry( app, date ); |
413 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; | 433 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; |
414 | } else if ( msg == "startSync(QString)" ) { | 434 | } else |
435 | |||
436 | if ( msg == "startSync(QString)" ) { | ||
415 | QString what; | 437 | QString what; |
416 | stream >> what; | 438 | stream >> what; |
417 | delete syncDialog; | 439 | delete syncDialog; |
418 | syncDialog = new SyncDialog( this, what ); | 440 | syncDialog = new SyncDialog( this, what ); |
419 | syncDialog->show(); | 441 | syncDialog->show(); |
420 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 442 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
421 | } else if ( msg == "stopSync()") { | 443 | } else |
444 | |||
445 | if ( msg == "stopSync()") { | ||
422 | delete syncDialog; | 446 | delete syncDialog; |
423 | syncDialog = 0; | 447 | syncDialog = 0; |
424 | } else if (msg == "restoreDone(QString)") { | 448 | } else |
449 | |||
450 | if (msg == "restoreDone(QString)") { | ||
425 | docList->restoreDone(); | 451 | docList->restoreDone(); |
426 | } else if ( msg == "getAllDocLinks()" ) { | 452 | } else |
453 | |||
454 | if ( msg == "getAllDocLinks()" ) { | ||
427 | docList->sendAllDocLinks(); | 455 | docList->sendAllDocLinks(); |
428 | } | 456 | } else |
457 | |||
429 | #ifdef Q_WS_QWS | 458 | #ifdef Q_WS_QWS |
430 | else if ( msg == "setMouseProto(QString)" ) { | 459 | if ( msg == "setMouseProto(QString)" ) { |
431 | QString mice; | 460 | QString mice; |
432 | stream >> mice; | 461 | stream >> mice; |
433 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 462 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
434 | qwsServer->openMouse(); | 463 | qwsServer->openMouse(); |
435 | } else if ( msg == "setKeyboard(QString)" ) { | 464 | } else |
465 | |||
466 | if ( msg == "setKeyboard(QString)" ) { | ||
436 | QString kb; | 467 | QString kb; |
437 | stream >> kb; | 468 | stream >> kb; |
438 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 469 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
439 | qwsServer->openKeyboard(); | 470 | qwsServer->openKeyboard(); |
471 | } else | ||
440 | 472 | ||
441 | } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) { | 473 | if ( msg == "setKeyboardAutoRepeat(int,int)" ) { |
442 | int delay, period; | 474 | int delay, period; |
443 | stream >> delay >> period; | 475 | stream >> delay >> period; |
444 | qwsSetKeyboardAutoRepeat( delay, period ); | 476 | qwsSetKeyboardAutoRepeat( delay, period ); |
445 | Config cfg( "qpe" ); | 477 | Config cfg( "qpe" ); |
446 | cfg.setGroup("Keyboard"); | 478 | cfg.setGroup("Keyboard"); |
447 | cfg.writeEntry( "RepeatDelay", delay ); | 479 | cfg.writeEntry( "RepeatDelay", delay ); |
448 | cfg.writeEntry( "RepeatPeriod", period ); | 480 | cfg.writeEntry( "RepeatPeriod", period ); |
449 | } else if ( msg == "setKeyboardLayout(QString)" ) { | 481 | } else |
482 | |||
483 | if ( msg == "setKeyboardLayout(QString)" ) { | ||
450 | QString kb; | 484 | QString kb; |
451 | stream >> kb; | 485 | stream >> kb; |
452 | setKeyboardLayout( kb ); | 486 | setKeyboardLayout( kb ); |
453 | Config cfg( "qpe" ); | 487 | Config cfg( "qpe" ); |
454 | cfg.setGroup("Keyboard"); | 488 | cfg.setGroup("Keyboard"); |
455 | cfg.writeEntry( "Layout", kb ); | 489 | cfg.writeEntry( "Layout", kb ); |
456 | } else if ( msg == "autoStart(QString)" ) { | 490 | } else |
491 | |||
492 | if ( msg == "autoStart(QString)" ) { | ||
457 | QString appName; | 493 | QString appName; |
458 | stream >> appName; | 494 | stream >> appName; |
459 | Config cfg( "autostart" ); | 495 | Config cfg( "autostart" ); |
460 | cfg.setGroup( "AutoStart" ); | 496 | cfg.setGroup( "AutoStart" ); |
461 | if ( appName.compare("clear") == 0){ | 497 | if ( appName.compare("clear") == 0){ |
462 | cfg.writeEntry("Apps", ""); | 498 | cfg.writeEntry("Apps", ""); |
463 | } | 499 | } |
464 | } else if ( msg == "autoStart(QString,QString)" ) { | 500 | } else |
501 | |||
502 | if ( msg == "autoStart(QString,QString)" ) { | ||
465 | QString modifier, appName; | 503 | QString modifier, appName; |
466 | stream >> modifier >> appName; | 504 | stream >> modifier >> appName; |
467 | Config cfg( "autostart" ); | 505 | Config cfg( "autostart" ); |
468 | cfg.setGroup( "AutoStart" ); | 506 | cfg.setGroup( "AutoStart" ); |
@@ -481,9 +519,11 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
481 | cfg.writeEntry("Apps", ""); | 519 | cfg.writeEntry("Apps", ""); |
482 | } | 520 | } |
483 | } | 521 | } |
484 | // case the autostart feature should be delayed | 522 | // case the autostart feature should be delayed |
485 | } else if ( msg == "autoStart(QString,QString,QString)") { | 523 | } else |
524 | |||
525 | if ( msg == "autoStart(QString,QString,QString)") { | ||
486 | QString modifier, appName, delay; | 526 | QString modifier, appName, delay; |
487 | stream >> modifier >> appName >> delay; | 527 | stream >> modifier >> appName >> delay; |
488 | Config cfg( "autostart" ); | 528 | Config cfg( "autostart" ); |
489 | 529 | ||
@@ -493,9 +533,8 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
493 | if (!appName.isEmpty()) { | 533 | if (!appName.isEmpty()) { |
494 | cfg.writeEntry("Apps", appName); | 534 | cfg.writeEntry("Apps", appName); |
495 | cfg.writeEntry("Delay", delay); | 535 | cfg.writeEntry("Delay", delay); |
496 | } | 536 | } |
497 | } else { | ||
498 | } | 537 | } |
499 | } | 538 | } |
500 | #endif | 539 | #endif |
501 | } | 540 | } |
@@ -505,12 +544,15 @@ void Server::receiveTaskBar(const QCString &msg, const QByteArray &data) | |||
505 | QDataStream stream( data, IO_ReadOnly ); | 544 | QDataStream stream( data, IO_ReadOnly ); |
506 | 545 | ||
507 | if ( msg == "reloadApps()" ) { | 546 | if ( msg == "reloadApps()" ) { |
508 | docList->reloadAppLnks(); | 547 | docList->reloadAppLnks(); |
509 | } else if ( msg == "soundAlarm()" ) { | 548 | } else |
549 | |||
550 | if ( msg == "soundAlarm()" ) { | ||
510 | ServerApplication::soundAlarm(); | 551 | ServerApplication::soundAlarm(); |
511 | } | 552 | } else |
512 | else if ( msg == "setLed(int,bool)" ) { | 553 | |
554 | if ( msg == "setLed(int,bool)" ) { | ||
513 | int led, status; | 555 | int led, status; |
514 | stream >> led >> status; | 556 | stream >> led >> status; |
515 | 557 | ||
516 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); | 558 | QValueList <OLed> ll = ODevice::inst ( )-> ledList ( ); |
@@ -553,11 +595,11 @@ bool Server::mkdir(const QString &localPath) | |||
553 | } | 595 | } |
554 | 596 | ||
555 | while (checkedPath != localPath) { | 597 | while (checkedPath != localPath) { |
556 | // no more seperators found, use the local path | 598 | // no more seperators found, use the local path |
557 | if (dirIndex == -1) | 599 | if (dirIndex == -1) { |
558 | checkedPath = localPath; | 600 | checkedPath = localPath; |
559 | else { | 601 | } else { |
560 | // the next directory to check | 602 | // the next directory to check |
561 | checkedPath = localPath.left(dirIndex) + "/"; | 603 | checkedPath = localPath.left(dirIndex) + "/"; |
562 | // advance the iterator; the next dir seperator | 604 | // advance the iterator; the next dir seperator |
563 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 605 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
@@ -595,8 +637,9 @@ void Server::startTransferServer() | |||
595 | delete qcopBridge; | 637 | delete qcopBridge; |
596 | qcopBridge = 0; | 638 | qcopBridge = 0; |
597 | } | 639 | } |
598 | } | 640 | } |
641 | |||
599 | if ( !transferServer ) { | 642 | if ( !transferServer ) { |
600 | // start transfer server | 643 | // start transfer server |
601 | transferServer = new TransferServer( 4242 ); | 644 | transferServer = new TransferServer( 4242 ); |
602 | if ( transferServer->ok() ) { | 645 | if ( transferServer->ok() ) { |
@@ -604,22 +647,23 @@ void Server::startTransferServer() | |||
604 | } else { | 647 | } else { |
605 | delete transferServer; | 648 | delete transferServer; |
606 | transferServer = 0; | 649 | transferServer = 0; |
607 | } | 650 | } |
608 | } | 651 | |
609 | if ( !transferServer || !qcopBridge ) | 652 | if ( !qcopBridge ) |
610 | tid_xfer = startTimer( 2000 ); | 653 | tid_xfer = startTimer( 2000 ); |
611 | } | 654 | } |
655 | } | ||
612 | 656 | ||
613 | void Server::timerEvent( QTimerEvent *e ) | 657 | void Server::timerEvent( QTimerEvent *e ) |
614 | { | 658 | { |
615 | if ( e->timerId() == tid_xfer ) { | 659 | if ( e->timerId() == tid_xfer ) { |
616 | killTimer( tid_xfer ); | 660 | killTimer( tid_xfer ); |
617 | tid_xfer = 0; | 661 | tid_xfer = 0; |
618 | startTransferServer(); | 662 | startTransferServer(); |
619 | } | 663 | } |
620 | /* ### FIXME today startin */ | ||
621 | #if 0 | 664 | #if 0 |
665 | /* ### FIXME today startin */ | ||
622 | else if ( e->timerId() == tid_today ) { | 666 | else if ( e->timerId() == tid_today ) { |
623 | QDate today = QDate::currentDate(); | 667 | QDate today = QDate::currentDate(); |
624 | if ( today != last_today_show ) { | 668 | if ( today != last_today_show ) { |
625 | last_today_show = today; | 669 | last_today_show = today; |
@@ -703,5 +747,4 @@ void Server::preloadApps() | |||
703 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 747 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
704 | #endif | 748 | #endif |
705 | } | 749 | } |
706 | } | 750 | } |
707 | |||