summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 7438891..2e4d03f 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -519,96 +519,99 @@ void Global::setDocument( QWidget* receiver, const QString& document )
519/*! 519/*!
520 \internal 520 \internal
521*/ 521*/
522bool Global::terminateBuiltin( const QString& n ) 522bool Global::terminateBuiltin( const QString& n )
523{ 523{
524 if (!builtin) 524 if (!builtin)
525 return FALSE; 525 return FALSE;
526 for (int i = 0; builtin[i].file; i++) { 526 for (int i = 0; builtin[i].file; i++) {
527 if ( builtin[i].file == n ) { 527 if ( builtin[i].file == n ) {
528 delete running[i]; 528 delete running[i];
529 return TRUE; 529 return TRUE;
530 } 530 }
531 } 531 }
532 return FALSE; 532 return FALSE;
533} 533}
534 534
535/*! 535/*!
536 \internal 536 \internal
537*/ 537*/
538void Global::terminate( const AppLnk* app ) 538void Global::terminate( const AppLnk* app )
539{ 539{
540 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this 540 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this
541 541
542#ifndef QT_NO_COP 542#ifndef QT_NO_COP
543 QCString channel = "QPE/Application/" + app->exec().utf8(); 543 QCString channel = "QPE/Application/" + app->exec().utf8();
544 if ( QCopChannel::isRegistered(channel) ) { 544 if ( QCopChannel::isRegistered(channel) ) {
545 QCopEnvelope e(channel, "quit()"); 545 QCopEnvelope e(channel, "quit()");
546 } 546 }
547#endif 547#endif
548} 548}
549 549
550/*! 550/*!
551 Low-level function to run command \a c. 551 Low-level function to run command \a c.
552 552
553 \warning Do not use this function. Use execute instead. 553 \warning Do not use this function. Use execute instead.
554 554
555 \sa execute() 555 \sa execute()
556*/ 556*/
557void Global::invoke(const QString &c) 557void Global::invoke(const QString &c)
558{ 558{
559 // Convert the command line in to a list of arguments 559 // Convert the command line in to a list of arguments
560 QStringList list = QStringList::split(QRegExp(" *"),c); 560 QStringList list = QStringList::split(QRegExp(" *"),c);
561 561
562#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 562#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
563 QString ap=list[0]; 563 QString ap=list[0];
564 // see if the application is already running 564 // see if the application is already running
565 // XXX should lock file /tmp/qcop-msg-ap 565 // XXX should lock file /tmp/qcop-msg-ap
566 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { 566 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
567 // If the channel is already register, the app is already running, so show it.
568 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
569
567 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 570 QCopEnvelope e("QPE/System", "notBusy(QString)" );
568 e << ap; 571 e << ap;
569 return; 572 return;
570 } 573 }
571 // XXX should unlock file /tmp/qcop-msg-ap 574 // XXX should unlock file /tmp/qcop-msg-ap
572 //see if it is being started 575 //see if it is being started
573 if ( StartingAppList::isStarting( ap ) ) { 576 if ( StartingAppList::isStarting( ap ) ) {
574 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 577 QCopEnvelope e("QPE/System", "notBusy(QString)" );
575 e << ap; 578 e << ap;
576 return; 579 return;
577 } 580 }
578 581
579#endif 582#endif
580 583
581#ifdef QT_NO_QWS_MULTIPROCESS 584#ifdef QT_NO_QWS_MULTIPROCESS
582 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); 585 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
583#else 586#else
584 587
585 QStrList slist; 588 QStrList slist;
586 unsigned int j; 589 unsigned int j;
587 for ( j = 0; j < list.count(); j++ ) 590 for ( j = 0; j < list.count(); j++ )
588 slist.append( list[j].utf8() ); 591 slist.append( list[j].utf8() );
589 592
590 const char **args = new (const char *)[slist.count() + 1]; 593 const char **args = new (const char *)[slist.count() + 1];
591 for ( j = 0; j < slist.count(); j++ ) 594 for ( j = 0; j < slist.count(); j++ )
592 args[j] = slist.at(j); 595 args[j] = slist.at(j);
593 args[j] = NULL; 596 args[j] = NULL;
594 597
595#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 598#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
596 // an attempt to show a wait... 599 // an attempt to show a wait...
597 // more logic should be used, but this will be fine for the moment... 600 // more logic should be used, but this will be fine for the moment...
598 QCopEnvelope ( "QPE/System", "busy()" ); 601 QCopEnvelope ( "QPE/System", "busy()" );
599#endif 602#endif
600 603
601#ifdef HAVE_QUICKEXEC 604#ifdef HAVE_QUICKEXEC
602 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; 605 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
603 qDebug("libfile = %s", libexe.latin1() ); 606 qDebug("libfile = %s", libexe.latin1() );
604 if ( QFile::exists( libexe ) ) { 607 if ( QFile::exists( libexe ) ) {
605 qDebug("calling quickexec %s", libexe.latin1() ); 608 qDebug("calling quickexec %s", libexe.latin1() );
606 quickexecv( libexe.utf8().data(), (const char **)args ); 609 quickexecv( libexe.utf8().data(), (const char **)args );
607 } else 610 } else
608#endif 611#endif
609 { 612 {
610 if ( !::vfork() ) { 613 if ( !::vfork() ) {
611 for ( int fd = 3; fd < 100; fd++ ) 614 for ( int fd = 3; fd < 100; fd++ )
612 ::close( fd ); 615 ::close( fd );
613 ::setpgid( ::getpid(), ::getppid() ); 616 ::setpgid( ::getpid(), ::getppid() );
614 // Try bindir first, so that foo/bar works too 617 // Try bindir first, so that foo/bar works too