summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp7
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
@@ -574,227 +574,230 @@ QString AppLnk::file() const
574 return mFile; 574 return mFile;
575} 575}
576 576
577/*! 577/*!
578 Returns the desktop file corresponding to this AppLnk. 578 Returns the desktop file corresponding to this AppLnk.
579 579
580 \sa file() exec() name() 580 \sa file() exec() name()
581*/ 581*/
582QString AppLnk::linkFile() const 582QString AppLnk::linkFile() const
583{ 583{
584 if ( mLinkFile.isNull() ) { 584 if ( mLinkFile.isNull() ) {
585 AppLnk* that = (AppLnk*)this; 585 AppLnk* that = (AppLnk*)this;
586 if ( type().contains('/') ) { 586 if ( type().contains('/') ) {
587 StorageInfo storage; 587 StorageInfo storage;
588 const FileSystem *fs = storage.fileSystemOf( that->mFile ); 588 const FileSystem *fs = storage.fileSystemOf( that->mFile );
589 /* tmpfs + and ramfs are available too but not removable 589 /* tmpfs + and ramfs are available too but not removable
590 * either we fix storage or add this 590 * either we fix storage or add this
591 */ 591 */
592 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { 592 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) {
593 that->mLinkFile = fs->path(); 593 that->mLinkFile = fs->path();
594 } else 594 } else
595 that->mLinkFile = getenv( "HOME" ); 595 that->mLinkFile = getenv( "HOME" );
596 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); 596 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
597 597
598 /* the desktop file exists make sure we don't point to the same file */ 598 /* the desktop file exists make sure we don't point to the same file */
599 if ( QFile::exists(that->mLinkFile+".desktop") ) { 599 if ( QFile::exists(that->mLinkFile+".desktop") ) {
600 AppLnk lnk( that->mLinkFile + ".desktop" ); 600 AppLnk lnk( that->mLinkFile + ".desktop" );
601 601
602 /* the linked is different */ 602 /* the linked is different */
603 if(that->file() != lnk.file() ) { 603 if(that->file() != lnk.file() ) {
604 int n = 1; 604 int n = 1;
605 QString nn; 605 QString nn;
606 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { 606 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) {
607 n++; 607 n++;
608 /* just to be sure */ 608 /* just to be sure */
609 AppLnk lnk(nn ); 609 AppLnk lnk(nn );
610 if (lnk.file() == that->file() ) 610 if (lnk.file() == that->file() )
611 break; 611 break;
612 } 612 }
613 that->mLinkFile = nn; 613 that->mLinkFile = nn;
614 } 614 }
615 } 615 }
616 that->mLinkFile += ".desktop"; 616 that->mLinkFile += ".desktop";
617 storeLink(); 617 storeLink();
618 } 618 }
619 return that->mLinkFile; 619 return that->mLinkFile;
620 } 620 }
621 return mLinkFile; 621 return mLinkFile;
622} 622}
623 623
624/*! 624/*!
625 Copies \a copy. 625 Copies \a copy.
626*/ 626*/
627AppLnk::AppLnk( const AppLnk &copy ) 627AppLnk::AppLnk( const AppLnk &copy )
628{ 628{
629 mName = copy.mName; 629 mName = copy.mName;
630 mPixmap = copy.mPixmap; 630 mPixmap = copy.mPixmap;
631 mBigPixmap = copy.mBigPixmap; 631 mBigPixmap = copy.mBigPixmap;
632 mExec = copy.mExec; 632 mExec = copy.mExec;
633 mType = copy.mType; 633 mType = copy.mType;
634 mRotation = copy.mRotation; 634 mRotation = copy.mRotation;
635 mComment = copy.mComment; 635 mComment = copy.mComment;
636 mFile = copy.mFile; 636 mFile = copy.mFile;
637 mLinkFile = copy.mLinkFile; 637 mLinkFile = copy.mLinkFile;
638 mIconFile = copy.mIconFile; 638 mIconFile = copy.mIconFile;
639 mMimeTypes = copy.mMimeTypes; 639 mMimeTypes = copy.mMimeTypes;
640 mMimeTypeIcons = copy.mMimeTypeIcons; 640 mMimeTypeIcons = copy.mMimeTypeIcons;
641 mId = 0; 641 mId = 0;
642 d = new AppLnkPrivate(); 642 d = new AppLnkPrivate();
643 d->mCat = copy.d->mCat; 643 d->mCat = copy.d->mCat;
644 d->mCatList = copy.d->mCatList; 644 d->mCatList = copy.d->mCatList;
645 d->mPixmaps = copy.d->mPixmaps; 645 d->mPixmaps = copy.d->mPixmaps;
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*/
654AppLnk::~AppLnk() 654AppLnk::~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*/
668void AppLnk::execute() const 668void 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*/
679void AppLnk::execute(const QStringList& args) const 679void 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*/
702void AppLnk::invoke(const QStringList& args) const 702void 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*/
712void AppLnk::setExec( const QString& exec ) 715void 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*/
723void AppLnk::setRotation ( const QString &rot ) 726void AppLnk::setRotation ( const QString &rot )
724{ 727{
725 mRotation = rot; 728 mRotation = rot;
726} 729}
727#endif 730#endif
728 731
729/*! 732/*!
730 Sets the Name property to \a docname. 733 Sets the Name property to \a docname.
731 734
732 \sa name() 735 \sa name()
733*/ 736*/
734void AppLnk::setName( const QString& docname ) 737void AppLnk::setName( const QString& docname )
735{ 738{
736 mName = docname; 739 mName = docname;
737} 740}
738 741
739/*! 742/*!
740 Sets the File property to \a filename. 743 Sets the File property to \a filename.
741 744
742 \sa file() name() 745 \sa file() name()
743*/ 746*/
744void AppLnk::setFile( const QString& filename ) 747void AppLnk::setFile( const QString& filename )
745{ 748{
746 mFile = filename; 749 mFile = filename;
747} 750}
748 751
749/*! 752/*!
750 Sets the LinkFile property to \a filename. 753 Sets the LinkFile property to \a filename.
751 754
752 \sa linkFile() 755 \sa linkFile()
753*/ 756*/
754void AppLnk::setLinkFile( const QString& filename ) 757void AppLnk::setLinkFile( const QString& filename )
755{ 758{
756 mLinkFile = filename; 759 mLinkFile = filename;
757} 760}
758 761
759/*! 762/*!
760 Sets the Comment property to \a comment. 763 Sets the Comment property to \a comment.
761 764
762 This text is displayed in the 'Details Dialog', for example if the 765 This text is displayed in the 'Details Dialog', for example if the
763 user uses the 'press-and-hold' gesture. 766 user uses the 'press-and-hold' gesture.
764 767
765 \sa comment() 768 \sa comment()
766*/ 769*/
767void AppLnk::setComment( const QString& comment ) 770void AppLnk::setComment( const QString& comment )
768{ 771{
769 mComment = comment; 772 mComment = comment;
770} 773}
771 774
772/*! 775/*!
773 Sets the Type property to \a type. 776 Sets the Type property to \a type.
774 777
775 For applications, games and settings the type should be \c 778 For applications, games and settings the type should be \c
776 Application; for documents the type should be the document's MIME 779 Application; for documents the type should be the document's MIME
777 type. 780 type.
778 781
779 \sa type() 782 \sa type()
780*/ 783*/
781void AppLnk::setType( const QString& type ) 784void AppLnk::setType( const QString& type )
782{ 785{
783 mType = type; 786 mType = type;
784} 787}
785 788
786/*! 789/*!
787 \fn QString AppLnk::icon() const 790 \fn QString AppLnk::icon() const
788 791
789 Returns the Icon property. 792 Returns the Icon property.
790 793
791 \sa setIcon() 794 \sa setIcon()
792*/ 795*/
793 796
794/*! 797/*!
795 Sets the Icon property to \a iconname. This is the filename from 798 Sets the Icon property to \a iconname. This is the filename from
796 which the pixmap() and bigPixmap() are obtained. 799 which the pixmap() and bigPixmap() are obtained.
797 800
798 \sa icon() setSmallIconSize() setBigIconSize() 801 \sa icon() setSmallIconSize() setBigIconSize()
799*/ 802*/
800void AppLnk::setIcon( const QString& iconname ) 803void AppLnk::setIcon( const QString& iconname )