Bug 392376 - "Double-clicking on the selected application within the file handling dialog should work as "OK" and launch the application" [p=florian r=Mano a=blocking-firefox3+]
authorreed@reedloden.com
Mon, 12 Nov 2007 22:48:20 -0800
changeset 7913 4d1cd59cf8bb92badad21d93b905bdd96b56cfbf
parent 7912 5a1ec3d20d19e2b360a0d89a35998f63cdeba3ed
child 7914 0389257239bb992613d0a4e4074284d85ade0d58
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMano, blocking-firefox3
bugs392376
milestone1.9b2pre
Bug 392376 - "Double-clicking on the selected application within the file handling dialog should work as "OK" and launch the application" [p=florian r=Mano a=blocking-firefox3+]
toolkit/mozapps/handling/content/dialog.js
toolkit/mozapps/handling/content/dialog.xul
--- a/toolkit/mozapps/handling/content/dialog.js
+++ b/toolkit/mozapps/handling/content/dialog.js
@@ -228,16 +228,27 @@ var dialog = {
   onCheck: function onCheck()
   {
     if (document.getElementById("remember").checked)
       document.getElementById("remember-text").setAttribute("visible", "true");
     else
       document.getElementById("remember-text").removeAttribute("visible");
   },
 
+  /**
+   * Function called when the user double clicks on an item of the list
+   */
+  onDblClick: function onDblClick()
+  {
+    if (this.selectedItem == this._itemChoose)
+      this.chooseApplication();
+    else
+      document.documentElement.acceptDialog();
+  },
+
   /////////////////////////////////////////////////////////////////////////////
   //// Getters / Setters
 
  /**
   * Returns the selected element in the richlistbox
   */
   get selectedItem()
   {
--- a/toolkit/mozapps/handling/content/dialog.xul
+++ b/toolkit/mozapps/handling/content/dialog.xul
@@ -58,16 +58,17 @@
   <hbox>
     <image id="description-image"/>
     <description id="description-text"/>
   </hbox>
 
   <vbox flex="1">
     <description id="item-action-text"/>
     <richlistbox id="items" flex="1"
+                 ondblclick="dialog.onDblClick();"
                  onselect="dialog.updateOKButton();">
       <richlistitem id="item-choose" orient="horizontal" selected="true">
         <label value="&ChooseApp.description;" flex="1"/>
         <button oncommand="dialog.chooseApplication();"
                 label="&ChooseApp.label;" accesskey="&ChooseApp.accessKey;"/>
       </richlistitem>
     </richlistbox>
   </vbox>