Bug 496414

Summary: Need to rename folder twice to make it reflect in the tab title
Product: [Applications] dolphin Reporter: postix <postix>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: akselmo, dolphin-bugs-null, greg, nate
Priority: NOR    
Version First Reported In: 24.08.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=437603
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description postix 2024-11-18 10:59:08 UTC
STEPS TO REPRODUCE
1. Open Dolphin
2. Create a new folder "foo"
3. Create a new tab with Ctrl + T
4. Open the folder "foo"
5. Switch to the first tab, which is parent of "foo"
6. Rename "foo" to "foo 2"
7. Rename "foo 2" to "foo 3"

OBSERVED RESULT
6. The 2nd tab still says "foo"
7. Then 2nd tab now says "foo 2" instead of "foo 3"
8. And the so on ...

The renaming is immediately taken into account in the address bar though.


SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.7-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 1 Akseli Lahtinen 2024-11-27 10:16:30 UTC
Can reproduce

dolphin 25.03.70
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.80
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.0
Kernel Version: 6.11.8-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 2 Bug Janitor Service 2024-11-27 12:13:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/865
Comment 3 Akseli Lahtinen 2024-11-28 10:46:37 UTC
Git commit 6c7c04718b573ed9c382e289c361acbe6bd456b9 by Akseli Lahtinen.
Committed on 28/11/2024 at 10:46.
Pushed by akselmo into branch 'master'.

DolphinTabPage: Update container view url on redirection

On url redirect, we should check which container url is being changed
and then update it accordingly. This makes sure the tab name is
updated.

We also should not disconnect redirection on view activation
since the redirection might be used by the other split. 
The disconnection is done in `setSplitViewEnabled` instead.

This allows us to update the tab name every time the url changes,
even inside a splitview where the split which name is changed is
not active.

M  +14   -4    src/dolphintabpage.cpp

https://invent.kde.org/system/dolphin/-/commit/6c7c04718b573ed9c382e289c361acbe6bd456b9
Comment 4 postix 2025-01-13 11:44:11 UTC
*** Bug 437603 has been marked as a duplicate of this bug. ***
Comment 5 Méven 2025-10-03 10:21:35 UTC
Git commit 051bc3665a169e261d57ecab1f70baaa31a4a1ad by Méven Car, on behalf of Wendi Gan.
Committed on 03/10/2025 at 06:49.
Pushed by meven into branch 'master'.

Add integration test for split view activation and tab title update after renaming a folder

In a split-view tab, the child folder is opened in the left view and other tabs, while the parent folder is opened in the right view. After renaming the child folder from the right view:
- The activated view should not switch to the left view.
- All tab titles should be updated.

M  +81   -1    src/tests/dolphinmainwindowtest.cpp

https://invent.kde.org/system/dolphin/-/commit/051bc3665a169e261d57ecab1f70baaa31a4a1ad
Comment 6 Méven 2025-10-03 10:21:36 UTC
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