From f77ac3e26fc89e33d88f1f932a3f3f3bda329d75 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 25 May 2017 10:23:13 +0100 Subject: [PATCH 1/1] Nag about potential problems when remaking the decryption chain. --- src/lib/config.h | 1 + src/wx/config_dialog.cc | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/lib/config.h b/src/lib/config.h index 44708a24f..970810a77 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -321,6 +321,7 @@ public: enum Nag { NAG_DKDM_CONFIG, NAG_ENCRYPTED_METADATA, + NAG_REMAKE_DECRYPTION_CHAIN, NAG_COUNT }; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 7d999e14b..a62164896 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2017 Carl Hetherington This file is part of DCP-o-matic. @@ -33,6 +33,7 @@ #include "make_chain_dialog.h" #include "email_dialog.h" #include "name_format_editor.h" +#include "nag_dialog.h" #include "lib/config.h" #include "lib/ratio.h" #include "lib/filter.h" @@ -66,6 +67,13 @@ using boost::function; using boost::optional; using dcp::locale_convert; +static +void +do_nothing () +{ + +} + class Page { public: @@ -793,11 +801,13 @@ public: wxString title, int border, function)> set, - function (void)> get + function (void)> get, + function nag_remake ) : wxPanel (parent) , _set (set) , _get (get) + , _nag_remake (nag_remake) { wxFont subheading_font (*wxNORMAL_FONT); subheading_font.SetWeight (wxFONTWEIGHT_BOLD); @@ -1026,6 +1036,8 @@ private: intermediate_common_name = i->subject_common_name (); } + _nag_remake (); + MakeChainDialog* d = new MakeChainDialog ( this, subject_organization_name, @@ -1133,6 +1145,7 @@ private: shared_ptr _chain; boost::function)> _set; boost::function (void)> _get; + boost::function _nag_remake; }; class KeysPage : public StandardPage @@ -1161,7 +1174,8 @@ private: _signer = new CertificateChainEditor ( _panel, _("Signing DCPs and KDMs"), _border, boost::bind (&Config::set_signer_chain, Config::instance (), _1), - boost::bind (&Config::signer_chain, Config::instance ()) + boost::bind (&Config::signer_chain, Config::instance ()), + boost::bind (&do_nothing) ); _panel->GetSizer()->Add (_signer); @@ -1169,7 +1183,8 @@ private: _decryption = new CertificateChainEditor ( _panel, _("Decrypting KDMs"), _border, boost::bind (&Config::set_decryption_chain, Config::instance (), _1), - boost::bind (&Config::decryption_chain, Config::instance ()) + boost::bind (&Config::decryption_chain, Config::instance ()), + boost::bind (&KeysPage::nag_remake_decryption_chain, this) ); _panel->GetSizer()->Add (_decryption); @@ -1229,6 +1244,15 @@ private: _decryption->config_changed (); } + void nag_remake_decryption_chain () + { + NagDialog::maybe_nag ( + _panel, + Config::NAG_REMAKE_DECRYPTION_CHAIN, + _("If you continue with this operation you will no longer be able to use any DKDMs that you have created. Also, any KDMs that have been sent to you will become useless. Proceed with caution!") + ); + } + CertificateChainEditor* _signer; CertificateChainEditor* _decryption; wxButton* _export_decryption_certificate; -- 2.30.2