Sensor view now starts up in view mode if no sensors are set to be visible. Closes #168

This commit is contained in:
Stefan Persson 2012-01-25 17:01:44 +01:00
parent 430871bebf
commit e69f7abba8
2 changed files with 9 additions and 1 deletions

View file

@ -36,6 +36,14 @@ com.telldus.sensors = function() {
});
view.setProperty('sensorModel', sensorList);
var initialViewMode = 'EDIT';
for (var i=0; i < sensorList.length; ++i) {
if (sensorList.get(i).showInList || sensorList.get(i).name !== "") {
initialViewMode = 'VIEW';
break;
}
}
view.setProperty('initialViewMode', initialViewMode);
saveSensorModel();
view.load("main.qml");
application.addWidget("sensors.gui", "icon.png", view);

View file

@ -3,7 +3,7 @@ import QtDesktop 0.1
Item {
id: main
state: "VIEW"
state: initialViewMode
ScrollArea {
id: scrollArea