diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-06-13 01:24:50 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-06-13 01:24:50 +0200 |
| commit | eb970af6fa9ddc854f13c88d6d8fd3b4a1057b9c (patch) | |
| tree | f8ceedd28f8bfe82969ffe186b005f2681da9f6c | |
| parent | cb8567bf31d8b9678b524f644bfe6117b817e536 (diff) | |
Only enable report-problem "OK" button when an email address has been entered.
Previously we would let users get it wrong, then show an error and dump
them back without any report message they might have written.
| -rw-r--r-- | src/wx/report_problem_dialog.cc | 18 | ||||
| -rw-r--r-- | src/wx/report_problem_dialog.h | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/wx/report_problem_dialog.cc b/src/wx/report_problem_dialog.cc index 9079b344d..2a0fb6bbd 100644 --- a/src/wx/report_problem_dialog.cc +++ b/src/wx/report_problem_dialog.cc @@ -105,17 +105,16 @@ ReportProblemDialog::ReportProblemDialog(wxWindow* parent, shared_ptr<Film> film _overall_sizer->SetSizeHints(this); _summary->SetFocus(); + + _email->Bind(wxEVT_TEXT, boost::bind(&ReportProblemDialog::setup_sensitivity, this)); + + setup_sensitivity(); } void ReportProblemDialog::report() { - if (_email->GetValue().IsEmpty()) { - error_dialog(this, _("Please enter an email address so that we can contact you with any queries about the problem.")); - return; - } - if (_email->GetValue() == char_to_wx("carl@dcpomatic.com") || _email->GetValue() == char_to_wx("cth@carlh.net")) { error_dialog(this, wxString::Format(_("Enter your email address for the contact, not %s"), _email->GetValue().data())); return; @@ -124,3 +123,12 @@ ReportProblemDialog::report() JobManager::instance()->add(make_shared<SendProblemReportJob>(_film, wx_to_std(_email->GetValue()), wx_to_std(_summary->GetValue()))); } + +void +ReportProblemDialog::setup_sensitivity() +{ + if (auto ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this))) { + ok->Enable(!_email->GetValue().IsEmpty()); + } +} + diff --git a/src/wx/report_problem_dialog.h b/src/wx/report_problem_dialog.h index c43defd41..ad76795a3 100644 --- a/src/wx/report_problem_dialog.h +++ b/src/wx/report_problem_dialog.h @@ -39,6 +39,8 @@ public: void report(); private: + void setup_sensitivity(); + std::shared_ptr<Film> _film; wxSizer* _overall_sizer; |
