diff options
| author | Kai Uwe Broulik <[email protected]> | 2025-09-01 16:48:06 +0200 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2025-09-01 16:42:23 +0000 |
| commit | efbda5eaa74dfe1ed81c2973c0fbcdf5c97666dc (patch) | |
| tree | 09246c5d5f26e0ab1e72800f5307e7570a76a6ac /src | |
| parent | 31f4c03aaa91d4f87eae026fc7207011a0789ede (diff) | |
DolphinContextMenu: Don't parent new file menu to the menu
It needs to outlive the menu for the file name input prompt to work.
While at it, hook up the new rejected signals ot ensure the menu
is properly cleaned up also when canceled.
Amends commit 697d58e9
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 382b4bc7d..1edbca05f 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -214,12 +214,15 @@ void DolphinContextMenu::addDirectoryItemContextMenu() // set up 'Create New' menu QAction *newDirAction = m_mainWindow->actionCollection()->action(QStringLiteral("create_dir")); QAction *newFileAction = m_mainWindow->actionCollection()->action(QStringLiteral("create_file")); - DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(newDirAction, newFileAction, this); + // Do not parent this to the menu, it has to outlive it. It is deleted manually below once a file has been created. + DolphinNewFileMenu *newFileMenu = new DolphinNewFileMenu(newDirAction, newFileAction, m_mainWindow); newFileMenu->checkUpToDate(); newFileMenu->setWorkingDirectory(m_fileInfo.url()); newFileMenu->setEnabled(selectedItemsProps.supportsWriting()); connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); + connect(newFileMenu, &DolphinNewFileMenu::fileCreationRejected, newFileMenu, &DolphinNewFileMenu::deleteLater); connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); + connect(newFileMenu, &DolphinNewFileMenu::directoryCreationRejected, newFileMenu, &DolphinNewFileMenu::deleteLater); QMenu *menu = newFileMenu->menu(); menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); |
