[open-ils-commits] r20229 - in branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content: main util (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Apr 20 01:04:18 EDT 2011


Author: phasefx
Date: 2011-04-20 01:04:14 -0400 (Wed, 20 Apr 2011)
New Revision: 20229

Modified:
   branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/util/network.js
Log:
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 <tsbere at mvlc.org>
Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>


Modified: branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2011-04-20 05:03:33 UTC (rev 20228)
+++ branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2011-04-20 05:04:14 UTC (rev 20229)
@@ -162,6 +162,8 @@
         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 @@
                     // 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 @@
         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 @@
                 // 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 @@
         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' : {

Modified: branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/util/network.js
===================================================================
--- branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/util/network.js	2011-04-20 05:03:33 UTC (rev 20228)
+++ branches/rel_2_1/Open-ILS/xul/staff_client/chrome/content/util/network.js	2011-04-20 05:04:14 UTC (rev 20229)
@@ -317,7 +317,6 @@
 
                 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()]) );



More information about the open-ils-commits mailing list