Changeset View
Changeset View
Standalone View
Standalone View
src/panels/information/informationpanel.cpp
Show First 20 Lines • Show All 284 Lines • ▼ Show 20 Line(s) | 279 | if (m_invalidUrlCandidate == m_shownUrl) { | |||
---|---|---|---|---|---|
285 | m_shownUrl = url(); | 285 | m_shownUrl = url(); | ||
286 | m_fileItem = KFileItem(); | 286 | m_fileItem = KFileItem(); | ||
287 | showItemInfo(); | 287 | showItemInfo(); | ||
288 | } | 288 | } | ||
289 | } | 289 | } | ||
290 | 290 | | |||
291 | void InformationPanel::slotFileRenamed(const QString& source, const QString& dest) | 291 | void InformationPanel::slotFileRenamed(const QString& source, const QString& dest) | ||
292 | { | 292 | { | ||
293 | if (m_shownUrl == QUrl::fromLocalFile(source)) { | 293 | if (m_shownUrl == QUrl::fromUserInput(source)) { | ||
294 | m_shownUrl = QUrl::fromLocalFile(dest); | 294 | m_shownUrl = QUrl::fromUserInput(dest); | ||
295 | m_fileItem = KFileItem(m_shownUrl); | 295 | m_fileItem = KFileItem(m_shownUrl); | ||
296 | 296 | | |||
297 | if ((m_selection.count() == 1) && (m_selection[0].url() == QUrl::fromLocalFile(source))) { | 297 | if ((m_selection.count() == 1) && (m_selection[0].url() == QUrl::fromLocalFile(source))) { | ||
298 | m_selection[0] = m_fileItem; | 298 | m_selection[0] = m_fileItem; | ||
299 | // Implementation note: Updating the selection is only required if exactly one | 299 | // Implementation note: Updating the selection is only required if exactly one | ||
300 | // item is selected, as the name of the item is shown. If this should change | 300 | // item is selected, as the name of the item is shown. If this should change | ||
301 | // in future: Before parsing the whole selection take care to test possible | 301 | // in future: Before parsing the whole selection take care to test possible | ||
302 | // performance bottlenecks when renaming several hundreds of files. | 302 | // performance bottlenecks when renaming several hundreds of files. | ||
303 | } | 303 | } | ||
304 | 304 | | |||
305 | showItemInfo(); | 305 | showItemInfo(); | ||
306 | } | 306 | } | ||
307 | } | 307 | } | ||
308 | 308 | | |||
309 | void InformationPanel::slotFilesAdded(const QString& directory) | 309 | void InformationPanel::slotFilesAdded(const QString& directory) | ||
310 | { | 310 | { | ||
311 | if (m_shownUrl == QUrl::fromLocalFile(directory)) { | 311 | if (m_shownUrl == QUrl::fromUserInput(directory)) { | ||
312 | // If the 'trash' icon changes because the trash has been emptied or got filled, | 312 | // If the 'trash' icon changes because the trash has been emptied or got filled, | ||
313 | // the signal filesAdded("trash:/") will be emitted. | 313 | // the signal filesAdded("trash:/") will be emitted. | ||
314 | KFileItem item(QUrl::fromLocalFile(directory)); | 314 | KFileItem item(QUrl::fromUserInput(directory)); | ||
315 | requestDelayedItemInfo(item); | 315 | requestDelayedItemInfo(item); | ||
316 | } | 316 | } | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | void InformationPanel::slotFilesChanged(const QStringList& files) | 319 | void InformationPanel::slotFilesChanged(const QStringList& files) | ||
320 | { | 320 | { | ||
321 | for (const QString& fileName : files) { | 321 | for (const QString& fileName : files) { | ||
322 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | 322 | if (m_shownUrl == QUrl::fromUserInput(fileName)) { | ||
elvisangelaccio: Can you explain what the problem is? Is it because `trash:/` is not local? | |||||
Yes indeed, only file:/ and scheme less urls are locals, thrash:/ or recentlyused:/ are not. And this may needed to do this in other knotify slot* in the future. I can add this in comment, if you file it is needed. meven: Yes indeed, only `file:/` and scheme less urls are locals, `thrash:/` or `recentlyused:/` are… | |||||
Looking at the git history, this was a KF5 porting bug. KUrl(fileName) was wrongly ported to QUrl::fromLocalFile(), while we should use QUrl::fromUserInput() instead. While at it, we should fix all the occurrences in this file (e.g. slotFilesRemoved() and so on). elvisangelaccio: Looking at the git history, this was a KF5 porting bug. `KUrl(fileName)` was wrongly ported to… | |||||
323 | showItemInfo(); | 323 | showItemInfo(); | ||
324 | break; | 324 | break; | ||
325 | } | 325 | } | ||
326 | } | 326 | } | ||
327 | } | 327 | } | ||
328 | 328 | | |||
329 | void InformationPanel::slotFilesRemoved(const QStringList& files) | 329 | void InformationPanel::slotFilesRemoved(const QStringList& files) | ||
330 | { | 330 | { | ||
331 | for (const QString& fileName : files) { | 331 | for (const QString& fileName : files) { | ||
332 | if (m_shownUrl == QUrl::fromLocalFile(fileName)) { | 332 | if (m_shownUrl == QUrl::fromUserInput(fileName)) { | ||
333 | // the currently shown item has been removed, show | 333 | // the currently shown item has been removed, show | ||
334 | // the parent directory as fallback | 334 | // the parent directory as fallback | ||
335 | markUrlAsInvalid(); | 335 | markUrlAsInvalid(); | ||
336 | break; | 336 | break; | ||
337 | } | 337 | } | ||
338 | } | 338 | } | ||
339 | } | 339 | } | ||
340 | 340 | | |||
341 | void InformationPanel::slotEnteredDirectory(const QString& directory) | 341 | void InformationPanel::slotEnteredDirectory(const QString& directory) | ||
342 | { | 342 | { | ||
343 | if (m_shownUrl == QUrl::fromLocalFile(directory)) { | 343 | if (m_shownUrl == QUrl::fromUserInput(directory)) { | ||
344 | KFileItem item(QUrl::fromLocalFile(directory)); | 344 | KFileItem item(QUrl::fromUserInput(directory)); | ||
345 | requestDelayedItemInfo(item); | 345 | requestDelayedItemInfo(item); | ||
346 | } | 346 | } | ||
347 | } | 347 | } | ||
348 | 348 | | |||
349 | void InformationPanel::slotLeftDirectory(const QString& directory) | 349 | void InformationPanel::slotLeftDirectory(const QString& directory) | ||
350 | { | 350 | { | ||
351 | if (m_shownUrl == QUrl::fromLocalFile(directory)) { | 351 | if (m_shownUrl == QUrl::fromUserInput(directory)) { | ||
352 | // The signal 'leftDirectory' is also emitted when a media | 352 | // The signal 'leftDirectory' is also emitted when a media | ||
353 | // has been unmounted. In this case no directory change will be | 353 | // has been unmounted. In this case no directory change will be | ||
354 | // done in Dolphin, but the Information Panel must be updated to | 354 | // done in Dolphin, but the Information Panel must be updated to | ||
355 | // indicate an invalid directory. | 355 | // indicate an invalid directory. | ||
356 | markUrlAsInvalid(); | 356 | markUrlAsInvalid(); | ||
357 | } | 357 | } | ||
358 | } | 358 | } | ||
359 | 359 | | |||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |
Can you explain what the problem is? Is it because trash:/ is not local?