Confirm on remove highlight

This commit is contained in:
Kovid Goyal 2020-05-12 19:59:40 +05:30
parent 7d38da5243
commit 6b85665584
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -12,7 +12,7 @@ from PyQt5.Qt import (
) )
from calibre.constants import plugins from calibre.constants import plugins
from calibre.gui2 import error_dialog from calibre.gui2 import error_dialog, question_dialog
from calibre.gui2.viewer.search import SearchInput from calibre.gui2.viewer.search import SearchInput
from polyglot.builtins import range from polyglot.builtins import range
@ -143,7 +143,10 @@ class HighlightsPanel(QWidget):
h = self.highlights.current_highlight h = self.highlights.current_highlight
if h is None: if h is None:
return self.no_selected_highlight() return self.no_selected_highlight()
self.request_highlight_action.emit(h['uuid'], 'delete') if question_dialog(self, _('Are you sure?'), _(
'Are you sure you want to delete this highlight permanently?')
):
self.request_highlight_action.emit(h['uuid'], 'delete')
def add_highlight(self): def add_highlight(self):
self.request_highlight_action.emit(None, 'create') self.request_highlight_action.emit(None, 'create')