Add settings to enable and disable in and outgoing mail accounts.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41077 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
37ffb53fb4
commit
08606d49da
@ -164,6 +164,11 @@ class BMailAccountSettings
|
||||
bool HasInbound();
|
||||
bool HasOutbound();
|
||||
|
||||
void SetInboundEnabled(bool enabled = true);
|
||||
bool IsInboundEnabled() const;
|
||||
void SetOutboundEnabled(bool enabled = true);
|
||||
bool IsOutboundEnabled() const;
|
||||
|
||||
status_t Reload();
|
||||
status_t Save();
|
||||
status_t Delete();
|
||||
@ -186,6 +191,9 @@ private:
|
||||
MailAddonSettings fInboundSettings;
|
||||
MailAddonSettings fOutboundSettings;
|
||||
|
||||
bool fInboundEnabled;
|
||||
bool fOutboundEnabled;
|
||||
|
||||
bool fModified;
|
||||
};
|
||||
|
||||
|
@ -611,6 +611,8 @@ MailAddonSettings::HasBeenModified()
|
||||
BMailAccountSettings::BMailAccountSettings()
|
||||
:
|
||||
fStatus(B_OK),
|
||||
fInboundEnabled(true),
|
||||
fOutboundEnabled(true),
|
||||
fModified(true)
|
||||
{
|
||||
fAccountID = real_time_clock();
|
||||
@ -772,6 +774,36 @@ BMailAccountSettings::HasOutbound()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BMailAccountSettings::SetInboundEnabled(bool enabled)
|
||||
{
|
||||
fInboundEnabled = enabled;
|
||||
fModified = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BMailAccountSettings::IsInboundEnabled() const
|
||||
{
|
||||
return fInboundEnabled;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BMailAccountSettings::SetOutboundEnabled(bool enabled)
|
||||
{
|
||||
fOutboundEnabled = enabled;
|
||||
fModified = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BMailAccountSettings::IsOutboundEnabled() const
|
||||
{
|
||||
return fOutboundEnabled;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMailAccountSettings::Reload()
|
||||
{
|
||||
@ -796,6 +828,11 @@ BMailAccountSettings::Reload()
|
||||
settings.FindMessage("outbound", &outboundSettings);
|
||||
fOutboundSettings.Load(outboundSettings);
|
||||
|
||||
if (settings.FindBool("inbound_enabled", &fInboundEnabled) != B_OK)
|
||||
fInboundEnabled = true;
|
||||
if (settings.FindBool("outbound_enabled", &fOutboundEnabled) != B_OK)
|
||||
fOutboundEnabled = true;
|
||||
|
||||
fModified = false;
|
||||
return B_OK;
|
||||
}
|
||||
@ -819,6 +856,9 @@ BMailAccountSettings::Save()
|
||||
fOutboundSettings.Save(outboundSettings);
|
||||
settings.AddMessage("outbound", &outboundSettings);
|
||||
|
||||
settings.AddBool("inbound_enabled", fInboundEnabled);
|
||||
settings.AddBool("outbound_enabled", fOutboundEnabled);
|
||||
|
||||
status_t status = _CreateAccountFilePath();
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
@ -223,8 +223,13 @@ void
|
||||
MailDaemonApp::_InitAccount(BMailAccountSettings& settings)
|
||||
{
|
||||
account_protocols account;
|
||||
account.inboundProtocol = _CreateInboundProtocol(settings,
|
||||
account.inboundImage);
|
||||
// inbound
|
||||
if (settings.IsInboundEnabled()) {
|
||||
account.inboundProtocol = _CreateInboundProtocol(settings,
|
||||
account.inboundImage);
|
||||
} else {
|
||||
account.inboundProtocol = NULL;
|
||||
}
|
||||
if (account.inboundProtocol) {
|
||||
DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), true,
|
||||
fErrorLogWindow, fMailStatusWindow);
|
||||
@ -235,8 +240,13 @@ MailDaemonApp::_InitAccount(BMailAccountSettings& settings)
|
||||
account.inboundThread->Run();
|
||||
}
|
||||
|
||||
account.outboundProtocol = _CreateOutboundProtocol(settings,
|
||||
account.outboundImage);
|
||||
// outbound
|
||||
if (settings.IsOutboundEnabled()) {
|
||||
account.outboundProtocol = _CreateOutboundProtocol(settings,
|
||||
account.outboundImage);
|
||||
} else {
|
||||
account.outboundProtocol = NULL;
|
||||
}
|
||||
if (account.outboundProtocol) {
|
||||
DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), false,
|
||||
fErrorLogWindow, fMailStatusWindow);
|
||||
|
Loading…
Reference in New Issue
Block a user