xref: /haiku/src/preferences/mail/ConfigWindow.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 #ifndef CONFIG_WINDOW_H
2 #define CONFIG_WINDOW_H
3 /* ConfigWindow - main eMail config window
4  *
5  * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
6  * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
7 */
8 
9 
10 #include <Window.h>
11 #include <ObjectList.h>
12 #include <ListItem.h>
13 
14 #include "MailSettings.h"
15 
16 
17 class BPopup;
18 class BTextControl;
19 class BCheckBox;
20 class BListView;
21 class BButton;
22 class BMenuField;
23 class BMailSettings;
24 class CenterContainer;
25 
26 
27 enum item_types
28 {
29 	ACCOUNT_ITEM = 0,
30 	INBOUND_ITEM,
31 	OUTBOUND_ITEM,
32 	FILTER_ITEM
33 };
34 
35 
36 class AccountItem : public BStringItem {
37 public:
38 								AccountItem(const char* label,
39 									BMailAccountSettings* account,
40 									item_types type);
41 
42 			void				Update(BView* owner, const BFont* font);
43 			void				DrawItem(BView* owner, BRect rect,
44 									bool complete);
45 			BMailAccountSettings*	GetAccount() { return fAccount; }
46 			item_types			GetType() { return fType; }
47 
48 			void				SetConfigPanel(BView* panel);
49 			BView*				ConfigPanel();
50 private:
51 			BMailAccountSettings*	fAccount;
52 			item_types			fType;
53 			BView*				fConfigPanel;
54 };
55 
56 
57 class ConfigWindow : public BWindow {
58 public:
59 								ConfigWindow();
60 								~ConfigWindow();
61 
62 			bool				QuitRequested();
63 			void				MessageReceived(BMessage* msg);
64 
65 			BMailAccountSettings*	AddAccount();
66 			void				AccountUpdated(BMailAccountSettings* account);
67 
68 private:
69 			void				_MakeHowToView();
70 
71 			void				_LoadSettings();
72 			void				_LoadAccounts();
73 			void				_SaveSettings();
74 
75 			status_t			_SetToGeneralSettings(BMailSettings *general);
76 			void				_RevertToLastSettings();
77 
78 			void				_AddAccountToView(
79 									BMailAccountSettings* account);
80 			void				_RemoveAccount(BMailAccountSettings* account);
81 			void				_RemoveAccountFromListView(
82 									BMailAccountSettings* account);
83 			void				_AccountSelected(AccountItem* item);
84 
85 			BListView*			fAccountsListView;
86 			BMailAccountSettings*	fLastSelectedAccount;
87 			CenterContainer*	fConfigView;
88 			BButton*			fRemoveButton;
89 
90 			BTextControl*		fIntervalControl;
91 			BMenuField*			fIntervalUnitField;
92 			BCheckBox*			fPPPActiveCheckBox;
93 			BCheckBox*			fPPPActiveSendCheckBox;
94 			BMenuField*			fStatusModeField;
95 			BCheckBox*			fAutoStartCheckBox;
96 
97 			bool				fSaveSettings;
98 			BObjectList<BMailAccountSettings>	fAccounts;
99 			BObjectList<BMailAccountSettings>	fToDeleteAccounts;
100 };
101 
102 #endif	/* CONFIG_WINDOW_H */
103