Bug 301435. Focus breaks when item removed from download manager. Patch by Doron Rosenberg. r+a=mconnor

This commit is contained in:
aaronleventhal%moonset.net 2005-07-25 22:21:31 +00:00
Родитель e87f2bb708
Коммит efb0f5b86e
2 изменённых файлов: 26 добавлений и 0 удалений

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

@ -319,6 +319,17 @@
listBox.goDown(); // Ensure viable initial focus position
]]>
</constructor>
<deconstructor>
<![CDATA[
// when we are destructed and we are selected, unselect ourselves so
// that richlistbox's selection doesn't point to something not in the DOM.
if (this.selected) {
this.control.clearSelection();
}
]]>
</deconstructor>
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
<property name="accessible">
<getter>

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

@ -220,6 +220,11 @@ var gDownloadObserver = {
// Add this download to the percentage average tally
var dl = aSubject.QueryInterface(Components.interfaces.nsIDownload);
gActiveDownloads.push(dl);
// now reset the richlistbox since the template was rebuilt
gDownloadsView.clearSelection();
gDownloadsView.focus();
break;
case "xpinstall-download-started":
var windowArgs = aSubject.QueryInterface(Components.interfaces.nsISupportsArray);
@ -279,8 +284,18 @@ function onDownloadResume(aEvent)
function onDownloadRemove(aEvent)
{
if (aEvent.target.removable) {
var selectedIndex = gDownloadsView.selectedIndex;
gDownloadManager.removeDownload(aEvent.target.id);
// now reset the richlistbox since the template was rebuilt
gDownloadsView.clearSelection();
if (selectedIndex >= gDownloadsView.getRowCount())
gDownloadsView.selectedIndex = selectedIndex - 1;
else
gDownloadsView.selectedIndex = selectedIndex;
gDownloadsView.focus();
gDownloadViewController.onCommandUpdate();
}
}