Automatically connect local machine when switch to device tab

This commit is contained in:
Noisyfox 2025-01-31 14:48:39 +08:00
parent 01bc090914
commit 09ee5fbc2c

View file

@ -5934,8 +5934,13 @@ std::map<std::string ,MachineObject*> DeviceManager::get_local_machine_list()
void DeviceManager::load_last_machine()
{
if (userMachineList.empty()) return;
if (userMachineList.empty()) {
// Orca: connect LAN printers instead
const auto local_machine = std::find_if(localMachineList.begin(), localMachineList.end(), [](const std::pair<std::string, MachineObject*>& it) -> bool { return it.second->has_access_right();});
if (local_machine != localMachineList.end()) {
this->set_selected_machine(local_machine->second->dev_id);
}
}
else if (userMachineList.size() == 1) {
this->set_selected_machine(userMachineList.begin()->second->dev_id);
} else {