Allow mail server / KDM from email configuration.
authorCarl Hetherington <cth@carlh.net>
Tue, 24 Sep 2013 23:00:33 +0000 (00:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 24 Sep 2013 23:00:33 +0000 (00:00 +0100)
src/lib/config.cc
src/lib/config.h
src/wx/config_dialog.cc
src/wx/config_dialog.h

index 9d2d9d1bf311284cf28fe61e74a0b7f6b813ee15..3a3a87faa53f227bee8d8a66a23128b3c026fbde 100644 (file)
@@ -139,6 +139,9 @@ Config::read ()
                cinema->read_screens (*i);
                _cinemas.push_back (cinema);
        }
+
+       _mail_server = f.string_child ("MailServer");
+       _kdm_from = f.string_child ("KDMFrom");
 }
 
 void
@@ -295,6 +298,9 @@ Config::write () const
                (*i)->as_xml (root->add_child ("Cinema"));
        }
 
+       root->add_child("MailServer")->add_child_text (_mail_server);
+       root->add_child("KDMFrom")->add_child_text (_kdm_from);
+
        doc.write_to_file_formatted (file(false).string ());
 }
 
index 3e8a975d6fcb4330c90edafda325168f8648717e..8dcb513a52b8fa245c2cb70a07c1478580921a78 100644 (file)
@@ -134,6 +134,14 @@ public:
                return _colour_conversions;
        }
 
+       std::string mail_server () const {
+               return _mail_server;
+       }
+
+       std::string kdm_from () const {
+               return _kdm_from;
+       }
+
        /** @param n New number of local encoding threads */
        void set_num_local_encoding_threads (int n) {
                _num_local_encoding_threads = n;
@@ -228,6 +236,14 @@ public:
        void set_colour_conversions (std::vector<PresetColourConversion> const & c) {
                _colour_conversions = c;
        }
+
+       void set_mail_server (std::string s) {
+               _mail_server = s;
+       }
+
+       void set_kdm_from (std::string f) {
+               _kdm_from = f;
+       }
        
        void write () const;
 
@@ -276,6 +292,8 @@ private:
        int _default_j2k_bandwidth;
        std::vector<PresetColourConversion> _colour_conversions;
        std::list<boost::shared_ptr<Cinema> > _cinemas;
+       std::string _mail_server;
+       std::string _kdm_from;
 
        /** Singleton instance, or 0 */
        static Config* _instance;
index dba83804e557670534786bba8d9593d3078dd6ff..65cc39f24f52953049149bdece47810a1e6823a6 100644 (file)
@@ -112,6 +112,14 @@ ConfigDialog::make_misc_panel ()
        _num_local_encoding_threads = new wxSpinCtrl (_misc_panel);
        table->Add (_num_local_encoding_threads, 1);
 
+       add_label_to_sizer (table, _misc_panel, _("Outgoing mail server"), true);
+       _mail_server = new wxTextCtrl (_misc_panel, wxID_ANY);
+       table->Add (_mail_server, 1, wxEXPAND | wxALL);
+
+       add_label_to_sizer (table, _misc_panel, _("From address for KDM emails"), true);
+       _kdm_from = new wxTextCtrl (_misc_panel, wxID_ANY);
+       table->Add (_kdm_from, 1, wxEXPAND | wxALL);
+       
        {
                add_label_to_sizer (table, _misc_panel, _("Default duration of still images"), true);
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -175,6 +183,11 @@ ConfigDialog::make_misc_panel ()
        _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ());
        _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::num_local_encoding_threads_changed, this));
 
+       _mail_server->SetValue (std_to_wx (config->mail_server ()));
+       _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_server_changed, this));
+       _kdm_from->SetValue (std_to_wx (config->kdm_from ()));
+       _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::kdm_from_changed, this));
+
        _default_still_length->SetRange (1, 3600);
        _default_still_length->SetValue (config->default_still_length ());
        _default_still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::default_still_length_changed, this));
@@ -452,3 +465,16 @@ ConfigDialog::make_colour_conversions_panel ()
                boost::bind (&colour_conversion_column, _1)
                );
 }
+
+void
+ConfigDialog::mail_server_changed ()
+{
+       Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ()));
+}
+
+
+void
+ConfigDialog::kdm_from_changed ()
+{
+       Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ()));
+}
index 82c4ee2a03b7a972f3796261dabc468046fe8848..3df7a6a2612a92f57e3c696f95aa27f6ea354ba0 100644 (file)
@@ -59,6 +59,8 @@ private:
        void issuer_changed ();
        void creator_changed ();
        void default_j2k_bandwidth_changed ();
+       void mail_server_changed ();
+       void kdm_from_changed ();
 
        void setup_language_sensitivity ();
 
@@ -83,6 +85,8 @@ private:
        wxTextCtrl* _tms_user;
        wxTextCtrl* _tms_password;
        wxSpinCtrl* _num_local_encoding_threads;
+       wxTextCtrl* _mail_server;
+       wxTextCtrl* _kdm_from;
        wxSpinCtrl* _default_still_length;
 #ifdef DCPOMATIC_USE_OWN_DIR_PICKER
        DirPickerCtrl* _default_directory;