20 // ======== |
20 // ======== |
21 // INCLUDES |
21 // INCLUDES |
22 // ======== |
22 // ======== |
23 |
23 |
24 #include <e32svr.h> |
24 #include <e32svr.h> |
25 #include <S32MEM.H> |
25 #include <s32mem.h> |
26 //#include <MessageStoreClient.h> |
26 //#include <MessageStoreClient.h> |
27 //<cmail> |
27 //<cmail> |
28 #include "msgstoretypes.h" |
28 #include "msgstoretypes.h" |
29 #include "debuglogmacros.h" |
29 #include "debuglogmacros.h" |
30 //</cmail> |
30 //</cmail> |
31 |
31 |
32 #include "MessageStoreClientServer.h" |
32 #include "MessageStoreClientServer.h" |
33 #include "EmailStoreUids.hrh" |
33 #include "emailstoreuids.hrh" |
34 #include "PropertiesSerializer.h" |
34 #include "PropertiesSerializer.h" |
35 #include "MsgStoreFolder.h" |
35 #include "msgstorefolder.h" |
36 #include "MsgStoreObserver.h" |
36 #include "msgstoreobserver.h" |
37 #include "MsgStorePropertyContainerWithContent.h" |
37 #include "msgstorepropertycontainerwithcontent.h" |
38 #include "MsgStoreSessionContext.h" |
38 #include "msgstoresessioncontext.h" |
39 |
39 |
40 // ========= |
40 // ========= |
41 // CONSTANTS |
41 // CONSTANTS |
42 // ========= |
42 // ========= |
43 |
43 |
44 //const TUint KSearchBufferLength = 30; |
44 //const TUint KSearchBufferLength = 30; |
45 |
45 |
46 |
46 |
47 /** This class defines the message store search client API. |
47 /** This class defines the message store search client API. |
48 |
48 |
49 This class is used to notify the search client of the completion of an asynchronous search of the |
49 This class is used to notify the search client of the completion of an asynchronous search of the |
50 message store. |
50 message store. |
51 */ |
51 */ |
52 class MMsgStoreSearchClient |
52 class MMsgStoreSearchClient |
53 { |
53 { |
54 public: |
54 public: |
55 |
55 |
56 virtual void MatchFound( TMsgStoreId aMessageId ) = 0; |
56 virtual void MatchFound( TMsgStoreId aMessageId ) = 0; |
57 |
57 |
58 virtual void SearchCompleted() = 0; |
58 virtual void SearchCompleted() = 0; |
59 |
59 |
60 }; // end class MMsgStoreSearchClient |
60 }; // end class MMsgStoreSearchClient |
61 |
61 |
62 |
62 |
63 /** This class defines the message store quick property client API. |
63 /** This class defines the message store quick property client API. |
64 |
64 |
65 This class is used to notify the client when a quick property is ready to be processed, or |
65 This class is used to notify the client when a quick property is ready to be processed, or |
66 to notify the client something has changed, restart building the list |
66 to notify the client something has changed, restart building the list |
67 */ |
67 */ |
68 class MMsgStoreQuickPropertyClient |
68 class MMsgStoreQuickPropertyClient |
69 { |
69 { |
70 public: |
70 public: |
71 |
71 |
72 virtual void ProcessQuickProperty( const CMsgStorePropertyContainer& aContainer ) = 0; |
72 virtual void ProcessQuickProperty( const CMsgStorePropertyContainer& aContainer ) = 0; |
73 |
73 |
74 virtual void Reset() = 0; |
74 virtual void Reset() = 0; |
75 |
75 |
76 }; // end class MMsgStoreSearchClient |
76 }; // end class MMsgStoreSearchClient |
77 |
77 |
78 |
78 |
79 |
79 |
80 // =============================== |
80 // =============================== |
81 // CLASS: TPropertyContainerProxy |
81 // CLASS: TPropertyContainerProxy |
82 // =============================== |
82 // =============================== |
83 class TPropertyContainerProxy : public MPropertiesArray |
83 class TPropertyContainerProxy : public MPropertiesArray |
84 { |
84 { |
85 public: |
85 public: |
86 |
86 |
87 // ============== |
87 // ============== |
88 // PUBLIC METHODS |
88 // PUBLIC METHODS |
89 // ============== |
89 // ============== |
90 |
90 |
91 TPropertyContainerProxy( MMsgStoreQuickPropertyClient& aClient ); |
91 TPropertyContainerProxy( MMsgStoreQuickPropertyClient& aClient ); |
92 |
92 |
93 // inherited from MPropertiesArray |
93 // inherited from MPropertiesArray |
94 virtual void AddElementL( TMsgStoreId aId, TMsgStoreId aParentId, const TDesC8& aProperties ); |
94 virtual void AddElementL( TMsgStoreId aId, TMsgStoreId aParentId, const TDesC8& aProperties ); |
95 virtual void Reset(); |
95 virtual void Reset(); |
96 |
96 |
97 private: |
97 private: |
98 |
98 |
99 // ================== |
99 // ================== |
100 // PRIVATE ATTRIBUTES |
100 // PRIVATE ATTRIBUTES |
101 // ================== |
101 // ================== |
102 |
102 |
103 MMsgStoreQuickPropertyClient& iClient; |
103 MMsgStoreQuickPropertyClient& iClient; |
104 |
104 |
105 }; // end class TPropertyContainerProxy |
105 }; // end class TPropertyContainerProxy |
106 |
106 |
107 |
107 |
116 #if 0 |
116 #if 0 |
117 // ========================================================================== |
117 // ========================================================================== |
118 // FUNCTION: CopyAttachmentL |
118 // FUNCTION: CopyAttachmentL |
119 // ========================================================================== |
119 // ========================================================================== |
120 EXPORT_C TMsgStoreId CMsgStoreSession::CopyAttachmentL( TMsgStoreId aAttachmentId, |
120 EXPORT_C TMsgStoreId CMsgStoreSession::CopyAttachmentL( TMsgStoreId aAttachmentId, |
121 TMsgStoreId aSourceMessageId, |
121 TMsgStoreId aSourceMessageId, |
122 TMsgStoreId aSourceFolderId, |
122 TMsgStoreId aSourceFolderId, |
123 TMsgStoreId aDestinationMessageId, |
123 TMsgStoreId aDestinationMessageId, |
124 TMsgStoreId aDestinationFolderId ) |
124 TMsgStoreId aDestinationFolderId ) |
125 { |
125 { |
126 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
126 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
127 iContext->VerifyTypeL( aSourceMessageId, EMsgStoreMessageBits ); |
127 iContext->VerifyTypeL( aSourceMessageId, EMsgStoreMessageBits ); |
128 iContext->VerifyTypeL( aSourceFolderId, EMsgStoreFolderBits ); |
128 iContext->VerifyTypeL( aSourceFolderId, EMsgStoreFolderBits ); |
129 iContext->VerifyTypeL( aDestinationMessageId, EMsgStoreMessageBits ); |
129 iContext->VerifyTypeL( aDestinationMessageId, EMsgStoreMessageBits ); |
130 iContext->VerifyTypeL( aDestinationFolderId, EMsgStoreFolderBits ); |
130 iContext->VerifyTypeL( aDestinationFolderId, EMsgStoreFolderBits ); |
131 |
131 |
132 return iContext->iSession.CopyContainerL( aAttachmentId, |
132 return iContext->iSession.CopyContainerL( aAttachmentId, |
133 aSourceMessageId, |
133 aSourceMessageId, |
134 aSourceFolderId, |
134 aSourceFolderId, |
135 aDestinationMessageId, |
135 aDestinationMessageId, |
136 aDestinationFolderId ); |
136 aDestinationFolderId ); |
137 } // end CopyAttachmentL |
137 } // end CopyAttachmentL |
138 |
138 |
139 // ========================================================================== |
139 // ========================================================================== |
140 // FUNCTION: QuickMessagePropertiesL |
140 // FUNCTION: QuickMessagePropertiesL |
141 // ========================================================================== |
141 // ========================================================================== |
142 EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, RPointerArray<CMsgStorePropertyContainer>& aQuickProperties ) |
142 EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, RPointerArray<CMsgStorePropertyContainer>& aQuickProperties ) |
143 { |
143 { |
144 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
144 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
145 |
145 |
146 TPropertyContainersArray containersArray( aQuickProperties ); |
146 TPropertyContainersArray containersArray( aQuickProperties ); |
147 |
147 |
148 iContext->iSession.ChildrenPropertiesL( aFolderId, // aId |
148 iContext->iSession.ChildrenPropertiesL( aFolderId, // aId |
149 KMsgStoreInvalidId, // aParentId (do not need to check parent ID) |
149 KMsgStoreInvalidId, // aParentId (do not need to check parent ID) |
150 EMsgStoreMessageBits, // aContainerType |
150 EMsgStoreMessageBits, // aContainerType |
151 ETrue, // aQuickProperties |
151 ETrue, // aQuickProperties |
152 EFalse, // aRecursive |
152 EFalse, // aRecursive |
153 containersArray ); |
153 containersArray ); |
154 } // end QuickMessagePropertiesL |
154 } // end QuickMessagePropertiesL |
155 |
155 |
156 // ========================================================================== |
156 // ========================================================================== |
157 // FUNCTION: QuickMessagePropertiesL overloaded |
157 // FUNCTION: QuickMessagePropertiesL overloaded |
158 // ========================================================================== |
158 // ========================================================================== |
159 EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, MMsgStoreQuickPropertyClient& aClient ) |
159 EXPORT_C void CMsgStoreSession::QuickMessagePropertiesL( TMsgStoreId aFolderId, MMsgStoreQuickPropertyClient& aClient ) |
160 { |
160 { |
161 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
161 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
162 |
162 |
163 TPropertyContainerProxy containerProxy( aClient ); |
163 TPropertyContainerProxy containerProxy( aClient ); |
164 |
164 |
165 iContext->iSession.ChildrenPropertiesL( aFolderId, // aId |
165 iContext->iSession.ChildrenPropertiesL( aFolderId, // aId |
166 KMsgStoreInvalidId, // aParentId (do not need to check parent ID) |
166 KMsgStoreInvalidId, // aParentId (do not need to check parent ID) |
167 EMsgStoreMessageBits, // aContainerType |
167 EMsgStoreMessageBits, // aContainerType |
168 ETrue, // aQuickProperties |
168 ETrue, // aQuickProperties |
169 EFalse, // aRecursive |
169 EFalse, // aRecursive |
170 containerProxy ); |
170 containerProxy ); |
171 } // end QuickMessagePropertiesL |
171 } // end QuickMessagePropertiesL |
172 |
172 |
173 // ========================================================================== |
173 // ========================================================================== |
174 // FUNCTION: AttachmentsL |
174 // FUNCTION: AttachmentsL |
175 // ========================================================================== |
175 // ========================================================================== |
176 EXPORT_C void CMsgStoreSession::AttachmentsL( TMsgStoreId aMessageId, |
176 EXPORT_C void CMsgStoreSession::AttachmentsL( TMsgStoreId aMessageId, |
177 TMsgStoreId aFolderId, |
177 TMsgStoreId aFolderId, |
178 RPointerArray<CMsgStoreAttachment>& aAttachmentsList ) |
178 RPointerArray<CMsgStoreAttachment>& aAttachmentsList ) |
179 { |
179 { |
180 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
180 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
181 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
181 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
182 |
182 |
183 // TAttachmentsArray attachmentsArray( *iContext, aAttachmentsList ); |
183 // TAttachmentsArray attachmentsArray( *iContext, aAttachmentsList ); |
184 |
184 |
185 iContext->iSession.ChildrenPropertiesL( aMessageId, // aId |
185 iContext->iSession.ChildrenPropertiesL( aMessageId, // aId |
186 aFolderId, // aParentId |
186 aFolderId, // aParentId |
187 EMsgStoreAttachmentBits, // aContainerType |
187 EMsgStoreAttachmentBits, // aContainerType |
188 EFalse, // aQuickProperties |
188 EFalse, // aQuickProperties |
189 EFalse, // aRecursive |
189 EFalse, // aRecursive |
190 attachmentsArray ); |
190 attachmentsArray ); |
191 } // end AttachmentsL |
191 } // end AttachmentsL |
192 |
192 |
193 // ========================================================================== |
193 // ========================================================================== |
194 // FUNCTION: AttachmentL |
194 // FUNCTION: AttachmentL |
195 // ========================================================================== |
195 // ========================================================================== |
196 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AttachmentL( TMsgStoreId aAttachmentId, |
196 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AttachmentL( TMsgStoreId aAttachmentId, |
197 TMsgStoreId aMessageId, |
197 TMsgStoreId aMessageId, |
198 TMsgStoreId aFolderId ) |
198 TMsgStoreId aFolderId ) |
199 { |
199 { |
200 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
200 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
201 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
201 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
202 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
202 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
203 |
203 |
204 RBuf8 propertiesBuf; |
204 RBuf8 propertiesBuf; |
205 CleanupClosePushL( propertiesBuf ); |
205 CleanupClosePushL( propertiesBuf ); |
206 |
206 |
207 iContext->iSession.ContainerPropertiesL( aAttachmentId, aMessageId, aFolderId, propertiesBuf ); |
207 iContext->iSession.ContainerPropertiesL( aAttachmentId, aMessageId, aFolderId, propertiesBuf ); |
208 |
208 |
209 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, aAttachmentId, aMessageId, propertiesBuf ); |
209 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, aAttachmentId, aMessageId, propertiesBuf ); |
210 |
210 |
211 CleanupStack::PopAndDestroy( &propertiesBuf ); |
211 CleanupStack::PopAndDestroy( &propertiesBuf ); |
212 |
212 |
213 return attachment; |
213 return attachment; |
214 } // end AttachmentL |
214 } // end AttachmentL |
215 |
215 |
216 // ========================================================================== |
216 // ========================================================================== |
217 // FUNCTION: AddAttachmentL |
217 // FUNCTION: AddAttachmentL |
218 // ========================================================================== |
218 // ========================================================================== |
219 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId, |
219 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId, |
220 TMsgStoreId aFolderId, |
220 TMsgStoreId aFolderId, |
221 const TDesC& aFilename, |
221 const TDesC& aFilename, |
222 const CMsgStorePropertyContainer& aProperties ) |
222 const CMsgStorePropertyContainer& aProperties ) |
223 { |
223 { |
224 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
224 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
225 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
225 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
226 |
226 |
227 if( aFilename.Length() == 0 ) |
227 if( aFilename.Length() == 0 ) |
228 { |
228 { |
229 __LOG_STATIC_ENTER( "msg", "AddAttachmentL" ) |
229 __LOG_STATIC_ENTER( "msg", "AddAttachmentL" ) |
230 __LOG_WRITE_ERROR( "zero length file name" ) |
230 __LOG_WRITE_ERROR( "zero length file name" ) |
231 __LOG_STATIC_EXIT |
231 __LOG_STATIC_EXIT |
232 User::Leave( KErrArgument ); |
232 User::Leave( KErrArgument ); |
233 } // end if |
233 } // end if |
234 |
234 |
235 RBuf8 serializedProperties; |
235 RBuf8 serializedProperties; |
236 CleanupClosePushL( serializedProperties ); |
236 CleanupClosePushL( serializedProperties ); |
237 aProperties.SerializeL( serializedProperties ); |
237 aProperties.SerializeL( serializedProperties ); |
238 |
238 |
239 TInt id = iContext->iSession.CreateContainerL( aMessageId, |
239 TInt id = iContext->iSession.CreateContainerL( aMessageId, |
240 aFolderId, |
240 aFolderId, |
241 EMsgStoreAttachmentBits, |
241 EMsgStoreAttachmentBits, |
242 serializedProperties, |
242 serializedProperties, |
243 ETrue, |
243 ETrue, |
244 aFilename ); |
244 aFilename ); |
245 |
245 |
246 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties ); |
246 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties ); |
247 |
247 |
248 CleanupStack::PopAndDestroy( &serializedProperties ); |
248 CleanupStack::PopAndDestroy( &serializedProperties ); |
249 |
249 |
250 return attachment; |
250 return attachment; |
251 } // end AddAttachmentL |
251 } // end AddAttachmentL |
252 |
252 |
253 // ========================================================================== |
253 // ========================================================================== |
254 // FUNCTION: AddAttachmentL |
254 // FUNCTION: AddAttachmentL |
255 // ========================================================================== |
255 // ========================================================================== |
256 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId, |
256 EXPORT_C CMsgStoreAttachment* CMsgStoreSession::AddAttachmentL( TMsgStoreId aMessageId, |
257 TMsgStoreId aFolderId, |
257 TMsgStoreId aFolderId, |
258 const CMsgStorePropertyContainer& aProperties ) |
258 const CMsgStorePropertyContainer& aProperties ) |
259 { |
259 { |
260 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
260 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
261 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
261 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
262 |
262 |
263 RBuf8 serializedProperties; |
263 RBuf8 serializedProperties; |
264 CleanupClosePushL( serializedProperties ); |
264 CleanupClosePushL( serializedProperties ); |
265 aProperties.SerializeL( serializedProperties ); |
265 aProperties.SerializeL( serializedProperties ); |
266 |
266 |
267 TInt id = iContext->iSession.CreateContainerL( aMessageId, |
267 TInt id = iContext->iSession.CreateContainerL( aMessageId, |
268 aFolderId, |
268 aFolderId, |
269 EMsgStoreAttachmentBits, |
269 EMsgStoreAttachmentBits, |
270 serializedProperties ); |
270 serializedProperties ); |
271 |
271 |
272 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties ); |
272 CMsgStoreAttachment* attachment = CMsgStoreAttachment::NewL( *iContext, id, aMessageId, serializedProperties ); |
273 |
273 |
274 CleanupStack::PopAndDestroy( &serializedProperties ); |
274 CleanupStack::PopAndDestroy( &serializedProperties ); |
275 |
275 |
276 return attachment; |
276 return attachment; |
277 } // end AddAttachmentL |
277 } // end AddAttachmentL |
278 |
278 |
279 // ========================================================================== |
279 // ========================================================================== |
280 // FUNCTION: RemoveAttachmentL |
280 // FUNCTION: RemoveAttachmentL |
281 // ========================================================================== |
281 // ========================================================================== |
282 EXPORT_C void CMsgStoreSession::RemoveAttachmentL( TMsgStoreId aAttachmentId, |
282 EXPORT_C void CMsgStoreSession::RemoveAttachmentL( TMsgStoreId aAttachmentId, |
283 TMsgStoreId aMessageId, |
283 TMsgStoreId aMessageId, |
284 TMsgStoreId aFolderId ) |
284 TMsgStoreId aFolderId ) |
285 { |
285 { |
286 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
286 iContext->VerifyTypeL( aMessageId, EMsgStoreMessageBits ); |
287 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
287 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
288 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
288 iContext->VerifyTypeL( aAttachmentId, EMsgStoreAttachmentBits ); |
289 |
289 |
290 iContext->iSession.DeleteContainerL( aAttachmentId, aMessageId, aFolderId ); |
290 iContext->iSession.DeleteContainerL( aAttachmentId, aMessageId, aFolderId ); |
291 } // end RemoveAttachmentL |
291 } // end RemoveAttachmentL |
292 |
292 |
293 // ========================================================================== |
293 // ========================================================================== |
294 // FUNCTION: SearchL |
294 // FUNCTION: SearchL |
295 // ========================================================================== |
295 // ========================================================================== |
296 EXPORT_C void CMsgStoreSession::SearchL( TMsgStoreId aFolderId, |
296 EXPORT_C void CMsgStoreSession::SearchL( TMsgStoreId aFolderId, |
297 TMsgStoreSearchType aSearchType, |
297 TMsgStoreSearchType aSearchType, |
298 const TDesC& aSearchString, |
298 const TDesC& aSearchString, |
299 MMsgStoreSearchClient& aSearchClient ) |
299 MMsgStoreSearchClient& aSearchClient ) |
300 { |
300 { |
301 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
301 iContext->VerifyTypeL( aFolderId, EMsgStoreFolderBits ); |
302 |
302 |
303 if( aSearchString.Length() == 0 ) |
303 if( aSearchString.Length() == 0 ) |
304 { |
304 { |
305 __LOG_STATIC_ENTER( "msg", "SearchL" ) |
305 __LOG_STATIC_ENTER( "msg", "SearchL" ) |
306 __LOG_WRITE_ERROR( "zero length search string" ) |
306 __LOG_WRITE_ERROR( "zero length search string" ) |
307 __LOG_STATIC_EXIT |
307 __LOG_STATIC_EXIT |
308 User::Leave( KErrArgument ); |
308 User::Leave( KErrArgument ); |
309 } // end if |
309 } // end if |
310 |
310 |
311 if( iContext->iSearchHandler ) |
311 if( iContext->iSearchHandler ) |
312 { |
312 { |
313 __LOG_STATIC_ENTER( "msg", "SearchL" ) |
313 __LOG_STATIC_ENTER( "msg", "SearchL" ) |
314 __LOG_WRITE_ERROR( "search already in progress" ) |
314 __LOG_WRITE_ERROR( "search already in progress" ) |
315 __LOG_STATIC_EXIT |
315 __LOG_STATIC_EXIT |
316 User::Leave( KErrInUse ); |
316 User::Leave( KErrInUse ); |
317 } // end if |
317 } // end if |
318 |
318 |
319 iContext->iSearchHandler = CMsgStoreSearchHandler::NewL( iContext->iSession, aFolderId, aSearchType, aSearchString, *this ); |
319 iContext->iSearchHandler = CMsgStoreSearchHandler::NewL( iContext->iSession, aFolderId, aSearchType, aSearchString, *this ); |
320 iContext->iSearchClient = &aSearchClient; |
320 iContext->iSearchClient = &aSearchClient; |
321 |
321 |
322 } // end SearchL |
322 } // end SearchL |
323 |
323 |
324 // ========================================================================== |
324 // ========================================================================== |
325 // FUNCTION: CancelSearch |
325 // FUNCTION: CancelSearch |
326 // ========================================================================== |
326 // ========================================================================== |
327 EXPORT_C void CMsgStoreSession::CancelSearch() |
327 EXPORT_C void CMsgStoreSession::CancelSearch() |
328 { |
328 { |
361 // FUNCTION: NewL |
361 // FUNCTION: NewL |
362 // ========================================================================== |
362 // ========================================================================== |
363 CMsgStoreSearchHandler* CMsgStoreSearchHandler::NewL( RMessageStoreSession& aSession, |
363 CMsgStoreSearchHandler* CMsgStoreSearchHandler::NewL( RMessageStoreSession& aSession, |
364 TMsgStoreId aFolderId, |
364 TMsgStoreId aFolderId, |
365 TMsgStoreSearchType aSearchType, |
365 TMsgStoreSearchType aSearchType, |
366 const TDesC& aSearchString, |
366 const TDesC& aSearchString, |
367 MMsgStoreSearchClient& aSearchClient ) |
367 MMsgStoreSearchClient& aSearchClient ) |
368 { |
368 { |
369 CMsgStoreSearchHandler* self = new(ELeave) CMsgStoreSearchHandler( aSession, aSearchClient ); |
369 CMsgStoreSearchHandler* self = new(ELeave) CMsgStoreSearchHandler( aSession, aSearchClient ); |
370 CleanupStack::PushL( self ); |
370 CleanupStack::PushL( self ); |
371 self->ConstructL( aFolderId, aSearchType, aSearchString ); |
371 self->ConstructL( aFolderId, aSearchType, aSearchString ); |
372 CleanupStack::Pop( self ); |
372 CleanupStack::Pop( self ); |
373 return self; |
373 return self; |
374 } // end NewL |
374 } // end NewL |
375 |
375 |
376 // ========================================================================== |
376 // ========================================================================== |
377 // FUNCTION: Constructor |
377 // FUNCTION: Constructor |
378 // ========================================================================== |
378 // ========================================================================== |
379 CMsgStoreSearchHandler::CMsgStoreSearchHandler( RMessageStoreSession& aSession, |
379 CMsgStoreSearchHandler::CMsgStoreSearchHandler( RMessageStoreSession& aSession, |
380 MMsgStoreSearchClient& aSearchClient ) : |
380 MMsgStoreSearchClient& aSearchClient ) : |
381 CActive( EPriorityStandard ), |
381 CActive( EPriorityStandard ), |
382 iSession( aSession ), |
382 iSession( aSession ), |
383 iSearchClient( aSearchClient ) |
383 iSearchClient( aSearchClient ) |
384 { |
384 { |
385 __LOG_CONSTRUCT( "msg", "CMsgStoreSearchHandler" ) |
385 __LOG_CONSTRUCT( "msg", "CMsgStoreSearchHandler" ) |
386 |
386 |
387 CActiveScheduler::Add(this); |
387 CActiveScheduler::Add(this); |
388 } // end constructor |
388 } // end constructor |
389 |
389 |
390 // ========================================================================== |
390 // ========================================================================== |
391 // FUNCTION: ConstructL |
391 // FUNCTION: ConstructL |
392 // ========================================================================== |
392 // ========================================================================== |
393 void CMsgStoreSearchHandler::ConstructL( TMsgStoreId aFolderId, |
393 void CMsgStoreSearchHandler::ConstructL( TMsgStoreId aFolderId, |
394 TMsgStoreSearchType aSearchType, |
394 TMsgStoreSearchType aSearchType, |
395 const TDesC& aSearchString ) |
395 const TDesC& aSearchString ) |
396 { |
396 { |
397 iMatchBuffer[0].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength ); |
397 iMatchBuffer[0].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength ); |
398 iMatchBuffer[1].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength ); |
398 iMatchBuffer[1].CreateL( sizeof(TMsgStoreId) * KSearchBufferLength ); |
399 |
399 |
400 iSession.PrepareSearchL( aFolderId, aSearchType, aSearchString ); |
400 iSession.PrepareSearchL( aFolderId, aSearchType, aSearchString ); |