-rw-r--r-- | library/applnk.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index 5185b5f..778ccab 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp @@ -295,97 +295,97 @@ QString AppLnk::type() const QString AppLnk::file() const { if ( mFile.isNull() ) { AppLnk* that = (AppLnk*)this; // copy? QString ext = MimeType(mType).extension(); if ( !ext.isEmpty() ) ext = "." + ext; if ( !mLinkFile.isEmpty() ) { that->mFile = mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop") ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile; } else if ( mType.contains('/') ) { that->mFile = QString(getenv("HOME"))+"/Documents/"+mType+"/"+safeFileName(that->mName); if ( QFile::exists(that->mFile+ext) || QFile::exists(that->mFile+".desktop") ) { // a .desktop with the same name exists int n=1; qWarning("AppLnk::file() n=1 %s", that->mFile.latin1() ); QString nn; while (QFile::exists((nn=(that->mFile+"_"+QString::number(n)))+ext) || QFile::exists(nn+".desktop")) n++; that->mFile = nn; qWarning("AppLnl::file() now mFile is %s", that->mFile.latin1() ); } that->mLinkFile = that->mFile+".desktop"; that->mFile += ext; } prepareDirectories(that->mFile); QFile f(that->mFile); if ( !f.open(IO_WriteOnly) ) that->mFile = QString::null; return that->mFile; } return mFile; } /*! Returns the desktop file coresponding to this AppLnk. \sa file(), exec() */ QString AppLnk::linkFile() const { if ( mLinkFile.isNull() ) { AppLnk* that = (AppLnk*)this; if ( type().contains('/') ) { StorageInfo storage; const FileSystem *fs = storage.fileSystemOf( that->mFile ); - if ( fs && fs->isRemovable() ) { + if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs" ) ) { that->mLinkFile = fs->path(); } else that->mLinkFile = getenv( "HOME" ); that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file int n=1; QString nn; AppLnk lnk( that->mLinkFile+".desktop" ); if(that->file() != lnk.file() ){ qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() ); while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){ n++; AppLnk lnk(nn ); // just to be sure if(lnk.file() ==that->file() ){ break; } } that->mLinkFile = nn; } } that->mLinkFile += ".desktop"; qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() ); storeLink(); } return that->mLinkFile; } return mLinkFile; } /*! Copies \a copy. */ AppLnk::AppLnk( const AppLnk © ) { mName = copy.mName; mPixmap = copy.mPixmap; mBigPixmap = copy.mBigPixmap; mExec = copy.mExec; mType = copy.mType; mRotation = copy.mRotation; mComment = copy.mComment; mFile = copy.mFile; mLinkFile = copy.mLinkFile; mIconFile = copy.mIconFile; mMimeTypes = copy.mMimeTypes; mMimeTypeIcons = copy.mMimeTypeIcons; mId = 0; d = new AppLnkPrivate(); |