fat: Greatly simplify and clean up dosfs_get_file_map().
[haiku.git] / src / preferences / mail / AutoConfigView.h
blobe22bdbd812e633905476c123219a811c6b78e916
1 /*
2 * Copyright 2007-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 AUTO_CONFIG_VIEW_H
7 #define AUTO_CONFIG_VIEW_H
10 #include "AutoConfig.h"
11 #include "ConfigViews.h"
13 #include <Box.h>
14 #include <Entry.h>
15 #include <MenuField.h>
16 #include <String.h>
17 #include <TextControl.h>
20 const int32 kNameChangedMsg = '?nch';
21 const int32 kEMailChangedMsg = '?ech';
22 const int32 kProtokollChangedMsg = '?pch';
23 const int32 kServerChangedMsg = '?sch';
26 enum protocol_type {
27 POP,
28 IMAP,
29 SMTP
33 struct account_info {
34 protocol_type inboundType;
35 entry_ref inboundProtocol;
36 entry_ref outboundProtocol;
37 BString name;
38 BString accountName;
39 BString email;
40 BString loginName;
41 BString password;
42 provider_info providerInfo;
46 class AutoConfigView : public BBox {
47 public:
48 AutoConfigView(BRect rect, AutoConfig& config);
50 virtual void AttachedToWindow();
51 virtual void MessageReceived(BMessage *msg);
53 bool GetBasicAccountInfo(account_info &info);
54 bool IsValidMailAddress(BString email);
56 private:
57 BMenuField* _SetupProtocolView(BRect rect);
58 status_t _GetSMTPAddonRef(entry_ref *ref);
60 BString _ExtractLocalPart(const char* email);
61 void _ProposeUsername();
63 private:
64 entry_ref fSMTPAddonRef;
65 BMenuField* fInProtocolsField;
66 BTextControl* fNameView;
67 BTextControl* fAccountNameView;
68 BTextControl* fEmailView;
69 BTextControl* fLoginNameView;
70 BTextControl* fPasswordView;
72 // ref to the parent autoconfig so you only ones read the database
73 AutoConfig& fAutoConfig;
77 class ServerSettingsView : public BView {
78 public:
79 ServerSettingsView(BRect rect,
80 const account_info& info);
81 ~ServerSettingsView();
82 void GetServerInfo(account_info& info);
84 private:
85 void _DetectMenuChanges();
86 void _GetAuthEncrMenu(entry_ref protocol,
87 BMenuField** authField,
88 BMenuField** sslField);
90 private:
91 bool fInboundAccount;
92 bool fOutboundAccount;
93 BTextControl* fInboundNameView;
94 BMenuField* fInboundAuthMenu;
95 BMenuField* fInboundEncryptionMenu;
96 BTextControl* fOutboundNameView;
97 BMenuField* fOutboundAuthMenu;
98 BMenuField* fOutboundEncryptionMenu;
100 BMenuItem* fInboundAuthItemStart;
101 BMenuItem* fInboundEncrItemStart;
102 BMenuItem* fOutboundAuthItemStart;
103 BMenuItem* fOutboundEncrItemStart;
105 image_id fImageId;
109 #endif // AUTO_CONFIG_VIEW_H