diff --git a/qml/components/ChoiceSetting.qml b/qml/components/ChoiceSetting.qml index 3178c86..361e40d 100644 --- a/qml/components/ChoiceSetting.qml +++ b/qml/components/ChoiceSetting.qml @@ -15,6 +15,7 @@ Setting { property var menu: ContextMenu { id: menu + enabled: valid Repeater { model: choices MenuItem { diff --git a/qml/components/IntegerSetting.qml b/qml/components/IntegerSetting.qml index ad06862..5b09a00 100644 --- a/qml/components/IntegerSetting.qml +++ b/qml/components/IntegerSetting.qml @@ -16,6 +16,7 @@ Setting { property var menu: ContextMenu { id: menu + enabled: valid MenuItem { Slider { diff --git a/qml/components/RangeSetting.qml b/qml/components/RangeSetting.qml index 02f232c..f3ee289 100644 --- a/qml/components/RangeSetting.qml +++ b/qml/components/RangeSetting.qml @@ -20,6 +20,7 @@ Setting { property var menu: ContextMenu { id: menu + enabled: valid MenuItem { } diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index c3111f7..94d29d3 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -82,13 +82,14 @@ Page { } Component.onCompleted: { - console.log("handling", tag, name, prettyName, JSON.stringify(printer.attrs[name+"-supported"]), JSON.stringify(printer.attrs[name+"-default"])) + console.log("handling", tag, name, prettyName, JSON.stringify(printer.attrs), JSON.stringify(printer.attrs[name+"-supported"]), JSON.stringify(printer.attrs[name+"-default"])) switch(tag) { case 0x21: loader.setSource("../components/IntegerSetting.qml", {name: name, prettyName: prettyName, tag: tag, + valid: printer.attrs.hasOwnProperty(name+"-supported"), low: printer.attrs[name+"-supported"].value.low, high: printer.attrs[name+"-supported"].value.high, default_choice: printer.attrs[name+"-default"].value @@ -98,8 +99,8 @@ Page { loader.setSource("../components/RangeSetting.qml", {name: name, prettyName: prettyName, - valid: false, //TODO - tag: 0x33 // integer-range + tag: tag, + valid: false //TODO printer.attrs.hasOwnProperty(name+"-supported"), }) break case 0x32: @@ -108,6 +109,7 @@ Page { {name: name, prettyName: prettyName, tag: tag, + valid: printer.attrs.hasOwnProperty(name+"-supported"), choices: printer.attrs[name+"-supported"].value, default_choice: printer.attrs[name+"-default"].value })