using boost::function;
static
-void
+bool
do_nothing ()
{
-
+ return false;
}
Page::Page (wxSize panel_size, int border)
GeneralPage::add_language_controls (wxGridBagSizer* table, int& r)
{
_set_language = new wxCheckBox (_panel, wxID_ANY, _("Set language"));
- table->Add (_set_language, wxGBPosition (r, 0));
+ table->Add (_set_language, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
_language = new wxChoice (_panel, wxID_ANY);
vector<pair<string, string> > languages;
languages.push_back (make_pair ("Čeština", "cs_CZ"));
GeneralPage::add_play_sound_controls (wxGridBagSizer* table, int& r)
{
_sound = new wxCheckBox (_panel, wxID_ANY, _("Play sound via"));
- table->Add (_sound, wxGBPosition (r, 0));
+ table->Add (_sound, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
_sound_output = new wxChoice (_panel, wxID_ANY);
table->Add (_sound_output, wxGBPosition (r, 1));
++r;
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)
try {
extra = c.read_string (dcp::file_to_string (wx_to_std (d->GetPath ())));
} catch (boost::filesystem::filesystem_error& e) {
- error_dialog (this, wxString::Format (_("Could not import certificate (%s)"), d->GetPath().data()));
+ error_dialog (this, _("Could not import certificate (%s)"), d->GetPath());
d->Destroy ();
return;
}
update_certificate_list ();
}
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
+ error_dialog (this, _("Could not read certificate file."), std_to_wx(e.what()));
}
}
}
if (d->ShowModal () == wxID_OK) {
- FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w");
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (path, errno, false);
}
string const s = j->certificate (true);
intermediate_common_name = i->subject_common_name ();
}
- _nag_remake ();
+ if (_nag_remake()) {
+ /* Cancel was clicked */
+ return;
+ }
MakeChainDialog* d = new MakeChainDialog (
this,
_set (chain);
update_private_key ();
} catch (dcp::MiscError& e) {
- error_dialog (this, wxString::Format (_("Could not read certificate file (%s)"), e.what ()));
+ error_dialog (this, _("Could not read certificate file."), std_to_wx(e.what()));
}
}
);
if (d->ShowModal () == wxID_OK) {
- FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w");
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (path, errno, false);
}
string const s = _get()->key().get ();
);
if (d->ShowModal () == wxID_OK) {
- FILE* f = fopen_boost (path_from_file_dialog (d, "dom"), "w");
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (path, errno, false);
}
string const chain = Config::instance()->decryption_chain()->chain();
d->Destroy ();
}
-void
+bool
KeysPage::nag_remake_decryption_chain ()
{
- NagDialog::maybe_nag (
+ return 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!")
+ _("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
);
}
KeysPage::export_decryption_chain ()
{
wxFileDialog* d = new wxFileDialog (
- _panel, _("Select Chain File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"),
+ _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) {
- FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w");
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (path, errno, false);
}
string const s = Config::instance()->decryption_chain()->chain();
KeysPage::export_decryption_certificate ()
{
wxFileDialog* d = new wxFileDialog (
- _panel, _("Select Certificate File"), wxEmptyString, wxEmptyString, wxT ("PEM files (*.pem)|*.pem"),
+ _panel, _("Select Certificate File"), wxEmptyString, _("dcpomatic_kdm_decryption_cert.pem"), wxT ("PEM files (*.pem)|*.pem"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);
if (d->ShowModal () == wxID_OK) {
- FILE* f = fopen_boost (path_from_file_dialog (d, "pem"), "w");
+ boost::filesystem::path path (wx_to_std(d->GetPath()));
+ FILE* f = fopen_boost (path, "w");
if (!f) {
- throw OpenFileError (wx_to_std (d->GetPath ()), errno, false);
+ throw OpenFileError (path, errno, false);
}
string const s = Config::instance()->decryption_chain()->leaf().certificate (true);
fwrite (s.c_str(), 1, s.length(), f);
fclose (f);
}
+
d->Destroy ();
}