diff --git a/src/ippmsg.cpp b/src/ippmsg.cpp index e2181c6..cc8d67a 100644 --- a/src/ippmsg.cpp +++ b/src/ippmsg.cpp @@ -27,10 +27,9 @@ IppMsg::IppMsg(QNetworkReply* resp) quint8 majVsn; quint8 minVsn; - quint16 status; quint32 reqId; - bts >> majVsn >> minVsn >> status >> reqId; + bts >> majVsn >> minVsn >> _status >> reqId; QJsonObject* attrs = 0; diff --git a/src/ippmsg.h b/src/ippmsg.h index 2ded090..0e8b016 100644 --- a/src/ippmsg.h +++ b/src/ippmsg.h @@ -68,6 +68,8 @@ public: QJsonObject getJobAttrs() {return _jobAttrs;} QJsonObject getOpAttrs() {return _opAttrs;} + quint16 getStatus() {return _status;} + protected: private: @@ -78,6 +80,8 @@ private: QJsonObject _jobAttrs; QJsonObject _printerAttrs; + quint16 _status; + static quint32 _reqid; }; diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 3a8874e..1a679b0 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -73,7 +73,7 @@ void IppPrinter::jobRequestFinished(QNetworkReply *reply) { try { IppMsg resp(reply); - qDebug() << resp.getOpAttrs() << resp.getJobAttrs(); + qDebug() << resp.getStatus() << resp.getOpAttrs() << resp.getJobAttrs(); _jobAttrs = resp.getJobAttrs(); emit jobAttrsChanged(); } @@ -111,6 +111,15 @@ bool IppPrinter::print(QJsonObject attrs, QString filename){ {"job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}}}, }; + // Only include if printer supports it +// if (filename.endsWith("pdf")) +// { +// attrs.insert("document-format", QJsonObject {{"tag", 73}, {"value", "application/pdf"}}); +// } +// else if (filename.endsWith("jpg")) { +// attrs.insert("document-format", QJsonObject {{"tag", 73}, {"value", "image/jpeg"}}); +// } + IppMsg job = IppMsg(o, attrs); QByteArray contents = job.encode(IppMsg::PrintJob);