Notify on failing to cancel job
This commit is contained in:
parent
3f3624559b
commit
5c67f44d78
8 changed files with 34 additions and 1 deletions
|
@ -13,6 +13,15 @@ Page {
|
||||||
console.log(JSON.stringify(printer.jobs))
|
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
|
// To enable PullDownMenu, place our content in a SilicaFlickable
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -157,17 +157,20 @@ void IppPrinter::getJobsRequestFinished(QNetworkReply *reply)
|
||||||
|
|
||||||
void IppPrinter::cancelJobFinished(QNetworkReply *reply)
|
void IppPrinter::cancelJobFinished(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
|
bool status = false;
|
||||||
if(reply->error() == QNetworkReply::NoError)
|
if(reply->error() == QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
IppMsg resp(reply);
|
IppMsg resp(reply);
|
||||||
qDebug() << resp.getStatus() << resp.getOpAttrs() << resp.getJobAttrs();
|
qDebug() << resp.getStatus() << resp.getOpAttrs() << resp.getJobAttrs();
|
||||||
|
status = resp.getStatus() <= 0xff;
|
||||||
}
|
}
|
||||||
catch(std::exception e)
|
catch(std::exception e)
|
||||||
{
|
{
|
||||||
qDebug() << e.what();
|
qDebug() << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit cancelStatus(status);
|
||||||
getJobs();
|
getJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +262,7 @@ bool IppPrinter::getJobs() {
|
||||||
|
|
||||||
bool IppPrinter::cancelJob(qint32 jobId) {
|
bool IppPrinter::cancelJob(qint32 jobId) {
|
||||||
|
|
||||||
qDebug() << "getting jobs";
|
qDebug() << "cancelling jobs";
|
||||||
|
|
||||||
QJsonObject o = opAttrs();
|
QJsonObject o = opAttrs();
|
||||||
o.insert("job-id", QJsonObject {{"tag", IppMsg::Integer}, {"value", jobId}});
|
o.insert("job-id", QJsonObject {{"tag", IppMsg::Integer}, {"value", jobId}});
|
||||||
|
|
|
@ -35,6 +35,7 @@ signals:
|
||||||
void jobsChanged();
|
void jobsChanged();
|
||||||
|
|
||||||
void jobAttrsFinished(bool status);
|
void jobAttrsFinished(bool status);
|
||||||
|
void cancelStatus(bool status);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onUrlChanged();
|
void onUrlChanged();
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
<source>job</source>
|
<source>job</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cancelling job failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrinterPage</name>
|
<name>PrinterPage</name>
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
<source>job</source>
|
<source>job</source>
|
||||||
<translation>trabajo</translation>
|
<translation>trabajo</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cancelling job failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrinterPage</name>
|
<name>PrinterPage</name>
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
<source>job</source>
|
<source>job</source>
|
||||||
<translation>tâche</translation>
|
<translation>tâche</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cancelling job failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrinterPage</name>
|
<name>PrinterPage</name>
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
<source>Cancelling job</source>
|
<source>Cancelling job</source>
|
||||||
<translation>正在取消作业</translation>
|
<translation>正在取消作业</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cancelling job failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrinterPage</name>
|
<name>PrinterPage</name>
|
||||||
|
|
|
@ -171,6 +171,10 @@
|
||||||
<source>job</source>
|
<source>job</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cancelling job failed</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>PrinterPage</name>
|
<name>PrinterPage</name>
|
||||||
|
|
Loading…
Reference in a new issue