diff --git a/briar-gtk/briar_gtk/actions/window.py b/briar-gtk/briar_gtk/actions/window.py index 7751e605ca84c6978ce35753a50472f828d169b4..d759f44ca3589b12be21ce3842bccf1f0927080f 100644 --- a/briar-gtk/briar_gtk/actions/window.py +++ b/briar-gtk/briar_gtk/actions/window.py @@ -36,7 +36,8 @@ class WindowActions(Actions): ) def _setup_delete_contact_action(self): - self._setup_action("delete-contact", None, self._delete_contact) + self._setup_action("delete-contact-dialog", None, + self._delete_contact_dialog) def _setup_open_about_page_action(self): self._setup_action("open-about-dialog", None, self._open_about_page) @@ -57,8 +58,8 @@ class WindowActions(Actions): self.widget.current_container.show_sidebar() # pylint: disable=unused-argument - def _delete_contact(self, action, parameter): - self.widget.current_container.delete_contact() + def _delete_contact_dialog(self, action, parameter): + self.widget.current_container.open_delete_contact_dialog() # pylint: disable=unused-argument def _open_about_page(self, action, parameter): diff --git a/briar-gtk/briar_gtk/containers/main_window.py b/briar-gtk/briar_gtk/containers/main_window.py index 3e7c316da4f51f63e79896e3c41e477ffd922da0..ee24790ae347d76756f539bd04b084e3b548cf02 100644 --- a/briar-gtk/briar_gtk/containers/main_window.py +++ b/briar-gtk/briar_gtk/containers/main_window.py @@ -5,7 +5,8 @@ # Initial version based on GNOME Fractal # https://gitlab.gnome.org/GNOME/fractal/-/tags/4.2.2 -from gi.repository import GLib +from gettext import gettext as _ +from gi.repository import GLib, Gtk from briar_wrapper.models.contacts import Contacts @@ -88,13 +89,31 @@ class MainWindowContainer(Container): self.contact_name_label.set_text("") self._current_contact_id = 0 - def delete_contact(self): + def open_delete_contact_dialog(self): if self._current_contact_id == 0: raise Exception("Can't delete contact with ID 0") - Contacts(APP().api).delete(self._current_contact_id) - self._refresh_contacts() - self.show_sidebar() + confirmation_dialog = Gtk.MessageDialog( + transient_for=APP().window, + flags=Gtk.DialogFlags.MODAL, + message_type=Gtk.MessageType.WARNING, + buttons=Gtk.ButtonsType.OK_CANCEL, + text=_("Confirm Contact Deletion"), + ) + confirmation_dialog.format_secondary_text( + _("Are you sure that you want to remove this contact and " + "all messages exchanged with this contact?") + ) + + confirmation_dialog.connect("response", self._delete_contact) + confirmation_dialog.show_all() + + def _delete_contact(self, widget, response_id): + if response_id == Gtk.ResponseType.OK: + Contacts(APP().api).delete(self._current_contact_id) + self._refresh_contacts() + self.show_sidebar() + widget.destroy() def _prepare_chat_view(self, contact_name): if self._no_chat_opened(): diff --git a/briar-gtk/data/ui/chat_menu.ui b/briar-gtk/data/ui/chat_menu.ui index 619ecbcd4b6813111cc83cf99178f8c642729c83..1f4be7a4bd20b4b819103f8e12cf2c48b3359a7d 100644 --- a/briar-gtk/data/ui/chat_menu.ui +++ b/briar-gtk/data/ui/chat_menu.ui @@ -26,7 +26,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="action_name">win.delete-contact</property> + <property name="action_name">win.delete-contact-dialog</property> <property name="text" translatable="yes">Delete contact</property> </object> <packing> diff --git a/briar-gtk/po/ar.po b/briar-gtk/po/ar.po index 3fb8ce273a32e6d22c2d066adfe1b2bdd105e399..0181ef8abb7d6557395f08d5358522f739fba482 100644 --- a/briar-gtk/po/ar.po +++ b/briar-gtk/po/ar.po @@ -92,7 +92,7 @@ msgid "Next" msgstr "التالي" msgid "Delete contact" -msgstr "" +msgstr "ØØ°Ù جهة الإتصال" msgid "Password" msgstr "كلمة السّر" @@ -152,6 +152,12 @@ msgstr "" msgid "Myself" msgstr "" +msgid "Confirm Contact Deletion" +msgstr "تأكيد ØØ°Ù جهة الإتصال" + +msgid "Are you sure that you want to remove this contact and all messages exchanged with this contact?" +msgstr "هل أنت متأكد/Ø© من أنك تريد ØØ°Ù جهة الإتصال هذه وكل الرسائل المتبادلة بينكما؟" + msgid "Please enter a password" msgstr "" diff --git a/briar-gtk/po/briar-gtk.pot b/briar-gtk/po/briar-gtk.pot index 38b008ad94730ec3ec3ee83efc6a30038aa9f889..3242ea495a20eef43c3c5760ceb51bc48c34592b 100644 --- a/briar-gtk/po/briar-gtk.pot +++ b/briar-gtk/po/briar-gtk.pot @@ -162,6 +162,12 @@ msgstr "" msgid "Myself" msgstr "" +msgid "Confirm Contact Deletion" +msgstr "" + +msgid "Are you sure that you want to remove this contact and all messages exchanged with this contact?" +msgstr "" + msgid "Please enter a password" msgstr "" diff --git a/briar-gtk/po/de.po b/briar-gtk/po/de.po index 69ae0417522fab5d028571f0d6e059499e4f08ff..e33a58773ba9813020020261853bd5e1ac3535b3 100644 --- a/briar-gtk/po/de.po +++ b/briar-gtk/po/de.po @@ -92,7 +92,7 @@ msgid "Next" msgstr "Weiter" msgid "Delete contact" -msgstr "Kontakt entfernen" +msgstr "Kontakt löschen" msgid "Password" msgstr "Passwort" @@ -152,6 +152,12 @@ msgstr "Briar-Funktionalität von" msgid "Myself" msgstr "Ich" +msgid "Confirm Contact Deletion" +msgstr "Löschen des Kontakts bestätigen" + +msgid "Are you sure that you want to remove this contact and all messages exchanged with this contact?" +msgstr "Bist du sicher, dass du diesen Kontakt und alle dazugehörigen Nachrichten löschen möchtest?" + msgid "Please enter a password" msgstr "Bitte gib ein Passwort ein" diff --git a/briar-gtk/po/es.po b/briar-gtk/po/es.po index 1c9cfd18a1c9c5dacdfe130e8ebcb1bdced441f1..cef368ad00da4275d709d36a244520fbe8227169 100644 --- a/briar-gtk/po/es.po +++ b/briar-gtk/po/es.po @@ -152,6 +152,12 @@ msgstr "Funcionalidad de Briar de" msgid "Myself" msgstr "Yo" +msgid "Confirm Contact Deletion" +msgstr "Confirmar eliminación de contacto" + +msgid "Are you sure that you want to remove this contact and all messages exchanged with this contact?" +msgstr "¿Seguro que quieres eliminar este contacto y todos los mensajes intercambiados entre vosotros?" + msgid "Please enter a password" msgstr "Por favor, introduce una contraseña"