Bug 670561 - Show profile path in profile manager. r=Mnyromyr
authorEdmund Wong <ewong@pw-wspx.org>
Sat, 10 Dec 2011 21:34:48 +0800
changeset 9966 75669e449485d980f1c9576577c9b516c17f0fbb
parent 9965 3d2c908c293836474a79e285c36cb9315aae68b9
child 9967 045ed5e786193f7edc5cbdc5cbe6faa32d059c02
push id336
push userbugzilla@standard8.plus.com
push dateTue, 31 Jan 2012 22:15:45 +0000
treeherdercomm-beta@54945f5d278d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMnyromyr
bugs670561
Bug 670561 - Show profile path in profile manager. r=Mnyromyr
suite/common/profile/profileSelection.js
suite/common/profile/profileSelection.xul
--- a/suite/common/profile/profileSelection.js
+++ b/suite/common/profile/profileSelection.js
@@ -96,19 +96,24 @@ function StartUp()
 // function : <profileSelection.js>::AddItem();
 // purpose  : utility function for adding items to a tree.
 function AddItem(aProfile, aProfileToSelect)
 {
   var tree = document.getElementById("profiles");
   var treeitem = document.createElement("treeitem");
   var treerow = document.createElement("treerow");
   var treecell = document.createElement("treecell");
+  var treetip = document.getElementById("treetip");
+  var profileDir = gProfileService.getProfileByName(aProfile.name).rootDir;
+
   treecell.setAttribute("label", aProfile.name);
   treerow.appendChild(treecell);
   treeitem.appendChild(treerow);
+  treeitem.setAttribute("tooltip", profileDir.path);
+  treetip.setAttribute("value", profileDir.path);
   tree.lastChild.appendChild(treeitem);
   treeitem.profile = aProfile;
   if (aProfile == aProfileToSelect) {
     var profileIndex = tree.view.getIndexOfItem(treeitem);
     tree.view.selection.select(profileIndex);
     tree.treeBoxObject.ensureRowIsVisible(profileIndex);
   }
 }
@@ -355,8 +360,18 @@ function HandleClickEvent(aEvent)
 {
   if (aEvent.button == 0 && aEvent.target.parentNode.view.selection.count != 0 && AcceptDialog()) {
     window.close();
     return true;
   }
 
   return false;
 }
+
+function HandleToolTipEvent(aEvent)
+{
+  var treeTip = document.getElementById("treetip");
+  var tree = document.getElementById("profiles");
+  var row = {};
+
+  tree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, {}, {});
+  treeTip.label = tree.view.getItemAtIndex(row.value).tooltip;
+}
--- a/suite/common/profile/profileSelection.xul
+++ b/suite/common/profile/profileSelection.xul
@@ -97,23 +97,27 @@
           <spacer flex="2"/>
         </hbox>
       </vbox>
     </deck>
 
     <separator class="thin" orient="vertical"/>
 
     <vbox flex="1">
+      <tooltip id="treetip"
+               onpopupshowing="HandleToolTipEvent(event);">
+      </tooltip>
       <tree id="profiles" flex="1" style="height: 0px;" seltype="single"
             hidecolumnpicker="true"
             onselect="DoEnabling();"
             onkeypress="HandleKeyEvent(event);">
         <treecols>
           <treecol label="&availableProfiles.label;" flex="1" sortLocked="true"/>
         </treecols>
-        <treechildren ondblclick="HandleClickEvent(event);"/>
+        <treechildren tooltip="treetip"
+                      ondblclick="HandleClickEvent(event);"/>
       </tree>
       <checkbox id="offlineState" label="&offlineState.label;" accesskey="&offlineState.accesskey;" hidden="true"/> 
       <checkbox id="autoSelect" label="&autoSelect.label;" accesskey="&autoSelect.accesskey;"/>
     </vbox>
   </hbox>
 
 </dialog>