From e0b10c83a11d2cb43f2c735fe9b9834aaf9ac19a Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 4 Apr 2020 13:56:36 +0200 Subject: [PATCH] make print() a slot --- qml/pages/PrinterPage.qml | 2 +- src/ippprinter.cpp | 10 ++++++---- src/ippprinter.h | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index bff96b6..e65d138 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -14,7 +14,7 @@ Page { Connections { target: printer - onJobAttrsFinished: { + onJobFinished: { 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) if(status == true) { diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 2c49dc0..6d0e3c2 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -134,7 +134,7 @@ void IppPrinter::printRequestFinished(QNetworkReply *reply) _jobAttrs.insert("job-state-message", QJsonObject {{"tag", IppMsg::TextWithoutLanguage}, {"value", "Network error"}}); } emit jobAttrsChanged(); - emit jobAttrsFinished(status); + emit jobFinished(status); } void IppPrinter::getJobsRequestFinished(QNetworkReply *reply) @@ -198,13 +198,16 @@ void IppPrinter::ignoreKnownSslErrors(QNetworkReply *reply, const QListpost(request, contents); file.close(); - return true; } bool IppPrinter::getJobs() { diff --git a/src/ippprinter.h b/src/ippprinter.h index e82a7ad..5464bc4 100644 --- a/src/ippprinter.h +++ b/src/ippprinter.h @@ -24,7 +24,6 @@ public: Q_INVOKABLE void refresh(); - Q_INVOKABLE bool print(QJsonObject attrs, QString file); Q_INVOKABLE bool getJobs(); Q_INVOKABLE bool cancelJob(qint32 jobId); @@ -34,10 +33,13 @@ signals: void jobAttrsChanged(); void jobsChanged(); - void jobAttrsFinished(bool status); + void jobFinished(bool status); void cancelStatus(bool status); public slots: + void print(QJsonObject attrs, QString file); + + void onUrlChanged(); void getPrinterAttributesFinished(QNetworkReply* reply); void printRequestFinished(QNetworkReply* reply);