Changeset View
Changeset View
Standalone View
Standalone View
kioslave/desktop/kio_desktop.cpp
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 160 | { | |||
---|---|---|---|---|---|
161 | ForwardingSlaveBase::prepareUDSEntry(entry, listing); | 161 | ForwardingSlaveBase::prepareUDSEntry(entry, listing); | ||
162 | const QString path = desktopFile(entry); | 162 | const QString path = desktopFile(entry); | ||
163 | 163 | | |||
164 | if (!path.isEmpty()) { | 164 | if (!path.isEmpty()) { | ||
165 | KDesktopFile file(path); | 165 | KDesktopFile file(path); | ||
166 | 166 | | |||
167 | const QString name = file.readName(); | 167 | const QString name = file.readName(); | ||
168 | if (!name.isEmpty()) | 168 | if (!name.isEmpty()) | ||
169 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | 169 | entry.replace(KIO::UDSEntry::UDS_DISPLAY_NAME, name); | ||
170 | 170 | | |||
171 | if (file.noDisplay() || !file.tryExec()) | 171 | if (file.noDisplay() || !file.tryExec()) | ||
172 | entry.insert(KIO::UDSEntry::UDS_HIDDEN, 1); | 172 | entry.replace(KIO::UDSEntry::UDS_HIDDEN, 1); | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | // Set a descriptive display name for the root item | 175 | // Set a descriptive display name for the root item | ||
176 | if (requestedUrl().path() == QLatin1String("/") | 176 | if (requestedUrl().path() == QLatin1String("/") | ||
177 | && entry.stringValue(KIO::UDSEntry::UDS_NAME) == QLatin1String(".")) { | 177 | && entry.stringValue(KIO::UDSEntry::UDS_NAME) == QLatin1String(".")) { | ||
178 | entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Desktop Folder")); | 178 | entry.replace(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Desktop Folder")); | ||
179 | } | 179 | } | ||
180 | 180 | | |||
181 | // Set the target URL to the local path | 181 | // Set the target URL to the local path | ||
182 | QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); | 182 | QUrl localUrl(QUrl::fromLocalFile(entry.stringValue(KIO::UDSEntry::UDS_LOCAL_PATH))); | ||
183 | entry.insert(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); | 183 | entry.replace(KIO::UDSEntry::UDS_TARGET_URL, localUrl.toString()); | ||
chinmoyr: A doubt, why are you using replace here? Is UDS_TARGET_URL set somewhere before coming here? | |||||
My bad! I didn't read the summary properly. But it seems UDS_TARGET_URL is not set anywhere prior to this (a year ago I think I fixed a bug involving this line and UDS_TARGET_URL wasn't set at that time :- ). chinmoyr: My bad! I didn't read the summary properly. But it seems UDS_TARGET_URL is not set anywhere… | |||||
:) Well, I would rather be safe then sorry. We have no control over what other code might do to the entry object, also is there nothing noted in any API contracts. kossebau: :)
Well, I would rather be safe then sorry. We have no control over what other code might do… | |||||
chinmoyr: I agree with you here. | |||||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | 186 | void DesktopProtocol::rename(const QUrl &_src, const QUrl &_dest, KIO::JobFlags flags) | ||
187 | { | 187 | { | ||
188 | Q_UNUSED(flags) | 188 | Q_UNUSED(flags) | ||
189 | 189 | | |||
190 | if (_src == _dest) { | 190 | if (_src == _dest) { | ||
191 | finished(); | 191 | finished(); | ||
Show All 37 Lines |
A doubt, why are you using replace here? Is UDS_TARGET_URL set somewhere before coming here?