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
This commit is contained in:
stippi
2012-07-03 15:38:50 +02:00
committed by Alexandre Deckner
parent 3b7f919fb8
commit c5d7a6c949
2 changed files with 23 additions and 0 deletions
+22
View File
@@ -250,6 +250,7 @@ DownloadWindow::MessageReceived(BMessage* message)
_RemoveMissingDownloads(); _RemoveMissingDownloads();
break; break;
case SAVE_SETTINGS: case SAVE_SETTINGS:
_ValidateButtonStatus();
_SaveSettings(); _SaveSettings();
break; 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<DownloadProgressView*>(
item->View());
if (!view)
continue;
if (view->IsFinished())
finishedCount++;
if (view->IsMissing())
missingCount++;
}
fRemoveFinishedButton->SetEnabled(finishedCount > 0);
fRemoveMissingButton->SetEnabled(missingCount > 0);
}
void void
DownloadWindow::_SaveSettings() DownloadWindow::_SaveSettings()
{ {
+1
View File
@@ -52,6 +52,7 @@ private:
void _DownloadFinished(BWebDownload* download); void _DownloadFinished(BWebDownload* download);
void _RemoveFinishedDownloads(); void _RemoveFinishedDownloads();
void _RemoveMissingDownloads(); void _RemoveMissingDownloads();
void _ValidateButtonStatus();
void _SaveSettings(); void _SaveSettings();
void _LoadSettings(); void _LoadSettings();
bool _OpenSettingsFile(BFile& file, uint32 mode); bool _OpenSettingsFile(BFile& file, uint32 mode);