btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / mail / ProtocolConfigView.h
blob7248d94df47b1dc5f04e3a06c87d10f7cae30907
1 /*
2 * Copyright 2004-2012, Haiku Inc. All rights reserved.
3 * Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
5 * Distributed under the terms of the MIT License.
6 */
7 #ifndef _PROTOCOL_CONFIG_VIEW_H
8 #define _PROTOCOL_CONFIG_VIEW_H
11 #include <CheckBox.h>
12 #include <StringView.h>
13 #include <TextControl.h>
14 #include <View.h>
16 #include <MailSettings.h>
17 #include <MailSettingsView.h>
20 class BCheckBox;
21 class BGridLayout;
22 class BMenuField;
23 class BTextControl;
26 namespace BPrivate {
29 class BodyDownloadConfigView : public BView {
30 public:
31 BodyDownloadConfigView();
33 void SetTo(const BMailProtocolSettings& settings);
35 status_t SaveInto(BMailAddOnSettings& settings) const;
37 virtual void MessageReceived(BMessage* message);
38 virtual void AttachedToWindow();
40 private:
41 BTextControl* fSizeControl;
42 BCheckBox* fPartialBox;
46 enum mail_protocol_config_options {
47 B_MAIL_PROTOCOL_HAS_AUTH_METHODS = 1,
48 B_MAIL_PROTOCOL_HAS_FLAVORS = 2,
49 B_MAIL_PROTOCOL_HAS_USERNAME = 4,
50 B_MAIL_PROTOCOL_HAS_PASSWORD = 8,
51 B_MAIL_PROTOCOL_HAS_HOSTNAME = 16,
52 B_MAIL_PROTOCOL_CAN_LEAVE_MAIL_ON_SERVER = 32,
53 B_MAIL_PROTOCOL_PARTIAL_DOWNLOAD = 64
57 class MailProtocolConfigView : public BMailSettingsView {
58 public:
59 MailProtocolConfigView(uint32 optionsMask
60 = B_MAIL_PROTOCOL_HAS_FLAVORS
61 | B_MAIL_PROTOCOL_HAS_USERNAME
62 | B_MAIL_PROTOCOL_HAS_PASSWORD
63 | B_MAIL_PROTOCOL_HAS_HOSTNAME);
64 virtual ~MailProtocolConfigView();
66 void SetTo(const BMailProtocolSettings& settings);
68 void AddFlavor(const char* label);
69 void AddAuthMethod(const char* label,
70 bool needUserPassword = true);
72 BGridLayout* Layout() const;
74 virtual status_t SaveInto(BMailAddOnSettings& settings) const;
76 virtual void AttachedToWindow();
77 virtual void MessageReceived(BMessage* message);
79 private:
80 BTextControl* _AddTextControl(BGridLayout* layout,
81 const char* name, const char* label);
82 BMenuField* _AddMenuField(BGridLayout* layout,
83 const char* name, const char* label);
84 void _StoreIndexOfMarked(BMessage& message,
85 const char* name, BMenuField* field) const;
86 void _StoreCheckBox(BMessage& message,
87 const char* name,
88 BCheckBox* checkBox) const;
89 void _SetCredentialsEnabled(bool enabled);
91 private:
92 BTextControl* fHostControl;
93 BTextControl* fUserControl;
94 BTextControl* fPasswordControl;
95 BMenuField* fFlavorField;
96 BMenuField* fAuthenticationField;
97 BCheckBox* fLeaveOnServerCheckBox;
98 BCheckBox* fRemoveFromServerCheckBox;
99 BodyDownloadConfigView* fBodyDownloadConfig;
103 } // namespace BPrivate
106 #endif /* _PROTOCOL_CONFIG_VIEW_H */