Quick fix attempt for issue #4076.

This patch attempts to keep the printer access code from being cleared
erroneously on a lost or failed connection.  This only applies to LAN
mode.

Notes:
  - The setting is 'access_code'.  There is also a setting named
    'user_access_code', but it's function is unclear and may be
    vestigal.
  - Some parts of the network connection behavior are handled by the
    networking plugin.  I can't seem to make the machine list refresh
    from outside.
This commit is contained in:
Billiam Crashkopf 2025-01-01 20:58:55 -08:00 committed by Lane.Wei
parent 5423c941ec
commit 8a9abc866d
1 changed files with 6 additions and 5 deletions

View File

@ -2076,11 +2076,12 @@ void GUI_App::init_networking_callbacks()
event.SetString(obj->dev_id);
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
} else if (state == ConnectStatus::ConnectStatusFailed) {
obj->set_access_code("");
obj->erase_user_access_code();
m_device_manager->localMachineList.erase(obj->dev_id);
m_device_manager->set_selected_machine("", true);
wxString text;
if (msg == "5") {
obj->set_access_code("");
obj->erase_user_access_code();
text = wxString::Format(_L("Incorrect password"));
wxGetApp().show_dialog(text);
} else {
@ -2089,9 +2090,9 @@ void GUI_App::init_networking_callbacks()
}
event.SetInt(-1);
} else if (state == ConnectStatus::ConnectStatusLost) {
obj->set_access_code("");
obj->erase_user_access_code();
m_device_manager->localMachineList.erase(obj->dev_id);
//obj->set_access_code("");
//obj->erase_user_access_code();
//m_device_manager->localMachineList.erase(obj->dev_id);
m_device_manager->set_selected_machine("", true);
event.SetInt(-1);
BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = lost";