Include creator/issuer in default name of exported KDM decryption key (#1888).
authorCarl Hetherington <cth@carlh.net>
Sat, 6 Feb 2021 19:41:48 +0000 (20:41 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 6 Feb 2021 19:45:47 +0000 (20:45 +0100)
src/wx/config_dialog.cc

index d9563f1b670c2620e425b6f28f8850326b621329..576e979e9f8fd4bef6f7474588aebded8fa948d4 100644 (file)
@@ -838,8 +838,19 @@ KeysPage::nag_alter_decryption_chain ()
 void
 KeysPage::export_decryption_certificate ()
 {
-       wxFileDialog* d = new wxFileDialog (
-               _panel, _("Select Certificate File"), wxEmptyString, _("dcpomatic_kdm_decryption_cert.pem"), wxT ("PEM files (*.pem)|*.pem"),
+       auto config = Config::instance();
+       wxString default_name = "dcpomatic";
+       if (!config->dcp_creator().empty()) {
+               default_name += "_" + std_to_wx(careful_string_filter(config->dcp_creator()));
+       }
+       if (!config->dcp_issuer().empty()) {
+               default_name += "_" + std_to_wx(careful_string_filter(config->dcp_issuer()));
+       }
+       /// TRANSLATORS: this is the suffix of the defautl filename used when exporting KDM decryption leaf certificates
+       default_name += _("_kdm_decryption_cert.pem");
+
+       auto d = new wxFileDialog (
+               _panel, _("Select Certificate File"), wxEmptyString, default_name, wxT("PEM files (*.pem)|*.pem"),
                wxFD_SAVE | wxFD_OVERWRITE_PROMPT
                );