Changeset View
Changeset View
Standalone View
Standalone View
kioslave/desktop/kio_desktop.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 83 | if (desktopIsEmpty) { | |||
---|---|---|---|---|---|
107 | } | 107 | } | ||
108 | } | 108 | } | ||
109 | #endif | 109 | #endif | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | bool DesktopProtocol::rewriteUrl(const QUrl &url, QUrl &newUrl) | 112 | bool DesktopProtocol::rewriteUrl(const QUrl &url, QUrl &newUrl) | ||
113 | { | 113 | { | ||
114 | newUrl.setScheme(QStringLiteral("file")); | 114 | newUrl.setScheme(QStringLiteral("file")); | ||
115 | newUrl.setPath(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + url.path()); | 115 | | ||
116 | QString newPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + url.path(); | ||||
117 | | ||||
118 | if (newPath.endsWith(QLatin1String("/"))) { | ||||
119 | newPath.chop(1); | ||||
120 | } | ||||
121 | | ||||
122 | newUrl.setPath(newPath); | ||||
116 | return true; | 123 | return true; | ||
117 | } | 124 | } | ||
118 | 125 | | |||
119 | void DesktopProtocol::listDir(const QUrl &url) | 126 | void DesktopProtocol::listDir(const QUrl &url) | ||
120 | { | 127 | { | ||
121 | KIO::ForwardingSlaveBase::listDir(url); | 128 | KIO::ForwardingSlaveBase::listDir(url); | ||
122 | 129 | | |||
123 | QUrl actual; | 130 | QUrl actual; | ||
Show All 37 Lines | 165 | if (!path.isEmpty()) { | |||
161 | const QString name = file.readName(); | 168 | const QString name = file.readName(); | ||
162 | if (!name.isEmpty()) | 169 | if (!name.isEmpty()) | ||
163 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | 170 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | ||
164 | 171 | | |||
165 | if (file.noDisplay() || !file.tryExec()) | 172 | if (file.noDisplay() || !file.tryExec()) | ||
166 | entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); | 173 | entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); | ||
167 | } | 174 | } | ||
168 | 175 | | |||
169 | // Set the target URL to the local path | 176 | QString localPath = entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH); | ||
170 | QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); | 177 | if (localPath.endsWith(QLatin1String("/."))) { | ||
171 | entry.insert(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); | 178 | localPath.chop(2); | ||
179 | } | ||||
180 | entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, localPath); | ||||
181 | // Set the target URL to the local path | ||||
182 | entry.insert(KIO::UDSEntry::UDS_TARGET_URL, QUrl::fromLocalFile(localPath).toString()); | ||||
172 | } | 183 | } | ||
173 | 184 | | |||
174 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | 185 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | ||
175 | { | 186 | { | ||
176 | Q_UNUSED(flags) | 187 | Q_UNUSED(flags) | ||
177 | 188 | | |||
178 | if (_src == _dest) { | 189 | if (_src == _dest) { | ||
179 | finished(); | 190 | finished(); | ||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |