summaryrefslogtreecommitdiff
path: root/core/launcher/documentlist.cpp
Unidiff
Diffstat (limited to 'core/launcher/documentlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 44ceb0c..d8e7a83 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -447,25 +447,36 @@ void DocumentList::sendAllDocLinks()
447 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { 447 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
448 DocLnk *doc = it.current(); 448 DocLnk *doc = it.current();
449 QFileInfo fi( doc->file() ); 449 QFileInfo fi( doc->file() );
450 if ( !fi.exists() ) 450 if ( !fi.exists() )
451 continue; 451 continue;
452 452
453 bool fake = !doc->linkFileKnown(); 453 bool fake = !doc->linkFileKnown();
454 if ( !fake ) { 454 if ( !fake ) {
455 QFile f( doc->linkFile() ); 455 QFile f( doc->linkFile() );
456 if ( f.open( IO_ReadOnly ) ) { 456 if ( f.open( IO_ReadOnly ) ) {
457 QTextStream ts( &f ); 457 QTextStream ts( &f );
458 ts.setEncoding( QTextStream::UnicodeUTF8 ); 458 ts.setEncoding( QTextStream::UnicodeUTF8 );
459 contents += ts.read(); 459 QString docLnk = ts.read();
460 // Strip out the (stale) LinkFile entry
461 int start = docLnk.find( "\nLinkFile = " ) + 1;
462 if ( start > 0 ) {
463 int end = docLnk.find( "\n", start + 1 ) + 1;
464 contents += docLnk.left(start);
465 contents += docLnk.mid(end);
466 } else {
467 contents += docLnk;
468 }
469 contents += "LinkFile = " + doc->linkFile() + "\n";
470
460 f.close(); 471 f.close();
461 } else 472 } else
462 fake = TRUE; 473 fake = TRUE;
463 } 474 }
464 if (fake) { 475 if (fake) {
465 contents += "[Desktop Entry]\n"; // No tr 476 contents += "[Desktop Entry]\n"; // No tr
466 contents += "Categories = " + // No tr 477 contents += "Categories = " + // No tr
467 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr 478 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
468 contents += "Name = "+doc->name()+"\n"; // No tr 479 contents += "Name = "+doc->name()+"\n"; // No tr
469 contents += "Type = "+doc->type()+"\n"; // No tr 480 contents += "Type = "+doc->type()+"\n"; // No tr
470 } 481 }
471 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) 482 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)