No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / make_chain_dialog.cc
1 /*
2     Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include "make_chain_dialog.h"
22 #include <boost/algorithm/string.hpp>
23
24 using std::string;
25
26 MakeChainDialog::MakeChainDialog (
27         wxWindow* parent,
28         string organisation,
29         string organisational_unit_name,
30         string root_common_name,
31         string intermediate_common_name,
32         string leaf_common_name
33         )
34         : TableDialog (parent, _("Make certificate chain"), 2, 1, true)
35 {
36         wxTextValidator validator (wxFILTER_EXCLUDE_CHAR_LIST);
37         validator.SetCharExcludes (wxT ("/"));
38
39         if (boost::algorithm::starts_with (root_common_name, ".")) {
40                 root_common_name = root_common_name.substr (1);
41         }
42
43         if (boost::algorithm::starts_with (intermediate_common_name, ".")) {
44                 intermediate_common_name = intermediate_common_name.substr (1);
45         }
46
47         if (boost::algorithm::starts_with (leaf_common_name, "CS.")) {
48                 leaf_common_name = leaf_common_name.substr (3);
49         }
50
51         add (_("Organisation"), true);
52         add (_organisation = new wxTextCtrl (this, wxID_ANY, std_to_wx (organisation), wxDefaultPosition, wxSize (480, -1), 0, validator));
53         add (_("Organisational unit"), true);
54         add (_organisational_unit = new wxTextCtrl (this, wxID_ANY, std_to_wx (organisational_unit_name), wxDefaultPosition, wxDefaultSize, 0, validator));
55
56         add (_("Root common name"), true);
57
58         {
59                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
60                 s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL);
61                 s->Add (_root_common_name = new wxTextCtrl (
62                                 this, wxID_ANY, std_to_wx (root_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
63                         );
64                 add (s);
65         }
66
67         add (_("Intermediate common name"), true);
68
69         {
70                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
71                 s->Add (new wxStaticText (this, wxID_ANY, wxT (".")), 0, wxALIGN_CENTER_VERTICAL);
72                 s->Add (_intermediate_common_name = new wxTextCtrl (
73                                 this, wxID_ANY, std_to_wx (intermediate_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
74                         );
75                 add (s);
76         }
77
78         add (_("Leaf common name"), true);
79
80         {
81                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
82                 s->Add (new wxStaticText (this, wxID_ANY, wxT ("CS.")), 0, wxALIGN_CENTER_VERTICAL);
83                 s->Add (_leaf_common_name = new wxTextCtrl (
84                                 this, wxID_ANY, std_to_wx (leaf_common_name), wxDefaultPosition, wxDefaultSize, 0, validator), 1, wxALIGN_CENTER_VERTICAL
85                         );
86                 add (s);
87         }
88
89         layout ();
90 }