Make KDM email subject configurable.
authorCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 12:56:42 +0000 (13:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 12:56:42 +0000 (13:56 +0100)
Suggested-by: Carsten Kurz
ChangeLog
src/lib/config.cc
src/lib/config.h
src/lib/kdm.cc
src/wx/config_dialog.cc

index f96ba701ed400b91ee2f99cff48c5bddcd0ab518..a810461116d18e82581d27e26feeea63c2d98e3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-07-16  Carl Hetherington  <cth@carlh.net>
 
+       * Make KDM email subject configurable.
+
        * Updates to de_DE from Carsten Kurz.
 
        * Limit allowed KDM types based on Interop/SMPTE setting
index 8e6dffee73f51d08a42098bd47adecd539922529..f7905b039cc3fa1d1729c2cab67a38927772aa25 100644 (file)
@@ -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);
index ebcf7e83dd98fa524f839c341e2e4873094c4eac..85e419a0a0348b53e3a19e643539832b8f3d1ce4 100644 (file)
@@ -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;
index 49bfae20ad727c36d62d057582c943c2edc9ac8c..571e09b69200f58ff0c5ac310d5f233ac9154eb9 100644 (file)
@@ -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 ());
index ff25882539019ad89a351e1b564c5cf218314772..5d1b32038290549b5263b2fc0f83aac43b6db454 100644 (file)
@@ -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;