From 173d9435e04bc5af8b2ebea37df72c516c39bddd Mon Sep 17 00:00:00 2001 From: Ernestas Kulik Date: Thu, 16 Jan 2020 17:40:34 +0100 Subject: [PATCH] views: Allow reporting non-reportable problems A bit of an oxymoron, but what can you do. Mostly targeted towards those afflicted by warning taints. Resolves: rhbz#1791655 https://bugzilla.redhat.com/show_bug.cgi?id=1679314 https://bugzilla.redhat.com/show_bug.cgi?id=1791655 --- src/gnome_abrt/controller.py.in | 10 ++++++-- src/gnome_abrt/views.py | 41 +++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/gnome_abrt/controller.py.in b/src/gnome_abrt/controller.py.in index c2991ed..5060b89 100644 --- a/src/gnome_abrt/controller.py.in +++ b/src/gnome_abrt/controller.py.in @@ -24,6 +24,9 @@ import traceback from gnome_abrt import errors from gnome_abrt.l10n import _ +import report + + class Controller: def __init__(self, sources, sigchld_assign=None): @@ -31,12 +34,15 @@ class Controller: self.run_event_fn = self._first_event_run self._sigchld_assign = sigchld_assign - def report(self, problem): + def report(self, problem, unsafe=False): if not problem: logging.error("BUG: Controller: Can't report None problem") return - self.run_event_fn("report-gui", problem) + flags = 0 + if unsafe: + flags |= report.LIBREPORT_IGNORE_NOT_REPORTABLE + report.report_problem_in_dir(problem.problem_id, flags) def delete(self, problem): if not problem: diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py index a7eabb0..32f27a7 100644 --- a/src/gnome_abrt/views.py +++ b/src/gnome_abrt/views.py @@ -840,8 +840,7 @@ class OopsWindow(Gtk.ApplicationWindow): sensitive_btn = problem is not None self._builder.btn_delete.set_sensitive(sensitive_btn) - self._builder.btn_report.set_sensitive( - sensitive_btn and not problem['not-reportable']) + self._builder.btn_report.set_sensitive(sensitive_btn) self._builder.vbx_links.foreach( destroy_links, None) self._builder.vbx_problem_messages.foreach( @@ -939,6 +938,13 @@ _("This problem has been reported, but a Bugzilla ticket has not" # Translators: Displayed after 'Reported' if a problem # has not been reported. self._builder.lbl_reported_value.set_text(_('no')) + + style_context = self._builder.btn_report.get_style_context() + + if problem['not-reportable']: + style_context.add_class('destructive-action') + else: + style_context.remove_class('destructive-action') else: if self._source is not None: self._builder.nb_problem_layout.set_current_page(1) @@ -998,8 +1004,35 @@ _("This problem has been reported, but a Bugzilla ticket has not" @handle_problem_and_source_errors def on_gac_report_activate(self, action): selected = self._get_selected(self.lss_problems) - if selected and not selected[0]['not-reportable']: - self._controller.report(selected[0]) + if not selected: + return + + unsafe = False + + if selected[0]['not-reportable']: + dialog = Gtk.MessageDialog(self, + Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.QUESTION, + Gtk.ButtonsType.NONE, + _("This problem is marked as not reportable, thus reporting should only be forced if you know what it entails. Do you wish to continue?")) + button = Gtk.Button.new_with_label(_("No")) + + button.get_style_context().add_class("suggested-action") + button.show() + + dialog.add_action_widget(button, Gtk.ResponseType.NO) + dialog.add_button(_("Yes"), Gtk.ResponseType.YES) + + response = dialog.run() + + dialog.destroy() + + if response != Gtk.ResponseType.YES: + return + + unsafe = True + + self._controller.report(selected[0], unsafe) @handle_problem_and_source_errors def on_se_problems_search_changed(self, entry): -- 2.25.1