Removing finished or missing downloads may have to disable the respective

other button.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@347 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi
2012-07-03 15:38:19 +02:00
committed by Alexandre Deckner
parent f28abe9d24
commit f65c57d54e
+8 -2
View File
@@ -748,6 +748,7 @@ DownloadWindow::_DownloadFinished(BWebDownload* download)
void void
DownloadWindow::_RemoveFinishedDownloads() DownloadWindow::_RemoveFinishedDownloads()
{ {
int32 missingCount = 0;
for (int32 i = fDownloadViewsLayout->CountItems() - 1; for (int32 i = fDownloadViewsLayout->CountItems() - 1;
BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) { BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) {
DownloadProgressView* view = dynamic_cast<DownloadProgressView*>( DownloadProgressView* view = dynamic_cast<DownloadProgressView*>(
@@ -757,9 +758,11 @@ DownloadWindow::_RemoveFinishedDownloads()
if (view->IsFinished()) { if (view->IsFinished()) {
view->RemoveSelf(); view->RemoveSelf();
delete view; delete view;
} } else if (view->IsMissing())
missingCount++;
} }
fRemoveFinishedButton->SetEnabled(false); fRemoveFinishedButton->SetEnabled(false);
fRemoveMissingButton->SetEnabled(missingCount > 0);
_SaveSettings(); _SaveSettings();
} }
@@ -767,6 +770,7 @@ DownloadWindow::_RemoveFinishedDownloads()
void void
DownloadWindow::_RemoveMissingDownloads() DownloadWindow::_RemoveMissingDownloads()
{ {
int32 finishedCount = 0;
for (int32 i = fDownloadViewsLayout->CountItems() - 1; for (int32 i = fDownloadViewsLayout->CountItems() - 1;
BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) { BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) {
DownloadProgressView* view = dynamic_cast<DownloadProgressView*>( DownloadProgressView* view = dynamic_cast<DownloadProgressView*>(
@@ -776,9 +780,11 @@ DownloadWindow::_RemoveMissingDownloads()
if (view->IsMissing()) { if (view->IsMissing()) {
view->RemoveSelf(); view->RemoveSelf();
delete view; delete view;
} } else if (view->IsFinished())
finishedCount++;
} }
fRemoveMissingButton->SetEnabled(false); fRemoveMissingButton->SetEnabled(false);
fRemoveFinishedButton->SetEnabled(finishedCount > 0);
_SaveSettings(); _SaveSettings();
} }