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 2010-03-24 20:25:54 +00:00 committed by Alexandre Deckner
parent 3b7f919fb8
commit c5d7a6c949
2 changed files with 23 additions and 0 deletions

View File

@ -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<DownloadProgressView*>(
item->View());
if (!view)
continue;
if (view->IsFinished())
finishedCount++;
if (view->IsMissing())
missingCount++;
}
fRemoveFinishedButton->SetEnabled(finishedCount > 0);
fRemoveMissingButton->SetEnabled(missingCount > 0);
}
void
DownloadWindow::_SaveSettings()
{

View File

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