Update change log and spec for wrt-plugins-tizen_0.2.73
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Messaging / Email.h
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  *
20  *
21  * @file       Email.h
22  * @author     Pawel Misiak (p.misiak@samsung.com)
23  * @version    0.1
24  * @brief
25  */
26 #ifndef EMAIL_H
27 #define EMAIL_H
28
29 #include <string>
30 #include <dpl/mutex.h>
31 #include <API/Messaging/IEmail.h>
32 #include <API/Messaging/IMessagingTypes.h>
33 #include <API/Messaging/EmailAccountInfo.h>
34
35 #include "ScopedMail.h"
36 #include "ScopedMailbox.h"
37
38 // The email service library
39 extern "C" {
40 //temporary solution for email-service problem (compilation break)
41 #ifndef NOW_REVERT
42 //#define NOW_REVERT
43 #endif
44 #ifndef SUPPORT_CONTACT_ON_SIM
45 //#define SUPPORT_CONTACT_ON_SIM
46 #endif
47 #ifndef _A_PROJECT_
48 #define _A_PROJECT_
49 #endif
50
51 #ifndef _PREVIEW_IN_MAILIST
52 #define _PREVIEW_IN_MAILIST
53 #endif
54 }
55
56 namespace TizenApis {
57 namespace Platform {
58 namespace Messaging {
59
60 class Email : public Api::Messaging::IEmail
61 {
62   public:
63     explicit Email(const std::string& id = std::string());
64
65     explicit Email(const std::string& id, int accountId);
66
67     explicit Email( Api::Messaging::EmailAccountInfo& account);
68
69     explicit Email(const Api::Messaging::FolderType folder);    
70
71     virtual ~Email();
72
73     virtual int send();
74
75     virtual void sendCancel(int handle);
76
77         virtual int downloadBody();
78
79         virtual void downloadBodyCancel( int handle );
80
81         virtual int downloadAttachment(const Api::Messaging::IAttachmentPtr& attachment);
82
83         virtual void downloadAttachmentCancel( int handle );
84
85     // implementation of interface of IMessage class
86     virtual void update(bool draftsOnly = false);
87
88     virtual void readAllData();
89
90     virtual void moveToFolder(const Api::Messaging::FolderType newFolder);
91
92     virtual void moveToFolder(const std::string& newFolder);
93
94     virtual void copyToFolder(const Api::Messaging::FolderType newFolder);
95
96     virtual void copyToFolder(const std::string& newFolder);
97
98     virtual void remove();
99
100     virtual int getAccountID();
101
102     virtual int getUID();
103
104     virtual int isBodyDownloaded();
105
106     virtual bool hasAttachment();
107
108   private:
109     void create();
110
111     void create( Api::Messaging::EmailAccountInfo& account );
112
113     void reload();
114
115     void readHeader();
116
117     void readBody();
118
119     void readInfo();
120
121     void updateBody();
122
123     void updateRecipients();
124
125     void updateFrom();
126         
127     void updateAttachments();
128
129     void updateSubject();
130
131     void updateReadStatus();
132
133     void updateIsRead();
134         
135     void updateMessage();       
136         
137     void addMessageToDraft();
138         
139     void createSendMessage();           
140         
141     void updatePriority();
142
143     int getIntId() const;
144
145   private:
146     DPL::Mutex m_updateMutex;
147     int m_accountId;
148     ScopedMail m_mail;
149     ScopedMailbox m_mailbox;    //delete?
150 };
151 }
152 }
153 }
154 #endif