Bug 953625 - wherever the focus is, make sure the up and down arrow change the selected account in the account manager. r=florian

This commit is contained in:
Romain Bezut 2009-08-02 23:47:05 +02:00
Родитель e7499f501b
Коммит dda0f9e52c
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -70,6 +70,7 @@ var gAccountManager = {
this.setAutoLoginNotification();
this.accountList.addEventListener("keypress", this.onKeyPress, true);
window.addEventListener("unload", this.unload, false);
},
unload: function am_unload() {
@ -162,6 +163,23 @@ var gAccountManager = {
}, 0, this);
},
onKeyPress: function am_onKeyPress(event) {
// As we stop propagation, the default action applies to the richlistbox
// so that the selected account is changed with this default action
if (event.keyCode == event.DOM_VK_DOWN) {
if (this.selectedIndex < this.itemCount - 1)
this.ensureIndexIsVisible(this.selectedIndex + 1);
event.stopPropagation();
return;
}
if (event.keyCode == event.DOM_VK_UP) {
if (this.selectedIndex > 0)
this.ensureIndexIsVisible(this.selectedIndex - 1);
event.stopPropagation();
}
},
getAccounts: function am_getAccounts() {
var pcs = Components.classes["@instantbird.org/purple/core;1"]
.getService(Ci.purpleICoreService);