|
1 /* |
|
2 * Copyright (c) 2005-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: UniHeaders declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __UNIHEADERS_H |
|
21 #define __UNIHEADERS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <mtclbase.h> // TMsvPartList |
|
27 #include <mmsgenutils.h> |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 // Maximum size for unified message field string value. |
|
32 const TInt KMaxHeaderStringLength = 1000; |
|
33 |
|
34 // MACROS |
|
35 |
|
36 // DATA TYPES |
|
37 |
|
38 // FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * This class provides access to unified message specific header data. |
|
46 * The class can be used from both Client MTM and Server MTM. |
|
47 */ |
|
48 NONSHARABLE_CLASS( CUniHeaders ) : public CBase |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CUniHeaders* NewL(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CUniHeaders(); |
|
61 |
|
62 public: // New functions |
|
63 |
|
64 /** |
|
65 * Reset. |
|
66 */ |
|
67 void Reset(); |
|
68 |
|
69 /** |
|
70 * Internalize the headers. |
|
71 * @param aStore CMsvStore |
|
72 */ |
|
73 void RestoreL( CMsvStore& aStore ); |
|
74 |
|
75 /** |
|
76 * Externalize the headers. |
|
77 * Caller must commit the store |
|
78 * @param aStore CMsvStore in edit mode. |
|
79 */ |
|
80 void StoreL( CMsvStore& aStore ); |
|
81 |
|
82 /** |
|
83 * Subject mutator. Note that Client MTM should update explicitly |
|
84 * TMsvEntry.iDescription too. |
|
85 * @param aSubject subject string, |
|
86 */ |
|
87 void SetSubjectL( const TDesC& aSubject ); |
|
88 |
|
89 /** |
|
90 * Subject accessor. |
|
91 * @return Subject string. |
|
92 */ |
|
93 TPtrC Subject() const; |
|
94 |
|
95 /** |
|
96 * Returns recipients that are of specified type (To, Cc, Bcc). |
|
97 * @param aType specifies recipient type |
|
98 * @return array of recipient addresses. |
|
99 */ |
|
100 const CDesCArray& TypedAddresseeList( TMsvRecipientType aType ); |
|
101 |
|
102 /** |
|
103 * Adds recipient with specified type (To, Cc, Bcc). |
|
104 * This function also adds all recipients into the internal list |
|
105 * that contains all addressees regardless of addressee type. |
|
106 * @param aRealAddress recipient address. |
|
107 * @param aType specifies recipient type |
|
108 */ |
|
109 void AddTypedAddresseeL( const TDesC& aRealAddress, |
|
110 TMsvRecipientType aType ); |
|
111 |
|
112 /** |
|
113 * Remove a given address from the right typed list. |
|
114 * @param aRealAddress recipient address. |
|
115 * @return ETrue is address is found and deleted. |
|
116 */ |
|
117 TBool RemoveAddressee( const TDesC& aRealAddress ); |
|
118 |
|
119 /** |
|
120 * Give const access to the "To" recipient list |
|
121 * @return recipient list |
|
122 */ |
|
123 inline const CDesCArray& ToRecipients() const; |
|
124 |
|
125 /** |
|
126 * Give const access to the "Cc" recipient list |
|
127 * @return recipient list |
|
128 */ |
|
129 inline const CDesCArray& CcRecipients() const; |
|
130 |
|
131 /** |
|
132 * Give const access to the "Bcc" recipient list |
|
133 * @return recipient list |
|
134 */ |
|
135 inline const CDesCArray& BccRecipients() const; |
|
136 |
|
137 /** |
|
138 * Size of the uni headers object in memory. |
|
139 * @return object size |
|
140 */ |
|
141 TInt Size() const; |
|
142 |
|
143 /** |
|
144 * Accessor for message type setting |
|
145 * @return Message type setting |
|
146 */ |
|
147 inline TInt32 MessageTypeSetting() const; |
|
148 |
|
149 /** |
|
150 * Mutator for message type setting |
|
151 * @param aSetting Message type setting |
|
152 */ |
|
153 inline void SetMessageTypeSetting( TInt32 aSetting ); |
|
154 |
|
155 /** |
|
156 * Accessor for message type locking |
|
157 * @return Message type locking |
|
158 */ |
|
159 inline TInt32 MessageTypeLocking() const; |
|
160 |
|
161 /** |
|
162 * Mutator for message type locking |
|
163 * @param aLocking Message type locking |
|
164 */ |
|
165 inline void SetMessageTypeLocking( TInt32 aLocking ); |
|
166 |
|
167 /** |
|
168 * Accessor for message root |
|
169 * @return Message root |
|
170 */ |
|
171 inline TMsvAttachmentId MessageRoot() const; |
|
172 |
|
173 /** |
|
174 * Mutator for message root |
|
175 * @param aRoot Message root |
|
176 */ |
|
177 inline void SetMessageRoot( TMsvAttachmentId aRoot ); |
|
178 |
|
179 public: // Functions from base classes |
|
180 |
|
181 |
|
182 protected: // New functions |
|
183 |
|
184 |
|
185 protected: // Functions from base classes |
|
186 |
|
187 |
|
188 private: |
|
189 |
|
190 /** |
|
191 * C++ default constructor. |
|
192 */ |
|
193 CUniHeaders(); |
|
194 |
|
195 /** |
|
196 * By default Symbian OS constructor is private. |
|
197 */ |
|
198 void ConstructL(); |
|
199 |
|
200 // By default, prohibit copy constructor |
|
201 CUniHeaders( const CUniHeaders& ); |
|
202 // Prohibit assignment operator |
|
203 CUniHeaders& operator= ( const CUniHeaders& ); |
|
204 |
|
205 /** |
|
206 * Internalize. |
|
207 * @param aStream read stream |
|
208 */ |
|
209 void InternalizeL( RMsvReadStream& aStream ); |
|
210 |
|
211 /** |
|
212 * Externalize. |
|
213 * @param aStream write stream |
|
214 */ |
|
215 void ExternalizeL( RMsvWriteStream& aStream ) const; |
|
216 |
|
217 /** |
|
218 * Remove a addressee from a given addressee list. |
|
219 * @param aList addressee list |
|
220 * @param aAddress addressee to match |
|
221 * @return ETrue if matched and deleted. |
|
222 */ |
|
223 TBool RemoveAddressee( |
|
224 CDesCArray& aList, |
|
225 const TDesC& aAddress ); |
|
226 |
|
227 /** |
|
228 * Externalize Array. |
|
229 * @param anArray the array to be externalized |
|
230 * @param aStream stream where to write. |
|
231 */ |
|
232 void ExternalizeArrayL( |
|
233 CDesC16Array& anArray, |
|
234 RWriteStream& aStream ) const; |
|
235 |
|
236 /** |
|
237 * Internalize Array. |
|
238 * @param anArray the array where to write data |
|
239 * @param aStream a stream where to read data from |
|
240 */ |
|
241 void InternalizeArrayL( |
|
242 CDesC16Array& anArray, |
|
243 RReadStream& aStream ); |
|
244 |
|
245 public: // Data |
|
246 |
|
247 protected: // Data |
|
248 |
|
249 private: // Data |
|
250 |
|
251 |
|
252 CDesCArray* iToArray; // TO headers |
|
253 CDesCArray* iCcArray; // Cc headers |
|
254 CDesCArray* iBccArray; // Bcc headers |
|
255 |
|
256 HBufC* iSubject; // Subject |
|
257 TInt32 iMessageTypeSetting; |
|
258 TInt32 iMessageTypeLocking; |
|
259 TMsvAttachmentId iMessageRoot; |
|
260 |
|
261 public: // Friend classes |
|
262 |
|
263 protected: // Friend classes |
|
264 |
|
265 private: // Friend classes |
|
266 |
|
267 |
|
268 }; |
|
269 |
|
270 #include "UniHeaders.inl" |
|
271 |
|
272 #endif // __UNIHEADERS_H |
|
273 |
|
274 // End of File |