mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
add confirm dialog for all deleting icon action
This commit is contained in:
parent
b4cef06f61
commit
9ec00f0ca5
@ -47,6 +47,7 @@ from calibre.constants import config_dir
|
|||||||
from calibre.ebooks.metadata import rating_to_stars
|
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 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.complete2 import EditWithComplete
|
||||||
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
from calibre.gui2.dialogs.edit_category_notes import EditNoteDialog
|
from calibre.gui2.dialogs.edit_category_notes import EditNoteDialog
|
||||||
from calibre.gui2.tag_browser.model import (
|
from calibre.gui2.tag_browser.model import (
|
||||||
COUNT_ROLE,
|
COUNT_ROLE,
|
||||||
@ -735,14 +736,34 @@ class TagsView(QTreeView): # {{{
|
|||||||
return
|
return
|
||||||
if action == 'clear_icon':
|
if action == 'clear_icon':
|
||||||
if extra == 'all':
|
if extra == 'all':
|
||||||
|
if not confirm(
|
||||||
|
_('<b>All</b> the value icons for the category "{}" '
|
||||||
|
'will be <b>permanently deleted</b>. Are you sure?').format(category),
|
||||||
|
'clear_category_all_value_icons', parent=get_gui()):
|
||||||
|
return
|
||||||
self._model.remove_all_value_icons(key, keep_template=True)
|
self._model.remove_all_value_icons(key, keep_template=True)
|
||||||
elif extra == 'value':
|
elif extra == 'value':
|
||||||
if index is not None:
|
if index is not None:
|
||||||
val, icon_name = make_icon_name(key, index)
|
val, icon_name = make_icon_name(key, index)
|
||||||
|
if not confirm(
|
||||||
|
_('The icon for the value "{0}" of the "{1}" category '
|
||||||
|
'will be <b>permanently deleted</b>. Are you sure?').format(val, category),
|
||||||
|
'clear_category_value_icon_single', parent=get_gui()):
|
||||||
|
return
|
||||||
self._model.remove_value_icon(key, val, icon_name)
|
self._model.remove_value_icon(key, val, icon_name)
|
||||||
else:
|
else:
|
||||||
|
if not confirm(
|
||||||
|
_('The template to choose the default value icons for the category "{}" '
|
||||||
|
'will be <b>permanently deleted</b>. Are you sure?').format(category),
|
||||||
|
'clear_category_value_icon_template', parent=get_gui()):
|
||||||
|
return
|
||||||
self._model.remove_value_icon(key, TEMPLATE_ICON_INDICATOR, None)
|
self._model.remove_value_icon(key, TEMPLATE_ICON_INDICATOR, None)
|
||||||
else:
|
else:
|
||||||
|
if not confirm(
|
||||||
|
_('The icon for the category "{}" '
|
||||||
|
'will be <b>permanently deleted</b>. Are you sure?').format(category),
|
||||||
|
'clear_category_icon', parent=get_gui()):
|
||||||
|
return
|
||||||
self._model.set_custom_category_icon(key, None)
|
self._model.set_custom_category_icon(key, None)
|
||||||
self.recount()
|
self.recount()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user