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))
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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}});
|
||||
|
|
|
@ -35,6 +35,7 @@ signals:
|
|||
void jobsChanged();
|
||||
|
||||
void jobAttrsFinished(bool status);
|
||||
void cancelStatus(bool status);
|
||||
|
||||
public slots:
|
||||
void onUrlChanged();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue