Bug with duplicate "Activate Telldus Live!" menu options on TC server reconnect fixed.

This commit is contained in:
Stefan Persson 2010-12-14 13:07:39 +00:00
parent 75ece58416
commit 0b4fd7477e

View file

@ -3,6 +3,7 @@ __setupPackage__( __extension__ );
com.telldus.live = function() {
var socket = null;
var menuId = 0;
var separatorId = 0;
var isRegistered = false;
var supportedMethods = 0;
@ -18,11 +19,10 @@ com.telldus.live = function() {
function notRegistered() {
isRegistered = false;
if (com.telldus.systray) {
com.telldus.systray.addSeparator();
if (com.telldus.systray && !menuId) {
separatorId = com.telldus.systray.addSeparator();
menuId = com.telldus.systray.addMenuItem("Activate Telldus Live!");
com.telldus.systray.menuItem(menuId).triggered.connect(socket.activate);
com.telldus.systray.addSeparator();
}
}
@ -53,7 +53,9 @@ com.telldus.live = function() {
function registered(msg) {
if (menuId > 0) {
com.telldus.systray.removeMenuItem(menuId);
com.telldus.systray.removeMenuItem(separatorId);
menuId = 0;
separatorId = 0;
}
supportedMethods = msg.getInt('supportedMethods');
isRegistered = true;