2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * @file IEmailAccount.cpp
20 * @author Pawel Misiak (p.misiak@samsung.com)
25 #include <Commons/Exception.h>
26 #include "IEmailAccount.h"
28 namespace WrtDeviceApis {
31 IEmailAccount::IEmailAccount() :
32 m_currentAccount("", "", ""),
37 IEmailAccount::~IEmailAccount()
41 void IEmailAccount::setCurrentEmailAccount(const EmailAccountInfo& account)
43 std::vector<EmailAccountInfo> accounts = getEmailAccounts();
44 if (std::find(accounts.begin(), accounts.end(),
45 account) != accounts.end()) {
46 m_currentAccount = account;
48 ThrowMsg(Commons::InvalidArgumentException,
49 "Wrong account name, account not exist");
53 EmailAccountInfo IEmailAccount::getCurrentEmailAccount() const
55 return m_currentAccount;
58 bool IEmailAccount::isCurrentAccountValid() const
60 return m_validAccount;
63 void IEmailAccount::setCurrentAccountValid(bool state)
65 m_validAccount = state;