Merge PR #433: Fix entering things pages when there's only one in the list

This commit is contained in:
Jenkins nymea 2020-09-21 23:34:37 +02:00
commit f08d712437
11 changed files with 19 additions and 25 deletions

View File

@ -161,7 +161,3 @@ BR=$$BRANDING
target.path = /usr/bin
INSTALLS += target
contains(ANDROID_TARGET_ARCH,) {
ANDROID_ABIS = \
armeabi-v7a
}

View File

@ -52,12 +52,21 @@ MainPageTile {
onClicked: {
var page;
// Only one item? Go streight to the thing page
if (devicesProxy.count === 1) {
page = app.interfaceListToDevicePage([iface.name]);
pageStack.push(Qt.resolvedUrl("../devicepages/" + page), {thing: devicesProxy.get(0)})
return;
}
// No (supported by app) interfaces at all? Open generic list
if (!iface) {
page = "GenericDeviceListPage.qml"
pageStack.push(Qt.resolvedUrl("../devicelistpages/" + page), {hiddenInterfaces: app.supportedInterfaces, filterTagId: root.filterTagId})
return;
}
// Open interface specific things list
switch (iface.name) {
case "heating":
case "sensor":

View File

@ -163,7 +163,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -42,24 +42,13 @@ Page {
property alias hiddenInterfaces: thingsProxyInternal.hiddenInterfaces
property alias filterTagId: thingsProxyInternal.filterTagId
Component.onCompleted: {
if (thingsProxyInternal.count === 1) {
enterPage(0, true)
}
}
property var devicesProxy: thingsProxyInternal
property var thingsProxy: thingsProxyInternal
function enterPage(index, replace) {
function enterPage(index) {
var thing = thingsProxy.get(index);
var page = app.interfaceListToDevicePage(root.shownInterfaces);
// var page = "GenericDevicePage.qml";
if (replace) {
pageStack.replace(Qt.resolvedUrl("../devicepages/" + page), {thing: thingsProxy.get(index)})
} else {
pageStack.push(Qt.resolvedUrl("../devicepages/" + page), {thing: thingsProxy.get(index)})
}
pageStack.push(Qt.resolvedUrl("../devicepages/" + page), {thing: thingsProxy.get(index)})
}
DevicesProxy {

View File

@ -97,7 +97,7 @@ DeviceListPageBase {
Binding { target: contentLoader.item; property: "device"; value: itemDelegate.device }
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -61,7 +61,7 @@ DeviceListPageBase {
width: parent.width
device: engine.deviceManager.devices.getDevice(model.id);
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -188,7 +188,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -222,7 +222,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -120,7 +120,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -185,7 +185,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}

View File

@ -155,7 +155,7 @@ DeviceListPageBase {
}
}
onClicked: {
enterPage(index, false)
enterPage(index)
}
}
}