Close All Tabs shortcut
authorThomas Berezansky <tsbere@mvlc.org>
Wed, 28 Sep 2011 23:00:56 +0000 (19:00 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 4 Nov 2011 21:43:04 +0000 (17:43 -0400)
Enable CTRL+Click on the close tab "X" to close all tabs.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/xul/staff_client/chrome/content/main/menu.js

index 61d239c..65aa26c 100644 (file)
@@ -273,7 +273,31 @@ main.menu.prototype = {
             ],
             'cmd_close_tab' : [
                 ['oncommand'],
-                function() { obj.close_tab(); }
+                function(event) {
+                    var myEvent = event;
+                    var closeAll = false;
+                    if(event && event.sourceEvent) myEvent = event.sourceEvent;
+                    // Note: The last event is not supposed to be myEvent in this if.
+                    if(myEvent && myEvent.explicitOriginalTarget.nodeName.match(/toolbarbutton/) && myEvent.explicitOriginalTarget.command == event.originalTarget.id) {
+                        var value = xulG.pref.getIntPref('ui.key.accelKey');
+                        switch(value) {
+                            case 17:
+                                closeAll = myEvent.ctrlKey;
+                                break;
+                            case 18:
+                                closeAll = myEvent.altKey;
+                                break;
+                            case 224:
+                                closeAll = myEvent.metaKey;
+                                break;
+                        }
+                    }
+                    if(closeAll) {
+                        obj.close_all_tabs();
+                    } else {
+                        obj.close_tab();
+                    }
+                }
             ],
             'cmd_close_all_tabs' : [
                 ['oncommand'],