summaryrefslogtreecommitdiff
path: root/mobile_src/Messaging/Email.h
blob: 9b8773d517f7af9215e9a848d3a1dee41910fe6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//
// Tizen Web Device API
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#ifndef EMAIL_H
#define EMAIL_H

#include <string>
#include <dpl/mutex.h>
#include "IEmail.h"
#include "IMessagingTypes.h"
#include "EmailAccountInfo.h"

#include "ScopedMail.h"
#include "ScopedMailbox.h"

// The email service library
extern "C" {
//temporary solution for email-service problem (compilation break)
#ifndef NOW_REVERT
//#define NOW_REVERT
#endif
#ifndef SUPPORT_CONTACT_ON_SIM
//#define SUPPORT_CONTACT_ON_SIM
#endif
#ifndef _A_PROJECT_
#define _A_PROJECT_
#endif

#ifndef _PREVIEW_IN_MAILIST
#define _PREVIEW_IN_MAILIST
#endif
}

namespace DeviceAPI {
namespace Messaging {

class Email : public IEmail
{
  public:
    explicit Email(const std::string& id = std::string());

    explicit Email(const std::string& id, int accountId);

    explicit Email( EmailAccountInfo& account);

    explicit Email(const FolderType folder);	

    virtual ~Email();

    virtual int send();

    virtual void sendCancel(int handle);

	virtual int downloadBody();

	virtual void downloadBodyCancel( int handle );

	virtual int downloadAttachment(const IAttachmentPtr& attachment);

	virtual void downloadAttachmentCancel( int handle );

    // implementation of interface of IMessage class
    virtual void update(bool draftsOnly = false);

    virtual void readAllData();

    virtual void moveToFolder(const FolderType newFolder);

    virtual void moveToFolder(const std::string& newFolder);

    virtual void copyToFolder(const FolderType newFolder);

    virtual void copyToFolder(const std::string& newFolder);

    virtual void remove();

    virtual int removeFinishCheck();

    virtual int getAccountID();

    virtual int getUID();

    virtual int isBodyDownloaded();

    virtual bool hasAttachment();

  private:
    void create();

    void create( EmailAccountInfo& account );

    void reload();

    void readHeader();

    void readBody();

    void readInfo();

    void updateBody();

    void updateRecipients();

    void updateFrom();
	
    void updateAttachments();

    void updateSubject();

    void updateReadStatus();

    void updateIsRead();
	
    void updateMessage();	
	
    void addMessageToDraft();

    void loadDraftMessage();
	
    void createSendMessage();		
	
    void updatePriority();

    int getIntId() const;

  private:
    DPL::Mutex m_updateMutex;
    int m_accountId;
    ScopedMail m_mail;
    ScopedMailbox m_mailbox;	//delete?
};
}
}
#endif