FILE* f = temp_zip.open ("wb");
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, get_from_zip_url_data);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
+ curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
CURLcode const cr = curl_easy_perform (curl);
string const zip = string_client_data (_serial->GetClientObject (_serial->GetSelection ()));
string const file = String::compose (
- "%1/%2/%3",
+ "ftp://dolbyrootcertificates:houro61l@ftp.dolby.co.uk/SHA256/%1/%2/%3",
wx_to_std (_country->GetStringSelection()),
wx_to_std (_cinema->GetStringSelection()),
zip
return;
}
string const cert = b[0] + "_" + b[1] + ".pem.crt";
-
+
optional<string> error = get_from_zip_url (file, cert, _load);
if (error) {
- error_dialog (this, std_to_wx (error.get ()));
+ _message->SetLabel (std_to_wx (error.get ()));
+ } else {
+ _message->SetLabel (_("Certificate downloaded"));
}
-
- _message->SetLabel (wxT (""));
}
: DownloadCertificateDialog (parent, load)
{
add (_("Server serial number"), true);
- _serial = add (new wxTextCtrl (this, wxID_ANY));
+ _serial = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (300, -1)));
+
+ _serial->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DoremiCertificateDialog::set_sensitivity, this));
add_common_widgets ();
}
}
_message->SetLabel (_("Downloading certificate"));
+ run_gui_loop ();
optional<string> error = get_from_zip_url (
String::compose (
if (error) {
error_dialog (this, std_to_wx (error.get ()));
} else {
- _message->SetLabel (wxT (""));
+ _message->SetLabel (_("Certificate downloaded"));
}
}
+
+void
+DoremiCertificateDialog::set_sensitivity ()
+{
+ _download->Enable (!_serial->IsEmpty ());
+}
+
private:
void download ();
+ void set_sensitivity ();
wxTextCtrl* _serial;
};
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
map<wxTreeItemId, shared_ptr<Cinema> >::iterator i = _cinemas.begin ();
- list<shared_ptr<Screen> > sc = i->second->screens ();
- while (i != _cinemas.end() && find (sc.begin(), sc.end(), s.second) == sc.end()) {
- ++i;
+ while (i != _cinemas.end ()) {
+ list<shared_ptr<Screen> > sc = i->second->screens ();
+ if (find (sc.begin(), sc.end(), s.second) != sc.end ()) {
+ break;
+ }
}
if (i == _cinemas.end()) {
d->ShowModal ();
d->Destroy ();
}
+
+ setup_sensitivity ();
}
void