summaryrefslogtreecommitdiff
path: root/library/applnk.cpp
Unidiff
Diffstat (limited to 'library/applnk.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp2
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
@@ -319,49 +319,49 @@ QString AppLnk::file() const
319 that->mLinkFile = that->mFile+".desktop"; 319 that->mLinkFile = that->mFile+".desktop";
320 that->mFile += ext; 320 that->mFile += ext;
321 } 321 }
322 prepareDirectories(that->mFile); 322 prepareDirectories(that->mFile);
323 QFile f(that->mFile); 323 QFile f(that->mFile);
324 if ( !f.open(IO_WriteOnly) ) 324 if ( !f.open(IO_WriteOnly) )
325 that->mFile = QString::null; 325 that->mFile = QString::null;
326 return that->mFile; 326 return that->mFile;
327 } 327 }
328 return mFile; 328 return mFile;
329} 329}
330 330
331/*! 331/*!
332 Returns the desktop file coresponding to this AppLnk. 332 Returns the desktop file coresponding to this AppLnk.
333 333
334 \sa file(), exec() 334 \sa file(), exec()
335*/ 335*/
336QString AppLnk::linkFile() const 336QString AppLnk::linkFile() const
337{ 337{
338 if ( mLinkFile.isNull() ) { 338 if ( mLinkFile.isNull() ) {
339 AppLnk* that = (AppLnk*)this; 339 AppLnk* that = (AppLnk*)this;
340 if ( type().contains('/') ) { 340 if ( type().contains('/') ) {
341 StorageInfo storage; 341 StorageInfo storage;
342 const FileSystem *fs = storage.fileSystemOf( that->mFile ); 342 const FileSystem *fs = storage.fileSystemOf( that->mFile );
343 if ( fs && fs->isRemovable() ) { 343 if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs" ) ) {
344 that->mLinkFile = fs->path(); 344 that->mLinkFile = fs->path();
345 } else 345 } else
346 that->mLinkFile = getenv( "HOME" ); 346 that->mLinkFile = getenv( "HOME" );
347 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); 347 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
348 if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file 348 if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file
349 int n=1; 349 int n=1;
350 QString nn; 350 QString nn;
351 AppLnk lnk( that->mLinkFile+".desktop" ); 351 AppLnk lnk( that->mLinkFile+".desktop" );
352 if(that->file() != lnk.file() ){ 352 if(that->file() != lnk.file() ){
353 qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() ); 353 qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() );
354 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){ 354 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){
355 n++; 355 n++;
356 AppLnk lnk(nn ); // just to be sure 356 AppLnk lnk(nn ); // just to be sure
357 if(lnk.file() ==that->file() ){ 357 if(lnk.file() ==that->file() ){
358 break; 358 break;
359 } 359 }
360 } 360 }
361 that->mLinkFile = nn; 361 that->mLinkFile = nn;
362 } 362 }
363 } 363 }
364 that->mLinkFile += ".desktop"; 364 that->mLinkFile += ".desktop";
365 qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() ); 365 qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() );
366 storeLink(); 366 storeLink();
367 } 367 }