From e4e1102f69e0cd910d715e3321f29d93e5558637 Mon Sep 17 00:00:00 2001 From: Thomas Michel Date: Mon, 27 Jul 2015 21:38:59 +0200 Subject: [PATCH] Disabled Modification of "Not Set" Items --- qml/pages/CosttypeView.qml | 2 ++ qml/pages/FueltypeView.qml | 2 ++ qml/pages/StationView.qml | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/qml/pages/CosttypeView.qml b/qml/pages/CosttypeView.qml index cd6ca0f..8047e1d 100644 --- a/qml/pages/CosttypeView.qml +++ b/qml/pages/CosttypeView.qml @@ -49,11 +49,13 @@ Page { menu: ContextMenu { MenuItem { + enabled: model.modelData.id > 0 ? true:false text: qsTr("Modify") onClicked: pageStack.push(Qt.resolvedUrl("CosttypeEntry.qml"), { costtype: model.modelData }) } MenuItem { + enabled: model.modelData.id > 0 ? true:false text: qsTr("Remove") onClicked: { remorseAction(qsTr("Deleting"), function() { diff --git a/qml/pages/FueltypeView.qml b/qml/pages/FueltypeView.qml index a13344b..2f76345 100644 --- a/qml/pages/FueltypeView.qml +++ b/qml/pages/FueltypeView.qml @@ -49,11 +49,13 @@ Page { menu: ContextMenu { MenuItem { + enabled: model.modelData.id > 0 ? true:false text: qsTr("Modify") onClicked: pageStack.push(Qt.resolvedUrl("FueltypeEntry.qml"), { fueltype: model.modelData }) } MenuItem { + enabled: model.modelData.id > 0 ? true:false text: qsTr("Remove") onClicked: { remorseAction(qsTr("Deleting"), function() { diff --git a/qml/pages/StationView.qml b/qml/pages/StationView.qml index a7fdc2b..9d1a621 100644 --- a/qml/pages/StationView.qml +++ b/qml/pages/StationView.qml @@ -48,12 +48,14 @@ Page { showMenuOnPressAndHold: true menu: ContextMenu { - MenuItem { - text: qsTr("Modify") - onClicked: pageStack.push(Qt.resolvedUrl("StationEntry.qml"), { station: model.modelData }) + MenuItem { + enabled: model.modelData.id > 0 ? true:false + text: qsTr("Modify") + onClicked: pageStack.push(Qt.resolvedUrl("StationEntry.qml"), { station: model.modelData }) } MenuItem { + enabled: model.modelData.id > 0 ? true:false text: qsTr("Remove") onClicked: { remorseAction(qsTr("Deleting"), function() {