commit 8a4fcd3d95ca4aeed1c46152cecadf29ed21e774
Author: Tommaso Cucinotta <[email protected]>
Date:   Thu Jul 27 00:01:51 2017 +0200

    prefs/needauth: added warning if user tries to disable authorization for 
needauth converters.
---
 src/frontends/qt4/GuiPrefs.cpp |   17 +++++++++++++++--
 src/frontends/qt4/GuiPrefs.h   |    1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index 5f2f474..95ea560 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -1684,8 +1684,6 @@ PrefConverters::PrefConverters(GuiPreferences * form)
                this, SIGNAL(changed()));
        connect(needauthForbiddenCB, SIGNAL(toggled(bool)),
                this, SIGNAL(changed()));
-       connect(needauthCB, SIGNAL(toggled(bool)),
-               this, SIGNAL(changed()));
 
        converterED->setValidator(new NoNewLineValidator(converterED));
        converterFlagED->setValidator(new NoNewLineValidator(converterFlagED));
@@ -1874,6 +1872,21 @@ void PrefConverters::on_needauthForbiddenCB_toggled(bool 
checked)
 }
 
 
+void PrefConverters::on_needauthCB_toggled(bool checked)
+{
+       if (checked)
+               return;
+
+       int ret = frontend::Alert::prompt(
+               _("SECURITY WARNING!"), _("Unchecking this option has the 
effect that potentially harmful converters would be run without asking your 
permission first. This is UNSAFE and NOT recommended, unless you know what you 
are doing. Are you sure you would like to proceed ? The recommended and safe 
answer is NO!"),
+               0, 0, _("&No"), _("&Yes"));
+       if (ret == 1)
+               changed();
+       else
+               needauthCB->setChecked(true);
+}
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // FormatValidator
diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h
index 3b6ff60..8f43a37 100644
--- a/src/frontends/qt4/GuiPrefs.h
+++ b/src/frontends/qt4/GuiPrefs.h
@@ -338,6 +338,7 @@ private Q_SLOTS:
        void changeConverter();
        void on_cacheCB_stateChanged(int state);
        void on_needauthForbiddenCB_toggled(bool);
+       void on_needauthCB_toggled(bool);
 
 private:
        void updateButtons();

Reply via email to