summaryrefslogtreecommitdiffstats
path: root/kioslave/system
diff options
context:
space:
mode:
Diffstat (limited to 'kioslave/system')
-rw-r--r--kioslave/system/entries/documents.desktop2
-rw-r--r--kioslave/system/systemimpl.cpp32
-rw-r--r--kioslave/system/systemimpl.h3
3 files changed, 34 insertions, 3 deletions
diff --git a/kioslave/system/entries/documents.desktop b/kioslave/system/entries/documents.desktop
index 225149c25..e5fc3d1c3 100644
--- a/kioslave/system/entries/documents.desktop
+++ b/kioslave/system/entries/documents.desktop
@@ -1,6 +1,6 @@
[Desktop Entry]
Type=Link
-Path[$e]=$( kxdglauncher --getpath --xdgname DOCUMENTS )
+Path=$( kxdglauncher --getpath --xdgname DOCUMENTS )
Icon=folder_man
Name=Documents Folder
Name[af]=Dokument Gids
diff --git a/kioslave/system/systemimpl.cpp b/kioslave/system/systemimpl.cpp
index a53c85045..63171009a 100644
--- a/kioslave/system/systemimpl.cpp
+++ b/kioslave/system/systemimpl.cpp
@@ -27,6 +27,7 @@
#include <tqapplication.h>
#include <tqeventloop.h>
#include <tqdir.h>
+#include <tqfile.h>
#include <sys/stat.h>
@@ -206,6 +207,33 @@ void SystemImpl::createTopLevelEntry(KIO::UDSEntry &entry) const
addAtom(entry, KIO::UDS_ICON_NAME, 0, "system");
}
+TQString SystemImpl::readPathINL(TQString filename)
+{
+ bool isPathExpanded = false;
+ TQString unexpandedPath;
+ TQFile f( filename );
+ if (!f.open(IO_ReadOnly))
+ return TQString();
+ // set the codec for the current locale
+ TQTextStream s(&f);
+ TQString line = s.readLine();
+ while (!line.isNull())
+ {
+ if (line.startsWith("Path=$(")) {
+ isPathExpanded = true;
+ unexpandedPath = line.remove("Path=");
+ }
+ line = s.readLine();
+ }
+ if (isPathExpanded == false) {
+ KDesktopFile desktop(filename, true);
+ return desktop.readPath();
+ }
+ else {
+ return unexpandedPath;
+ }
+}
+
void SystemImpl::createEntry(KIO::UDSEntry &entry,
const TQString &directory,
const TQString &file)
@@ -219,7 +247,7 @@ void SystemImpl::createEntry(KIO::UDSEntry &entry,
entry.clear();
// Ensure that we really want this entry to be displayed
- if ( desktop.readURL().isEmpty() && desktop.readPath().isEmpty() )
+ if ( desktop.readURL().isEmpty() && readPathINL(directory+file).isEmpty() )
{
return;
}
@@ -231,7 +259,7 @@ void SystemImpl::createEntry(KIO::UDSEntry &entry,
if ( desktop.readURL().isEmpty() )
{
- addAtom(entry, KIO::UDS_URL, 0, desktop.readPath());
+ addAtom(entry, KIO::UDS_URL, 0, readPathINL(directory+file));
}
else
{
diff --git a/kioslave/system/systemimpl.h b/kioslave/system/systemimpl.h
index 2cddeb120..45de39b3b 100644
--- a/kioslave/system/systemimpl.h
+++ b/kioslave/system/systemimpl.h
@@ -22,6 +22,7 @@
#include <kio/global.h>
#include <kio/job.h>
+#include <kdesktopfile.h>
#include <kurl.h>
#include <dcopobject.h>
@@ -56,6 +57,8 @@ private:
bool m_lastListingEmpty;
+ TQString readPathINL(TQString filename);
+
/// Last error code stored in class to simplify API.
/// Note that this means almost no method can be const.
int m_lastErrorCode;