From 9ec00f0ca5d42de423e60868a664aef284e00933 Mon Sep 17 00:00:00 2001
From: un-pogaz <46523284+un-pogaz@users.noreply.github.com>
Date: Sat, 18 Jan 2025 15:53:03 +0100
Subject: [PATCH] add confirm dialog for all deleting icon action
---
src/calibre/gui2/tag_browser/view.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py
index a8fd07ff17..7a2ad0acbc 100644
--- a/src/calibre/gui2/tag_browser/view.py
+++ b/src/calibre/gui2/tag_browser/view.py
@@ -47,6 +47,7 @@ from calibre.constants import config_dir
from calibre.ebooks.metadata import rating_to_stars
from calibre.gui2 import FunctionDispatcher, choose_files, config, empty_index, gprefs, pixmap_to_data, question_dialog, rating_font, safe_open_url
from calibre.gui2.complete2 import EditWithComplete
+from calibre.gui2.dialogs.confirm_delete import confirm
from calibre.gui2.dialogs.edit_category_notes import EditNoteDialog
from calibre.gui2.tag_browser.model import (
COUNT_ROLE,
@@ -735,14 +736,34 @@ class TagsView(QTreeView): # {{{
return
if action == 'clear_icon':
if extra == 'all':
+ if not confirm(
+ _('All the value icons for the category "{}" '
+ 'will be permanently deleted. Are you sure?').format(category),
+ 'clear_category_all_value_icons', parent=get_gui()):
+ return
self._model.remove_all_value_icons(key, keep_template=True)
elif extra == 'value':
if index is not None:
val, icon_name = make_icon_name(key, index)
+ if not confirm(
+ _('The icon for the value "{0}" of the "{1}" category '
+ 'will be permanently deleted. Are you sure?').format(val, category),
+ 'clear_category_value_icon_single', parent=get_gui()):
+ return
self._model.remove_value_icon(key, val, icon_name)
else:
+ if not confirm(
+ _('The template to choose the default value icons for the category "{}" '
+ 'will be permanently deleted. Are you sure?').format(category),
+ 'clear_category_value_icon_template', parent=get_gui()):
+ return
self._model.remove_value_icon(key, TEMPLATE_ICON_INDICATOR, None)
else:
+ if not confirm(
+ _('The icon for the category "{}" '
+ 'will be permanently deleted. Are you sure?').format(category),
+ 'clear_category_icon', parent=get_gui()):
+ return
self._model.set_custom_category_icon(key, None)
self.recount()
return