+ auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ table->AddGrowableCol (1, 1);
+ _panel->GetSizer()->Add (table, 0, wxEXPAND | wxALL, _border);
+
+ _enable_message_box = new CheckBox (_panel, _("Message box"));
+ table->Add (_enable_message_box, 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+
+ _enable_email = new CheckBox (_panel, _("Email"));
+ table->Add (_enable_email, 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+
+ add_label_to_sizer (table, _panel, _("Subject"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _subject = new wxTextCtrl (_panel, wxID_ANY);
+ table->Add (_subject, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, _panel, _("From address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _from = new wxTextCtrl (_panel, wxID_ANY);
+ table->Add (_from, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, _panel, _("To address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _to = new wxTextCtrl (_panel, wxID_ANY);
+ table->Add (_to, 1, wxEXPAND | wxALL);
+
+ vector<EditableListColumn> columns;
+ columns.push_back (EditableListColumn(_("Address")));
+ add_label_to_sizer (table, _panel, _("CC addresses"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _cc = new EditableList<string, EmailDialog> (
+ _panel,
+ columns,
+ bind (&Config::notification_cc, Config::instance()),
+ bind (&Config::set_notification_cc, Config::instance(), _1),
+ [] (string s, int) {
+ return s;
+ },
+ true,
+ EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
+ );
+ table->Add (_cc, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, _panel, _("BCC address"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ _bcc = new wxTextCtrl (_panel, wxID_ANY);
+ table->Add (_bcc, 1, wxEXPAND | wxALL);
+
+ _email = new wxTextCtrl (_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (-1, 200), wxTE_MULTILINE);
+ _panel->GetSizer()->Add (_email, 0, wxEXPAND | wxALL, _border);
+
+ _reset_email = new Button (_panel, _("Reset to default subject and text"));
+ _panel->GetSizer()->Add (_reset_email, 0, wxEXPAND | wxALL, _border);
+
+ _cc->layout ();
+
+ _enable_message_box->Bind (wxEVT_CHECKBOX, boost::bind (&NotificationsPage::type_changed, this, _enable_message_box, Config::MESSAGE_BOX));
+ _enable_email->Bind (wxEVT_CHECKBOX, boost::bind (&NotificationsPage::type_changed, this, _enable_email, Config::EMAIL));
+
+ _subject->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_subject_changed, this));
+ _from->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_from_changed, this));
+ _to->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_to_changed, this));
+ _bcc->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_bcc_changed, this));
+ _email->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_email_changed, this));
+ _reset_email->Bind (wxEVT_BUTTON, boost::bind (&NotificationsPage::reset_email, this));
+
+ setup_sensitivity ();
+ }
+
+ void setup_sensitivity ()
+ {
+ bool const s = _enable_email->GetValue();
+ _subject->Enable(s);
+ _from->Enable(s);
+ _to->Enable(s);
+ _cc->Enable(s);
+ _bcc->Enable(s);
+ _email->Enable(s);
+ _reset_email->Enable(s);
+ }
+
+ void config_changed () override
+ {
+ auto config = Config::instance ();
+
+ checked_set (_enable_message_box, config->notification(Config::MESSAGE_BOX));
+ checked_set (_enable_email, config->notification(Config::EMAIL));
+ checked_set (_subject, config->notification_subject ());
+ checked_set (_from, config->notification_from ());
+ checked_set (_to, config->notification_to ());
+ checked_set (_bcc, config->notification_bcc ());
+ checked_set (_email, Config::instance()->notification_email ());
+
+ setup_sensitivity ();
+ }
+
+ void notification_subject_changed ()
+ {
+ Config::instance()->set_notification_subject(wx_to_std(_subject->GetValue()));
+ }
+
+ void notification_from_changed ()
+ {
+ Config::instance()->set_notification_from(wx_to_std(_from->GetValue()));
+ }
+
+ void notification_to_changed ()
+ {
+ Config::instance()->set_notification_to(wx_to_std(_to->GetValue()));
+ }
+
+ void notification_bcc_changed ()
+ {
+ Config::instance()->set_notification_bcc(wx_to_std(_bcc->GetValue()));
+ }
+
+ void notification_email_changed ()
+ {
+ if (_email->GetValue().IsEmpty()) {