Handle autoLogin.
This commit is contained in:
Родитель
87c95d5427
Коммит
0ac3c9082c
|
@ -35,7 +35,9 @@
|
|||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
<xul:hbox flex="1" class="account-buttons">
|
||||
<xul:checkbox label="&account.autoSignOn;"/>
|
||||
<xul:checkbox label="&account.autoSignOn;"
|
||||
xbl:inherits="checked=autologin"
|
||||
oncommand="gAccountManager.autologin()"/>
|
||||
<xul:spacer flex="1"/>
|
||||
<xul:button label="&account.connect.label;"
|
||||
accesskey="&account.connect.accesskey;"
|
||||
|
@ -65,6 +67,7 @@
|
|||
this.setAttribute("prplicon", "chrome://instantbird/skin/prpl/" +
|
||||
proto.id + "-48.png");
|
||||
this.setAttribute("state", "Connecting...");
|
||||
this.autoLogin = aAccount.autoLogin;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -97,6 +100,25 @@
|
|||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="autoLogin">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
return this.hasAttribute("autologin");
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("autologin", "true");
|
||||
else
|
||||
this.removeAttribute("autologin");
|
||||
this._account.autoLogin = val;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -5,16 +5,16 @@ var gAccountManager = {
|
|||
var pcs = Components.classes["@instantbird.org/purple/core;1"]
|
||||
.getService(Ci.purpleICoreService);
|
||||
var accounts = pcs.getAccounts();
|
||||
var accountList = document.getElementById("accountlist");
|
||||
this.accountList = document.getElementById("accountlist");
|
||||
while (accounts.hasMoreElements()) {
|
||||
var acc = accounts.getNext()
|
||||
.QueryInterface(Ci.purpleIAccount);
|
||||
dump(acc.id + ": " + acc.name + "\n");
|
||||
var elt = document.createElement("richlistitem");
|
||||
accountList.appendChild(elt);
|
||||
this.accountList.appendChild(elt);
|
||||
elt.build(acc);
|
||||
}
|
||||
accountList.selectedIndex = 0;
|
||||
this.accountList.selectedIndex = 0;
|
||||
var ObserverService = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
ObserverService.addObserver(this, "new account", false);
|
||||
|
@ -31,44 +31,42 @@ var gAccountManager = {
|
|||
if (!(aObject instanceof Ci.purpleIAccount))
|
||||
throw "Bad notification.";
|
||||
|
||||
var accountList = document.getElementById("accountlist");
|
||||
|
||||
if (aTopic == "new account") {
|
||||
dump("new account : " + aObject.id + ": " + aObject.name + "\n");
|
||||
var elt = document.createElement("richlistitem");
|
||||
accountList.appendChild(elt);
|
||||
this.accountList.appendChild(elt);
|
||||
elt.build(aObject);
|
||||
if (accountList.getRowCount() == 1)
|
||||
accountList.selectedIndex = 0;
|
||||
if (this.accountList.getRowCount() == 1)
|
||||
this.accountList.selectedIndex = 0;
|
||||
}
|
||||
else if (aTopic == "deleting account") {
|
||||
dump("deleting account : " + aObject.id + ": " + aObject.name + "\n");
|
||||
var elt = document.getElementById(aObject.id);
|
||||
if (!elt.selected) {
|
||||
accountList.removeChild(elt);
|
||||
this.accountList.removeChild(elt);
|
||||
return;
|
||||
}
|
||||
// The currently selected element is removed,
|
||||
// ensure another element gets selected (if the list is not empty)
|
||||
var selectedIndex = accountList.selectedIndex;
|
||||
accountList.removeChild(elt);
|
||||
var count = accountList.getRowCount();
|
||||
this.accountList.removeChild(elt);
|
||||
var count = this.accountList.getRowCount();
|
||||
if (!count)
|
||||
return;
|
||||
if (selectedIndex == count)
|
||||
--selectedIndex;
|
||||
accountList.selectedIndex = selectedIndex;
|
||||
this.accountList.selectedIndex = selectedIndex;
|
||||
dump("new selected index : " + selectedIndex + "\n");
|
||||
}
|
||||
},
|
||||
connect: function am_connect() {
|
||||
document.getElementById("accountlist").selectedItem.connect();
|
||||
this.accountList.selectedItem.connect();
|
||||
},
|
||||
disconnect: function am_disconnect() {
|
||||
document.getElementById("accountlist").selectedItem.disconnect();
|
||||
this.accountList.selectedItem.disconnect();
|
||||
},
|
||||
delete: function am_delete() {
|
||||
document.getElementById("accountlist").selectedItem.delete();
|
||||
this.accountList.selectedItem.delete();
|
||||
},
|
||||
new: function am_new() {
|
||||
window.openDialog("chrome://instantbird/content/account.xul");
|
||||
|
@ -76,6 +74,10 @@ var gAccountManager = {
|
|||
edit: function am_edit() {
|
||||
alert("not implemented yet!");
|
||||
},
|
||||
autologin: function am_autologin() {
|
||||
var elt = this.accountList.selectedItem;
|
||||
elt.autoLogin = !elt.autoLogin;
|
||||
},
|
||||
close: function am_close() {
|
||||
window.close();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче