Edit book: Fix restoring confirmation dialogs not restoring question_dialog() based confirmations

This commit is contained in:
Kovid Goyal 2021-04-08 14:23:52 +05:30
parent 26431a36ea
commit 61bf9e10ce
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

View File

@ -412,11 +412,12 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False,
yes_text=None, no_text=None, yes_icon=None, no_icon=None,
):
from calibre.gui2.dialogs.message_box import MessageBox
prefs = gui_prefs()
if not isinstance(skip_dialog_name, unicode_type):
skip_dialog_name = None
try:
auto_skip = set(gprefs.get('questions_to_auto_skip', ()))
auto_skip = set(prefs.get('questions_to_auto_skip', ()))
except Exception:
auto_skip = set()
if (skip_dialog_name is not None and skip_dialog_name in auto_skip):
@ -438,7 +439,7 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False,
if skip_dialog_name is not None and not d.toggle_checkbox.isChecked():
auto_skip.add(skip_dialog_name)
gprefs.set('questions_to_auto_skip', list(auto_skip))
prefs.set('questions_to_auto_skip', list(auto_skip))
return ret

View File

@ -841,6 +841,10 @@ class Preferences(QDialog):
elif key.startswith('skip_ask_to_show_current_diff_for_'):
del tprefs[key]
changed += 1
elif key == 'questions_to_auto_skip':
changed += len(tprefs[key] or ())
del tprefs[key]
msg = _('There are no disabled confirmation prompts')
if changed:
msg = ngettext(