Merge PR #433: Fix entering things pages when there's only one in the list
This commit is contained in:
commit
f08d712437
@ -161,7 +161,3 @@ BR=$$BRANDING
|
||||
target.path = /usr/bin
|
||||
INSTALLS += target
|
||||
|
||||
contains(ANDROID_TARGET_ARCH,) {
|
||||
ANDROID_ABIS = \
|
||||
armeabi-v7a
|
||||
}
|
||||
|
||||
@ -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":
|
||||
|
||||
@ -163,7 +163,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -97,7 +97,7 @@ DeviceListPageBase {
|
||||
Binding { target: contentLoader.item; property: "device"; value: itemDelegate.device }
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ DeviceListPageBase {
|
||||
width: parent.width
|
||||
device: engine.deviceManager.devices.getDevice(model.id);
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ DeviceListPageBase {
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
enterPage(index, false)
|
||||
enterPage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user