From f65c57d54eca61c834926836f25da9ab9f7f8c46 Mon Sep 17 00:00:00 2001 From: stippi Date: Tue, 23 Mar 2010 15:13:56 +0000 Subject: [PATCH] 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 --- src/apps/webpositive/DownloadWindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/apps/webpositive/DownloadWindow.cpp b/src/apps/webpositive/DownloadWindow.cpp index ae60ac4f5f..c22a8602cc 100644 --- a/src/apps/webpositive/DownloadWindow.cpp +++ b/src/apps/webpositive/DownloadWindow.cpp @@ -748,6 +748,7 @@ DownloadWindow::_DownloadFinished(BWebDownload* download) void DownloadWindow::_RemoveFinishedDownloads() { + int32 missingCount = 0; for (int32 i = fDownloadViewsLayout->CountItems() - 1; BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) { DownloadProgressView* view = dynamic_cast( @@ -757,9 +758,11 @@ DownloadWindow::_RemoveFinishedDownloads() if (view->IsFinished()) { view->RemoveSelf(); delete view; - } + } else if (view->IsMissing()) + missingCount++; } fRemoveFinishedButton->SetEnabled(false); + fRemoveMissingButton->SetEnabled(missingCount > 0); _SaveSettings(); } @@ -767,6 +770,7 @@ DownloadWindow::_RemoveFinishedDownloads() void DownloadWindow::_RemoveMissingDownloads() { + int32 finishedCount = 0; for (int32 i = fDownloadViewsLayout->CountItems() - 1; BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) { DownloadProgressView* view = dynamic_cast( @@ -776,9 +780,11 @@ DownloadWindow::_RemoveMissingDownloads() if (view->IsMissing()) { view->RemoveSelf(); delete view; - } + } else if (view->IsFinished()) + finishedCount++; } fRemoveMissingButton->SetEnabled(false); + fRemoveFinishedButton->SetEnabled(finishedCount > 0); _SaveSettings(); }