details:   https://code.openbravo.com/erp/devel/pi/rev/69c758824b3e
changeset: 22760:69c758824b3e
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Mar 24 11:56:34 2014 +0100
summary:   fixed bug 25910: prevent continous CRTL-O to open browser's open 
dialog

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quickrun-widget.js
 |  24 +++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (59 lines):

diff -r b24d8a94df0e -r 69c758824b3e 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quickrun-widget.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quickrun-widget.js
     Mon Mar 24 06:09:59 2014 +0000
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quickrun-widget.js
     Mon Mar 24 11:56:34 2014 +0100
@@ -149,11 +149,18 @@
   // ** {{{ click }}} **
   // clicking the button shows or hides the layout.
   click: function () {
+    var me;
     if (this.showing) {
       this.doHide();
       return false;
+    } else if (!this.executingAction) {
+      this.setExecutingAction();
+      this.doShow();
     } else {
-      this.doShow();
+      // do nothing: action has just been launched, preventing it to be 
triggered
+      // twice at the same time
+      // see issue #25910
+      return false;
     }
   },
 
@@ -238,6 +245,17 @@
   // is called.
   beforeShow: function () {},
 
+  //** {{{ setExecutingAction }}} **
+  // We are opening the quick run or hiding it, remember it during 100ms not
+  // to try to open it again at the same time
+  setExecutingAction: function () {
+    var me = this;
+    this.executingAction = true;
+    setTimeout(function () {
+      delete me.executingAction;
+    }, 100);
+  },
+
   // ** {{{ doHide }}} **
   // Hide the expanded layout.
   doHide: function () {
@@ -258,6 +276,8 @@
       isc.OBQuickRun.currentQuickRun = null;
     }
 
+    this.focus(); // keeping focus in SC component
+    this.setExecutingAction();
     if (isc.isA.Canvas(this.focusOnHide)) {
       // setting the focus back to a SC component so keyboard shortcuts 
continue
       // working (they do not if focus is in browser). This is needed to be 
done
@@ -265,7 +285,7 @@
       // on this new element (see issue #25910)
       setTimeout(function () {
         me.focusOnHide.focus();
-      }, 100);
+      }, 50);
     }
 
     if (typeof OB.MainView.TabSet.getSelectedTab().pane.tabSelected === 
'function') {

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to