diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-05 13:35:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-05 13:35:50 +0100 |
| commit | 7fe0f3035f13d306d38c63740674e4fc2f652052 (patch) | |
| tree | 44b4b836a13b0abd084d115773d38edb7ca93bb0 /src | |
| parent | 7673eebbd4595326b419f269544c43ed68bb5cf2 (diff) | |
Warn if there is no mail server configured when one is needed (#1046).
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/kdm_output_panel.cc | 88 |
1 files changed, 58 insertions, 30 deletions
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index f9078eac4..bbfc1a01d 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -155,6 +155,54 @@ KDMOutputPanel::make ( list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite, shared_ptr<Log> log ) { + list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms); + + /* Decide whether to proceed */ + + bool proceed = true; + + if (_email->GetValue ()) { + + if (Config::instance()->mail_server().empty ()) { + proceed = false; + error_dialog (this, _("You must set up a mail server in Preferences before you can send emails.")); + } + + bool cinemas_with_no_email = false; + BOOST_FOREACH (CinemaKDMs i, cinema_kdms) { + if (i.cinema->emails.empty ()) { + cinemas_with_no_email = true; + } + } + + if (proceed && cinemas_with_no_email && !confirm_dialog ( + this, + _("You have selected some cinemas that have no configured email address. Do you want to continue?") + )) { + proceed = false; + } + + if (proceed && 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); + } + } + + if (!emails.empty ()) { + ConfirmKDMEmailDialog* d = new ConfirmKDMEmailDialog (this, emails); + if (d->ShowModal() == wxID_CANCEL) { + proceed = false; + } + } + } + } + + if (!proceed) { + return make_pair (shared_ptr<Job>(), 0); + } + Config::instance()->set_kdm_filename_format (_filename_format->get ()); int written = 0; @@ -197,37 +245,17 @@ KDMOutputPanel::make ( } if (_email->GetValue ()) { - - 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) { - job.reset ( - new SendKDMEmailJob ( - cinema_kdms, - _filename_format->get(), - name_values, - name, - log - ) - ); - } + job.reset ( + new SendKDMEmailJob ( + cinema_kdms, + _filename_format->get(), + name_values, + name, + log + ) + ); } + } catch (dcp::NotEncryptedError& e) { error_dialog (this, _("CPL's content is not encrypted.")); } catch (exception& e) { |
