diff --git a/telldus-gui/Plugins/Live/__init__.js b/telldus-gui/Plugins/Live/__init__.js index 0ebaec0c..f65e4ebf 100644 --- a/telldus-gui/Plugins/Live/__init__.js +++ b/telldus-gui/Plugins/Live/__init__.js @@ -97,6 +97,9 @@ com.telldus.live = function() { function registrationLinkVisible(visibleParam){ configUI.findChild('registrationLink').visible = visibleParam; + if (com.telldus.sensors) { + com.telldus.sensors.showLiveOptions(!visibleParam); + } } function sendDevicesReport() { diff --git a/telldus-gui/Plugins/Sensors/SensorList.qml b/telldus-gui/Plugins/Sensors/SensorList.qml index c6317e6c..32979119 100644 --- a/telldus-gui/Plugins/Sensors/SensorList.qml +++ b/telldus-gui/Plugins/Sensors/SensorList.qml @@ -51,8 +51,8 @@ Column { text: qsTr("Send to Telldus Live!") anchors.right: sensorinformationTitle.left horizontalAlignment: Text.AlignHCenter - visible: main.state == "EDIT" - width: 150 + visible: main.state == "EDIT" && showLiveOptions + width: showLiveOptions ? 150 : 0 } HeaderTitle { id: sensorinformationTitle @@ -70,7 +70,9 @@ Column { } Repeater { model: sensorModel - delegate: SensorView{ state: main.state == "EDIT" ? 'EDIT' : ''} + delegate: SensorView { + state: main.state == "EDIT" ? 'EDIT' : '' + } } Row{ spacing: 20 diff --git a/telldus-gui/Plugins/Sensors/SensorView.qml b/telldus-gui/Plugins/Sensors/SensorView.qml index 407040d2..85f8c3a9 100644 --- a/telldus-gui/Plugins/Sensors/SensorView.qml +++ b/telldus-gui/Plugins/Sensors/SensorView.qml @@ -96,13 +96,13 @@ Item{ Item { id: sendtolivecheckbox height: 40 - width: 150 + width: showLiveOptions ? 150 : 0 anchors.right: sensorInfo.left CheckBox { id: checkBoxSTL anchors.centerIn: parent width: checkBoxSTL.height - visible: sensorViewItem.state == "EDIT" + visible: sensorViewItem.state == "EDIT" && showLiveOptions checked: modelData.sendToLive onClicked: modelData.setSendToLive(!modelData.sendToLive) } diff --git a/telldus-gui/Plugins/Sensors/__init__.js b/telldus-gui/Plugins/Sensors/__init__.js index 4270068e..5fa90e20 100644 --- a/telldus-gui/Plugins/Sensors/__init__.js +++ b/telldus-gui/Plugins/Sensors/__init__.js @@ -7,6 +7,7 @@ __postInit__ = function() { com.telldus.sensors = function() { var sensorList; + var view; function init() { var sensorData = 0; sensorList = loadSensorModel(); @@ -51,6 +52,7 @@ com.telldus.sensors = function() { } } view.setProperty('initialViewMode', initialViewMode); + view.setProperty('showLiveOptions', (!com.telldus.live || !com.telldus.live.isRegisteredToLive())); saveSensorModel(); view.load("main.qml"); application.addWidget("sensors.gui", "icon.png", view); @@ -224,9 +226,14 @@ com.telldus.sensors = function() { settings.setValue("sensors", sensorProperties); } + function showLiveOptions(status){ + if(view){ + view.setProperty('showLiveOptions', status); + } + } + function sendSensorReport(){ - //TODO Only show "sendToLive" if Telldus Live! is activated - if(!com.telldus.live.isRegisteredToLive()){ + if(!com.telldus.live || !com.telldus.live.isRegisteredToLive()){ return; } @@ -268,7 +275,7 @@ com.telldus.sensors = function() { } sensor.setValue(dataType, value, timestamp); - if (sensor.sendToLive){ + if (com.telldus.live && com.telldus.live.isRegisteredToLive() && sensor.sendToLive){ sensorValues = pickSensorValues(sensor) if (allValuesUpdated(sensorValues)) { com.telldus.live.sendSensorValues(sensor, sensorValues); @@ -281,7 +288,8 @@ com.telldus.sensors = function() { } return { //Public functions - init:init + init:init, + showLiveOptions: showLiveOptions } }();