Now possible to activate Telldus Live! from Settings. Closes #101.

This commit is contained in:
Stefan Persson 2011-12-22 12:10:48 +01:00
parent 16a9b87fb6
commit 319e505509
2 changed files with 119 additions and 27 deletions

View file

@ -19,6 +19,7 @@ com.telldus.live = function() {
socket.connectToServer();
com.telldus.core.deviceEvent.connect(deviceEvent);
com.telldus.core.deviceChange.connect(sendDevicesReport);
configUI.findChild('registrationLink').visible = false;
}
function notRegistered() {
@ -28,6 +29,7 @@ com.telldus.live = function() {
menuId = com.telldus.systray.addMenuItem( qsTr("Activate Telldus Live!") );
com.telldus.systray.menuItem(menuId).triggered.connect(socket.activate);
}
registrationLinkVisible(true);
}
function deviceEvent(deviceId, method, data) {
@ -63,9 +65,17 @@ com.telldus.live = function() {
}
supportedMethods = msg.getInt('supportedMethods');
isRegistered = true;
registrationLinkVisible(false);
sendDevicesReport();
}
function registrationLinkVisible(visibleParam){
configUI.findChild('registrationLink').visible = visibleParam;
if(visibleParam){
configUI.findChild('registrationLink').clicked.connect(socket.activate);
}
}
function sendDevicesReport() {
if (!isRegistered) {
return;

View file

@ -7,38 +7,120 @@
<x>0</x>
<y>0</y>
<width>323</width>
<height>263</height>
<height>251</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>331</width>
<height>251</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>unknown</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="registrationLink">
<property name="text">
<string>Activate Telldus Live!</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>