From 19c583f615ce732c274b1dda41158285bd4f60a2 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 11 Sep 2022 18:48:15 +0200 Subject: [PATCH] Fix misleading deletion label in context menu for empty folders --- novelwriter/gui/projtree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/novelwriter/gui/projtree.py b/novelwriter/gui/projtree.py index b8e4dfbf..9c2bf9fc 100644 --- a/novelwriter/gui/projtree.py +++ b/novelwriter/gui/projtree.py @@ -1019,7 +1019,11 @@ class GuiProjectTree(QTreeWidget): # Document Actions # ================ + isRoot = tItem.isRootType() + isFolder = tItem.isFolderType() isFile = tItem.isFileType() + isEmpty = selItem.childCount() == 0 + if isFile: ctxMenu.addAction( self.tr("Open Document"), @@ -1079,7 +1083,7 @@ class GuiProjectTree(QTreeWidget): # Delete Item # =========== - if tItem.itemClass == nwItemClass.TRASH or tItem.isRootType(): + if tItem.itemClass == nwItemClass.TRASH or isRoot or (isFolder and isEmpty): ctxMenu.addAction( self.tr("Delete Permanently"), lambda: self.deleteItem(tHandle) )