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 #include "MessageFolder.h"
20 #include <CommonsJavaScript/JSUtils.h>
21 #include <Commons/Exception.h>
22 #include "MsgServiceHandleMgr.h"
23 #include <API/Messaging/IMessaging.h>
27 #include <msg_transport.h>
37 MessageFolder::MessageFolder()
41 MessageFolder::MessageFolder(email_mailbox_t m_mailboxes)
43 m_id = m_mailboxes.mailbox_id;
45 m_accountid = m_mailboxes.account_id;
46 m_contentType = TYPE_EMAIL;
47 m_name = m_mailboxes.alias;
48 m_path = m_mailboxes.mailbox_name;
49 m_type = getFolderType(m_mailboxes.mailbox_type);
50 if(0 == m_mailboxes.local)
52 m_synchronizable = TRUE;
55 m_synchronizable = FALSE;
59 MessageFolder::~MessageFolder()
63 void MessageFolder::setName(std::string name)
67 void MessageFolder::setSynchronizable(bool synchronizable)
69 m_synchronizable = synchronizable;
74 unsigned long MessageFolder::getId()
78 unsigned long MessageFolder::getParentId()
82 unsigned long MessageFolder::getAccountId()
86 unsigned short MessageFolder::getContentType()
90 std::string MessageFolder::getName()
94 std::string MessageFolder::getPath()
98 unsigned short MessageFolder::getType()
103 bool MessageFolder::getSynchronizable()
105 return m_synchronizable;
108 int MessageFolder::getFolderType(email_mailbox_type_e folderType)
110 if(EMAIL_MAILBOX_TYPE_INBOX == folderType)
114 else if(EMAIL_MAILBOX_TYPE_SENTBOX == folderType)
116 return FOLDER_SENTBOX;
118 else if(EMAIL_MAILBOX_TYPE_DRAFT == folderType)
120 return FOLDER_DRAFTS;
122 else if(EMAIL_MAILBOX_TYPE_OUTBOX == folderType)
124 return FOLDER_OUTBOX;
126 else if(EMAIL_MAILBOX_TYPE_ALL_EMAILS != folderType)
128 return FOLDER_NOTSTANDARD;
131 return FOLDER_NOTSTANDARD;