summaryrefslogtreecommitdiff
path: root/library/global.cpp
authorzecke <zecke>2003-08-25 14:46:43 (UTC)
committer zecke <zecke>2003-08-25 14:46:43 (UTC)
commit292b097e7db25dd231381c5b09307a1fbe81a492 (patch) (unidiff)
treeb103c6c5e15e784dc07af55539672a72559da821 /library/global.cpp
parent5f292b6e4fc0f4ee8e4bced9a916f6bdce864b6b (diff)
downloadopie-292b097e7db25dd231381c5b09307a1fbe81a492.zip
opie-292b097e7db25dd231381c5b09307a1fbe81a492.tar.gz
opie-292b097e7db25dd231381c5b09307a1fbe81a492.tar.bz2
-instead of defining for an board we define now what this
boards need QPE_NEED_CALIBRATE -launcher is the only one executin application -allow processing of QCOPfiles after start ( qpeapplication ) -qcopenvelope no longer calls Global::execute
Diffstat (limited to 'library/global.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp59
1 files changed, 7 insertions, 52 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 189b830..5c89430 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -655,104 +655,59 @@ void Global::invoke(const QString &c)
655 655
656 break; // success 656 break; // success
657 } 657 }
658 ::close ( pfd [0] ); 658 ::close ( pfd [0] );
659 } 659 }
660 } 660 }
661 if ( success ) 661 if ( success )
662 StartingAppList::add( list[0] ); 662 StartingAppList::add( list[0] );
663 else 663 else
664 QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 ); 664 QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 );
665 } 665 }
666#endif //QT_NO_QWS_MULTIPROCESS 666#endif //QT_NO_QWS_MULTIPROCESS
667} 667}
668 668
669 669
670/*! 670/*!
671 Executes the application identfied by \a c, passing \a 671 Executes the application identfied by \a c, passing \a
672 document if it isn't null. 672 document if it isn't null.
673 673
674 Note that a better approach might be to send a QCop message to the 674 Note that a better approach might be to send a QCop message to the
675 application's QPE/Application/\e{appname} channel. 675 application's QPE/Application/\e{appname} channel.
676*/ 676*/
677void Global::execute( const QString &c, const QString& document ) 677void Global::execute( const QString &c, const QString& document )
678{ 678{
679 if ( qApp->type() != QApplication::GuiServer ) {
680 // ask the server to do the work 679 // ask the server to do the work
681#if !defined(QT_NO_COP) 680#if !defined(QT_NO_COP)
682 if ( document.isNull() ) { 681 if ( document.isNull() ) {
683 QCopEnvelope e( "QPE/System", "execute(QString)" ); 682 QCopEnvelope e( "QPE/System", "execute(QString)" );
684 e << c; 683 e << c;
685 } else { 684 } else {
686 QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); 685 QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
687 e << c << document; 686 e << c << document;
688 }
689#endif
690 return;
691 }
692
693 // Attempt to execute the app using a builtin class for the app first
694 // else try and find it in the bin directory
695 if (builtin) {
696 for (int i = 0; builtin[i].file; i++) {
697 if ( builtin[i].file == c ) {
698 if ( running[i] ) {
699 if ( !document.isNull() && builtin[i].documentary )
700 setDocument(running[i], document);
701 running[i]->raise();
702 running[i]->show();
703 running[i]->setActiveWindow();
704 } else {
705 running[i] = builtin[i].func( builtin[i].maximized );
706 }
707#ifndef QT_NO_COP
708 QCopEnvelope e("QPE/System", "notBusy(QString)" );
709 e << c; // that was quick ;-)
710#endif
711 return;
712 }
713 }
714 }
715
716 //Global::invoke(c, document);
717
718 // Convert the command line in to a list of arguments
719 QStringList list = QStringList::split(QRegExp(" *"),c);
720
721#if !defined(QT_NO_COP)
722 QString ap=list[0];
723
724 qDebug("executing %s", ap.latin1() );
725
726 /* if need be, sending a qcop message will result in an invoke, see
727 preceeding function */
728 invoke( ap );
729 //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
730 if ( !document.isEmpty() ) {
731 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" );
732 env << document;
733 } 687 }
734#endif 688#endif
689 return;
735} 690}
736 691
737/*! 692/*!
738 Returns the string \a s with the characters '\', '"', and '$' quoted 693 Returns the string \a s with the characters '\', '"', and '$' quoted
739 by a preceeding '\'. 694 by a preceeding '\'.
740 695
741 \sa stringQuote() 696 \sa stringQuote()
742*/ 697*/
743QString Global::shellQuote(const QString& s) 698QString Global::shellQuote(const QString& s)
744{ 699{
745 QString r="\""; 700 QString r="\"";
746 for (int i=0; i<(int)s.length(); i++) { 701 for (int i=0; i<(int)s.length(); i++) {
747 char c = s[i].latin1(); 702 char c = s[i].latin1();
748 switch (c) { 703 switch (c) {
749 case '\\': case '"': case '$': 704 case '\\': case '"': case '$':
750 r+="\\"; 705 r+="\\";
751 } 706 }
752 r += s[i]; 707 r += s[i];
753 } 708 }
754 r += "\""; 709 r += "\"";
755 return r; 710 return r;
756} 711}
757 712
758/*! 713/*!