diff options
| author | Pan Zhang <[email protected]> | 2025-10-10 14:09:37 +0800 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-10-17 10:34:42 +0000 |
| commit | 79fe69f7077e4397d5000cedab8a8d6934ff0d04 (patch) | |
| tree | 6b6e8a5c1c05f35e31d0f63899a21e2c82380b09 | |
| parent | b2388a115ac85699ff5a7cfe63bba2aee468965a (diff) | |
dolphincontextmenu: Update "Empty Trash" enabled state dynamically
Initialize the action state based on current trash contents and keep it in sync with Trash::emptinessChanged to avoid incorrect disabling on startup.
BUG: 501091
| -rw-r--r-- | src/dolphincontextmenu.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 1edbca05f..c0b370311 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -128,6 +128,10 @@ void DolphinContextMenu::addTrashContextMenu() }); emptyTrashAction->setEnabled(!Trash::isEmpty()); + connect(&Trash::instance(), &Trash::emptinessChanged, this, [emptyTrashAction]() { + emptyTrashAction->setEnabled(!Trash::isEmpty()); + }); + // Insert 'Sort By' and 'View Mode' if (ContextMenuSettings::showSortBy() || ContextMenuSettings::showViewMode()) { addSeparator(); |
