Commit 53fd9bec authored by Falk Alexander Seidl's avatar Falk Alexander Seidl

Add Safety Warning Dialog For Attachment Opening

parent f76e543f
Pipeline #70013 passed with stage
in 29 minutes and 36 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkMessageDialog" id="warning_dialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<property name="message_type">warning</property>
<property name="text" translatable="yes" comments="Dialog title which informs the user about unsaved changes. ">Safety Info</property>
<property name="secondary_text" translatable="yes" comments="Dialog subtitle which informs the user about unsaved changes more detailed. ">It is possible that external applications will create unencrypted hidden or temporary copies of this attachment file! Please proceed with caution.</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child>
<object class="GtkButton" id="back_button">
<property name="label" translatable="yes" comments="Discard all the changes which the user have made to his keepass safe">Back</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="proceed_button">
<property name="label" translatable="yes" comments="Save all the changes which the user have made to his keepass safe">Proceed</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
......@@ -4,6 +4,7 @@
<file compressed="true">database.kdbx</file>
<file compressed="true">passwordsafe.css</file>
<file compressed="true" preprocess="xml-stripblanks">about_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">attachment_warning_dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">create_database.ui</file>
<file compressed="true" preprocess="xml-stripblanks">created_database.ui</file>
<file compressed="true" preprocess="xml-stripblanks">unlocked_database.ui</file>
......
......@@ -8,12 +8,12 @@
<property name="text" translatable="yes" comments="Dialog title which informs the user about unsaved changes. ">Unsaved Changes</property>
<property name="secondary_text" translatable="yes" comments="Dialog subtitle which informs the user about unsaved changes more detailed. ">Do you want to write all changes to the safe?</property>
<child internal-child="vbox">
<object class="GtkBox" id="message">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="buttonbox">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
......
......@@ -662,6 +662,23 @@ class EntryPage:
stream.get_output_stream().write_bytes(GLib.Bytes.new(bytes))
stream.close()
builder = Gtk.Builder()
builder.add_from_resource("/org/gnome/PasswordSafe/attachment_warning_dialog.ui")
warning_dialog = builder.get_object("warning_dialog")
warning_dialog.set_destroy_with_parent(True)
warning_dialog.set_modal(True)
warning_dialog.set_transient_for(self.unlocked_database.window)
builder.get_object("back_button").connect("clicked", self.on_warning_dialog_back_button_clicked, warning_dialog)
builder.get_object("proceed_button").connect("clicked", self.on_warning_dialog_proceed_button_clicked, warning_dialog, file)
warning_dialog.present()
def on_warning_dialog_back_button_clicked(self, button, dialog):
dialog.close()
def on_warning_dialog_proceed_button_clicked(self, button, dialog, file):
dialog.close()
subprocess.call("xdg-open " + file.get_path(), shell=True)
self.unlocked_database.scheduled_tmpfiles_deletion.append(file)
......
data/about_dialog.ui.in
data/attachment_warning_dialog.ui
data/create_database.ui
data/created_database.ui
data/database_settings_dialog.ui
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment