From 9266c7831e5e4d0f4e123bd62e6cc0a2d114038f Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Thu, 15 Oct 2009 09:49:49 +0000 Subject: Del and Enter keys work in redirect list. git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@268 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/code/settings.xul.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'chrome/content/code/settings.xul.js') diff --git a/chrome/content/code/settings.xul.js b/chrome/content/code/settings.xul.js index c7b375c..f85c1ee 100644 --- a/chrome/content/code/settings.xul.js +++ b/chrome/content/code/settings.xul.js @@ -12,6 +12,8 @@ var Settings = { btnEdit : null, btnUp : null, btnDown : null, + btnExport : null, + btnImport : null, chkEnableRedirector : null, chkShowStatusBarIcon : null, chkShowContextMenu : null, @@ -25,6 +27,8 @@ var Settings = { this.btnEdit = document.getElementById('btnEdit'); this.btnUp = document.getElementById('btnUp'); this.btnDown = document.getElementById('btnDown'); + this.btnExport = document.getElementById('btnExport'); + this.btnImport = document.getElementById('btnImport'); this.chkEnableRedirector = document.getElementById('chkEnableRedirector'); this.chkShowStatusBarIcon = document.getElementById('chkShowStatusBarIcon'); this.chkShowContextMenu = document.getElementById('chkShowContextMenu'); @@ -39,7 +43,8 @@ var Settings = { this.template = document.getElementsByTagName('richlistitem')[0]; this.lstRedirects.removeChild(this.template); this.addItemsToListBox(Redirector.list); - + this.selectionChange(); + this.strings = document.getElementById('redirector-strings'); this.strings.getPluralized = function(id, number) { id += number == 1 ? 'Singular' : ''; @@ -188,6 +193,14 @@ var Settings = { alert(e); } }, + + listKeypress : function(event) { + if (event.keyCode == 13) { //Enter button + this.editRedirect(); + } else if (event.keyCode == 46) { //Del button + this.deleteRedirect(); + } + }, selectionChange : function() { if (!this.lstRedirects) { @@ -199,6 +212,7 @@ var Settings = { this.btnDelete.disabled = (index == -1); this.btnUp.disabled = (index <= 0); this.btnDown.disabled = (index == -1 || index >= Redirector.list.length-1); + this.btnExport.disabled = (Redirector.list.length == 0); }, importExport : function(mode, captionKey, func) { -- cgit v1.2.3-70-g09d2