xref: /haiku/src/servers/mail/DefaultNotifier.h (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
1 /*
2  * Copyright 2011-2012, Haiku, Inc. All rights reserved.
3  * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef DEFAULT_NOTIFIER_H
7 #define DEFAULT_NOTIFIER_H
8 
9 
10 #include <Notification.h>
11 #include <String.h>
12 
13 #include "MailProtocol.h"
14 
15 #include "ErrorLogWindow.h"
16 #include "StatusWindow.h"
17 
18 
19 class DefaultNotifier : public BMailNotifier {
20 public:
21 								DefaultNotifier(const char* accountName,
22 									bool inbound, ErrorLogWindow* errorWindow,
23 									uint32 showMode);
24 								~DefaultNotifier();
25 
26 			BMailNotifier*		Clone();
27 
28 			void				ShowError(const char* error);
29 			void				ShowMessage(const char* message);
30 
31 			void				SetTotalItems(uint32 items);
32 			void				SetTotalItemsSize(uint64 size);
33 			void				ReportProgress(uint32 messages, uint64 bytes,
34 									const char* message = NULL);
35 			void				ResetProgress(const char* message = NULL);
36 
37 private:
38 			void				_NotifyIfAllowed(int timeout = 0);
39 
40 private:
41 			BString				fAccountName;
42 			bool				fIsInbound;
43 			ErrorLogWindow*		fErrorWindow;
44 			BNotification		fNotification;
45 			uint32&				fShowMode;
46 
47 			uint32				fTotalItems;
48 			uint32				fItemsDone;
49 			uint64				fTotalSize;
50 			uint64				fSizeDone;
51 };
52 
53 
54 #endif // DEFAULT_NOTIFIER_H
55