X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fgdc_certificate_panel.cc;h=f7f86895df931eaaf307d0277a2b1c2914d74465;hb=31de5b1272d928557a7272977584f5dcc9876c75;hp=a90f098f51b8e16874d9255cfd70a8763e2fbdf3;hpb=7d293a3268c320f474d42fef15548635c3cb40b0;p=dcpomatic.git diff --git a/src/wx/gdc_certificate_panel.cc b/src/wx/gdc_certificate_panel.cc index a90f098f5..f7f86895d 100644 --- a/src/wx/gdc_certificate_panel.cc +++ b/src/wx/gdc_certificate_panel.cc @@ -27,9 +27,21 @@ using std::string; using boost::optional; +using boost::bind; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog) - : DownloadCertificatePanel (dialog) + : CredentialsDownloadCertificatePanel ( + dialog, + bind(&Config::gdc_username, Config::instance()), + bind(&Config::set_gdc_username, Config::instance(), _1), + bind(&Config::unset_gdc_username, Config::instance()), + bind(&Config::gdc_password, Config::instance()), + bind(&Config::set_gdc_password, Config::instance(), _1), + bind(&Config::unset_gdc_password, Config::instance()) + ) { } @@ -37,21 +49,19 @@ GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog) void GDCCertificatePanel::do_download () { - Config* config = Config::instance (); - if (!config->gdc_username() || !config->gdc_password()) { - _dialog->message()->SetLabel(wxT("")); - error_dialog (this, _("No GDC username/password configured. Add your account details to the Accounts page in Preferences.")); - return; + string serial = wx_to_std (_serial->GetValue()); + if (!serial.empty() && serial[0] == 'A') { + /* We're adding the A ourselves */ + serial = serial.substr(1); } - string const url = String::compose( "ftp://%1:%2@ftp.gdc-tech.com/SHA256/A%3.crt.pem", Config::instance()->gdc_username().get(), Config::instance()->gdc_password().get(), - wx_to_std(_serial->GetValue()) + serial ); - optional error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1)); + optional error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1)); if (error) { _dialog->message()->SetLabel(wxT(""));