diff options
| author | Wendi Gan <[email protected]> | 2025-09-02 10:38:32 +0800 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-10-03 06:49:14 +0000 |
| commit | d0f8985b4c5c790781be6fcd06d299f087e78756 (patch) | |
| tree | 3861aee3bf87a17b4f8d090d3af4e711dadd3bc2 /src/dolphintabpage.cpp | |
| parent | 4afc9526c2f021d8c59adcd56d5ef7251e614e8b (diff) | |
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.
BUG: 506634
CCBUG: 497313
CCBUG: 496414
Diffstat (limited to 'src/dolphintabpage.cpp')
| -rw-r--r-- | src/dolphintabpage.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 8e06bbb69..35c244c9e 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -470,17 +470,7 @@ void DolphinTabPage::slotViewActivated() void DolphinTabPage::slotViewUrlRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - // Make sure the url of the view is updated. BUG:496414 - if (splitViewEnabled()) { - if (primaryViewContainer()->view()->url() == oldUrl) { - primaryViewContainer()->view()->setUrl(newUrl); - } - if (secondaryViewContainer()->view()->url() == oldUrl) { - secondaryViewContainer()->view()->setUrl(newUrl); - } - } else { - activeViewContainer()->view()->setUrl(newUrl); - } + Q_UNUSED(oldUrl) Q_EMIT activeViewUrlChanged(newUrl); } |
