summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-06 20:39:08 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-06 20:44:37 +0100
commit3ef0d7b3786ee947e2b38bb4b2823c83969f0c67 (patch)
tree65ac683294f61105b343ad38e9693ace6650fbee /src
parent40457440bc4fcadf13ba7acf5fb198cdba23c13a (diff)
Add some default filenames to the advanced certificate/key export dialogues (#1888).
Diffstat (limited to 'src')
-rw-r--r--src/wx/config_dialog.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 14abc286b..9e630195f 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -436,11 +436,23 @@ CertificateChainEditor::export_certificate ()
wxFileDialog* d = new wxFileDialog (
this, _("Select Certificate File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"),
+ auto all = _get()->root_to_leaf();
+
+ wxString default_name;
+ if (i == 0) {
+ default_name = "root.pem";
+ } else if (i == static_cast<int>(all.size() - 1)) {
+ default_name = "leaf.pem";
+ } else {
+ default_name = "intermediate.pem";
+ }
+
+ auto d = new wxFileDialog(
+ this, _("Select Certificate File"), wxEmptyString, default_name, wxT ("PEM files (*.pem)|*.pem"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);
- dcp::CertificateChain::List all = _get()->root_to_leaf ();
- dcp::CertificateChain::List::iterator j = all.begin ();
+ auto j = all.begin ();
for (int k = 0; k < i; ++k) {
++j;
}
@@ -462,8 +474,8 @@ CertificateChainEditor::export_certificate ()
void
CertificateChainEditor::export_chain ()
{
- wxFileDialog* d = new wxFileDialog (
- this, _("Select Chain File"), wxEmptyString, wxEmptyString, wxT("PEM files (*.pem)|*.pem"),
+ auto d = new wxFileDialog (
+ this, _("Select Chain File"), wxEmptyString, _("certificate_chain.pem"), wxT("PEM files (*.pem)|*.pem"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);
@@ -636,8 +648,8 @@ CertificateChainEditor::export_private_key ()
return;
}
- wxFileDialog* d = new wxFileDialog (
- this, _("Select Key File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"),
+ auto d = new wxFileDialog (
+ this, _("Select Key File"), wxEmptyString, _("private_key.pem"), wxT ("PEM files (*.pem)|*.pem"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);