mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-26 18:40:40 +00:00
fix discovery printer missing in UI
Signed-off-by: liuwenfeng <bluecodeman@outlook.com>
This commit is contained in:
parent
041da5b95d
commit
6ce43742b0
@ -3156,22 +3156,22 @@ bool PrintServiceAbility::AddVendorPrinterToDiscovery(const std::string &globalV
|
||||
printerInfo->SetPrinterName(cupsPrinter.name);
|
||||
}
|
||||
printerInfo->SetPrinterId(globalPrinterId);
|
||||
printerInfo->SetPrinterState(PRINTER_ADDED);
|
||||
printSystemData_.AddPrinterToDiscovery(printerInfo);
|
||||
}
|
||||
printerInfo->SetPrinterState(PRINTER_ADDED);
|
||||
SendPrinterDiscoverEvent(PRINTER_ADDED, *printerInfo);
|
||||
SendPrinterEvent(*printerInfo);
|
||||
if (printSystemData_.IsPrinterAdded(printerInfo->GetPrinterId()) &&
|
||||
!printSystemData_.CheckPrinterBusy(printerInfo->GetPrinterId())) {
|
||||
if (CheckPrinterUriDifferent(printerInfo)) {
|
||||
PRINT_HILOGW("different printer uri, ignore it");
|
||||
} else {
|
||||
PRINT_HILOGI("added printer, update status to idle");
|
||||
printerInfo->SetPrinterStatus(PRINTER_STATUS_IDLE);
|
||||
printSystemData_.UpdatePrinterStatus(printerInfo->GetPrinterId(), PRINTER_STATUS_IDLE);
|
||||
SendPrinterEventChangeEvent(PRINTER_EVENT_STATE_CHANGED, *printerInfo);
|
||||
SendPrinterChangeEvent(PRINTER_EVENT_STATE_CHANGED, *printerInfo);
|
||||
if (CheckPrinterUriDifferent(printerInfo) &&
|
||||
UpdateAddedPrinterInCups(printerInfo->GetPrinterId(), printerInfo->GetUri())) {
|
||||
printSystemData_.UpdatePrinterUri(printerInfo);
|
||||
printSystemData_.SaveCupsPrinterMap();
|
||||
}
|
||||
printerInfo->SetPrinterStatus(PRINTER_STATUS_IDLE);
|
||||
printSystemData_.UpdatePrinterStatus(printerInfo->GetPrinterId(), PRINTER_STATUS_IDLE);
|
||||
SendPrinterEventChangeEvent(PRINTER_EVENT_STATE_CHANGED, *printerInfo);
|
||||
SendPrinterChangeEvent(PRINTER_EVENT_STATE_CHANGED, *printerInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user