Changeset View
Changeset View
Standalone View
Standalone View
kioslave/desktop/kio_desktop.cpp
Show All 16 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "kio_desktop.h" | 20 | #include "kio_desktop.h" | ||
21 | 21 | | |||
22 | #include <KConfigGroup> | 22 | #include <KConfigGroup> | ||
23 | #include <KDesktopFile> | 23 | #include <KDesktopFile> | ||
24 | #include <KDirNotify> | 24 | #include <KDirNotify> | ||
25 | #include <KLocalizedString> | ||||
25 | 26 | | |||
26 | #include <kio/udsentry.h> | 27 | #include <kio/udsentry.h> | ||
27 | #include <kio_version.h> | 28 | #include <kio_version.h> | ||
28 | 29 | | |||
29 | #include <QCoreApplication> | 30 | #include <QCoreApplication> | ||
30 | #include <QFile> | 31 | #include <QFile> | ||
31 | #include <QDBusInterface> | 32 | #include <QDBusInterface> | ||
32 | #include <QDesktopServices> | 33 | #include <QDesktopServices> | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 159 | if (!path.isEmpty()) { | |||
161 | const QString name = file.readName(); | 162 | const QString name = file.readName(); | ||
162 | if (!name.isEmpty()) | 163 | if (!name.isEmpty()) | ||
163 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | 164 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | ||
164 | 165 | | |||
165 | if (file.noDisplay() || !file.tryExec()) | 166 | if (file.noDisplay() || !file.tryExec()) | ||
166 | entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); | 167 | entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); | ||
167 | } | 168 | } | ||
168 | 169 | | |||
170 | // Set a descriptive display name for the root item | ||||
171 | if (requestedUrl().path() == QLatin1String("/") | ||||
dfaure: This will be wrong in subdirs of desktop:/, as you mentioned in the description, no?
You can… | |||||
172 | && entry.stringValue(KIO::UDSEntry::UDS_NAME) == QLatin1String(".")) { | ||||
173 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Desktop Folder")); | ||||
174 | } | ||||
175 | | ||||
169 | // Set the target URL to the local path | 176 | // Set the target URL to the local path | ||
170 | QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); | 177 | QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); | ||
171 | entry.insert(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); | 178 | entry.insert(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); | ||
172 | } | 179 | } | ||
173 | 180 | | |||
174 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | 181 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | ||
175 | { | 182 | { | ||
176 | Q_UNUSED(flags) | 183 | Q_UNUSED(flags) | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
This will be wrong in subdirs of desktop:/, as you mentioned in the description, no?
You can do if (requestedUrl().path() == "/" && ....)
where requestedUrl() is a method from the base class ForwardingSlaveBase.