From c5d7a6c9490b6ed384171e082b032c52f7cb63b7 Mon Sep 17 00:00:00 2001 From: stippi Date: Wed, 24 Mar 2010 20:25:54 +0000 Subject: [PATCH] Manually removing downloads needs to trigger checking the button enabled status in the download window. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@354 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/DownloadWindow.cpp | 22 ++++++++++++++++++++++ src/apps/webpositive/DownloadWindow.h | 1 + 2 files changed, 23 insertions(+) diff --git a/src/apps/webpositive/DownloadWindow.cpp b/src/apps/webpositive/DownloadWindow.cpp index 5f6dbf1867..71ba1a3894 100644 --- a/src/apps/webpositive/DownloadWindow.cpp +++ b/src/apps/webpositive/DownloadWindow.cpp @@ -250,6 +250,7 @@ DownloadWindow::MessageReceived(BMessage* message) _RemoveMissingDownloads(); break; case SAVE_SETTINGS: + _ValidateButtonStatus(); _SaveSettings(); break; @@ -390,6 +391,27 @@ DownloadWindow::_RemoveMissingDownloads() } +void +DownloadWindow::_ValidateButtonStatus() +{ + int32 finishedCount = 0; + int32 missingCount = 0; + for (int32 i = fDownloadViewsLayout->CountItems() - 1; + BLayoutItem* item = fDownloadViewsLayout->ItemAt(i); i--) { + DownloadProgressView* view = dynamic_cast( + item->View()); + if (!view) + continue; + if (view->IsFinished()) + finishedCount++; + if (view->IsMissing()) + missingCount++; + } + fRemoveFinishedButton->SetEnabled(finishedCount > 0); + fRemoveMissingButton->SetEnabled(missingCount > 0); +} + + void DownloadWindow::_SaveSettings() { diff --git a/src/apps/webpositive/DownloadWindow.h b/src/apps/webpositive/DownloadWindow.h index 3275620293..02f950b86b 100644 --- a/src/apps/webpositive/DownloadWindow.h +++ b/src/apps/webpositive/DownloadWindow.h @@ -52,6 +52,7 @@ private: void _DownloadFinished(BWebDownload* download); void _RemoveFinishedDownloads(); void _RemoveMissingDownloads(); + void _ValidateButtonStatus(); void _SaveSettings(); void _LoadSettings(); bool _OpenSettingsFile(BFile& file, uint32 mode);