64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Definition of the class CFsMtmClient.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CFSCLIENTMTM_H
|
|
20 |
#define CFSCLIENTMTM_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <mtclbase.h>
|
|
24 |
#include "cfsmailcommon.h"
|
|
25 |
|
|
26 |
#include <msvstd.hrh>
|
|
27 |
enum TEasEmailMTMCmds
|
|
28 |
{
|
|
29 |
KEasEmailMTMReadEntry = KMtmFirstFreeMtmFunctionId, //from <msvstd.hrh>
|
|
30 |
KEasEmailMTMAddEmailAttachment,
|
|
31 |
KEasEmailMTMDeleteEntry,
|
|
32 |
// KEEP THIS ALWAYS LAST!
|
|
33 |
KEasEmailMTMLastCommand
|
|
34 |
};
|
|
35 |
|
|
36 |
class CFsSendAsHelper;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Implements MFsEmailBaseMtm
|
|
40 |
*
|
|
41 |
* @since S60 v5.2
|
|
42 |
* @lib fsclientmtm.lib
|
|
43 |
*/
|
|
44 |
class MFsEmailBaseMtm
|
|
45 |
{
|
|
46 |
/**
|
|
47 |
* Creates a new MTM account. The account also acts as an Inbox folder
|
|
48 |
*
|
|
49 |
* @param aAccountName Freestyle Account name.
|
|
50 |
* @param aOwnAddress Freestyle Account own mail address.
|
|
51 |
* @param aMsgId Freestyle Account details.
|
|
52 |
* @return KErrNone if no problem in creating account.
|
|
53 |
*/
|
|
54 |
virtual TInt CreateAccountL( const TDesC& aAccountName,
|
|
55 |
const TDesC& aOwnAddress, TFSMailMsgId aMsgId) = 0;
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Deletes created MTM account.
|
|
59 |
*
|
|
60 |
* @param aAccountName Freestyle Account name.
|
|
61 |
* @param aMsgId Freestyle Account details.
|
|
62 |
* @return KErrNone if no problem in deleting account.
|
|
63 |
*/
|
|
64 |
virtual TInt DeleteAccountL( const TDesC& aAccountName,
|
|
65 |
TFSMailMsgId aMsgId) = 0;
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Renames existing MTM account.
|
|
69 |
*
|
|
70 |
* @param aAccountName Freestyle Account name.
|
|
71 |
* @param aOwnAddress Freestyle Account own mail address.
|
|
72 |
* @param aMsgId Freestyle Account details.
|
|
73 |
* @return KErrNone if no problem in deleting account.
|
|
74 |
*/
|
|
75 |
virtual TInt RenameAccountL( const TDesC& aAccountNewName,
|
|
76 |
const TDesC& aOwnAddress, TFSMailMsgId aMsgId) = 0;
|
|
77 |
};
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Implements CBaseMtm to provide Client-side MTM functionality
|
|
81 |
*
|
|
82 |
* @since S60 3.1
|
|
83 |
* @lib fsclientmtm.lib
|
|
84 |
*/
|
|
85 |
class CFsMtmClient : public CBaseMtm, public MFsEmailBaseMtm
|
|
86 |
{
|
|
87 |
public: // Construction and destruction
|
|
88 |
/**
|
|
89 |
* Constructs new object.
|
|
90 |
* @return created object.
|
|
91 |
*/
|
|
92 |
IMPORT_C static CFsMtmClient* NewL(
|
|
93 |
CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Destructor.
|
|
97 |
*/
|
|
98 |
~CFsMtmClient();
|
|
99 |
|
|
100 |
public: // From MFsEmailBaseMtm
|
|
101 |
virtual TInt CreateAccountL(const TDesC& aAccountName,
|
|
102 |
const TDesC& aOwnAddress, TFSMailMsgId aMsgId);
|
|
103 |
|
|
104 |
virtual TInt DeleteAccountL(const TDesC& aAccountName,
|
|
105 |
TFSMailMsgId aMsgId);
|
|
106 |
|
|
107 |
virtual TInt RenameAccountL( const TDesC& aAccountNewName,
|
|
108 |
const TDesC& aOwnAddress, TFSMailMsgId aMsgId);
|
|
109 |
|
|
110 |
public: // From CBaseMtm
|
|
111 |
|
|
112 |
virtual void SetSubjectL(const TDesC& aSubject);
|
|
113 |
|
|
114 |
// Attachment functions to support the SendAs API
|
|
115 |
virtual void AddAttachmentL(const TDesC& aFilePath,
|
|
116 |
const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
|
|
117 |
|
|
118 |
virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType,
|
|
119 |
TUint aCharset, TRequestStatus& aStatus);
|
|
120 |
|
|
121 |
virtual void AddLinkedAttachmentL(const TDesC& aFilePath,
|
|
122 |
const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
|
|
123 |
|
|
124 |
virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId,
|
|
125 |
TRequestStatus& aStatus);
|
|
126 |
|
|
127 |
virtual void CreateAttachmentL(const TDesC& aFileName,
|
|
128 |
RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset,
|
|
129 |
TRequestStatus& aStatus);
|
|
130 |
|
|
131 |
// Addressee list (used by objects with no MTM knowledge)
|
|
132 |
void AddAddresseeL(const TDesC& aRealAddress);
|
|
133 |
|
|
134 |
void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
|
|
135 |
|
|
136 |
void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress);
|
|
137 |
|
|
138 |
void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress,
|
|
139 |
const TDesC& aAlias);
|
|
140 |
|
|
141 |
void RemoveAddressee(TInt aIndex);
|
|
142 |
|
|
143 |
// Store and restore entry data
|
|
144 |
void SaveMessageL();
|
|
145 |
|
|
146 |
void LoadMessageL();
|
|
147 |
|
|
148 |
// Response message creation
|
|
149 |
CMsvOperation* ReplyL (TMsvId aReplyEntryId, TMsvPartList aPartlist,
|
|
150 |
TRequestStatus& aCompletionStatus);
|
|
151 |
|
|
152 |
CMsvOperation* ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList,
|
|
153 |
TRequestStatus& aCompletionStatus);
|
|
154 |
|
|
155 |
// Validation and search
|
|
156 |
TMsvPartList ValidateMessage(TUint aPartList);
|
|
157 |
|
|
158 |
TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
|
|
159 |
|
|
160 |
// MTM-specific functionality
|
|
161 |
TInt QueryCapability(TUid aCapability, TInt& aResponse);
|
|
162 |
|
|
163 |
void InvokeSyncFunctionL(TInt aFunctionId,
|
|
164 |
const CMsvEntrySelection& aSelection, TDes8& aParameter);
|
|
165 |
|
|
166 |
CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,
|
|
167 |
const CMsvEntrySelection& aSelection, TDes8& aParameter,
|
|
168 |
TRequestStatus& aCompletionStatus);
|
|
169 |
|
|
170 |
IMPORT_C TInt RemoveRedundantAccountsL(RArray<TFSMailMsgId>& aMailBoxIds);
|
|
171 |
|
|
172 |
IMPORT_C TInt AddEmailAsAttachmentL( const TUint& aPluginId, const TDesC& aAttachmentPath, TMsvId& aNewAttachEntryId );
|
|
173 |
IMPORT_C TInt DeleteEmailAsAttachmentL( const TMsvId aNewAttachEntryId );
|
|
174 |
|
|
175 |
protected: // From CBaseMtm
|
|
176 |
void ContextEntrySwitched();
|
|
177 |
|
|
178 |
private: // methods used internally
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Finds the accounts entry based on account name.
|
|
182 |
*
|
|
183 |
* @param aAccountName Freestyle Account name.
|
|
184 |
* @param aMsgId Freestyle Account details.
|
|
185 |
*/
|
|
186 |
void SetTMsvIdsL( const TDesC& aAccountName, TFSMailMsgId aMsgId);
|
|
187 |
|
|
188 |
private: // constructors
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Constructor.
|
|
192 |
*
|
|
193 |
* @param aRegisteredMtmDll To access self registry information.
|
|
194 |
* @param aMsvSession To communicate from Client to Server
|
|
195 |
*/
|
|
196 |
CFsMtmClient(CRegisteredMtmDll& aRegisteredMtmDll,
|
|
197 |
CMsvSession& aMsvSession);
|
|
198 |
/**
|
|
199 |
* Second-phase constructor.
|
|
200 |
*/
|
|
201 |
void ConstructL();
|
|
202 |
|
|
203 |
private: //data
|
|
204 |
// Current account details
|
|
205 |
TMsvId iAccountId;
|
|
206 |
|
|
207 |
// Current account details
|
|
208 |
CMsvEntry* iAccountEntry;
|
|
209 |
|
|
210 |
// To call sendasinfo functions.
|
|
211 |
CFsSendAsHelper* iSendAsHelper;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Tells if feature Email Attached In Email is ON or OFF.
|
|
215 |
* State is looked from cenrep.
|
|
216 |
*/
|
|
217 |
TBool iEmailAttachedInEmail;
|
|
218 |
|
|
219 |
CMsvOperationActiveSchedulerWait* iActiveSchedulerWait;
|
|
220 |
TMsvId iMTMAttachmentId;
|
|
221 |
};
|
|
222 |
|
|
223 |
#endif // CFSCLIENTMTM_H
|