to not going away (#1158).
+2018-01-07 Carl Hetherington <cth@carlh.net>
+
+ * Make certificate re-creation cancellable and default nags
+ to not going away (#1158).
+
2018-01-06 Carl Hetherington <cth@carlh.net>
* Check that we can decrypt a DKDM when it is loaded into
2018-01-06 Carl Hetherington <cth@carlh.net>
* Check that we can decrypt a DKDM when it is loaded into
using boost::function;
static
using boost::function;
static
}
Page::Page (wxSize panel_size, int border)
}
Page::Page (wxSize panel_size, int border)
int border,
function<void (shared_ptr<dcp::CertificateChain>)> set,
function<shared_ptr<const dcp::CertificateChain> (void)> get,
int border,
function<void (shared_ptr<dcp::CertificateChain>)> set,
function<shared_ptr<const dcp::CertificateChain> (void)> get,
- function<void (void)> nag_remake
+ function<bool (void)> nag_remake
)
: wxDialog (parent, wxID_ANY, title)
, _set (set)
)
: wxDialog (parent, wxID_ANY, title)
, _set (set)
intermediate_common_name = i->subject_common_name ();
}
intermediate_common_name = i->subject_common_name ();
}
+ if (_nag_remake()) {
+ /* Cancel was clicked */
+ return;
+ }
MakeChainDialog* d = new MakeChainDialog (
this,
MakeChainDialog* d = new MakeChainDialog (
this,
KeysPage::nag_remake_decryption_chain ()
{
KeysPage::nag_remake_decryption_chain ()
{
+ return NagDialog::maybe_nag (
_panel,
Config::NAG_REMAKE_DECRYPTION_CHAIN,
_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!")
+ _("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!"),
+ true
int border,
boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> set,
boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> get,
int border,
boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> set,
boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> get,
- boost::function<void (void)> nag_remake
+ boost::function<bool (void)> nag_remake
);
void add_button (wxWindow* button);
);
void add_button (wxWindow* button);
wxBoxSizer* _button_sizer;
boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> _set;
boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> _get;
wxBoxSizer* _button_sizer;
boost::function<void (boost::shared_ptr<dcp::CertificateChain>)> _set;
boost::function<boost::shared_ptr<const dcp::CertificateChain> (void)> _get;
- boost::function<void (void)> _nag_remake;
+ boost::function<bool (void)> _nag_remake;
};
class KeysPage : public StandardPage
};
class KeysPage : public StandardPage
void export_decryption_certificate ();
void export_decryption_chain ();
void config_changed () {}
void export_decryption_certificate ();
void export_decryption_chain ();
void config_changed () {}
- void nag_remake_decryption_chain ();
+ bool nag_remake_decryption_chain ();
void decryption_advanced ();
void signing_advanced ();
void export_decryption_chain_and_key ();
void decryption_advanced ();
void signing_advanced ();
void export_decryption_chain_and_key ();
-NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message)
+NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel)
: wxDialog (parent, wxID_ANY, _("Important notice"))
, _nag (nag)
{
: wxDialog (parent, wxID_ANY, _("Important notice"))
, _nag (nag)
{
sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show this message again"));
sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show this message again"));
- b->SetValue (true);
- Config::instance()->set_nagged (_nag, true);
sizer->Add (b, 0, wxALL, 6);
b->Bind (wxEVT_CHECKBOX, bind (&NagDialog::shut_up, this, _1));
sizer->Add (b, 0, wxALL, 6);
b->Bind (wxEVT_CHECKBOX, bind (&NagDialog::shut_up, this, _1));
- wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer (0);
- sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
- buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
- buttons->Realize ();
+ int flags = wxOK;
+ if (can_cancel) {
+ flags |= wxCANCEL;
+ }
+ wxSizer* buttons = CreateSeparatedButtonSizer (flags);
+ if (buttons) {
+ sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
SetSizer (sizer);
sizer->Layout ();
SetSizer (sizer);
sizer->Layout ();
Config::instance()->set_nagged (_nag, ev.IsChecked());
}
Config::instance()->set_nagged (_nag, ev.IsChecked());
}
-void
-NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message)
+/** @return true if the user clicked Cancel */
+bool
+NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel)
- if (!Config::instance()->nagged (nag)) {
- NagDialog* d = new NagDialog (parent, nag, message);
- d->ShowModal ();
- d->Destroy ();
+ if (Config::instance()->nagged(nag)) {
+ return false;
+
+ NagDialog* d = new NagDialog (parent, nag, message, can_cancel);
+ int const r = d->ShowModal();
+ d->Destroy ();
+
+ return r == wxID_CANCEL;
class NagDialog : public wxDialog
{
public:
class NagDialog : public wxDialog
{
public:
- static void maybe_nag (wxWindow* parent, Config::Nag nag, wxString message);
+ static bool maybe_nag (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel = false);
- NagDialog (wxWindow* parent, Config::Nag nag, wxString message);
+ NagDialog (wxWindow* parent, Config::Nag nag, wxString message, bool can_cancel);
void shut_up (wxCommandEvent& ev);
wxStaticText* _text;
void shut_up (wxCommandEvent& ev);
wxStaticText* _text;