diff options
| author | Méven Car <[email protected]> | 2025-12-23 13:31:29 +0100 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-12-24 09:41:39 +0000 |
| commit | 5c0d7da4aa3b2323b418bcf668981a16b61a9244 (patch) | |
| tree | 30a808f4529a1e8d91817019b67b6cfa401390f5 /src/views/dolphinview.cpp | |
| parent | 4c4b9923f1f591c930dd4c3866c3b83a0a477750 (diff) | |
DolphinView: observeCreatedDirectory take into account last / of m_url
BUG: 513345
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 47a5461ff..6297efafe 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1835,6 +1835,11 @@ void DolphinView::observeCreatedDirectory(const QUrl &newDirectoryUrl) return; } + if (!m_url.isParentOf(newDirectoryUrl)) { + // the view has moved + return; + } + // since this is async make sure the selection state hasn't change in the meantime std::function<bool()> condition([this]() { return !m_container->controller()->selectionManager()->hasSelection(); @@ -1843,7 +1848,8 @@ void DolphinView::observeCreatedDirectory(const QUrl &newDirectoryUrl) // in case, a new hiercachy was created, select the first folder in its parent path auto targetUrl = newDirectoryUrl; auto parentUrl = targetUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); - while (parentUrl != m_url) { + const auto containingUrl = m_url.adjusted(QUrl::StripTrailingSlash); + while (parentUrl != containingUrl) { targetUrl = parentUrl; parentUrl = targetUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); } |
