Bug 103684 - RFE: Implement direct ordering of filters (insert new filter at the current position / above the selected filter) r/moa=mnyromyr
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sun, 29 Apr 2012 16:20:23 +0100
changeset 12002 21373a678b467335c577486b801de01abeea7ca3
parent 12001 2ae1a960f31875c494d134f615020ccc5a5a117d
child 12003 c2fc01604fdc62d362f0c36b138548b63ce4df47
push id599
push usermconley@mozilla.com
push dateMon, 16 Jul 2012 20:33:12 +0000
treeherdercomm-beta@c3489d5b7b65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs103684
Bug 103684 - RFE: Implement direct ordering of filters (insert new filter at the current position / above the selected filter) r/moa=mnyromyr
suite/mailnews/search/FilterListDialog.js
--- a/suite/mailnews/search/FilterListDialog.js
+++ b/suite/mailnews/search/FilterListDialog.js
@@ -381,24 +381,27 @@ function onEditFilter()
   window.openDialog("chrome://messenger/content/FilterEditor.xul", "FilterEditor", "chrome,modal,titlebar,resizable,centerscreen", args);
 
   // The focus change will cause a repaint of the row updating any name change
 }
 
 function onNewFilter(emailAddress)
 {
   var curFilterList = currentFilterList();
-  var args = {filterList: curFilterList, refresh: false};
+  var position = Math.max(gFilterTree.currentIndex, 0);
+  var args = {filterList: curFilterList,
+              filterPosition: position, refresh: false};
   
   window.openDialog("chrome://messenger/content/FilterEditor.xul", "FilterEditor", "chrome,modal,titlebar,resizable,centerscreen", args);
 
   if (args.refresh)
   {
-    gFilterTreeView.tree.rowCountChanged(0, 1);
-    gFilterTree.view.selection.select(0);
+    gFilterTreeView.tree.rowCountChanged(position, 1);
+    gFilterTree.view.selection.select(position);
+    gFilterTree.treeBoxObject.ensureRowIsVisible(position);
   }
 }
 
 function onDeleteFilter()
 {
   var filterList = currentFilterList();
   if (!filterList)
     return;