-rw-r--r-- | library/global.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/library/global.cpp b/library/global.cpp index 2e4d03f..9b908bf 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -619,132 +619,128 @@ void Global::invoke(const QString &c) | |||
619 | ::execvp( args[0], (char * const *)args ); | 619 | ::execvp( args[0], (char * const *)args ); |
620 | _exit( -1 ); | 620 | _exit( -1 ); |
621 | } | 621 | } |
622 | } | 622 | } |
623 | StartingAppList::add( list[0] ); | 623 | StartingAppList::add( list[0] ); |
624 | #endif //QT_NO_QWS_MULTIPROCESS | 624 | #endif //QT_NO_QWS_MULTIPROCESS |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | /*! | 628 | /*! |
629 | Executes the application identfied by \a c, passing \a | 629 | Executes the application identfied by \a c, passing \a |
630 | document if it isn't null. | 630 | document if it isn't null. |
631 | 631 | ||
632 | Note that a better approach might be to send a QCop message to the | 632 | Note that a better approach might be to send a QCop message to the |
633 | application's QPE/Application/\e{appname} channel. | 633 | application's QPE/Application/\e{appname} channel. |
634 | */ | 634 | */ |
635 | void Global::execute( const QString &c, const QString& document ) | 635 | void Global::execute( const QString &c, const QString& document ) |
636 | { | 636 | { |
637 | if ( qApp->type() != QApplication::GuiServer ) { | 637 | if ( qApp->type() != QApplication::GuiServer ) { |
638 | // ask the server to do the work | 638 | // ask the server to do the work |
639 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 639 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
640 | if ( document.isNull() ) { | 640 | if ( document.isNull() ) { |
641 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 641 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
642 | e << c; | 642 | e << c; |
643 | } else { | 643 | } else { |
644 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); | 644 | QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); |
645 | e << c << document; | 645 | e << c << document; |
646 | } | 646 | } |
647 | #endif | 647 | #endif |
648 | return; | 648 | return; |
649 | } | 649 | } |
650 | 650 | ||
651 | // Attempt to execute the app using a builtin class for the app first | 651 | // Attempt to execute the app using a builtin class for the app first |
652 | // else try and find it in the bin directory | 652 | // else try and find it in the bin directory |
653 | if (builtin) { | 653 | if (builtin) { |
654 | for (int i = 0; builtin[i].file; i++) { | 654 | for (int i = 0; builtin[i].file; i++) { |
655 | if ( builtin[i].file == c ) { | 655 | if ( builtin[i].file == c ) { |
656 | if ( running[i] ) { | 656 | if ( running[i] ) { |
657 | if ( !document.isNull() && builtin[i].documentary ) | 657 | if ( !document.isNull() && builtin[i].documentary ) |
658 | setDocument(running[i], document); | 658 | setDocument(running[i], document); |
659 | running[i]->raise(); | 659 | running[i]->raise(); |
660 | running[i]->show(); | 660 | running[i]->show(); |
661 | running[i]->setActiveWindow(); | 661 | running[i]->setActiveWindow(); |
662 | } else { | 662 | } else { |
663 | running[i] = builtin[i].func( builtin[i].maximized ); | 663 | running[i] = builtin[i].func( builtin[i].maximized ); |
664 | } | 664 | } |
665 | #ifndef QT_NO_COP | 665 | #ifndef QT_NO_COP |
666 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 666 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
667 | e << c; // that was quick ;-) | 667 | e << c; // that was quick ;-) |
668 | #endif | 668 | #endif |
669 | return; | 669 | return; |
670 | } | 670 | } |
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
674 | //Global::invoke(c, document); | 674 | //Global::invoke(c, document); |
675 | 675 | ||
676 | // Convert the command line in to a list of arguments | 676 | // Convert the command line in to a list of arguments |
677 | QStringList list = QStringList::split(QRegExp(" *"),c); | 677 | QStringList list = QStringList::split(QRegExp(" *"),c); |
678 | 678 | ||
679 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 679 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
680 | QString ap=list[0]; | 680 | QString ap=list[0]; |
681 | 681 | ||
682 | qDebug("executing %s", ap.latin1() ); | 682 | qDebug("executing %s", ap.latin1() ); |
683 | if ( ap == "suspend" ) { | ||
684 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | ||
685 | return; | ||
686 | } | ||
687 | 683 | ||
688 | /* if need be, sending a qcop message will result in an invoke, see | 684 | /* if need be, sending a qcop message will result in an invoke, see |
689 | preceeding function */ | 685 | preceeding function */ |
690 | invoke( ap ); | 686 | invoke( ap ); |
691 | //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } | 687 | //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } |
692 | if ( !document.isEmpty() ) { | 688 | if ( !document.isEmpty() ) { |
693 | QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); | 689 | QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); |
694 | env << document; | 690 | env << document; |
695 | } | 691 | } |
696 | #endif | 692 | #endif |
697 | } | 693 | } |
698 | 694 | ||
699 | /*! | 695 | /*! |
700 | Returns the string \a s with the characters '\', '"', and '$' quoted | 696 | Returns the string \a s with the characters '\', '"', and '$' quoted |
701 | by a preceeding '\'. | 697 | by a preceeding '\'. |
702 | 698 | ||
703 | \sa stringQuote() | 699 | \sa stringQuote() |
704 | */ | 700 | */ |
705 | QString Global::shellQuote(const QString& s) | 701 | QString Global::shellQuote(const QString& s) |
706 | { | 702 | { |
707 | QString r="\""; | 703 | QString r="\""; |
708 | for (int i=0; i<(int)s.length(); i++) { | 704 | for (int i=0; i<(int)s.length(); i++) { |
709 | char c = s[i].latin1(); | 705 | char c = s[i].latin1(); |
710 | switch (c) { | 706 | switch (c) { |
711 | case '\\': case '"': case '$': | 707 | case '\\': case '"': case '$': |
712 | r+="\\"; | 708 | r+="\\"; |
713 | } | 709 | } |
714 | r += s[i]; | 710 | r += s[i]; |
715 | } | 711 | } |
716 | r += "\""; | 712 | r += "\""; |
717 | return r; | 713 | return r; |
718 | } | 714 | } |
719 | 715 | ||
720 | /*! | 716 | /*! |
721 | Returns the string \a s with the characters '\' and '"' quoted by a | 717 | Returns the string \a s with the characters '\' and '"' quoted by a |
722 | preceeding '\'. | 718 | preceeding '\'. |
723 | 719 | ||
724 | \sa shellQuote() | 720 | \sa shellQuote() |
725 | */ | 721 | */ |
726 | QString Global::stringQuote(const QString& s) | 722 | QString Global::stringQuote(const QString& s) |
727 | { | 723 | { |
728 | QString r="\""; | 724 | QString r="\""; |
729 | for (int i=0; i<(int)s.length(); i++) { | 725 | for (int i=0; i<(int)s.length(); i++) { |
730 | char c = s[i].latin1(); | 726 | char c = s[i].latin1(); |
731 | switch (c) { | 727 | switch (c) { |
732 | case '\\': case '"': | 728 | case '\\': case '"': |
733 | r+="\\"; | 729 | r+="\\"; |
734 | } | 730 | } |
735 | r += s[i]; | 731 | r += s[i]; |
736 | } | 732 | } |
737 | r += "\""; | 733 | r += "\""; |
738 | return r; | 734 | return r; |
739 | } | 735 | } |
740 | 736 | ||
741 | /*! | 737 | /*! |
742 | Finds all documents on the system's document directories which | 738 | Finds all documents on the system's document directories which |
743 | match the filter \a mimefilter, and appends the resulting DocLnk | 739 | match the filter \a mimefilter, and appends the resulting DocLnk |
744 | objects to \a folder. | 740 | objects to \a folder. |
745 | */ | 741 | */ |
746 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) | 742 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) |
747 | { | 743 | { |
748 | QString homedocs = QString(getenv("HOME")) + "/Documents"; | 744 | QString homedocs = QString(getenv("HOME")) + "/Documents"; |
749 | DocLnkSet d(homedocs,mimefilter); | 745 | DocLnkSet d(homedocs,mimefilter); |
750 | folder->appendFrom(d); | 746 | folder->appendFrom(d); |