From 4a09831444efe276c2186c9158951577e58472cb Mon Sep 17 00:00:00 2001 From: stippi Date: Sun, 23 May 2010 13:21:43 +0000 Subject: [PATCH] When the expected size of a download is unknown, at least set the progress bar to 100% when it finished. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@519 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/DownloadProgressView.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/apps/webpositive/DownloadProgressView.cpp b/src/apps/webpositive/DownloadProgressView.cpp index ad02111a05..f819651f72 100644 --- a/src/apps/webpositive/DownloadProgressView.cpp +++ b/src/apps/webpositive/DownloadProgressView.cpp @@ -372,7 +372,7 @@ DownloadProgressView::MessageReceived(BMessage* message) = fProcessStartTime = fLastSpeedReferenceTime = fEstimatedFinishReferenceTime = system_time(); break; - }; + } case B_DOWNLOAD_PROGRESS: { int64 currentSize; @@ -383,6 +383,12 @@ DownloadProgressView::MessageReceived(BMessage* message) } break; } + case B_DOWNLOAD_REMOVED: + // TODO: This is a bit asymetric. The removed notification + // arrives here, but it would be nicer if it arrived + // at the window... + Window()->PostMessage(message); + break; case OPEN_DOWNLOAD: { // TODO: In case of executable files, ask the user first! @@ -414,12 +420,6 @@ DownloadProgressView::MessageReceived(BMessage* message) // TOAST! return; } - case B_DOWNLOAD_REMOVED: - // TODO: This is a bit asymetric. The removed notification - // arrives here, but it would be nicer if it arrived - // at the window... - Window()->PostMessage(message); - break; case B_NODE_MONITOR: { int32 opCode; @@ -610,6 +610,10 @@ void DownloadProgressView::DownloadFinished() { fDownload = NULL; + if (fExpectedSize == -1) { + fStatusBar->SetTo(100.0); + fExpectedSize = fCurrentSize; + } fTopButton->SetEnabled(true); fBottomButton->SetLabel("Remove"); fBottomButton->SetMessage(new BMessage(REMOVE_DOWNLOAD));