Open Bug 1346744 Opened 7 years ago

trying to hide targeted treeview items in filters list fails [boxObject.invalidateRow]

Categories

(SeaMonkey :: MailNews: Backend, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

People

(Reporter: realRaven, Unassigned)

Details

Attachments

(1 file)

Attached image GUI and bahavior
I am trying to resurrect some code that adds search / filtering in the message filters list on SeaMonkey through my (XUL based) addon quickFilters. I suspect the "delete" action has never been properly tested, I am going through a loop removing non-matching filters, like this:

let filterList = document.getElementById("filterTree"); // SeaMonkey specific
for (let i = rows - 1; i>=0; i--){
	// http://mxr.mozilla.org/comm-central/source/suite/mailnews/search/FilterListDialog.js
	// SeaMonkey
	item = getFilter(i); // SM / Postbox: defined in FilterListDialog.js 
	title = item.filterName;
	if (title.toLocaleLowerCase().indexOf(keyWord) === -1){
		filterList.view.performActionOnRow("delete", i); // the view is same as gFilterTreeView
		filterList.boxObject.invalidateRow(i);
		filterList.boxObject.rowCountChanged(i+1, -1); // was i + 1  -- same as gFilterTreeView.tree
		hiddenCount++;
		// problem: gFilterTreeView.filterList is not updated; see setServer(uri) in FilterListDialog.js
		// maybe we can replace set filterList(val) { ... }
		//   this.mFilterList = val  => replace with the "filtered" values
	}
}

The problem is the rowCountChanged seems to only always remove the _last_ item in the list - (ignored the efirst parameter?) after calling invalidateRow(i). I made sure to iterate the array backwards from the end. I don't want to remove anything from the underlying data structure (the editable filter list) just hide from the view what doesn't fit with the filter criteria (in above example the name but in Thunderbird I have more powerful filter methods)

Any ideas on how to fix it? Can I somehow access the XUL contents and make them invisible or does the CPP implementation make this impossible for any script.

Either preformActionOnRow doesn't work or rowCountChanged malfunctions...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: