Physical printers: Implemented import/export to/from the ConfigBundle.

+ fixed a bug : Case sensitivity of printer's name wasn't check during the adding of a new printer,
as a result in printers list was appeared both of printers (ex. "YuSanka" and "yusanka"), but related file was just one.
This commit is contained in:
YuSanka 2020-10-01 22:48:00 +02:00
parent 94a9820661
commit 2bba0e3131
7 changed files with 140 additions and 27 deletions

View file

@ -468,15 +468,17 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event)
}
PhysicalPrinterCollection& printers = wxGetApp().preset_bundle->physical_printers;
const PhysicalPrinter* existing = printers.find_printer(into_u8(printer_name));
const PhysicalPrinter* existing = printers.find_printer(into_u8(printer_name), false);
if (existing && into_u8(printer_name) != printers.get_selected_printer_name())
{
wxString msg_text = from_u8((boost::format(_u8L("Printer with name \"%1%\" already exists.")) % printer_name).str());
wxString msg_text = from_u8((boost::format(_u8L("Printer with name \"%1%\" already exists.")) % existing->name/*printer_name*/).str());
msg_text += "\n" + _L("Replace?");
wxMessageDialog dialog(nullptr, msg_text, _L("Warning"), wxICON_WARNING | wxYES | wxNO);
if (dialog.ShowModal() == wxID_NO)
return;
m_printer.name = existing->name;
}
std::set<std::string> repeat_presets;