https://bugs.kde.org/show_bug.cgi?id=496414

--- Comment #6 from Méven <[email protected]> ---
Git commit d0f8985b4c5c790781be6fcd06d299f087e78756 by Méven Car, on behalf of
Wendi Gan.
Committed on 03/10/2025 at 06:49.
Pushed by meven into branch 'master'.

DolphinTabPage, DolphinView: Fix duplicate folder for MTP device

Issue:
When opening an MTP device via the sidebar, Dolphin shows one "Internal shared
storage" folder. However, clicking the entry again results in a duplicate
folder being displayed.
This regression was introduced by !865 (commit 6c7c047).

Reason:
The URL of an MTP device in the sidebar is
`mtp:udi=/org/kde/solid/udev/sys/devices/...`. When clicking to open the MTP
device, it is redirected to `mtp:/...`.
- On the first click (no cache), `KCoreDirListerCache::slotUpdateResult()`
calls `KCoreDirListerPrivate::emitItems()`.
- On the second click (with cache), `KCoreDirListerCache::slotRedirection()`
first calls `KCoreDirListerPrivate::emitItems()`. Besides,
`DolphinTabPage::slotViewUrlRedirection()` calls `KCoreDirLister::openUrl()`,
which triggers `CachedItemsJob::start()`, and eventually calls
`KCoreDirListerPrivate::emitItems()` again. As a result, two
`KCoreDirLister::itemsAdded` signals are emitted, causing
`m_pendingItemsToInsert` to be appended twice.

---

BUG 496414:
Need to rename folder twice to make it reflect in the tab title.

Reason:
`m_url` is updated after emitting the `DolphinView::redirection` signal. It
triggers `DolphinTabWidget::tabUrlChanged()`, which still uses the old URL and
thus resets the tab title incorrectly.

---

Change:
- Revert the change in `DolphinTabPage::slotViewUrlRedirection()`.
- Update `m_url` before `DolphinView::redirection` to fix BUG 496414.
- Emit `DolphinView::urlChanged` signal to refresh the navigator of the
inactive view.
Related: bug 506634, bug 497313

M  +1    -11   src/dolphintabpage.cpp
M  +4    -1    src/views/dolphinview.cpp

https://invent.kde.org/system/dolphin/-/commit/d0f8985b4c5c790781be6fcd06d299f087e78756

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to