Fix messages when there is no job-state-message at all

This commit is contained in:
Anton Thomasson 2020-05-01 11:21:03 +02:00
parent 93b79cf37f
commit 27cc5a38e5

View file

@ -15,8 +15,13 @@ Page {
Connections { Connections {
target: printer target: printer
onJobAttrsFinished: { onJobAttrsFinished: {
var msg = printer.jobAttrs["job-state-message"] && printer.jobAttrs["job-state-message"].value != "" var msg = ""
? printer.jobAttrs["job-state-message"].value : Utils.ippName("job-state", printer.jobAttrs["job-state"].value) if (printer.jobAttrs.hasOwnProperty("job-state-message") && printer.jobAttrs["job-state-message"].value != "") {
msg = printer.jobAttrs["job-state-message"].value
}
else if (printer.jobAttrs.hasOwnProperty("job-state")) {
msg = Utils.ippName("job-state", printer.jobAttrs["job-state"].value)
}
if(status == true) { if(status == true) {
notifier.notify(qsTr("Print success: ") + msg) notifier.notify(qsTr("Print success: ") + msg)
pageStack.pop() //or replace? pageStack.pop() //or replace?