Add warning/hint about suffixes
This commit is contained in:
parent
5dcd6cf54f
commit
2f1e1bf7a5
10 changed files with 217 additions and 21 deletions
|
@ -82,14 +82,16 @@ Dialog {
|
||||||
text: printerName ? printerName : ""
|
text: printerName ? printerName : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 1
|
||||||
|
height: 2*Theme.paddingLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
visible: valueField.text.indexOf(":9100") != -1
|
visible: valueField.text.indexOf(":9100") != -1
|
||||||
|
x: Theme.paddingLarge
|
||||||
|
|
||||||
anchors.top: col.bottom
|
|
||||||
anchors.topMargin: Theme.paddingLarge*2
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
width: parent.width-2*Theme.paddingLarge
|
width: parent.width-2*Theme.paddingLarge
|
||||||
spacing: Theme.paddingMedium
|
spacing: Theme.paddingMedium
|
||||||
|
|
||||||
|
@ -108,6 +110,56 @@ Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: suffixWarning
|
||||||
|
visible: canAccept && !printer.correctSuffix
|
||||||
|
x: Theme.paddingLarge
|
||||||
|
|
||||||
|
width: parent.width-2*Theme.paddingLarge
|
||||||
|
spacing: Theme.paddingMedium
|
||||||
|
|
||||||
|
Icon {
|
||||||
|
id: warningIcon2
|
||||||
|
source: "image://theme/icon-m-warning"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
width: parent.width-warningIcon2.width-Theme.paddingMedium
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
color: Theme.highlightColor
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("The uri suffix is not in the printer's supported list.")+" "+
|
||||||
|
qsTr("It might not accept print jobs on this address.")+" "+
|
||||||
|
qsTr("Consider using a suffix like \"/ipp/print\".")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: 1
|
||||||
|
height: 2*Theme.paddingLarge
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
x: Theme.paddingLarge
|
||||||
|
visible: suffixWarning.visible && printer.suffixes.length != 0
|
||||||
|
text: qsTr("The printer/server lists these suffixes:")
|
||||||
|
}
|
||||||
|
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: suffixWarning.visible ? printer.suffixes : 0
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
x: Theme.paddingLarge
|
||||||
|
text: printer.suffixes[index]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
onDone: {
|
onDone: {
|
||||||
if (result == DialogResult.Accepted) {
|
if (result == DialogResult.Accepted) {
|
||||||
value = valueField.text
|
value = valueField.text
|
||||||
|
|
|
@ -722,6 +722,34 @@ bool IppPrinter::isIpps()
|
||||||
return _url.scheme() == "ipps";
|
return _url.scheme() == "ipps";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IppPrinter::correctSuffix()
|
||||||
|
{
|
||||||
|
foreach(QJsonValue u, _attrs["printer-uri-supported"].toObject()["value"].toArray())
|
||||||
|
{
|
||||||
|
QUrl url(u.toString());
|
||||||
|
if(url.path() == _url.path())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList IppPrinter::suffixes()
|
||||||
|
{
|
||||||
|
QStringList res;
|
||||||
|
foreach(QJsonValue u, _attrs["printer-uri-supported"].toObject()["value"].toArray())
|
||||||
|
{
|
||||||
|
QUrl url(u.toString());
|
||||||
|
if(!res.contains(url.path()))
|
||||||
|
{
|
||||||
|
res.append(url.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.sort();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
QUrl IppPrinter::httpUrl() {
|
QUrl IppPrinter::httpUrl() {
|
||||||
qDebug() << _url;
|
qDebug() << _url;
|
||||||
QUrl url = _url;
|
QUrl url = _url;
|
||||||
|
|
|
@ -19,7 +19,9 @@ class IppPrinter : public QObject
|
||||||
Q_PROPERTY(QString progress MEMBER _progress NOTIFY progressChanged)
|
Q_PROPERTY(QString progress MEMBER _progress NOTIFY progressChanged)
|
||||||
|
|
||||||
Q_PROPERTY(bool tainted MEMBER _tainted NOTIFY taintedChanged)
|
Q_PROPERTY(bool tainted MEMBER _tainted NOTIFY taintedChanged)
|
||||||
Q_PROPERTY(bool isIpps READ isIpps() NOTIFY urlChanged)
|
Q_PROPERTY(bool isIpps READ isIpps NOTIFY urlChanged)
|
||||||
|
Q_PROPERTY(bool correctSuffix READ correctSuffix NOTIFY attrsChanged)
|
||||||
|
Q_PROPERTY(QStringList suffixes READ suffixes NOTIFY attrsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IppPrinter();
|
IppPrinter();
|
||||||
|
@ -35,6 +37,8 @@ public:
|
||||||
Q_INVOKABLE bool cancelJob(qint32 jobId);
|
Q_INVOKABLE bool cancelJob(qint32 jobId);
|
||||||
|
|
||||||
bool isIpps();
|
bool isIpps();
|
||||||
|
bool correctSuffix();
|
||||||
|
QStringList suffixes();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void urlChanged();
|
void urlChanged();
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation>端口9100未用于IPP。</translation>
|
<translation>端口9100未用于IPP。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
<source>Port 9100 is not used for IPP.</source>
|
<source>Port 9100 is not used for IPP.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The uri suffix is not in the printer's supported list.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It might not accept print jobs on this address.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Consider using a suffix like "/ipp/print".</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>The printer/server lists these suffixes:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>BusyPage</name>
|
<name>BusyPage</name>
|
||||||
|
|
Loading…
Reference in a new issue