diff --git a/gramps/gui/dialog.py b/gramps/gui/dialog.py
index 01f8f2cb9..53def5a78 100644
--- a/gramps/gui/dialog.py
+++ b/gramps/gui/dialog.py
@@ -168,6 +168,52 @@ class QuestionDialog2:
self.parent.set_modal(True)
return (response == Gtk.ResponseType.ACCEPT)
+class QuestionDialog3:
+ """ Like QuestionDialog2, but includes cancel button,
+ returns: 1 (okbutton, label_msg1)
+ 0 (no button label_msg2)
+ -1 (cancel button)
+ """
+ def __init__(self, msg1, msg2, label_msg1, label_msg2, parent=None):
+ self.xml = Glade(toplevel='questiondialog')
+
+ self.top = self.xml.toplevel
+ self.top.set_icon(ICON)
+ self.top.set_title("%s - Gramps" % msg1)
+
+ label1 = self.xml.get_object('qd_label1')
+ label1.set_text('%s' %
+ html.escape(msg1))
+ label1.set_use_markup(True)
+
+ label2 = self.xml.get_object('qd_label2')
+ # see https://github.com/emesene/emesene/issues/723
+ label2.connect('activate-link', on_activate_link)
+ label2.set_text(msg2)
+ label2.set_use_markup(True)
+
+ self.xml.get_object('okbutton').set_label(label_msg1)
+ self.xml.get_object('okbutton').set_use_underline(True)
+ self.xml.get_object('no').set_label(label_msg2)
+ self.xml.get_object('no').set_use_underline(True)
+ self.xml.get_object('cancelbutton').show()
+
+ self.parent = parent
+ if parent:
+ self.top.set_transient_for(parent)
+ self.parent_modal = parent.get_modal()
+ if self.parent_modal:
+ parent.set_modal(False)
+ self.top.show()
+
+ def run(self):
+ response = self.top.run()
+ self.top.destroy()
+ if self.parent and self.parent_modal:
+ self.parent.set_modal(True)
+ return (-1 if response == Gtk.ResponseType.DELETE_EVENT
+ else response == Gtk.ResponseType.ACCEPT)
+
class OptionDialog:
def __init__(self, msg1, msg2, btnmsg1, task1, btnmsg2, task2, parent=None):
self.xml = Glade(toplevel='optiondialog')
diff --git a/gramps/gui/glade/dialog.glade b/gramps/gui/glade/dialog.glade
index cb47a7d4b..bb32b056c 100644
--- a/gramps/gui/glade/dialog.glade
+++ b/gramps/gui/glade/dialog.glade
@@ -696,6 +696,19 @@
True
False
end
+
+
+
+ True
+ True
+ 0
+
+
@@ -722,7 +735,7 @@
False
False
- 1
+ 2
@@ -805,6 +818,7 @@
+ cancelbutton
no
okbutton
diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py
index 528a3b42a..0751046ee 100644
--- a/gramps/gui/views/listview.py
+++ b/gramps/gui/views/listview.py
@@ -66,7 +66,7 @@ from gramps.gen.const import CUSTOM_FILTERS
from gramps.gen.utils.debug import profile
from gramps.gen.utils.string import data_recover_msg
from gramps.gen.plug import CATEGORY_QR_PERSON
-from ..dialog import QuestionDialog, QuestionDialog2, ErrorDialog
+from ..dialog import QuestionDialog, QuestionDialog3, ErrorDialog
from ..editors import FilterEditor
from ..ddtargets import DdTargets
from ..plug.quick import create_quickreport_menu, create_web_connect_menu
@@ -543,14 +543,18 @@ class ListView(NavigationView):
"""
prompt = True
if len(self.selected_handles()) > 1:
- q = QuestionDialog2(
+ ques = QuestionDialog3(
_("Multiple Selection Delete"),
_("More than one item has been selected for deletion. "
"Select the option indicating how to delete the items:"),
_("Delete All"),
_("Confirm Each Delete"),
parent=self.uistate.window)
- prompt = not q.run()
+ res = ques.run()
+ if res == -1: # Cancel
+ return
+ else:
+ prompt = not res # we prompt on 'Confirm Each Delete'
if not prompt:
self.uistate.set_busy_cursor(True)
@@ -569,11 +573,16 @@ class ListView(NavigationView):
#descr = object.get_description()
#if descr == "":
descr = object.get_gramps_id()
- self.uistate.set_busy_cursor(True)
- QuestionDialog(_('Delete %s?') % descr, msg,
- _('_Delete Item'), query.query_response,
- parent=self.uistate.window)
- self.uistate.set_busy_cursor(False)
+ ques = QuestionDialog3(_('Delete %s?') % descr, msg,
+ _('_Yes'), _('_No'),
+ parent=self.uistate.window)
+ res = ques.run()
+ if res == -1: # Cancel
+ return
+ elif res: # If true, perfom the delete
+ self.uistate.set_busy_cursor(True)
+ query.query_response()
+ self.uistate.set_busy_cursor(False)
else:
query.query_response()