2 * Copyright 2007-2012, Haiku, Inc. All rights reserved.
3 * Copyright 2001-2002, Dr. Zoidberg Enterprises. All rights reserved.
4 * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
6 * Distributed under the terms of the MIT License.
11 #include <GridLayout.h>
12 #include <MailFilter.h>
13 #include <MenuField.h>
14 #include <TextControl.h>
16 #include <FileConfigView.h>
17 #include <MailPrivate.h>
18 #include <ProtocolConfigView.h>
21 #undef B_TRANSLATION_CONTEXT
22 #define B_TRANSLATION_CONTEXT "ConfigView"
25 using namespace BPrivate
;
28 class SMTPConfigView
: public MailProtocolConfigView
{
31 const BMailAccountSettings
& settings
);
33 virtual status_t
SaveInto(BMailAddOnSettings
& settings
) const;
36 MailFileConfigView
* fFileView
;
40 SMTPConfigView::SMTPConfigView(const BMailAccountSettings
& settings
)
42 MailProtocolConfigView(B_MAIL_PROTOCOL_HAS_AUTH_METHODS
43 | B_MAIL_PROTOCOL_HAS_USERNAME
| B_MAIL_PROTOCOL_HAS_PASSWORD
44 | B_MAIL_PROTOCOL_HAS_HOSTNAME
45 | B_MAIL_PROTOCOL_HAS_FLAVORS
48 AddFlavor(B_TRANSLATE("Unencrypted"));
49 AddFlavor(B_TRANSLATE("SSL"));
51 AddAuthMethod(B_TRANSLATE("None"), false);
52 AddAuthMethod(B_TRANSLATE("ESMTP"));
53 AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);
55 BTextControl
* control
= (BTextControl
*)FindView("host");
56 control
->SetLabel(B_TRANSLATE("SMTP server:"));
58 SetTo(settings
.OutboundSettings());
60 fFileView
= new MailFileConfigView(B_TRANSLATE("Destination:"), "path",
61 false, BPrivate::default_mail_out_directory().Path());
62 fFileView
->SetTo(&settings
.OutboundSettings(), NULL
);
64 Layout()->AddView(fFileView
, 0, Layout()->CountRows(),
65 Layout()->CountColumns());
70 SMTPConfigView::SaveInto(BMailAddOnSettings
& settings
) const
72 status_t status
= fFileView
->SaveInto(settings
);
76 return MailProtocolConfigView::SaveInto(settings
);
84 instantiate_protocol_settings_view(const BMailAccountSettings
& accountSettings
,
85 const BMailProtocolSettings
& settings
)
87 return new SMTPConfigView(accountSettings
);