From 8b792e050568cc27220b0ac9baf124bf260b5c34 Mon Sep 17 00:00:00 2001 From: "michael.buettner%sun.com" Date: Tue, 11 Dec 2007 11:21:28 +0000 Subject: [PATCH] Bug 405502 - Imported task is displayed twice in task list, r=dbo --- calendar/base/content/calendar-task-tree.xml | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/calendar/base/content/calendar-task-tree.xml b/calendar/base/content/calendar-task-tree.xml index 188295e990d..aaba9d13d97 100644 --- a/calendar/base/content/calendar-task-tree.xml +++ b/calendar/base/content/calendar-task-tree.xml @@ -185,12 +185,15 @@ addItem: function tTV_addItem(aItem) { // The rowCountChanged function takes two arguments, the index where the - // first row was inserted and the number of rows to insert. - this.binding.mTaskArray.push(aItem); - var index = this.binding.mTaskArray.length - 1; - this.binding.mHash2Index[aItem.hashId] = index; - this.treebox.rowCountChanged(index, 1); - this.tree.view.selection.select(index); + // first row was inserted and the number of rows to insert. + var index = this.binding.mHash2Index[aItem.hashId]; + if (index === undefined) { + var index = this.binding.mTaskArray.length; + this.binding.mTaskArray.push(aItem); + this.binding.mHash2Index[aItem.hashId] = index; + this.treebox.rowCountChanged(index, 1); + this.tree.view.selection.select(index); + } }, removeItem: function tTV_removeItem(aItem) { @@ -558,8 +561,10 @@ }, onEndBatch: function tTO_onEndBatch() { - this.mInBatch = false; - this.binding.refresh(); + if (this.mInBatch) { + this.mInBatch = false; + this.binding.refresh(); + } }, onLoad: function tTO_onLoad() {