Tab: Update print host address and cafile properly, fix #1687
This commit is contained in:
parent
a99c823401
commit
f7529dbef5
@ -128,6 +128,8 @@ public:
|
||||
|
||||
virtual wxString get_tooltip_text(const wxString& default_string);
|
||||
|
||||
void field_changed() { on_change_field(); }
|
||||
|
||||
// set icon to "UndoToSystemValue" button according to an inheritance of preset
|
||||
// void set_nonsys_btn_icon(const wxBitmap& icon);
|
||||
|
||||
|
@ -1587,11 +1587,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(btn);
|
||||
|
||||
btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent e) {
|
||||
btn->Bind(wxEVT_BUTTON, [this, parent, optgroup](wxCommandEvent &e) {
|
||||
BonjourDialog dialog(parent);
|
||||
if (dialog.show_and_lookup()) {
|
||||
optgroup->set_value("print_host", std::move(dialog.get_selected()), true);
|
||||
// FIXME: emit killfocus on the edit widget
|
||||
optgroup->get_field("print_host")->field_changed();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1605,7 +1605,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(btn);
|
||||
|
||||
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) {
|
||||
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
|
||||
if (! host) {
|
||||
const auto text = wxString::Format("%s",
|
||||
@ -1646,6 +1646,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
|
||||
wxFileDialog openFileDialog(this, _(L("Open CA certificate file")), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (openFileDialog.ShowModal() != wxID_CANCEL) {
|
||||
optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true);
|
||||
optgroup->get_field("printhost_cafile")->field_changed();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user