From: phasefx Date: Wed, 20 Apr 2011 05:03:24 +0000 (+0000) Subject: Hotkey Fixes X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=d1a8a05dac598f04504c91e3c4afe7c8da6490ce Hotkey Fixes Attempt to be more robust/forceful on clearing hint text Reset hotkeys less often (such as *not* on operator change) Re-enable keyset properly Author: Thomas Berezansky Signed-off-by: Thomas Berezansky Signed-off-by: Jason Etheridge git-svn-id: svn://svn.open-ils.org/ILS/trunk@20227 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index ba8a97d..7319be4 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -162,6 +162,8 @@ main.menu.prototype = { var network = new util.network(); network.set_user_status(); + this.set_menu_hotkeys(); + function open_conify_page(path, labelKey, event) { // tab label @@ -1409,7 +1411,10 @@ main.menu.prototype = { // Easy enough, toggle disabled on the keyset var keyset = document.getElementById("menu_frame_keys"); var disabled = (keyset.getAttribute("disabled") == "true") ? "false" : "true"; - keyset.setAttribute("disabled", disabled); + if(disabled == "true") + keyset.setAttribute("disabled", "true"); + else + keyset.removeAttribute("disabled"); // Then find every menuitem/toolbarbutton for this command for a graphical hint var controls = document.getElementsByAttribute("command","cmd_hotkeys_toggle"); for(var i = 0; i < controls.length; i++) @@ -1722,14 +1727,23 @@ commands: var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]. getService(Components.interfaces.nsIWindowMediator); var mainwin = wm.getMostRecentWindow('eg_main'); - var explicit = false; JSAN.use('util.network'); var network = new util.network(); if(hotkeyset) { // Explicit request + // Store this.data.current_hotkeyset = hotkeyset; this.data.stash('current_hotkeyset'); - explicit = true; + // Then iterate over windows + var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(); + var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator); + var enumerator = windowManagerInterface.getEnumerator('eg_menu'); + + var w; + while ( w = enumerator.getNext() ) { + if ( w != window ) + w.g.menu.set_menu_hotkeys(); + } } else { // Non-explicit request? if(this.data.current_hotkeyset) // Previous hotkeyset? @@ -1775,6 +1789,7 @@ commands: // If you want to take this trick for use *anywhere* in *any* project, regardless of licensing, please do // Because it was a PITA to figure out menuitem.style.display = 'none'; // Hide the item to force menu to clear spot + menuitem.setAttribute('acceltext', ''); // Set acceltext to blank string outright menuitem.removeAttribute('acceltext'); // Remove acceltext to clear out hotkey hint text menuitem.parentNode.openPopupAtScreen(0,0,false); // Tell menupopup to redraw itself menuitem.parentNode.hidePopup(); // And then make it go away right away. @@ -1826,10 +1841,6 @@ commands: var hotkeylist = document.getElementById('main.menu.admin.client.hotkeys.current.popup'); var selectitems = hotkeylist.getElementsByAttribute('value',hotkeyset); if(selectitems.length > 0) selectitems[0].setAttribute('checked','true'); - // Tell other windows to update - if(explicit) { - network.set_user_status(); - } }, 'page_meter' : { diff --git a/Open-ILS/xul/staff_client/chrome/content/util/network.js b/Open-ILS/xul/staff_client/chrome/content/util/network.js index 836a0ce..5cba385 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/network.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/network.js @@ -317,7 +317,6 @@ util.network.prototype = { if(!offlinestrings) w.document.getElementById('offlineStrings'); if(permlist) w.g.menu.set_menu_access(permlist); - w.g.menu.set_menu_hotkeys(); if(data.list.au.length > 1) { addCSSClass(w.document.getElementById('main_tabbox'),'operator_change'); x.setAttribute('label', offlineStrings.getFormattedString('menu.cmd_chg_session.operator.label', [data.list.au[1].usrname()]) );