Don't display all possible channel checkboxes while the analysis
[dcpomatic.git] / src / wx / email_dialog.cc
index 97f974a90050a17699c0bcb22d2eacacf815e6d3..854a130c6e541e185499dcfd7a6d035d4ca86817 100644 (file)
@@ -23,6 +23,7 @@
 
 using std::string;
 using boost::shared_ptr;
+using boost::optional;
 
 EmailDialog::EmailDialog (wxWindow* parent)
        : TableDialog (parent, _("Email address"), 2, 1, true)
@@ -31,6 +32,8 @@ EmailDialog::EmailDialog (wxWindow* parent)
        _email = add (new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (400, -1)));
 
        layout ();
+
+       _email->SetFocus ();
 }
 
 void
@@ -39,8 +42,14 @@ EmailDialog::set (string address)
        _email->SetValue (std_to_wx (address));
 }
 
-string
+optional<string>
 EmailDialog::get () const
 {
-       return wx_to_std (_email->GetValue ());
+       string s = wx_to_std (_email->GetValue ());
+       if (s.empty ()) {
+               /* Invalid email address */
+               return optional<string> ();
+       }
+
+       return s;
 }