harbour-seaprint/qml/pages/utils.js

31 lines
585 B
JavaScript
Raw Normal View History

2019-12-01 22:27:00 +03:00
function supported_formats(printer)
{
var formats = printer.attrs["document-format-supported"].value;
var supported = [];
if(has(formats, "application/pdf"))
{
supported.push("PDF");
}
if(has(formats, "image/jpeg"))
{
supported.push("JPEG");
}
2019-12-08 15:55:56 +03:00
if(supported.length == 0)
{
supported.push("No relevant formats supported")
}
2020-01-03 14:45:51 +03:00
return supported.join(" ");
2019-12-01 22:27:00 +03:00
}
function has(arrayish, what)
{
for(var i in arrayish)
{
if(arrayish[i] == what)
return true
}
return false
}