summaryrefslogtreecommitdiff
path: root/core/launcher/documentlist.cpp
Side-by-side diff
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
@@ -435,49 +435,60 @@ void DocumentList::storageChanged()
void DocumentList::sendAllDocLinks()
{
if ( d->tid != 0 ) {
// We are in the middle of scanning, set a flag so
// we do this when we finish our scanning
d->needToSendAllDocLinks = true;
return;
}
QString contents;
Categories cats;
for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
DocLnk *doc = it.current();
QFileInfo fi( doc->file() );
if ( !fi.exists() )
continue;
bool fake = !doc->linkFileKnown();
if ( !fake ) {
QFile f( doc->linkFile() );
if ( f.open( IO_ReadOnly ) ) {
QTextStream ts( &f );
ts.setEncoding( QTextStream::UnicodeUTF8 );
- contents += ts.read();
+ QString docLnk = ts.read();
+ // Strip out the (stale) LinkFile entry
+ int start = docLnk.find( "\nLinkFile = " ) + 1;
+ if ( start > 0 ) {
+ int end = docLnk.find( "\n", start + 1 ) + 1;
+ contents += docLnk.left(start);
+ contents += docLnk.mid(end);
+ } else {
+ contents += docLnk;
+ }
+ contents += "LinkFile = " + doc->linkFile() + "\n";
+
f.close();
} else
fake = TRUE;
}
if (fake) {
contents += "[Desktop Entry]\n"; // No tr
contents += "Categories = " + // No tr
cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
contents += "Name = "+doc->name()+"\n"; // No tr
contents += "Type = "+doc->type()+"\n"; // No tr
}
contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
contents += QString("Size = %1\n").arg( fi.size() ); // No tr
}
//odebug << "sending length " << contents.length() << "" << oendl;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
e << contents;
#endif
//odebug << "================ \n\n" << contents << "\n\n===============" << oendl;
d->needToSendAllDocLinks = false;
}