Commit cbf7124e authored by Gabriele Best's avatar Gabriele Best
Browse files

Bug 244371 - Show a tooltip in Bookmarks and History sidebars, r=mak

parent 1e69abea
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@
                         onpopupshowing="HistoryMenu.onPopupShowing(event);"
                         onpopuphidden="HistoryMenu.onPopupHidden(event);"
                         place="place:redirectsMode=2&sort=4&maxResults=10"
                         tooltip="btTooltip">
                         tooltip="bhTooltip">
                <menuitem id="historyMenuBack"
                          label="&backCmd.label;"
#ifdef XP_MACOSX
@@ -526,7 +526,7 @@
               oncommand="BookmarksEventHandler.onCommand(event);"
               onclick="BookmarksEventHandler.onClick(event);"
               onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"
               tooltip="btTooltip">
               tooltip="bhTooltip">
      <menuitem id="menu_bookmarkThisPage"
                label="&bookmarkThisPageCmd.label;"
                command="Browser:AddBookmarkAs"
+33 −12
Original line number Diff line number Diff line
@@ -920,26 +920,47 @@ var BookmarksEventHandler = {
    }
  },

  fillInBTTooltip: function(aTipElement) {
    if (!aTipElement.node)
      return false;
  fillInBHTooltip: function(aDocument, aEvent) {
    var node;
    var cropped = false;

    if (aDocument.tooltipNode.localName == "treechildren") {
      var tree = aDocument.tooltipNode.parentNode;
      var row = {}, column = {};
      var tbo = tree.treeBoxObject;
      tbo.getCellAt(aEvent.clientX, aEvent.clientY, row, column, {});

      node = tree.view.nodeForTreeIndex(row.value);
      cropped = tbo.isCellCropped(row.value, column.value);
    }
    else
      node = aDocument.tooltipNode.node;

    //Show tooltips only for URL items
    if (!PlacesUtils.nodeIsURI(aTipElement.node))
    if (!node)
      return false;

    var title = aTipElement.node.title;
    var url = aTipElement.node.uri;
    var title = node.title;
    var url;

    // Show URL only for URI-type nodes.
    if (PlacesUtils.nodeIsURI(node))
      url = node.uri;

    // Show tooltip for containers only if their title is cropped.
    if (!cropped && !url)
      return false;

    var tooltipTitle = document.getElementById("btTitleText");
    tooltipTitle.hidden = !title || (title == url);
    var tooltipTitle = aDocument.getElementById("bhtTitleText");
    tooltipTitle.hidden = (!title || (title == url));
    if (!tooltipTitle.hidden)
      tooltipTitle.textContent = title;

    var tooltipUrl = document.getElementById("btUrlText");
    var tooltipUrl = aDocument.getElementById("bhtUrlText");
    tooltipUrl.hidden = !url;
    if (!tooltipUrl.hidden)
      tooltipUrl.value = url;

    //Show tooltip
    // Show tooltip.
    return true;
  }
};
+3 −9
Original line number Diff line number Diff line
@@ -284,14 +284,8 @@
    </panel>
  </popupset>

  <!-- bookmarks toolbar tooltip -->
  <tooltip id="btTooltip" noautohide="true"
           onpopupshowing="return BookmarksEventHandler.fillInBTTooltip(document.tooltipNode)">
    <vbox id="btTooltipTextBox" flex="1">
      <label id="btTitleText" class="tooltip-label" />
      <label id="btUrlText" crop="center" class="tooltip-label" />
    </vbox>
  </tooltip>
  <!-- Bookmarks and history tooltip -->
  <tooltip id="bhTooltip"/>

  <toolbox id="navigator-toolbox" class="toolbox-top" mode="icons"
#ifdef WINCE
@@ -457,7 +451,7 @@
               onclick="BookmarksEventHandler.onClick(event);"
               oncommand="BookmarksEventHandler.onCommand(event);"
               onpopupshowing="BookmarksEventHandler.onPopupShowing(event);"
               tooltip="btTooltip"/>
               tooltip="bhTooltip"/>
      </toolbaritem>

        <toolbarbutton id="downloads-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
+5 −1
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@
  <commandset id="editMenuCommands"/>
  <popup id="placesContext"/>

  <!-- Bookmarks and history tooltip -->
  <tooltip id="bhTooltip"/>

  <hbox align="center">
    <label value="&search.label;" accesskey="&search.accesskey;" control="search-box"/>
    <textbox id="search-box" flex="1" type="search" class="compact"
@@ -79,6 +82,7 @@
    <treecols>
      <treecol id="title" flex="1" primary="true" hideheader="true"/>
    </treecols>
    <treechildren id="bookmarks-view-children" view="bookmarks-view" class="sidebar-placesTreechildren" flex="1"/>
    <treechildren id="bookmarks-view-children" view="bookmarks-view"
                  class="sidebar-placesTreechildren" flex="1" tooltip="bhTooltip"/>
  </tree>
</page>
+4 −1
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@
  <!-- required to overlay the context menu -->
  <popup id="placesContext" />

  <!-- Bookmarks and history tooltip -->
  <tooltip id="bhTooltip"/>

  <hbox align="center">
    <label value="&find.label;" accesskey="&find.accesskey;" 
           control="search-box"/>
@@ -122,6 +125,6 @@
    <treecols>
      <treecol id="title" flex="1" primary="true" hideheader="true"/>
    </treecols>
    <treechildren class="sidebar-placesTreechildren" flex="1"/>
    <treechildren class="sidebar-placesTreechildren" flex="1" tooltip="bhTooltip"/>
  </tree>
</page>
Loading