Notify on failing to cancel job

This commit is contained in:
Anton Thomasson 2020-02-23 13:11:28 +01:00
parent 3f3624559b
commit 5c67f44d78
8 changed files with 34 additions and 1 deletions

View file

@ -13,6 +13,15 @@ Page {
console.log(JSON.stringify(printer.jobs))
}
Connections {
target: printer
onCancelStatus: {
if(status != true) {
notifier.notify(qsTr("Cancelling job failed"))
}
}
}
// To enable PullDownMenu, place our content in a SilicaFlickable
SilicaFlickable {
anchors.fill: parent

View file

@ -157,17 +157,20 @@ void IppPrinter::getJobsRequestFinished(QNetworkReply *reply)
void IppPrinter::cancelJobFinished(QNetworkReply *reply)
{
bool status = false;
if(reply->error() == QNetworkReply::NoError)
{
try {
IppMsg resp(reply);
qDebug() << resp.getStatus() << resp.getOpAttrs() << resp.getJobAttrs();
status = resp.getStatus() <= 0xff;
}
catch(std::exception e)
{
qDebug() << e.what();
}
}
emit cancelStatus(status);
getJobs();
}
@ -259,7 +262,7 @@ bool IppPrinter::getJobs() {
bool IppPrinter::cancelJob(qint32 jobId) {
qDebug() << "getting jobs";
qDebug() << "cancelling jobs";
QJsonObject o = opAttrs();
o.insert("job-id", QJsonObject {{"tag", IppMsg::Integer}, {"value", jobId}});

View file

@ -35,6 +35,7 @@ signals:
void jobsChanged();
void jobAttrsFinished(bool status);
void cancelStatus(bool status);
public slots:
void onUrlChanged();

View file

@ -171,6 +171,10 @@
<source>job</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancelling job failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>

View file

@ -171,6 +171,10 @@
<source>job</source>
<translation>trabajo</translation>
</message>
<message>
<source>Cancelling job failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>

View file

@ -171,6 +171,10 @@
<source>job</source>
<translation>tâche</translation>
</message>
<message>
<source>Cancelling job failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>

View file

@ -171,6 +171,10 @@
<source>Cancelling job</source>
<translation></translation>
</message>
<message>
<source>Cancelling job failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>

View file

@ -171,6 +171,10 @@
<source>job</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancelling job failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PrinterPage</name>