summaryrefslogtreecommitdiff
path: root/src/wx/report_problem_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-06-13 01:24:50 +0200
committerCarl Hetherington <cth@carlh.net>2025-06-13 01:24:50 +0200
commiteb970af6fa9ddc854f13c88d6d8fd3b4a1057b9c (patch)
treef8ceedd28f8bfe82969ffe186b005f2681da9f6c /src/wx/report_problem_dialog.cc
parentcb8567bf31d8b9678b524f644bfe6117b817e536 (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.
Diffstat (limited to 'src/wx/report_problem_dialog.cc')
-rw-r--r--src/wx/report_problem_dialog.cc18
1 files changed, 13 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());
+ }
+}
+