Update change log and spec for wrt-plugins-tizen_0.2.73
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Messaging / MessageFolder.cpp
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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. 
15 */
16
17  
18
19 #include "MessageFolder.h"
20 #include <CommonsJavaScript/JSUtils.h>
21 #include <Commons/Exception.h>
22 #include "MsgServiceHandleMgr.h"
23 #include <API/Messaging/IMessaging.h>
24
25 extern "C" {
26 #include <msg.h>
27 #include <msg_transport.h>
28 }
29
30 using namespace DPL;
31
32 namespace TizenApis {
33 namespace Platform {
34 namespace Messaging {
35
36         
37 MessageFolder::MessageFolder()
38 {
39 }
40
41 MessageFolder::MessageFolder(email_mailbox_t m_mailboxes)
42 {
43         m_id = m_mailboxes.mailbox_id;  
44         m_parentid = -1;
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)
51         {
52                 m_synchronizable = TRUE;
53         }else
54         {
55                 m_synchronizable = FALSE;
56         }
57 }
58
59 MessageFolder::~MessageFolder()
60 {
61 }
62
63 void MessageFolder::setName(std::string name)
64 {
65         m_name = name;
66 }
67 void MessageFolder::setSynchronizable(bool synchronizable)
68 {
69         m_synchronizable = synchronizable;
70 }
71
72
73 // getter
74 unsigned long MessageFolder::getId()
75 {
76         return m_id;
77 }
78 unsigned long MessageFolder::getParentId()
79 {
80         return m_parentid;
81 }
82 unsigned long MessageFolder::getAccountId()
83 {
84         return m_accountid;
85 }
86 unsigned short MessageFolder::getContentType()
87 {
88         return m_contentType;
89 }
90 std::string MessageFolder::getName()
91 {
92         return m_name;
93 }
94 std::string MessageFolder::getPath()
95 {
96         return m_path;
97 }
98 unsigned short MessageFolder::getType()
99 {
100         return m_type;
101 }
102
103 bool MessageFolder::getSynchronizable()
104 {
105         return m_synchronizable;
106 }
107
108 int MessageFolder::getFolderType(email_mailbox_type_e folderType)
109 {
110         if(EMAIL_MAILBOX_TYPE_INBOX == folderType)
111         {
112                 return FOLDER_INBOX;
113         }
114         else if(EMAIL_MAILBOX_TYPE_SENTBOX == folderType)
115         {
116                 return FOLDER_SENTBOX;
117         }
118         else if(EMAIL_MAILBOX_TYPE_DRAFT == folderType)
119         {
120                 return FOLDER_DRAFTS;
121         }
122         else if(EMAIL_MAILBOX_TYPE_OUTBOX == folderType)
123         {
124                 return FOLDER_OUTBOX;
125         }
126         else if(EMAIL_MAILBOX_TYPE_ALL_EMAILS != folderType)
127         {
128                 return FOLDER_NOTSTANDARD;
129         }
130
131         return FOLDER_NOTSTANDARD;
132 }
133
134
135 }
136 }
137 }
138