Limit transfer formats when PDF tools not installed
This commit is contained in:
parent
13a66f358b
commit
ee0fc56bde
2 changed files with 18 additions and 3 deletions
|
@ -1,12 +1,13 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
import seaprint.convertchecker 1.0
|
||||||
import "../pages/utils.js" as Utils
|
import "../pages/utils.js" as Utils
|
||||||
|
|
||||||
Setting {
|
Setting {
|
||||||
property var choices
|
property var choices
|
||||||
property string mime_type
|
property string mime_type
|
||||||
|
|
||||||
property var limited_choices: Utils.limitChoices(name, choices, mime_type)
|
property var limited_choices: Utils.limitChoices(name, choices, mime_type, ConvertChecker)
|
||||||
|
|
||||||
property int num_large_choices: 8
|
property int num_large_choices: 8
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,12 @@ function canConvertPdfTo(type)
|
||||||
return has(targets, type)
|
return has(targets, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function canTransferPdfAs(type)
|
||||||
|
{
|
||||||
|
var targets = ["application/octet-stream", "application/pdf"];
|
||||||
|
return has(targets, type)
|
||||||
|
}
|
||||||
|
|
||||||
function canConvertImageTo(type)
|
function canConvertImageTo(type)
|
||||||
{
|
{
|
||||||
var targets = ["application/octet-stream", "image/jpeg", "image/png", "image/pwg-raster", "image/urf", "image/gif"];
|
var targets = ["application/octet-stream", "image/jpeg", "image/png", "image/pwg-raster", "image/urf", "image/gif"];
|
||||||
|
@ -158,13 +164,21 @@ function unitsIsDpi(resolution)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function limitChoices(name, choices, mimeType)
|
function limitChoices(name, choices, mimeType, ConvertChecker)
|
||||||
{
|
{
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case "document-format":
|
case "document-format":
|
||||||
if(mimeType == "application/pdf")
|
if(mimeType == "application/pdf")
|
||||||
{
|
{
|
||||||
return choices.filter(canConvertPdfTo)
|
if(ConvertChecker.pdf)
|
||||||
|
{
|
||||||
|
return choices.filter(canConvertPdfTo)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return choices.filter(canTransferPdfAs)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(mimeType == "image/jpeg" || mimeType == "image/png")
|
else if(mimeType == "image/jpeg" || mimeType == "image/png")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue