summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-30 11:27:53 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-30 11:27:53 +0000
commitc2cbab19cc66ec3e2e2e7e5c8c208983396de70c (patch)
treefab5a7626a161d74a89e2681bb6087783b5ebdc2 /src
parent69752192994292e90a2dc347416fc5a1aeca9468 (diff)
Hide the 'export decryption chain' button in the advanced page of preferences.
Diffstat (limited to 'src')
-rw-r--r--src/wx/config_dialog.cc51
-rw-r--r--src/wx/config_dialog.h3
2 files changed, 28 insertions, 26 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 8b6d215a2..13a405670 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -408,6 +408,8 @@ CertificateChainEditor::CertificateChainEditor (
_button_sizer = new wxBoxSizer (wxHORIZONTAL);
_remake_certificates = new Button (this, _("Re-make certificates and key..."));
_button_sizer->Add (_remake_certificates, 1, wxRIGHT, border);
+ _export_chain = new Button (this, _("Export chain..."));
+ _button_sizer->Add (_export_chain, 1, wxRIGHT, border);
table->Add (_button_sizer, wxGBPosition (r, 0), wxGBSpan (1, 4));
++r;
@@ -424,6 +426,7 @@ CertificateChainEditor::CertificateChainEditor (
_certificates->Bind (wxEVT_LIST_ITEM_SELECTED, bind (&CertificateChainEditor::update_sensitivity, this));
_certificates->Bind (wxEVT_LIST_ITEM_DESELECTED, bind (&CertificateChainEditor::update_sensitivity, this));
_remake_certificates->Bind (wxEVT_BUTTON, bind (&CertificateChainEditor::remake_certificates, this));
+ _export_chain->Bind (wxEVT_BUTTON, bind (&CertificateChainEditor::export_chain, this));
_import_private_key->Bind (wxEVT_BUTTON, bind (&CertificateChainEditor::import_private_key, this));
_export_private_key->Bind (wxEVT_BUTTON, bind (&CertificateChainEditor::export_private_key, this));
@@ -543,6 +546,29 @@ CertificateChainEditor::export_certificate ()
}
void
+CertificateChainEditor::export_chain ()
+{
+ wxFileDialog* d = new wxFileDialog (
+ this, _("Select Chain File"), wxEmptyString, wxEmptyString, wxT("PEM files (*.pem)|*.pem"),
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT
+ );
+
+ if (d->ShowModal () == wxID_OK) {
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
+ if (!f) {
+ throw OpenFileError (path, errno, false);
+ }
+
+ string const s = _get()->chain();
+ checked_fwrite (s.c_str(), s.length(), f, path);
+ fclose (f);
+ }
+
+ d->Destroy ();
+}
+
+void
CertificateChainEditor::update_certificate_list ()
{
_certificates->DeleteAllItems ();
@@ -737,8 +763,6 @@ KeysPage::setup ()
wxButton* export_decryption_certificate = new Button (_panel, _("Export KDM decryption certificate..."));
sizer->Add (export_decryption_certificate, 0, wxLEFT, _border);
- wxButton* export_decryption_chain = new Button (_panel, _("Export KDM decryption chain..."));
- sizer->Add (export_decryption_chain, 0, wxLEFT, _border);
wxButton* export_settings = new Button (_panel, _("Export all KDM decryption settings..."));
sizer->Add (export_settings, 0, wxLEFT, _border);
wxButton* import_settings = new Button (_panel, _("Import all KDM decryption settings..."));
@@ -747,7 +771,6 @@ KeysPage::setup ()
sizer->Add (decryption_advanced, 0, wxALL, _border);
export_decryption_certificate->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_certificate, this));
- export_decryption_chain->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain, this));
export_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::export_decryption_chain_and_key, this));
import_settings->Bind (wxEVT_BUTTON, bind (&KeysPage::import_decryption_chain_and_key, this));
decryption_advanced->Bind (wxEVT_BUTTON, bind (&KeysPage::decryption_advanced, this));
@@ -868,28 +891,6 @@ KeysPage::nag_remake_decryption_chain ()
}
void
-KeysPage::export_decryption_chain ()
-{
- wxFileDialog* d = new wxFileDialog (
- _panel, _("Select Chain File"), wxEmptyString, _("dcpomatic_kdm_decryption_chain.pem"), wxT ("PEM files (*.pem)|*.pem"),
- wxFD_SAVE | wxFD_OVERWRITE_PROMPT
- );
-
- if (d->ShowModal () == wxID_OK) {
- boost::filesystem::path path (wx_to_std(d->GetPath()));
- FILE* f = fopen_boost (path, "w");
- if (!f) {
- throw OpenFileError (path, errno, false);
- }
-
- string const s = Config::instance()->decryption_chain()->chain();
- checked_fwrite (s.c_str(), s.length(), f, path);
- fclose (f);
- }
- d->Destroy ();
-}
-
-void
KeysPage::export_decryption_certificate ()
{
wxFileDialog* d = new wxFileDialog (
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index 3b8762d8b..896b463d8 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -135,6 +135,7 @@ private:
void update_private_key ();
void import_private_key ();
void export_private_key ();
+ void export_chain ();
wxListCtrl* _certificates;
wxButton* _add_certificate;
@@ -144,6 +145,7 @@ private:
wxStaticText* _private_key;
wxButton* _import_private_key;
wxButton* _export_private_key;
+ wxButton* _export_chain;
wxStaticText* _private_key_bad;
wxSizer* _sizer;
wxBoxSizer* _button_sizer;
@@ -173,7 +175,6 @@ private:
void setup ();
void export_decryption_certificate ();
- void export_decryption_chain ();
void config_changed () {}
bool nag_remake_decryption_chain ();
void decryption_advanced ();