Bug 353698 - Make sure to announce the fact that a selected event was deleted. r=lilmatt, mvl

This commit is contained in:
jminta%gmail.com 2007-01-10 15:11:03 +00:00
Родитель 11803f58ca
Коммит 3ff1065a37
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -1357,11 +1357,18 @@
function isNotItem(a) {
return !a.hasSameIds(aItem);
}
var oldLength = this.mSelectedItems.length;
this.mSelectedItems = this.mSelectedItems.filter(isNotItem);
for each (box in boxes) {
box.box.deleteItem(aItem);
}
// If a deleted event was selected, we need to announce that the
// selection changed.
if (oldLength != this.mSelectedItems.length) {
this.fireEvent("itemselect", this.mSelectedItems);
}
]]></body>
</method>

Просмотреть файл

@ -2642,6 +2642,19 @@
column.deleteEvent(aEvent);
}
}
// See whether the item we are deleting was selected. If it was, then
// fire the appropriate event so our watchers can update
var found = false;
for (var i = 0; i < this.mSelectedItems.length; i++) {
if (this.mSelectedItems[i].hasSameIds(aEvent)) {
this.mSelectedItems.splice(i, 1);
found = true;
}
}
if (found) {
this.fireEvent("itemselect", this.mSelectedItems);
}
]]></body>
</method>