diff options
| author | Wendi Gan <[email protected]> | 2025-09-28 11:46:23 +0800 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-10-03 06:49:14 +0000 |
| commit | eeb5251c30c3cbcdff5db59b250286eae30792fb (patch) | |
| tree | 8c78d18a145f2220330091204a7eebda07086821 /src/dolphinviewcontainer.cpp | |
| parent | d0f8985b4c5c790781be6fcd06d299f087e78756 (diff) | |
DolphinViewContainer, DolphinView: Fix incorrect view activation when renaming folder
Issue:
In a split-view tab, if a folder is opened in the left view and its parent folder is opened in the right view, renaming the folder from the right view activates the left view.
Reason:
When renaming the folder, the emitted `DolphinView::urlChanged` will invoke `KUrlNavigator::setLocationUrl()`, which finally calls `DolphinViewContainer::setActive()` and activates the left view.
Change:
- Temporarily disconnect the `DolphinUrlNavigator::activated` signal to avoid activation of `DolphinViewContainer`.
- Force inactivate `DolphinUrlNavigator`.
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 5543dad5a..3f8d7d71e 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -938,6 +938,21 @@ void DolphinViewContainer::redirect(const QUrl &oldUrl, const QUrl &newUrl) setSearchBarVisible(isSearchUrl(newUrl)); m_urlNavigator->blockSignals(block); + + // Before emitting `urlChanged`, temporarily disconnect the `activated` signal to avoid activation of `DolphinViewContainer`. + bool blockActivation = m_urlNavigatorConnected && !isActive(); + if (blockActivation) { + disconnect(m_urlNavigatorConnected, &DolphinUrlNavigator::activated, this, &DolphinViewContainer::activate); + } + + Q_EMIT m_view->urlChanged(newUrl); + + if (blockActivation) { + connect(m_urlNavigatorConnected, &DolphinUrlNavigator::activated, this, &DolphinViewContainer::activate); + + // Force inactivate `DolphinUrlNavigator`. + m_urlNavigatorConnected->setActive(false); + } } void DolphinViewContainer::requestFocus() |
