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);