- if (_output->email ()) {
-
- list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms);
-
- bool ok = true;
-
- if (Config::instance()->confirm_kdm_email ()) {
- list<string> emails;
- BOOST_FOREACH (CinemaKDMs i, cinema_kdms) {
- BOOST_FOREACH (string j, i.cinema->emails) {
- emails.push_back (j);
- }
- }
-
- ConfirmKDMEmailDialog* d = new ConfirmKDMEmailDialog (this, emails);
- if (d->ShowModal() == wxID_CANCEL) {
- ok = false;
- }
- }
-
- if (ok) {
- JobManager::instance()->add (
- shared_ptr<Job> (new SendKDMEmailJob (
- cinema_kdms,
- _output->name_format(),
- name_values,
- film->dcp_name(),
- film->log()
- ))
- );
- }
- }
- } catch (dcp::NotEncryptedError& e) {
- error_dialog (this, _("CPL's content is not encrypted."));
- } catch (exception& e) {
- error_dialog (this, e.what ());
- } catch (...) {
- error_dialog (this, _("An unknown exception occurred."));
+ pair<shared_ptr<Job>, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1));
+ if (result.first) {
+ JobManager::instance()->add (result.first);
+ }
+
+ if (result.second > 0) {
+ /* XXX: proper plural form support in wxWidgets? */
+ wxString s = result.second == 1 ? _("%d KDM written to %s") : _("%d KDMs written to %s");
+ message_dialog (
+ this,
+ wxString::Format (s, result.second, std_to_wx(_output->directory().string()).data())
+ );