author | mickeyl <mickeyl> | 2004-03-08 16:37:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-08 16:37:42 (UTC) |
commit | 2599910741451f86323af10585c858d217a122d5 (patch) (unidiff) | |
tree | e00a51cc13f2cfd85eb79e9af7a79d69f777ad77 | |
parent | 82fb70f4e5d8582185da89264e1a1e3b2517f459 (diff) | |
download | opie-2599910741451f86323af10585c858d217a122d5.zip opie-2599910741451f86323af10585c858d217a122d5.tar.gz opie-2599910741451f86323af10585c858d217a122d5.tar.bz2 |
support launching applications with user defined arguments
-rw-r--r-- | library/applnk.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 9c60f1a..5f7da8e 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -646,83 +646,86 @@ AppLnk::AppLnk( const AppLnk © ) | |||
646 | } | 646 | } |
647 | 647 | ||
648 | /*! | 648 | /*! |
649 | Destroys the AppLnk. Note that if the AppLnk is currently a member | 649 | Destroys the AppLnk. Note that if the AppLnk is currently a member |
650 | of an AppLnkSet, this will produce a run-time warning. | 650 | of an AppLnkSet, this will produce a run-time warning. |
651 | 651 | ||
652 | \sa AppLnkSet::add() AppLnkSet::remove() | 652 | \sa AppLnkSet::add() AppLnkSet::remove() |
653 | */ | 653 | */ |
654 | AppLnk::~AppLnk() | 654 | AppLnk::~AppLnk() |
655 | { | 655 | { |
656 | if ( mId ) | 656 | if ( mId ) |
657 | qWarning("Deleting AppLnk that is in an AppLnkSet"); | 657 | qWarning("Deleting AppLnk that is in an AppLnkSet"); |
658 | if ( d ) | 658 | if ( d ) |
659 | delete d; | 659 | delete d; |
660 | } | 660 | } |
661 | 661 | ||
662 | /*! | 662 | /*! |
663 | \overload | 663 | \overload |
664 | Executes the application associated with this AppLnk. | 664 | Executes the application associated with this AppLnk. |
665 | 665 | ||
666 | \sa exec() | 666 | \sa exec() |
667 | */ | 667 | */ |
668 | void AppLnk::execute() const | 668 | void AppLnk::execute() const |
669 | { | 669 | { |
670 | execute(QStringList()); | 670 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); |
671 | } | 671 | } |
672 | 672 | ||
673 | /*! | 673 | /*! |
674 | Executes the application associated with this AppLnk, with | 674 | Executes the application associated with this AppLnk, with |
675 | \a args as arguments. | 675 | \a args as arguments. |
676 | 676 | ||
677 | \sa exec() | 677 | \sa exec() |
678 | */ | 678 | */ |
679 | void AppLnk::execute(const QStringList& args) const | 679 | void AppLnk::execute(const QStringList& args) const |
680 | { | 680 | { |
681 | #ifdef Q_WS_QWS | 681 | #ifdef Q_WS_QWS |
682 | if ( !mRotation.isEmpty() ) { | 682 | if ( !mRotation.isEmpty() ) { |
683 | // ######## this will only work in the server | 683 | // ######## this will only work in the server |
684 | int rot = QPEApplication::defaultRotation(); | 684 | int rot = QPEApplication::defaultRotation(); |
685 | rot = (rot+mRotation.toInt())%360; | 685 | rot = (rot+mRotation.toInt())%360; |
686 | QCString old = getenv("QWS_DISPLAY"); | 686 | QCString old = getenv("QWS_DISPLAY"); |
687 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 687 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); |
688 | invoke(args); | 688 | invoke(args); |
689 | setenv("QWS_DISPLAY", old.data(), 1); | 689 | setenv("QWS_DISPLAY", old.data(), 1); |
690 | } else | 690 | } else |
691 | #endif | 691 | #endif |
692 | invoke(args); | 692 | invoke(args); |
693 | } | 693 | } |
694 | 694 | ||
695 | /*! | 695 | /*! |
696 | Invokes the application associated with this AppLnk, with | 696 | Invokes the application associated with this AppLnk, with |
697 | \a args as arguments. Rotation is not taken into account by | 697 | \a args as arguments. Rotation is not taken into account by |
698 | this function, so you should not call it directly. | 698 | this function, so you should not call it directly. |
699 | 699 | ||
700 | \sa execute() | 700 | \sa execute() |
701 | */ | 701 | */ |
702 | void AppLnk::invoke(const QStringList& args) const | 702 | void AppLnk::invoke(const QStringList& args) const |
703 | { | 703 | { |
704 | Global::execute( exec(), args[0] ); | 704 | if ( property( "Arguments" ).isEmpty() ) |
705 | Global::execute( exec(), args[0] ); | ||
706 | else | ||
707 | Global::execute( exec(), args.join( " " ) ); | ||
705 | } | 708 | } |
706 | 709 | ||
707 | /*! | 710 | /*! |
708 | Sets the Exec property to \a exec. | 711 | Sets the Exec property to \a exec. |
709 | 712 | ||
710 | \sa exec() name() | 713 | \sa exec() name() |
711 | */ | 714 | */ |
712 | void AppLnk::setExec( const QString& exec ) | 715 | void AppLnk::setExec( const QString& exec ) |
713 | { | 716 | { |
714 | mExec = exec; | 717 | mExec = exec; |
715 | } | 718 | } |
716 | 719 | ||
717 | #if 0 // this was inlined for better BC | 720 | #if 0 // this was inlined for better BC |
718 | /*! | 721 | /*! |
719 | Sets the Rotation property to \a rot. | 722 | Sets the Rotation property to \a rot. |
720 | 723 | ||
721 | \sa rotation() | 724 | \sa rotation() |
722 | */ | 725 | */ |
723 | void AppLnk::setRotation ( const QString &rot ) | 726 | void AppLnk::setRotation ( const QString &rot ) |
724 | { | 727 | { |
725 | mRotation = rot; | 728 | mRotation = rot; |
726 | } | 729 | } |
727 | #endif | 730 | #endif |
728 | 731 | ||