Fix #1988443 [[Enhancement] Add warning pop-up when deleting custom highlight style](https://bugs.launchpad.net/calibre/+bug/1988443)

This commit is contained in:
Kovid Goyal 2022-09-14 13:56:58 +05:30
parent b8366228fb
commit afeefef650
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -473,6 +473,13 @@ class EditNotesAndColors: # {{{
return item return item
def remove_custom_color(self): def remove_custom_color(self):
question_dialog(_('Are you sure?'), _(
'Do you want to permanently delete this highlighting style?'), def (yes):
if yes:
self.do_remove_custom_color()
)
def do_remove_custom_color(self):
item = self.container.getElementsByClassName('current-swatch')[0] item = self.container.getElementsByClassName('current-swatch')[0]
cct = JSON.parse(item.dataset.style) cct = JSON.parse(item.dataset.style)
p = item.parentNode p = item.parentNode