#include "nag_dialog.h"
#include "name_format_editor.h"
#include "password_entry.h"
+#include "send_test_email_dialog.h"
#include "server_dialog.h"
#include "static_text.h"
#include "wx_util.h"
#include "lib/config.h"
#include "lib/cross.h"
#include "lib/dcp_content_type.h"
+#include "lib/emailer.h"
#include "lib/exceptions.h"
#include "lib/filter.h"
#include "lib/log.h"
_password = new PasswordEntry (_panel);
table->Add (_password->get_panel(), 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+ _send_test_email = new Button (_panel, _("Send test email..."));
+ table->Add (_send_test_email);
+
_server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this));
_port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this));
_protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this));
_user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this));
_password->Changed.connect (boost::bind(&EmailPage::password_changed, this));
+ _send_test_email->Bind (wxEVT_BUTTON, boost::bind(&EmailPage::send_test_email_clicked, this));
}
void config_changed ()
Config::instance()->set_mail_password(_password->get());
}
+ void send_test_email_clicked ()
+ {
+ auto dialog = new SendTestEmailDialog(_panel);
+ auto result = dialog->ShowModal();
+ dialog->Destroy();
+ if (result == wxID_OK) {
+ Emailer emailer(
+ wx_to_std(dialog->from()),
+ { wx_to_std(dialog->to()) },
+ wx_to_std(_("DCP-o-matic test email")),
+ wx_to_std(_("This is a test email from DCP-o-matic."))
+ );
+ auto config = Config::instance();
+ try {
+ emailer.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password());
+ } catch (NetworkError& e) {
+ error_dialog (_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or("")));
+ return;
+ } catch (std::exception& e) {
+ error_dialog (_panel, _("Test email sending failed."), std_to_wx(e.what()));
+ return;
+ } catch (...) {
+ error_dialog (_panel, _("Test email sending failed."));
+ return;
+ }
+ message_dialog (_panel, _("Test email sent."));
+ }
+ }
+
wxTextCtrl* _server;
wxSpinCtrl* _port;
wxChoice* _protocol;
wxTextCtrl* _user;
PasswordEntry* _password;
+ Button* _send_test_email;
};
--- /dev/null
+/*
+ Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "send_test_email_dialog.h"
+
+
+SendTestEmailDialog::SendTestEmailDialog (wxWindow* parent)
+ : TableDialog (parent, _("Send test email"), 2, 1, true)
+{
+ add (_("From address"), true);
+ _from = add (new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1)));
+ add (_("To address"), true);
+ _to = add (new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300, -1)));
+
+ layout ();
+}
+
+
--- /dev/null
+/*
+ Copyright (C) 2022 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "table_dialog.h"
+
+
+class wxTextCtrl;
+
+
+class SendTestEmailDialog : public TableDialog
+{
+public:
+ SendTestEmailDialog (wxWindow* parent);
+
+ wxString from () const {
+ return _from->GetValue();
+ }
+
+ wxString to () const {
+ return _to->GetValue();
+ }
+
+private:
+ wxTextCtrl* _from;
+ wxTextCtrl* _to;
+};
+
screens_panel.cc
self_dkdm_dialog.cc
send_i18n_dialog.cc
+ send_test_email_dialog.cc
server_dialog.cc
servers_list_dialog.cc
simple_video_view.cc