From 1a8e6ff935093c188623131d91510f409c732f93 Mon Sep 17 00:00:00 2001 From: Paolo Stivanin Date: Tue, 27 Feb 2024 14:32:35 +0100 Subject: [PATCH] Show warning when exporting to a plain format --- src/exports.c | 13 +++++++++---- src/message-dialogs.c | 14 +++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/exports.c b/src/exports.c index a08e6ec2..72c99fc6 100644 --- a/src/exports.c +++ b/src/exports.c @@ -5,10 +5,9 @@ #include "message-dialogs.h" #include "common/exports.h" - -static void show_ret_msg_dialog (GtkWidget *mainwin, - const gchar *fpath, - const gchar *ret_msg); +static void show_ret_msg_dialog (GtkWidget *mainwin, + const gchar *fpath, + const gchar *ret_msg); void @@ -35,6 +34,12 @@ export_data_cb (GSimpleAction *simple, return; } encrypted = TRUE; + } else { + const gchar *msg = "Please note that exporting to a plain format is a huge security risk.\n" + "If you wish to safely abort the operation, please click the 'Cancel' button below."; + if (get_confirmation_from_dialog (app_data->main_window, msg) == FALSE) { + return; + } } GtkFileChooserNative *fl_diag = gtk_file_chooser_native_new ("Export file", diff --git a/src/message-dialogs.c b/src/message-dialogs.c index 0780cc19..caadd261 100644 --- a/src/message-dialogs.c +++ b/src/message-dialogs.c @@ -23,20 +23,20 @@ get_confirmation_from_dialog (GtkWidget *parent, static GtkWidget *dialog = NULL; gboolean confirm; - dialog = gtk_dialog_new_with_buttons ("Confirm", GTK_WINDOW (parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + dialog = gtk_dialog_new_with_buttons ("Confirm", GTK_WINDOW(parent), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, "OK", GTK_RESPONSE_OK, "Cancel", GTK_RESPONSE_CANCEL, NULL); - gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + gtk_container_set_border_width (GTK_CONTAINER(dialog), 5); - GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + GtkWidget *content_area = gtk_dialog_get_content_area (GTK_DIALOG(dialog)); GtkWidget *label = gtk_label_new (NULL); - gtk_label_set_markup (GTK_LABEL (label), message); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); - gtk_container_add (GTK_CONTAINER (content_area), label); + gtk_label_set_markup (GTK_LABEL(label), message); + gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_CENTER); + gtk_container_add (GTK_CONTAINER(content_area), label); gtk_widget_show_all (dialog); - gint result = gtk_dialog_run (GTK_DIALOG (dialog)); + gint result = gtk_dialog_run (GTK_DIALOG(dialog)); switch (result) { case GTK_RESPONSE_OK: confirm = TRUE;