summaryrefslogtreecommitdiff
path: root/library/applnk.cpp
Unidiff
Diffstat (limited to 'library/applnk.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index c82d3b9..874a1b6 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -592,195 +592,197 @@ QString AppLnk::linkFile() const
592 /* tmpfs + and ramfs are available too but not removable 592 /* tmpfs + and ramfs are available too but not removable
593 * either we fix storage or add this 593 * either we fix storage or add this
594 */ 594 */
595 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) { 595 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) {
596 that->mLinkFile = fs->path(); 596 that->mLinkFile = fs->path();
597 } else 597 } else
598 that->mLinkFile = getenv( "HOME" ); 598 that->mLinkFile = getenv( "HOME" );
599 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); 599 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
600 600
601 /* the desktop file exists make sure we don't point to the same file */ 601 /* the desktop file exists make sure we don't point to the same file */
602 if ( QFile::exists(that->mLinkFile+".desktop") ) { 602 if ( QFile::exists(that->mLinkFile+".desktop") ) {
603 AppLnk lnk( that->mLinkFile + ".desktop" ); 603 AppLnk lnk( that->mLinkFile + ".desktop" );
604 604
605 /* the linked is different */ 605 /* the linked is different */
606 if(that->file() != lnk.file() ) { 606 if(that->file() != lnk.file() ) {
607 int n = 1; 607 int n = 1;
608 QString nn; 608 QString nn;
609 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) { 609 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) {
610 n++; 610 n++;
611 /* just to be sure */ 611 /* just to be sure */
612 AppLnk lnk(nn ); 612 AppLnk lnk(nn );
613 if (lnk.file() == that->file() ) 613 if (lnk.file() == that->file() )
614 break; 614 break;
615 } 615 }
616 that->mLinkFile = nn; 616 that->mLinkFile = nn;
617 } 617 }
618 } 618 }
619 that->mLinkFile += ".desktop"; 619 that->mLinkFile += ".desktop";
620 storeLink(); 620 storeLink();
621 } 621 }
622 return that->mLinkFile; 622 return that->mLinkFile;
623 } 623 }
624 return mLinkFile; 624 return mLinkFile;
625} 625}
626 626
627/*! 627/*!
628 Copies \a copy. 628 Copies \a copy.
629*/ 629*/
630AppLnk::AppLnk( const AppLnk &copy ) 630AppLnk::AppLnk( const AppLnk &copy )
631{ 631{
632 mName = copy.mName; 632 mName = copy.mName;
633 mPixmap = copy.mPixmap; 633 mPixmap = copy.mPixmap;
634 mBigPixmap = copy.mBigPixmap; 634 mBigPixmap = copy.mBigPixmap;
635 mExec = copy.mExec; 635 mExec = copy.mExec;
636 mType = copy.mType; 636 mType = copy.mType;
637 mRotation = copy.mRotation; 637 mRotation = copy.mRotation;
638 mComment = copy.mComment; 638 mComment = copy.mComment;
639 mFile = copy.mFile; 639 mFile = copy.mFile;
640 mLinkFile = copy.mLinkFile; 640 mLinkFile = copy.mLinkFile;
641 mIconFile = copy.mIconFile; 641 mIconFile = copy.mIconFile;
642 mMimeTypes = copy.mMimeTypes; 642 mMimeTypes = copy.mMimeTypes;
643 mMimeTypeIcons = copy.mMimeTypeIcons; 643 mMimeTypeIcons = copy.mMimeTypeIcons;
644 mId = 0; 644 mId = 0;
645 d = new AppLnkPrivate(); 645 d = new AppLnkPrivate();
646 d->mCat = copy.d->mCat; 646 d->mCat = copy.d->mCat;
647 d->mCatList = copy.d->mCatList; 647 d->mCatList = copy.d->mCatList;
648 d->mPixmaps = copy.d->mPixmaps; 648 d->mPixmaps = copy.d->mPixmaps;
649} 649}
650 650
651/*! 651/*!
652 Destroys the AppLnk. Note that if the AppLnk is currently a member 652 Destroys the AppLnk. Note that if the AppLnk is currently a member
653 of an AppLnkSet, this will produce a run-time warning. 653 of an AppLnkSet, this will produce a run-time warning.
654 654
655 \sa AppLnkSet::add() AppLnkSet::remove() 655 \sa AppLnkSet::add() AppLnkSet::remove()
656*/ 656*/
657AppLnk::~AppLnk() 657AppLnk::~AppLnk()
658{ 658{
659 if ( mId ) 659 if ( mId )
660 qWarning("Deleting AppLnk that is in an AppLnkSet"); 660 qWarning("Deleting AppLnk that is in an AppLnkSet");
661 if ( d ) 661 if ( d )
662 delete d; 662 delete d;
663} 663}
664 664
665/*! 665/*!
666 \overload 666 \overload
667 Executes the application associated with this AppLnk. 667 Executes the application associated with this AppLnk.
668 668
669 \sa exec() 669 \sa exec()
670*/ 670*/
671void AppLnk::execute() const 671void AppLnk::execute() const
672{ 672{
673 execute( QStringList::split( ' ', property( "Arguments" ) ) ); 673 execute( QStringList::split( ' ', property( "Arguments" ) ) );
674} 674}
675 675
676/*! 676/*!
677 Executes the application associated with this AppLnk, with 677 Executes the application associated with this AppLnk, with
678 \a args as arguments. 678 \a args as arguments.
679 679
680 \sa exec() 680 \sa exec()
681*/ 681*/
682void AppLnk::execute(const QStringList& args) const 682void AppLnk::execute(const QStringList& args) const
683{ 683{
684#ifdef Q_WS_QWS 684#ifdef Q_WS_QWS
685 if ( !mRotation.isEmpty() ) { 685 if ( !mRotation.isEmpty() ) {
686 // ######## this will only work in the server 686 // ######## this will only work in the server
687 int rot = QPEApplication::defaultRotation(); 687 int rot = QPEApplication::defaultRotation();
688 int j = 0;
688 rot = (rot+mRotation.toInt())%360; 689 rot = (rot+mRotation.toInt())%360;
689 QCString old = getenv("QWS_DISPLAY"); 690 QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed";
690 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 691 QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() );
692 setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 );
691 invoke(args); 693 invoke(args);
692 setenv("QWS_DISPLAY", old.data(), 1); 694 setenv("QWS_DISPLAY", old.data(), 1);
693 } else 695 } else
694#endif 696#endif
695 invoke(args); 697 invoke(args);
696} 698}
697 699
698/*! 700/*!
699 Invokes the application associated with this AppLnk, with 701 Invokes the application associated with this AppLnk, with
700 \a args as arguments. Rotation is not taken into account by 702 \a args as arguments. Rotation is not taken into account by
701 this function, so you should not call it directly. 703 this function, so you should not call it directly.
702 704
703 \sa execute() 705 \sa execute()
704*/ 706*/
705void AppLnk::invoke(const QStringList& args) const 707void AppLnk::invoke(const QStringList& args) const
706{ 708{
707 if ( property( "Arguments" ).isEmpty() ) 709 if ( property( "Arguments" ).isEmpty() )
708 Global::execute( exec(), args[0] ); 710 Global::execute( exec(), args[0] );
709 else 711 else
710 Global::execute( exec(), args.join( " " ) ); 712 Global::execute( exec(), args.join( " " ) );
711} 713}
712 714
713/*! 715/*!
714 Sets the Exec property to \a exec. 716 Sets the Exec property to \a exec.
715 717
716 \sa exec() name() 718 \sa exec() name()
717*/ 719*/
718void AppLnk::setExec( const QString& exec ) 720void AppLnk::setExec( const QString& exec )
719{ 721{
720 mExec = exec; 722 mExec = exec;
721} 723}
722 724
723#if 0 // this was inlined for better BC 725#if 0 // this was inlined for better BC
724/*! 726/*!
725 Sets the Rotation property to \a rot. 727 Sets the Rotation property to \a rot.
726 728
727 \sa rotation() 729 \sa rotation()
728*/ 730*/
729void AppLnk::setRotation ( const QString &rot ) 731void AppLnk::setRotation ( const QString &rot )
730{ 732{
731 mRotation = rot; 733 mRotation = rot;
732} 734}
733#endif 735#endif
734 736
735/*! 737/*!
736 Sets the Name property to \a docname. 738 Sets the Name property to \a docname.
737 739
738 \sa name() 740 \sa name()
739*/ 741*/
740void AppLnk::setName( const QString& docname ) 742void AppLnk::setName( const QString& docname )
741{ 743{
742 mName = docname; 744 mName = docname;
743} 745}
744 746
745/*! 747/*!
746 Sets the File property to \a filename. 748 Sets the File property to \a filename.
747 749
748 \sa file() name() 750 \sa file() name()
749*/ 751*/
750void AppLnk::setFile( const QString& filename ) 752void AppLnk::setFile( const QString& filename )
751{ 753{
752 mFile = filename; 754 mFile = filename;
753} 755}
754 756
755/*! 757/*!
756 Sets the LinkFile property to \a filename. 758 Sets the LinkFile property to \a filename.
757 759
758 \sa linkFile() 760 \sa linkFile()
759*/ 761*/
760void AppLnk::setLinkFile( const QString& filename ) 762void AppLnk::setLinkFile( const QString& filename )
761{ 763{
762 mLinkFile = filename; 764 mLinkFile = filename;
763} 765}
764 766
765/*! 767/*!
766 Sets the Comment property to \a comment. 768 Sets the Comment property to \a comment.
767 769
768 This text is displayed in the 'Details Dialog', for example if the 770 This text is displayed in the 'Details Dialog', for example if the
769 user uses the 'press-and-hold' gesture. 771 user uses the 'press-and-hold' gesture.
770 772
771 \sa comment() 773 \sa comment()
772*/ 774*/
773void AppLnk::setComment( const QString& comment ) 775void AppLnk::setComment( const QString& comment )
774{ 776{
775 mComment = comment; 777 mComment = comment;
776} 778}
777 779
778/*! 780/*!
779 Sets the Type property to \a type. 781 Sets the Type property to \a type.
780 782
781 For applications, games and settings the type should be \c 783 For applications, games and settings the type should be \c
782 Application; for documents the type should be the document's MIME 784 Application; for documents the type should be the document's MIME
783 type. 785 type.
784 786
785 \sa type() 787 \sa type()
786*/ 788*/