From 27cc5a38e575fff42c03c74828d6ebf22c277ab6 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Fri, 1 May 2020 11:21:03 +0200 Subject: [PATCH] Fix messages when there is no job-state-message at all --- qml/pages/PrinterPage.qml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index a89ad2d..2ea9a46 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -15,8 +15,13 @@ Page { Connections { target: printer onJobAttrsFinished: { - var msg = printer.jobAttrs["job-state-message"] && printer.jobAttrs["job-state-message"].value != "" - ? printer.jobAttrs["job-state-message"].value : Utils.ippName("job-state", printer.jobAttrs["job-state"].value) + var msg = "" + 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) { notifier.notify(qsTr("Print success: ") + msg) pageStack.pop() //or replace?