Commit 7a170f98 authored by neil%parkwaycc.co.uk's avatar neil%parkwaycc.co.uk
Browse files

Ability to navigate the search folderpicker when closed b=302120 sr=mscott

parent 2585bbcd
Loading
Loading
Loading
Loading
+81 −49
Original line number Diff line number Diff line
@@ -1759,21 +1759,38 @@
              return (l < f + p ? l : f + p) - 1;
            },
            handleEvent: function handleEvent(event) {
              var index;
              var box = this.tree.treeBoxObject;
              if (this.parentNode.hasAttribute("open")) {
                event.stopPropagation();
                var index = this.tree.currentIndex;
                var box = this.tree.treeBoxObject;
                switch (event.keyCode) {
                  case event.DOM_VK_ESCAPE:
                    this.self.hidePopup();
                    return;
                  case event.DOM_VK_ENTER:
                  case event.DOM_VK_RETURN:
                    this.self.fire();
                    return;
                }
                index = this.tree.currentIndex;
              } else {
                switch (event.keyCode) {
                  case event.DOM_VK_PAGE_UP:
                  case event.DOM_VK_PAGE_DOWN:
                    return;
                }
                index = this.self.setInitialSelection();
              }
              switch (event.keyCode) {
                case event.DOM_VK_UP:
                    if (index <= 0) return;
                  if (index <= 0)
                    return;
                  index--;
                  break;
                case event.DOM_VK_DOWN:
                  index++;
                    if (index == box.view.rowCount) return;
                  if (index == box.view.rowCount)
                    return;
                  break;
                case event.DOM_VK_PAGE_UP:
                  if (index == box.getFirstVisibleRow())
@@ -1791,32 +1808,22 @@
                case event.DOM_VK_END:
                  index = box.view.rowCount - 1;
                  break;
                  case event.DOM_VK_ENTER:
                  case event.DOM_VK_RETURN:
                    this.self.fire();
                    return;
                default:
                  return;
              }
              box.view.selection.select(index);
              if (this.parentNode.hasAttribute("open"))
                box.ensureRowIsVisible(index);
              }
              else
                this.self.fire();
            }
          })
        ]]>
      </field>
    </implementation>
    <handlers>
      <handler event="mousemove" action="this.updateHover(event);"/>
      <handler event="click" action="this.updateHover(event);this.fire();"/>
      <handler event="popupshowing">
      <method name="setInitialSelection">
        <body>
          <![CDATA[
          this.parentNode.addEventListener("blur", this.onBlurMenuList, false);
          window.top.document.addEventListener("keydown", this.onKeyDownMenuList, true);
          window.top.document.addEventListener("keypress", this.onKeyPressMenuList, true);
          var box = this.tree.treeBoxObject;
          box.focused = true;
          var view = box.view;
            var view = this.tree.view;
            view.selection.selectEventsSuppressed = true;
            for (var i = 0; i < view.rowCount; i++) {
              if (view.isContainer(i)) {
@@ -1830,15 +1837,40 @@
                }
              }
            }
          var height = view.rowCount * box.rowHeight;
          height += this.boxObject.height - box.treeBody.boxObject.height;
          this.height = height;
            var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
            var index = this.tree.builderView.getIndexOfResource(RDF.GetResource(this.parentNode.getAttribute("uri")));
          if (index >= 0) {
            view.selection.select(index);
            return index;
          ]]>
        </body>
      </method>
      <constructor>
        <![CDATA[
          this.parentNode.addEventListener("keypress", this.onKeyPressMenuList, true);
        ]]>
      </constructor>
      <destructor>
        <![CDATA[
          this.parentNode.removeEventListener("keypress", this.onKeyPressMenuList, true);
        ]]>
      </destructor>
    </implementation>
    <handlers>
      <handler event="mousemove" action="this.updateHover(event);"/>
      <handler event="click" action="this.updateHover(event);this.fire();"/>
      <handler event="popupshowing">
        <![CDATA[
          this.parentNode.addEventListener("blur", this.onBlurMenuList, false);
          window.top.document.addEventListener("keydown", this.onKeyDownMenuList, true);
          window.top.document.addEventListener("keypress", this.onKeyPressMenuList, true);
          var box = this.tree.treeBoxObject;
          box.focused = true;
          var index = this.setInitialSelection();
          var height = box.view.rowCount * box.rowHeight;
          height += this.boxObject.height - box.treeBody.boxObject.height;
          this.height = height;
          if (index >= 0)
            setTimeout(function() { box.ensureRowIsVisible(index); }, 0);
          }
        ]]>
      </handler>
      <handler event="popuphiding">