diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-24 06:25:11 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-24 06:25:11 +0000 |
commit | 0dfb53e20e286167d0d38a347ee8911033d43fbb (patch) | |
tree | a399e58d36a1133d2f72f0d709447bb559a11bb2 /kioslave/system/systemimpl.cpp | |
parent | 6ade341229a0ce755b3e606d974b37c7d1609c8a (diff) | |
download | tdebase-0dfb53e20e286167d0d38a347ee8911033d43fbb.tar.gz tdebase-0dfb53e20e286167d0d38a347ee8911033d43fbb.zip |
Fix Documents shortcut in K Menu and system:/ folder
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1178867 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/system/systemimpl.cpp')
-rw-r--r-- | kioslave/system/systemimpl.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
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 { |