-rw-r--r-- | library/global.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/global.cpp b/library/global.cpp index e5fc2b3..fd7579a 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -444,129 +444,129 @@ void Global::terminate( const AppLnk* app ) | |||
444 | 444 | ||
445 | /*! | 445 | /*! |
446 | Low-level function to run command \a c. Not recommended. | 446 | Low-level function to run command \a c. Not recommended. |
447 | */ | 447 | */ |
448 | void Global::invoke(const QString &c) | 448 | void Global::invoke(const QString &c) |
449 | { | 449 | { |
450 | // Convert the command line in to a list of arguments | 450 | // Convert the command line in to a list of arguments |
451 | QStringList list = QStringList::split(QRegExp(" *"),c); | 451 | QStringList list = QStringList::split(QRegExp(" *"),c); |
452 | 452 | ||
453 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 453 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
454 | QString ap=list[0]; | 454 | QString ap=list[0]; |
455 | // see if the application is already running | 455 | // see if the application is already running |
456 | // XXX should lock file /tmp/qcop-msg-ap | 456 | // XXX should lock file /tmp/qcop-msg-ap |
457 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { | 457 | if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { |
458 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 458 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
459 | e << ap; | 459 | e << ap; |
460 | return; | 460 | return; |
461 | } | 461 | } |
462 | // XXX should unlock file /tmp/qcop-msg-ap | 462 | // XXX should unlock file /tmp/qcop-msg-ap |
463 | //see if it is being started | 463 | //see if it is being started |
464 | if ( StartingAppList::isStarting( ap ) ) { | 464 | if ( StartingAppList::isStarting( ap ) ) { |
465 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 465 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
466 | e << ap; | 466 | e << ap; |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | 469 | ||
470 | #endif | 470 | #endif |
471 | 471 | ||
472 | #ifdef QT_NO_QWS_MULTIPROCESS | 472 | #ifdef QT_NO_QWS_MULTIPROCESS |
473 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); | 473 | QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); |
474 | #else | 474 | #else |
475 | 475 | ||
476 | QStrList slist; | 476 | QStrList slist; |
477 | unsigned int j; | 477 | unsigned int j; |
478 | for ( j = 0; j < list.count(); j++ ) | 478 | for ( j = 0; j < list.count(); j++ ) |
479 | slist.append( list[j].utf8() ); | 479 | slist.append( list[j].utf8() ); |
480 | 480 | ||
481 | const char **args = new (const char *)[slist.count() + 1]; | 481 | const char **args = new (const char *)[slist.count() + 1]; |
482 | for ( j = 0; j < slist.count(); j++ ) | 482 | for ( j = 0; j < slist.count(); j++ ) |
483 | args[j] = slist.at(j); | 483 | args[j] = slist.at(j); |
484 | args[j] = NULL; | 484 | args[j] = NULL; |
485 | 485 | ||
486 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 486 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
487 | // an attempt to show a wait... | 487 | // an attempt to show a wait... |
488 | // more logic should be used, but this will be fine for the moment... | 488 | // more logic should be used, but this will be fine for the moment... |
489 | QCopEnvelope ( "QPE/System", "busy()" ); | 489 | QCopEnvelope ( "QPE/System", "busy()" ); |
490 | #endif | 490 | #endif |
491 | 491 | ||
492 | #ifdef HAVE_QUICKEXEC | 492 | #ifdef HAVE_QUICKEXEC |
493 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; | 493 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; |
494 | qDebug("libfile = %s", libexe.latin1() ); | 494 | qDebug("libfile = %s", libexe.latin1() ); |
495 | if ( QFile::exists( libexe ) ) { | 495 | if ( QFile::exists( libexe ) ) { |
496 | qDebug("calling quickexec %s", libexe.latin1() ); | 496 | qDebug("calling quickexec %s", libexe.latin1() ); |
497 | quickexecv( libexe.utf8().data(), (const char **)args ); | 497 | quickexecv( libexe.utf8().data(), (const char **)args ); |
498 | } else | 498 | } else |
499 | #endif | 499 | #endif |
500 | { | 500 | { |
501 | if ( !::vfork() ) { | 501 | if ( !::vfork() ) { |
502 | for ( int fd = 3; fd < 100; fd++ ) | 502 | for ( int fd = 3; fd < 100; fd++ ) |
503 | ::close( fd ); | 503 | ::close( fd ); |
504 | ::setpgid( ::getpid(), ::getppid() ); | 504 | ::setpgid( ::getpid(), ::getppid() ); |
505 | // Try bindir first, so that foo/bar works too | 505 | // Try bindir first, so that foo/bar works too |
506 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); | 506 | ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); |
507 | ::execvp( args[0], (char * const *)args ); | 507 | ::execvp( args[0], (char * const *)args ); |
508 | exit( -1 ); | 508 | _exit( -1 ); |
509 | } | 509 | } |
510 | } | 510 | } |
511 | StartingAppList::add( list[0] ); | 511 | StartingAppList::add( list[0] ); |
512 | #endif //QT_NO_QWS_MULTIPROCESS | 512 | #endif //QT_NO_QWS_MULTIPROCESS |
513 | } | 513 | } |
514 | 514 | ||
515 | /*! | 515 | /*! |
516 | Executes application identfied by \a c, passing \a document. | 516 | Executes application identfied by \a c, passing \a document. |
517 | 517 | ||
518 | Note that you might be better off sending a QCop message to | 518 | Note that you might be better off sending a QCop message to |
519 | the application's QPE/Application/<i>appname</i> channel. | 519 | the application's QPE/Application/<i>appname</i> channel. |
520 | */ | 520 | */ |
521 | void Global::execute( const QString &c, const QString& document ) | 521 | void Global::execute( const QString &c, const QString& document ) |
522 | { | 522 | { |
523 | if ( qApp->type() != QApplication::GuiServer ) { | 523 | if ( qApp->type() != QApplication::GuiServer ) { |
524 | // ask the server to do the work | 524 | // ask the server to do the work |
525 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 525 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
526 | if ( document.isNull() ) { | 526 | if ( document.isNull() ) { |
527 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 527 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
528 | e << c; | 528 | e << c; |
529 | } else { | 529 | } else { |
530 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); | 530 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); |
531 | e << c << document; | 531 | e << c << document; |
532 | } | 532 | } |
533 | #endif | 533 | #endif |
534 | return; | 534 | return; |
535 | } | 535 | } |
536 | 536 | ||
537 | // Attempt to execute the app using a builtin class for the app first | 537 | // Attempt to execute the app using a builtin class for the app first |
538 | // else try and find it in the bin directory | 538 | // else try and find it in the bin directory |
539 | if (builtin) { | 539 | if (builtin) { |
540 | for (int i = 0; builtin[i].file; i++) { | 540 | for (int i = 0; builtin[i].file; i++) { |
541 | if ( builtin[i].file == c ) { | 541 | if ( builtin[i].file == c ) { |
542 | if ( running[i] ) { | 542 | if ( running[i] ) { |
543 | if ( !document.isNull() && builtin[i].documentary ) | 543 | if ( !document.isNull() && builtin[i].documentary ) |
544 | setDocument(running[i], document); | 544 | setDocument(running[i], document); |
545 | running[i]->raise(); | 545 | running[i]->raise(); |
546 | running[i]->show(); | 546 | running[i]->show(); |
547 | running[i]->setActiveWindow(); | 547 | running[i]->setActiveWindow(); |
548 | } else { | 548 | } else { |
549 | running[i] = builtin[i].func( builtin[i].maximized ); | 549 | running[i] = builtin[i].func( builtin[i].maximized ); |
550 | } | 550 | } |
551 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 551 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
552 | e << c; // that was quick ;-) | 552 | e << c; // that was quick ;-) |
553 | return; | 553 | return; |
554 | } | 554 | } |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | //Global::invoke(c, document); | 558 | //Global::invoke(c, document); |
559 | 559 | ||
560 | // Convert the command line in to a list of arguments | 560 | // Convert the command line in to a list of arguments |
561 | QStringList list = QStringList::split(QRegExp(" *"),c); | 561 | QStringList list = QStringList::split(QRegExp(" *"),c); |
562 | 562 | ||
563 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 563 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
564 | QString ap=list[0]; | 564 | QString ap=list[0]; |
565 | 565 | ||
566 | qDebug("executing %s", ap.latin1() ); | 566 | qDebug("executing %s", ap.latin1() ); |
567 | if ( ap == "suspend" ) { | 567 | if ( ap == "suspend" ) { |
568 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 568 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
569 | return; | 569 | return; |
570 | } | 570 | } |
571 | 571 | ||
572 | /* if need be, sending a qcop message will result in an invoke, see | 572 | /* if need be, sending a qcop message will result in an invoke, see |