Rework choiceMade
This commit is contained in:
parent
0371b4ca94
commit
0f890337d3
1 changed files with 15 additions and 16 deletions
|
@ -15,7 +15,6 @@ Page {
|
||||||
property string selectedFile
|
property string selectedFile
|
||||||
property string selectedFileType: Mimer.get_type(selectedFile)
|
property string selectedFileType: Mimer.get_type(selectedFile)
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: wifi
|
target: wifi
|
||||||
onConnectedChanged: {
|
onConnectedChanged: {
|
||||||
|
@ -25,15 +24,15 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function choiceMade(name, tag, choice)
|
function choiceMade(setting)
|
||||||
{
|
{
|
||||||
if(choice != undefined)
|
if(setting.choice != undefined)
|
||||||
{
|
{
|
||||||
jobParams[name] = {tag: tag, value: choice};
|
jobParams[setting.name] = {tag: setting.tag, value: setting.choice};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jobParams[name] = undefined
|
jobParams[setting.name] = undefined;
|
||||||
}
|
}
|
||||||
console.log(JSON.stringify(jobParams));
|
console.log(JSON.stringify(jobParams));
|
||||||
}
|
}
|
||||||
|
@ -93,7 +92,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Keyword
|
tag: IppMsg.Keyword
|
||||||
|
@ -104,7 +103,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
IntegerSetting {
|
IntegerSetting {
|
||||||
tag: IppMsg.Integer
|
tag: IppMsg.Integer
|
||||||
|
@ -115,7 +114,7 @@ Page {
|
||||||
high: valid ? printer.attrs[name+"-supported"].value.high : 0
|
high: valid ? printer.attrs[name+"-supported"].value.high : 0
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Keyword
|
tag: IppMsg.Keyword
|
||||||
|
@ -126,7 +125,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
RangeSetting {
|
RangeSetting {
|
||||||
tag: IppMsg.IntegerRange
|
tag: IppMsg.IntegerRange
|
||||||
|
@ -138,7 +137,7 @@ Page {
|
||||||
property var pdfpages: ConvertChecker.pdfPages(selectedFile)
|
property var pdfpages: ConvertChecker.pdfPages(selectedFile)
|
||||||
high: name=="page-ranges" ? (pdfpages == 0 ? 65535 : pdfpages) : 0
|
high: name=="page-ranges" ? (pdfpages == 0 ? 65535 : pdfpages) : 0
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Keyword
|
tag: IppMsg.Keyword
|
||||||
|
@ -149,7 +148,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Enum
|
tag: IppMsg.Enum
|
||||||
|
@ -160,7 +159,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Resolution
|
tag: IppMsg.Resolution
|
||||||
|
@ -171,7 +170,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.MimeMediaType
|
tag: IppMsg.MimeMediaType
|
||||||
|
@ -182,7 +181,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
ChoiceSetting {
|
ChoiceSetting {
|
||||||
tag: IppMsg.Keyword
|
tag: IppMsg.Keyword
|
||||||
|
@ -193,7 +192,7 @@ Page {
|
||||||
default_choice: utils.getDefaultChoice(name)
|
default_choice: utils.getDefaultChoice(name)
|
||||||
mime_type: selectedFileType
|
mime_type: selectedFileType
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
MediaColSetting {
|
MediaColSetting {
|
||||||
tag: IppMsg.BeginCollection
|
tag: IppMsg.BeginCollection
|
||||||
|
@ -202,7 +201,7 @@ Page {
|
||||||
valid: false
|
valid: false
|
||||||
printer: page.printer
|
printer: page.printer
|
||||||
|
|
||||||
onChoiceChanged: page.choiceMade(name, tag, choice)
|
onChoiceChanged: page.choiceMade(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue