mail: fixes of default notifier (reset)

This fixes POP3 notification messages.

Change-Id: Ic7d9c0bb23c4dc9814f6c4bade0aba367fa28db1
Reviewed-on: https://review.haiku-os.org/685
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Peter Kosyh
2018-11-11 20:36:28 +00:00
committed by waddlesplash
parent fea29e79c7
commit 398bb93961
+6 -4
View File
@@ -104,6 +104,8 @@ DefaultNotifier::ReportProgress(uint32 messages, uint64 bytes,
const char* message) const char* message)
{ {
fSizeDone += bytes; fSizeDone += bytes;
fItemsDone += messages;
if (fTotalSize > 0) if (fTotalSize > 0)
fNotification.SetProgress(fSizeDone / (float)fTotalSize); fNotification.SetProgress(fSizeDone / (float)fTotalSize);
else if (fTotalItems > 0) { else if (fTotalItems > 0) {
@@ -117,8 +119,6 @@ DefaultNotifier::ReportProgress(uint32 messages, uint64 bytes,
fNotification.SetProgress(0); fNotification.SetProgress(0);
} }
fItemsDone += messages;
BString progress; BString progress;
progress << message << "\t"; progress << message << "\t";
@@ -128,7 +128,7 @@ DefaultNotifier::ReportProgress(uint32 messages, uint64 bytes,
fNotification.SetContent(progress); fNotification.SetContent(progress);
int timeout = 0; // Default timeout int timeout = 0; // Default timeout
if (fItemsDone == fTotalItems && fTotalItems != 0) if (fItemsDone >= fTotalItems && fTotalItems != 0)
timeout = 1; // We're done, make the window go away faster timeout = 1; // We're done, make the window go away faster
_NotifyIfAllowed(timeout); _NotifyIfAllowed(timeout);
@@ -138,10 +138,12 @@ DefaultNotifier::ReportProgress(uint32 messages, uint64 bytes,
void void
DefaultNotifier::ResetProgress(const char* message) DefaultNotifier::ResetProgress(const char* message)
{ {
fSizeDone = 0;
fItemsDone = 0;
fNotification.SetProgress(0); fNotification.SetProgress(0);
if (message != NULL) if (message != NULL)
fNotification.SetTitle(message); fNotification.SetTitle(message);
_NotifyIfAllowed(); _NotifyIfAllowed(1); // go away faster
} }