summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-16 13:56:42 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-16 13:56:42 +0100
commitab3d0c5040bbf4d40790ad91990f0f2b6aa8e838 (patch)
tree278ab7ec10cecf8da9bdcf19f8c491cd0cfcfb05 /src
parentd7cefaf92f12975691bfe695f43f621debd0617e (diff)
Make KDM email subject configurable.
Suggested-by: Carsten Kurz
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc2
-rw-r--r--src/lib/config.h10
-rw-r--r--src/lib/kdm.cc2
-rw-r--r--src/wx/config_dialog.cc12
4 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 8e6dffee7..f7905b039 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -186,6 +186,7 @@ Config::read ()
_mail_server = f.string_child ("MailServer");
_mail_user = f.optional_string_child("MailUser").get_value_or ("");
_mail_password = f.optional_string_child("MailPassword").get_value_or ("");
+ _kdm_subject = f.optional_string_child ("KDMSubject").get_value_or (_("KDM delivery"));
_kdm_from = f.string_child ("KDMFrom");
_kdm_cc = f.optional_string_child ("KDMCC").get_value_or ("");
_kdm_email = f.string_child ("KDMEmail");
@@ -366,6 +367,7 @@ Config::write () const
root->add_child("MailServer")->add_child_text (_mail_server);
root->add_child("MailUser")->add_child_text (_mail_user);
root->add_child("MailPassword")->add_child_text (_mail_password);
+ root->add_child("KDMSubject")->add_child_text (_kdm_subject);
root->add_child("KDMFrom")->add_child_text (_kdm_from);
root->add_child("KDMCC")->add_child_text (_kdm_cc);
root->add_child("KDMEmail")->add_child_text (_kdm_email);
diff --git a/src/lib/config.h b/src/lib/config.h
index ebcf7e83d..85e419a0a 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -169,6 +169,10 @@ public:
return _mail_password;
}
+ std::string kdm_subject () const {
+ return _kdm_subject;
+ }
+
std::string kdm_from () const {
return _kdm_from;
}
@@ -323,6 +327,11 @@ public:
changed ();
}
+ void set_kdm_subject (std::string s) {
+ _kdm_subject = s;
+ changed ();
+ }
+
void set_kdm_from (std::string f) {
_kdm_from = f;
changed ();
@@ -414,6 +423,7 @@ private:
std::string _mail_server;
std::string _mail_user;
std::string _mail_password;
+ std::string _kdm_subject;
std::string _kdm_from;
std::string _kdm_cc;
std::string _kdm_email;
diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc
index 49bfae20a..571e09b69 100644
--- a/src/lib/kdm.cc
+++ b/src/lib/kdm.cc
@@ -232,7 +232,7 @@ email_kdms (
/* Send email */
quickmail_initialize ();
- quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), "KDM delivery");
+ quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), Config::instance()->kdm_subject().c_str ());
quickmail_add_to (mail, i->cinema->email.c_str ());
if (!Config::instance()->kdm_cc().empty ()) {
quickmail_add_cc (mail, Config::instance()->kdm_cc().c_str ());
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index ff2588253..5d1b32038 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -669,6 +669,10 @@ public:
font.SetPointSize (font.GetPointSize() - 1);
plain->SetFont (font);
table->AddSpacer (0);
+
+ add_label_to_sizer (table, panel, _("Subject"), true);
+ _kdm_subject = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_kdm_subject, 1, wxEXPAND | wxALL);
add_label_to_sizer (table, panel, _("From address"), true);
_kdm_from = new wxTextCtrl (panel, wxID_ANY);
@@ -691,6 +695,8 @@ public:
_mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_user_changed, this));
_mail_password->SetValue (std_to_wx (config->mail_password ()));
_mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_password_changed, this));
+ _kdm_subject->SetValue (std_to_wx (config->kdm_subject ()));
+ _kdm_subject->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_subject_changed, this));
_kdm_from->SetValue (std_to_wx (config->kdm_from ()));
_kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_from_changed, this));
_kdm_cc->SetValue (std_to_wx (config->kdm_cc ()));
@@ -717,6 +723,11 @@ private:
{
Config::instance()->set_mail_password (wx_to_std (_mail_password->GetValue ()));
}
+
+ void kdm_subject_changed ()
+ {
+ Config::instance()->set_kdm_subject (wx_to_std (_kdm_subject->GetValue ()));
+ }
void kdm_from_changed ()
{
@@ -742,6 +753,7 @@ private:
wxTextCtrl* _mail_server;
wxTextCtrl* _mail_user;
wxTextCtrl* _mail_password;
+ wxTextCtrl* _kdm_subject;
wxTextCtrl* _kdm_from;
wxTextCtrl* _kdm_cc;
wxTextCtrl* _kdm_email;