Actually consider PDF support in printer-info

This commit is contained in:
Anton Thomasson 2020-02-16 14:15:48 +01:00
parent 86bfedf01a
commit 3a5b5cdf59
9 changed files with 32 additions and 30 deletions

View file

@ -210,6 +210,13 @@ Page {
Row { Row {
spacing: Theme.paddingMedium spacing: Theme.paddingMedium
Label {
id: format_unsupported_label
visible: format_label.text == "" && maybe_format_label.text == ""
color: "red"
font.pixelSize: Theme.fontSizeExtraSmall
text: qsTr("No compatible formats supported")
}
Label { Label {
id: format_label id: format_label
color: canPrint ? Theme.primaryColor : "red" color: canPrint ? Theme.primaryColor : "red"

View file

@ -14,20 +14,15 @@ function supported_formats(printer)
supported.push("JPEG"); supported.push("JPEG");
} }
if(supported.length == 0)
{
supported.push(qsTr("No compatible formats supported"))
}
//var info = "MFG:Hewlett-Packard;CMD:PJL,BIDI-ECP,PJL,POSTSCRIPT,PDF,PCLXL,PCL;MDL:HP LaserJet P3010 Series;CLS:PRINTER;DES:Hewlett-Packard ".split(";"); //var info = "MFG:Hewlett-Packard;CMD:PJL,BIDI-ECP,PJL,POSTSCRIPT,PDF,PCLXL,PCL;MDL:HP LaserJet P3010 Series;CLS:PRINTER;DES:Hewlett-Packard ".split(";");
var maybe = [] var maybe = []
var info = printer.attrs["printer-info"].value.split(";"); var info = printer.attrs["printer-info"] ? printer.attrs["printer-info"].value.split(";") : [];
for(var i in info) for(var i in info)
{ {
if(info[i].split(":")[0] == "CMD") if(info[i].split(":")[0] == "CMD")
{ {
if(has(info[i].split(":")[1].split(","), "PDF")) if(!has(supported, "PDF") && has(info[i].split(":")[1].split(","), "PDF"))
{ {
mimetypes.push("application/pdf"); mimetypes.push("application/pdf");
maybe.push("PDF"); maybe.push("PDF");

View file

@ -9,7 +9,7 @@ Name: harbour-seaprint
# << macros # << macros
Summary: SeaPrint Summary: SeaPrint
Version: 0.4.1 Version: 0.4.2
Release: 1 Release: 1
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE

View file

@ -1,6 +1,6 @@
Name: harbour-seaprint Name: harbour-seaprint
Summary: SeaPrint Summary: SeaPrint
Version: 0.4.1 Version: 0.4.2
Release: 1 Release: 1
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS

View file

@ -140,6 +140,10 @@
<source>Unknown</source> <source>Unknown</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>
@ -281,9 +285,5 @@
<source>dots/cm</source> <source>dots/cm</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -140,6 +140,10 @@
<source>Unknown</source> <source>Unknown</source>
<translation>Desconocido</translation> <translation>Desconocido</translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished">No hay formatos compatibles</translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>
@ -281,9 +285,5 @@
<source>dots/cm</source> <source>dots/cm</source>
<translation>ppp</translation> <translation>ppp</translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation>No hay formatos compatibles</translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -140,6 +140,10 @@
<source>Unknown</source> <source>Unknown</source>
<translation>Inconnu</translation> <translation>Inconnu</translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished">Aucun format compatible supporté</translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>
@ -281,9 +285,5 @@
<source>dots/cm</source> <source>dots/cm</source>
<translation>pts/cm</translation> <translation>pts/cm</translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation>Aucun format compatible supporté</translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -140,6 +140,10 @@
<source>Unknown</source> <source>Unknown</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>
@ -281,9 +285,5 @@
<source>dots/cm</source> <source>dots/cm</source>
<translation>/</translation> <translation>/</translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -140,6 +140,10 @@
<source>Unknown</source> <source>Unknown</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>
@ -281,9 +285,5 @@
<source>dots/cm</source> <source>dots/cm</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>No compatible formats supported</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>