From a9cbac74aafe1ce3c5ec37010b84ea8a40035941 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sun, 2 Nov 2025 13:13:43 +0000 Subject: Revert "Make create folder use selected directory !1026" This reverts merge request !1035 65bb95f5 This simply made an unexpected behavior change, opposite to most users expectations. https://discuss.kde.org/t/slightly-strange-behaviour-in-dolphin/40209/33 Disregarding https://en.wikipedia.org/wiki/Principle_of_least_astonishment (Occam's razor) Having different behavior when there a folder selected + shortcut, and a folder selected + context menu should be considered different use case. One has a strong context established, the other has no context from the user perspective. BUG: 510757 CCBUG: 508196 It re-introduces 508196 --- src/dolphinmainwindow.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 7d8e406c2..dd11b67f7 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -830,16 +830,7 @@ void DolphinMainWindow::createDirectory() // just check if we are already running one. This prevents opening multiple // dialogs. BUG:481401 if (!m_newFileMenu->isCreateDirectoryRunning()) { - QUrl targetDirectory = activeViewContainer()->url(); - - // Check if there's a single selected directory to create the new folder inside - // This makes Ctrl+Shift+N behavior consistent with right-click context menu - const KFileItemList selectedItems = m_activeViewContainer->view()->selectedItems(); - if (selectedItems.count() == 1 && selectedItems.first().isDir()) { - targetDirectory = selectedItems.first().url(); - } - - m_newFileMenu->setWorkingDirectory(targetDirectory); + m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); m_newFileMenu->createDirectory(); } } @@ -848,16 +839,7 @@ void DolphinMainWindow::createFile() { // Use the same logic as in createDirectory() if (!m_newFileMenu->isCreateFileRunning()) { - QUrl targetDirectory = activeViewContainer()->url(); - - // Check if there's a single selected directory to create the new file inside - // This makes the create file action consistent with create directory - const KFileItemList selectedItems = m_activeViewContainer->view()->selectedItems(); - if (selectedItems.count() == 1 && selectedItems.first().isDir()) { - targetDirectory = selectedItems.first().url(); - } - - m_newFileMenu->setWorkingDirectory(targetDirectory); + m_newFileMenu->setWorkingDirectory(activeViewContainer()->url()); m_newFileMenu->createFile(); } } -- cgit v1.3