tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / 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  * @file       Email.h
20  * @author     Pawel Misiak (p.misiak@samsung.com)
21  * @version    0.1
22  * @brief
23  */
24 #ifndef EMAIL_H
25 #define EMAIL_H
26
27 #include <string>
28 #include <dpl/mutex.h>
29 #include <API/Messaging/IEmail.h>
30 #include <API/Messaging/IMessagingTypes.h>
31
32 #include "ScopedMail.h"
33 #include "ScopedMailbox.h"
34
35 // The email service library
36 extern "C" {
37 //temporary solution for email-service problem (compilation break)
38 #ifndef NOW_REVERT
39 //#define NOW_REVERT
40 #endif
41 #ifndef SUPPORT_CONTACT_ON_SIM
42 //#define SUPPORT_CONTACT_ON_SIM
43 #endif
44 #ifndef _A_PROJECT_
45 #define _A_PROJECT_
46 #endif
47
48 #ifndef _PREVIEW_IN_MAILIST
49 #define _PREVIEW_IN_MAILIST
50 #endif
51 }
52
53 namespace WrtDeviceApis {
54 namespace Messaging {
55 class Email : public Api::IEmail
56 {
57   public:
58     explicit Email(const std::string& id = std::string());
59
60     virtual ~Email();
61
62     virtual void send();
63
64     virtual void sendCancel();
65
66     // implementation of interface of IMessage class
67     virtual void update(bool draftsOnly = false);
68
69     virtual void readAllData();
70
71     virtual void moveToFolder(const Api::FolderType newFolder);
72
73     virtual void moveToFolder(const std::string& newFolder);
74
75     virtual void copyToFolder(const Api::FolderType newFolder);
76
77     virtual void copyToFolder(const std::string& newFolder);
78
79     virtual void remove();
80
81     virtual int getAccountId() const;
82
83   private:
84     void create();
85
86     void reload();
87
88     void readHeader();
89
90     void readBody();
91
92     void readInfo();
93
94     void updateBody();
95
96     void updateRecipients();
97
98     void updateFrom();
99
100     void updateAttachments();
101
102     void updateSubject();
103
104     void updateReadStatus();
105
106     void updatePriority();
107
108     int getIntId() const;
109
110   private:
111     DPL::Mutex m_updateMutex;
112     int m_accountId;
113     ScopedMail m_mail;
114     ScopedMailbox m_mailbox;
115 };
116 }
117 }
118
119 #endif