|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifdef _DEBUG |
|
17 #undef _NO_SESSION_LOGGING_ |
|
18 #endif |
|
19 |
|
20 #include <s32std.h> |
|
21 |
|
22 #include "MSVIPC.H" |
|
23 #include "MSVUIDS.H" |
|
24 #include "MSVIDS.H" |
|
25 #include "MSVAPI.H" |
|
26 #include "MSVCOP.H" |
|
27 #include "MSVPANIC.H" |
|
28 |
|
29 #include <mmsvstoremanager.h> |
|
30 #include <tmsvsystemprogress.h> |
|
31 #include <tnonoperationmtmdata.h> |
|
32 |
|
33 const TInt KMsvSessionObserverArrayGranularity=4; |
|
34 |
|
35 //********************************** |
|
36 // CMsvSession |
|
37 //********************************** |
|
38 |
|
39 EXPORT_C CMsvSession* CMsvSession::OpenSyncL(MMsvSessionObserver& aObserver) |
|
40 // |
|
41 // |
|
42 // |
|
43 /** Creates a session synchronously. |
|
44 |
|
45 The session can be used once the function returns. |
|
46 |
|
47 @param aObserver A reference to a session observer, through which the program |
|
48 can be notified of important events regarding entries, MTMs, and the Message |
|
49 Server. |
|
50 @leave KErrNoMemory Not enough memory to create object. |
|
51 @return New session object */ |
|
52 { |
|
53 CMsvSession* self = new(ELeave) CMsvSession(aObserver); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(ETrue); |
|
56 CleanupStack::Pop(self); |
|
57 return self; |
|
58 } |
|
59 |
|
60 EXPORT_C CMsvSession* CMsvSession::OpenAsyncL(MMsvSessionObserver& aObserver) |
|
61 // |
|
62 // |
|
63 // |
|
64 /** Creates a session asynchronously. |
|
65 |
|
66 The session cannot be used until the passed MMsvSessionObserver observer has |
|
67 been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. |
|
68 If any functions are called before this, they will fail with KErrNotReady. |
|
69 |
|
70 @param aObserver A reference to a session observer, through which the program |
|
71 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
72 @return New session object |
|
73 @leave KErrNoMemory Not enough memory to create object. |
|
74 */ |
|
75 { |
|
76 CMsvSession* self = new(ELeave) CMsvSession(aObserver); |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(EFalse); |
|
79 CleanupStack::Pop(self); |
|
80 return self; |
|
81 } |
|
82 |
|
83 |
|
84 EXPORT_C CMsvSession* CMsvSession::OpenAsObserverL(MMsvSessionObserver& aObserver) |
|
85 // |
|
86 // |
|
87 // |
|
88 /** Creates a session that is used only as an observer. |
|
89 |
|
90 The session created with this function should only be used to observe events, and |
|
91 not actively use the server. It used for applications such as system monitoring utilities. |
|
92 |
|
93 @param aObserver A reference to a session observer, through which the program |
|
94 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
95 @return New session object |
|
96 @leave KErrNoMemory Not enough memory to create object. |
|
97 */ |
|
98 { |
|
99 CMsvSession* self = new(ELeave) CMsvSession(aObserver); |
|
100 CleanupStack::PushL(self); |
|
101 self->ConstructAsObserverL(); |
|
102 CleanupStack::Pop(self); |
|
103 return self; |
|
104 } |
|
105 |
|
106 |
|
107 /** |
|
108 Creates a session synchronously. |
|
109 |
|
110 The session can be used once the function returns. |
|
111 |
|
112 @param aObserver A reference to a session observer, through which the program |
|
113 can be notified of important events regarding entries, MTMs, and the Message |
|
114 Server. |
|
115 @param aFs A connected file server session |
|
116 @leave KErrNoMemory Not enough memory to create object. |
|
117 @return New session object |
|
118 */ |
|
119 EXPORT_C CMsvSession* CMsvSession::OpenSyncL(MMsvSessionObserver& aObserver, RFs& aFs) |
|
120 { |
|
121 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs); |
|
122 CleanupStack::PushL(self); |
|
123 self->ConstructL(ETrue); |
|
124 CleanupStack::Pop(self); |
|
125 return self; |
|
126 } |
|
127 |
|
128 /** |
|
129 Creates a session asynchronously. |
|
130 |
|
131 The session cannot be used until the passed MMsvSessionObserver observer has |
|
132 been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. |
|
133 If any functions are called before this, they will fail with KErrNotReady. |
|
134 |
|
135 @param aObserver A reference to a session observer, through which the program |
|
136 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
137 @param aFs A connected file server session |
|
138 @return New session object |
|
139 @leave KErrNoMemory Not enough memory to create object. |
|
140 */ |
|
141 EXPORT_C CMsvSession* CMsvSession::OpenAsyncL(MMsvSessionObserver& aObserver, RFs& aFs) |
|
142 { |
|
143 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs); |
|
144 CleanupStack::PushL(self); |
|
145 self->ConstructL(EFalse); |
|
146 CleanupStack::Pop(self); |
|
147 return self; |
|
148 } |
|
149 |
|
150 |
|
151 /** |
|
152 Creates a session that is used only as an observer. |
|
153 |
|
154 The session created with this function should only be used to observe events, and |
|
155 not actively use the server. It used for applications such as system monitoring utilities. |
|
156 |
|
157 @param aObserver A reference to a session observer, through which the program |
|
158 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
159 @param aFs A connected file server session |
|
160 @return New session object |
|
161 @leave KErrNoMemory Not enough memory to create object. |
|
162 */ |
|
163 EXPORT_C CMsvSession* CMsvSession::OpenAsObserverL(MMsvSessionObserver& aObserver, RFs& aFs) |
|
164 { |
|
165 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs); |
|
166 CleanupStack::PushL(self); |
|
167 self->ConstructAsObserverL(); |
|
168 CleanupStack::Pop(self); |
|
169 return self; |
|
170 } |
|
171 |
|
172 CMsvSession::CMsvSession(MMsvSessionObserver& aObserver) |
|
173 : CActive(EPriorityStandard), iMainObserver(aObserver), iReceiveEntryEvents(ETrue) |
|
174 { |
|
175 __DECLARE_NAME(_S("CMsvSession")); |
|
176 } |
|
177 |
|
178 CMsvSession::CMsvSession(MMsvSessionObserver& aObserver, RFs& aFs) |
|
179 : CActive(EPriorityStandard), iFs(aFs), iMainObserver(aObserver), iReceiveEntryEvents(ETrue), iUseSharedFs(ETrue) |
|
180 { |
|
181 } |
|
182 |
|
183 EXPORT_C CMsvSession* CMsvSession::OpenSyncL(MMsvSessionObserver& aObserver, TInt aPriority) |
|
184 // |
|
185 // |
|
186 // |
|
187 /** Creates a session synchronously. |
|
188 |
|
189 The session can be used once the function returns. |
|
190 Clients to specify a priority that is tuned to their scheduler. |
|
191 |
|
192 @param aObserver A reference to a session observer, through which the program |
|
193 can be notified of important events regarding entries, MTMs, and the Message |
|
194 Server. |
|
195 @param aPriority Active object priority |
|
196 @leave KErrNoMemory Not enough memory to create object. |
|
197 @return New session object */ |
|
198 { |
|
199 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aPriority); |
|
200 CleanupStack::PushL(self); |
|
201 self->ConstructL(ETrue); |
|
202 CleanupStack::Pop(self); |
|
203 return self; |
|
204 } |
|
205 |
|
206 EXPORT_C CMsvSession* CMsvSession::OpenAsyncL(MMsvSessionObserver& aObserver, TInt aPriority) |
|
207 // |
|
208 // |
|
209 // |
|
210 /** Creates a session asynchronously. |
|
211 |
|
212 The session cannot be used until the passed MMsvSessionObserver observer has |
|
213 been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. |
|
214 If any functions are called before this, they will fail with KErrNotReady. |
|
215 Clients to specify a priority that is tuned to their scheduler. |
|
216 |
|
217 @param aObserver A reference to a session observer, through which the program |
|
218 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
219 @param aPriority Active object priority |
|
220 @return New session object |
|
221 @leave KErrNoMemory Not enough memory to create object. |
|
222 */ |
|
223 { |
|
224 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aPriority); |
|
225 CleanupStack::PushL(self); |
|
226 self->ConstructL(EFalse); |
|
227 CleanupStack::Pop(self); |
|
228 return self; |
|
229 } |
|
230 |
|
231 |
|
232 EXPORT_C CMsvSession* CMsvSession::OpenAsObserverL(MMsvSessionObserver& aObserver, TInt aPriority) |
|
233 // |
|
234 // |
|
235 // |
|
236 /** Creates a session that is used only as an observer. |
|
237 |
|
238 The session created with this function should only be used to observe events, and |
|
239 not actively use the server. It used for applications such as system monitoring utilities. |
|
240 Clients to specify a priority that is tuned to their scheduler. |
|
241 |
|
242 @param aObserver A reference to a session observer, through which the program |
|
243 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
244 @param aPriority Active object priority |
|
245 @return New session object |
|
246 @leave KErrNoMemory Not enough memory to create object. |
|
247 */ |
|
248 { |
|
249 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aPriority); |
|
250 CleanupStack::PushL(self); |
|
251 self->ConstructAsObserverL(); |
|
252 CleanupStack::Pop(self); |
|
253 return self; |
|
254 } |
|
255 |
|
256 |
|
257 /** |
|
258 Creates a session synchronously. |
|
259 |
|
260 The session can be used once the function returns. |
|
261 Clients to specify a priority that is tuned to their scheduler. |
|
262 |
|
263 @param aObserver A reference to a session observer, through which the program |
|
264 can be notified of important events regarding entries, MTMs, and the Message |
|
265 Server. |
|
266 @param aFs A connected file server session |
|
267 @param aPriority Active object priority |
|
268 @leave KErrNoMemory Not enough memory to create object. |
|
269 @return New session object |
|
270 */ |
|
271 EXPORT_C CMsvSession* CMsvSession::OpenSyncL(MMsvSessionObserver& aObserver, RFs& aFs, TInt aPriority) |
|
272 { |
|
273 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs, aPriority); |
|
274 CleanupStack::PushL(self); |
|
275 self->ConstructL(ETrue); |
|
276 CleanupStack::Pop(self); |
|
277 return self; |
|
278 } |
|
279 |
|
280 /** |
|
281 Creates a session asynchronously. |
|
282 |
|
283 The session cannot be used until the passed MMsvSessionObserver observer has |
|
284 been informed that the message server is ready with TMsvSessionEvent::EMsvServerReady. |
|
285 If any functions are called before this, they will fail with KErrNotReady. |
|
286 Clients to specify a priority that is tuned to their scheduler. |
|
287 |
|
288 @param aObserver A reference to a session observer, through which the program |
|
289 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
290 @param aFs A connected file server session |
|
291 @param aPriority Active object priority |
|
292 @return New session object |
|
293 @leave KErrNoMemory Not enough memory to create object. |
|
294 */ |
|
295 EXPORT_C CMsvSession* CMsvSession::OpenAsyncL(MMsvSessionObserver& aObserver, RFs& aFs, TInt aPriority) |
|
296 { |
|
297 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs, aPriority); |
|
298 CleanupStack::PushL(self); |
|
299 self->ConstructL(EFalse); |
|
300 CleanupStack::Pop(self); |
|
301 return self; |
|
302 } |
|
303 |
|
304 |
|
305 /** |
|
306 Creates a session that is used only as an observer. |
|
307 |
|
308 The session created with this function should only be used to observe events, and |
|
309 not actively use the server. It used for applications such as system monitoring utilities. |
|
310 Clients to specify a priority that is tuned to their scheduler. |
|
311 |
|
312 @param aObserver A reference to a session observer, through which the program |
|
313 can be notified of important events regarding entries, MTMs, and the Message Server. |
|
314 @param aFs A connected file server session |
|
315 @param aPriority Active object priority |
|
316 @return New session object |
|
317 @leave KErrNoMemory Not enough memory to create object. |
|
318 */ |
|
319 EXPORT_C CMsvSession* CMsvSession::OpenAsObserverL(MMsvSessionObserver& aObserver, RFs& aFs, TInt aPriority) |
|
320 { |
|
321 CMsvSession* self = new(ELeave) CMsvSession(aObserver, aFs, aPriority); |
|
322 CleanupStack::PushL(self); |
|
323 self->ConstructAsObserverL(); |
|
324 CleanupStack::Pop(self); |
|
325 return self; |
|
326 } |
|
327 |
|
328 CMsvSession::CMsvSession(MMsvSessionObserver& aObserver, TInt aPriority) |
|
329 : CActive(aPriority), iMainObserver(aObserver), iReceiveEntryEvents(ETrue) |
|
330 { |
|
331 __DECLARE_NAME(_S("CMsvSession")); |
|
332 } |
|
333 |
|
334 CMsvSession::CMsvSession(MMsvSessionObserver& aObserver, RFs& aFs, TInt aPriority) |
|
335 : CActive(aPriority), iFs(aFs), iMainObserver(aObserver), iReceiveEntryEvents(ETrue), iUseSharedFs(ETrue) |
|
336 { |
|
337 } |
|
338 |
|
339 CMsvSession::~CMsvSession() |
|
340 { |
|
341 __ASSERT_ALWAYS(iCleanupList==NULL || iCleanupList->Count()==0, PanicServer(EMsvEntriesStillOnCleanupList)); |
|
342 delete iCleanupList; |
|
343 delete iNotifSelection; |
|
344 Cancel(); |
|
345 if (!iUseSharedFs) |
|
346 { |
|
347 iFs.Close(); |
|
348 } |
|
349 iSession->Close(); |
|
350 delete iSession; |
|
351 delete iObservers; |
|
352 delete iMessageFolder; |
|
353 |
|
354 #ifndef _NO_SESSION_LOGGING_ |
|
355 if (iLog.LogValid()) |
|
356 iLog.CloseLog(); |
|
357 iLog.Close(); |
|
358 #endif |
|
359 } |
|
360 |
|
361 void CMsvSession::ConstructL(TBool aSyncOpening) |
|
362 { |
|
363 if (!iUseSharedFs) |
|
364 { |
|
365 // Not using the connected file session, so need to connect |
|
366 User::LeaveIfError(iFs.Connect()); |
|
367 } |
|
368 iSession = new(ELeave) RMsvServerSession; |
|
369 |
|
370 TInt error = iSession->Connect(iFs); |
|
371 |
|
372 #ifndef _NO_SESSION_LOGGING_ |
|
373 CreateSessionLogL(); |
|
374 Log(_L("CMsvSession::ConstructL - iSession->Connect: %d"),error); |
|
375 #endif |
|
376 User::LeaveIfError(error); |
|
377 |
|
378 iCleanupList = new(ELeave) CMsvEntrySelection; |
|
379 iCleanupList->SetReserveL(1); |
|
380 |
|
381 iNotifSelection = new(ELeave) CMsvEntrySelection; |
|
382 CActiveScheduler::Add(this); |
|
383 iSession->QueueSessionEventRequest(iChange, iSequenceBuf, iStatus); |
|
384 SetActive(); |
|
385 if (aSyncOpening) |
|
386 { |
|
387 iSyncStart=KRequestPending; |
|
388 while(iSyncStart == KRequestPending) |
|
389 { |
|
390 User::WaitForRequest(iStatus); |
|
391 HandleNotifyL(); |
|
392 } |
|
393 GetMessageFolderL(); |
|
394 } |
|
395 } |
|
396 |
|
397 #ifndef _NO_SESSION_LOGGING_ |
|
398 void CMsvSession::CreateSessionLogL() |
|
399 { |
|
400 // Connect to flogger |
|
401 if (iLog.Connect() == KErrNone) |
|
402 { |
|
403 // Log name same as the process which creates the session |
|
404 TFileName name(RProcess().FileName()); |
|
405 TInt pos = name.LocateReverse('\\'); |
|
406 if (pos > 0) |
|
407 name = name.Mid(pos + 1); |
|
408 pos = name.LocateReverse('.'); |
|
409 if (pos > 0) |
|
410 name = name.Left(pos); |
|
411 name += _L(".txt"); |
|
412 |
|
413 iLog.CreateLog(_L("msgs"), name, EFileLoggingModeOverwrite); |
|
414 iLog.SetDateAndTime(EFalse, ETrue); |
|
415 |
|
416 Log(_L("Created new session")); |
|
417 } |
|
418 } |
|
419 |
|
420 void CMsvSession::Log(TRefByValue<const TDesC> aFmt, ...) |
|
421 { |
|
422 if (!iLog.LogValid()) |
|
423 return; |
|
424 |
|
425 VA_LIST list; |
|
426 VA_START(list, aFmt); |
|
427 |
|
428 // Generate the text |
|
429 TBuf<256> buf; |
|
430 buf.FormatList(aFmt, list); |
|
431 |
|
432 // Write to file |
|
433 _LIT(KFormatFile, "CMsvSession %x: %S"); |
|
434 iLog.WriteFormat(KFormatFile, this, &buf); |
|
435 |
|
436 #ifndef _NO_SESSION_LOGGING_SERIAL_ |
|
437 // Write to serial |
|
438 _LIT(KFormatSerial, "MSGS: CMsvSession %x: %S"); |
|
439 RDebug::Print(KFormatSerial, this, &buf); |
|
440 #endif |
|
441 } |
|
442 #endif |
|
443 |
|
444 void CMsvSession::ConstructAsObserverL() |
|
445 { |
|
446 ConstructL(ETrue); |
|
447 iSession->SetSessionAsObserver(); |
|
448 |
|
449 #ifndef _NO_SESSION_LOGGING_ |
|
450 Log(_L("The session is an observer")); |
|
451 #endif |
|
452 } |
|
453 |
|
454 /** |
|
455 Checks that the current drive matches the one on the server |
|
456 updates it if it doesn't |
|
457 used because sync create might cause the drive to change, which we |
|
458 will be notified about, but the client might try and do something |
|
459 before that notification comes in. |
|
460 **/ |
|
461 void CMsvSession::CheckDrive() |
|
462 { |
|
463 const TDriveNumber drive = STATIC_CAST(TDriveNumber,iSession->GetMessageDrive()); |
|
464 if (drive >= KErrNone && iDrive != drive) |
|
465 { |
|
466 iDrive = drive; |
|
467 TChar letter; |
|
468 const TInt err = RFs::DriveToChar(drive, letter); |
|
469 if (err == KErrNone) |
|
470 { |
|
471 TPtr path(iMessageFolder->Des()); |
|
472 TBuf<1> buf; |
|
473 buf.Append(letter); |
|
474 path.Replace(0, 1, buf); |
|
475 #ifndef _NO_SESSION_LOGGING_ |
|
476 Log(_L("Check Drive changed folder to %d, %S"), iDrive,iMessageFolder); |
|
477 #endif |
|
478 } |
|
479 } |
|
480 } |
|
481 |
|
482 void CMsvSession::GetMessageFolderL() |
|
483 // |
|
484 // |
|
485 // |
|
486 { |
|
487 |
|
488 TFileName dir; |
|
489 User::LeaveIfError(iSession->GetMessageDirectory(dir)); |
|
490 iDrive=STATIC_CAST(TDriveNumber,User::LeaveIfError(iSession->GetMessageDrive())); |
|
491 // The folder name needs deleting on index reload |
|
492 delete iMessageFolder; |
|
493 iMessageFolder = NULL; |
|
494 iMessageFolder=dir.AllocL(); |
|
495 |
|
496 #ifndef _NO_SESSION_LOGGING_ |
|
497 Log(_L("Message Folder is %d, %S"), iDrive,&dir); |
|
498 #endif |
|
499 } |
|
500 |
|
501 |
|
502 void CMsvSession::RunL() |
|
503 // |
|
504 // Called when a change request has been completed |
|
505 // |
|
506 { |
|
507 HandleNotifyL(); |
|
508 } |
|
509 |
|
510 TInt CMsvSession::RunError(TInt aError) |
|
511 // |
|
512 // Called on a leave in RunL |
|
513 // |
|
514 { |
|
515 TRAPD( |
|
516 error, |
|
517 NotifyAllObserversL( |
|
518 MMsvSessionObserver::EMsvGeneralError, |
|
519 STATIC_CAST(TAny *,&aError), |
|
520 NULL, |
|
521 NULL |
|
522 ) |
|
523 ); |
|
524 |
|
525 return error; |
|
526 } |
|
527 |
|
528 void CMsvSession::HandleNotifyL() |
|
529 { |
|
530 if (iStatus.Int()==KErrServerTerminated) |
|
531 { |
|
532 // the server has died, so no more changes will be notified |
|
533 NotifyAllObserversL(MMsvSessionObserver::EMsvServerTerminated, NULL, NULL, NULL); |
|
534 return; |
|
535 } |
|
536 __ASSERT_DEBUG(iStatus.Int()==KErrNone, PanicServer(EMsvErrorNotification)); |
|
537 |
|
538 TMsvNotifBuffer localBuffer(iChange); |
|
539 iNotifySequence = iSequenceBuf(); |
|
540 |
|
541 // needs to be requeued before notitication, because the main observer might delete the session |
|
542 iSession->QueueSessionEventRequest(iChange, iSequenceBuf, iStatus); |
|
543 if (iSyncStart != KRequestPending) |
|
544 SetActive(); |
|
545 |
|
546 DoHandleNotifyL(localBuffer); |
|
547 } |
|
548 |
|
549 |
|
550 void CMsvSession::DoHandleNotifyL(TMsvNotifBuffer& aBuffer) |
|
551 // |
|
552 // |
|
553 // |
|
554 { |
|
555 TMsvServerChangeNotificationType changeType; |
|
556 TMsvPackedChangeNotification changeBuffer(aBuffer); |
|
557 |
|
558 TInt parameter1, parameter2; |
|
559 iNotifSelection->Reset(); |
|
560 changeBuffer.UnpackL(changeType, *iNotifSelection, parameter1, parameter2); |
|
561 |
|
562 #ifndef _NO_SESSION_LOGGING_ |
|
563 Log(_L("Received notification %d, sequence %d"), changeType, iNotifySequence); |
|
564 #endif |
|
565 |
|
566 switch (changeType) |
|
567 { |
|
568 case EMsvEntriesCreated: |
|
569 NotifyAllObserversL(MMsvSessionObserver::EMsvEntriesCreated, (TAny*) iNotifSelection, (TAny*) ¶meter1, NULL); |
|
570 break; |
|
571 case EMsvEntriesChanged: |
|
572 NotifyAllObserversL(MMsvSessionObserver::EMsvEntriesChanged, (TAny*) iNotifSelection, (TAny*) ¶meter1, NULL); |
|
573 break; |
|
574 case EMsvEntriesDeleted: |
|
575 NotifyAllObserversL(MMsvSessionObserver::EMsvEntriesDeleted, (TAny*) iNotifSelection, (TAny*) ¶meter1, NULL); |
|
576 break; |
|
577 case EMsvEntriesMoved: |
|
578 NotifyAllObserversL(MMsvSessionObserver::EMsvEntriesMoved, (TAny*) iNotifSelection, (TAny*) ¶meter1, (TAny*) & parameter2); |
|
579 break; |
|
580 case EMsvMtmGroupInstalled: |
|
581 NotifyAllObserversL(MMsvSessionObserver::EMsvMtmGroupInstalled, NULL, (TAny*) ¶meter1, NULL); |
|
582 break; |
|
583 case EMsvMtmGroupDeInstalled: |
|
584 NotifyAllObserversL(MMsvSessionObserver::EMsvMtmGroupDeInstalled, NULL, (TAny*) ¶meter1, NULL); |
|
585 break; |
|
586 case EMsvCloseSession: |
|
587 NotifyAllObserversL(MMsvSessionObserver::EMsvCloseSession, (TAny*) &iNotifSelection->At(0), (TAny*) ¶meter1, NULL); |
|
588 break; |
|
589 // |
|
590 case EMsvIndexLoaded: |
|
591 if (iSyncStart==KRequestPending) |
|
592 { |
|
593 iSyncStart = KErrNone; |
|
594 } |
|
595 else |
|
596 { |
|
597 GetMessageFolderL(); // if this fails the session is usless, but they never get the server ready event |
|
598 NotifyAllObserversL(MMsvSessionObserver::EMsvServerReady, NULL, NULL, NULL); |
|
599 } |
|
600 break; |
|
601 // |
|
602 case EMsvIndexFailedToLoad: |
|
603 if (iSyncStart==KRequestPending) |
|
604 { |
|
605 iSyncStart = parameter1; |
|
606 } |
|
607 else |
|
608 NotifyAllObserversL(MMsvSessionObserver::EMsvServerFailedToStart, (TAny*) ¶meter1, NULL, NULL); |
|
609 break; |
|
610 // |
|
611 case EMsvMediaChanged: |
|
612 case EMsvMediaUnavailable: |
|
613 case EMsvMediaAvailable: |
|
614 case EMsvMediaIncorrect: |
|
615 { |
|
616 MMsvSessionObserver::TMsvSessionEvent event = MMsvSessionObserver::EMsvMediaChanged; |
|
617 event = (MMsvSessionObserver::TMsvSessionEvent)(event + (changeType - EMsvMediaChanged)); |
|
618 NotifyAllObserversL(event, ¶meter1, ¶meter2, NULL); |
|
619 break; |
|
620 } |
|
621 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
622 case EMsvMessageStoreNotSupported: |
|
623 NotifyAllObserversL(MMsvSessionObserver::EMsvMessageStoreNotSupported, (TAny*)¶meter1, NULL, NULL); |
|
624 break; |
|
625 |
|
626 case EMsvMessageStoreCorrupt: |
|
627 NotifyAllObserversL(MMsvSessionObserver::EMsvMessageStoreCorrupt, (TAny*)¶meter1, NULL, NULL); |
|
628 break; |
|
629 |
|
630 case EMsvRefreshMessageView: |
|
631 NotifyAllObserversL(MMsvSessionObserver::EMsvRefreshMessageView, (TAny*)¶meter1, NULL, NULL); |
|
632 break; |
|
633 |
|
634 case EMsvDiskNotAvailable: |
|
635 NotifyAllObserversL(MMsvSessionObserver::EMsvDiskNotAvailable, (TAny*)¶meter1, NULL, NULL); |
|
636 break; |
|
637 |
|
638 case EMsvUnableToProcessDiskNotification: |
|
639 NotifyAllObserversL(MMsvSessionObserver::EMsvUnableToProcessDiskNotification, (TAny*)¶meter1, NULL, NULL); |
|
640 break; |
|
641 #endif |
|
642 // |
|
643 default: |
|
644 __ASSERT_DEBUG(EFalse, PanicServer(EMsvUnknownChangeType2)); |
|
645 } |
|
646 } |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 void CMsvSession::DoCancel() |
|
652 // |
|
653 // |
|
654 // |
|
655 { |
|
656 iSession->CancelSessionEventRequest(); |
|
657 } |
|
658 |
|
659 |
|
660 void CMsvSession::NotifyAllObserversL(MMsvSessionObserver::TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
661 { |
|
662 if (iObservers) |
|
663 { |
|
664 TInt count=iObservers->Count(); |
|
665 while (count--) |
|
666 iObservers->At(count)->HandleSessionEventL(aEvent,aArg1,aArg2,aArg3); |
|
667 } |
|
668 // main observer told at end - so all entries etc can be updated |
|
669 iMainObserver.HandleSessionEventL(aEvent,aArg1,aArg2,aArg3); |
|
670 } |
|
671 |
|
672 |
|
673 EXPORT_C void CMsvSession::AddObserverL(MMsvSessionObserver& aObserver) |
|
674 // |
|
675 // |
|
676 // |
|
677 /** Registers a new session observer. |
|
678 |
|
679 CMsvSession objects can call back observer objects that implement the MMsvSessionObserver::HandleSessionEvent() |
|
680 when certain events occur. Any number of observers can be registered. |
|
681 |
|
682 For details of when observers are called, see TMsvSessionEvent::TMsvEntryEvent. |
|
683 |
|
684 @param aObserver A reference to an observer to be registered for events |
|
685 @leave KErrNoMemory Not enough memory to register the observer */ |
|
686 { |
|
687 if (iObservers==NULL) |
|
688 iObservers = new (ELeave) CArrayPtrFlat<MMsvSessionObserver>(KMsvSessionObserverArrayGranularity); |
|
689 iObservers->AppendL(&aObserver); |
|
690 |
|
691 User::LeaveIfError(iSession->SetReceiveEntryEvents(ETrue)); |
|
692 |
|
693 #ifndef _NO_SESSION_LOGGING_ |
|
694 Log(_L("Added new observer %d"), iObservers->Count()); |
|
695 #endif |
|
696 } |
|
697 |
|
698 EXPORT_C void CMsvSession::RemoveObserver(MMsvSessionObserver& aObserver) |
|
699 // |
|
700 // |
|
701 // |
|
702 /** Deregisters a previously registered observer. |
|
703 |
|
704 @param aObserver A reference to an observer to be unregistered for events */ |
|
705 { |
|
706 __ASSERT_DEBUG(iObservers, PanicServer(EMsvSessionNoObservers)); |
|
707 if (iObservers) |
|
708 { |
|
709 TInt count=iObservers->Count(); |
|
710 while (count--) |
|
711 { |
|
712 if (iObservers->At(count)==&aObserver) |
|
713 { |
|
714 #ifndef _NO_SESSION_LOGGING_ |
|
715 Log(_L("Removed observer %d"), count + 1); |
|
716 #endif |
|
717 iObservers->Delete(count); |
|
718 if (iObservers->Count()==0) |
|
719 { |
|
720 delete iObservers; |
|
721 iObservers=0; |
|
722 if(iReceiveEntryEvents==EFalse) |
|
723 // ignoring the returned error as I have no place to report it. |
|
724 iSession->SetReceiveEntryEvents(EFalse); |
|
725 } |
|
726 return; |
|
727 } |
|
728 } |
|
729 __ASSERT_DEBUG(count>=0, PanicServer(EMsvSessionUnknownObserver)); |
|
730 } |
|
731 } |
|
732 |
|
733 |
|
734 /** Sets whether the session's observer should be notified of events related to |
|
735 changes in message server entries. |
|
736 |
|
737 If the flag is set to true, the session observer will be notified of all events types. |
|
738 If it is set to false, the observer will not be notified of events of types EMsvEntriesCreated, |
|
739 EMsvEntriesChanged, EMsvEntriesDeleted, or EMsvEntriesMoved. (Event types are enumerated in |
|
740 MMsvSessionObserver::TMsvSessionEvent.) |
|
741 |
|
742 If a session has additional observers, as set through AddObserver(), then the value of this |
|
743 flag is ignored, and the observers receive notification of all events. |
|
744 @param aReceive |
|
745 @return Symbian OS error code |
|
746 @see MMsvSessionObserver::TMsvSessionEvent |
|
747 */ |
|
748 EXPORT_C TInt CMsvSession::SetReceiveEntryEvents(TBool aReceive) |
|
749 { |
|
750 TInt error=KErrNone; |
|
751 if(aReceive!=iReceiveEntryEvents) |
|
752 { |
|
753 iReceiveEntryEvents=aReceive; |
|
754 // don't send a turn off event if we have observers |
|
755 if(!(iReceiveEntryEvents==EFalse && iObservers!=NULL)) |
|
756 error=iSession->SetReceiveEntryEvents(iReceiveEntryEvents); |
|
757 } |
|
758 return error; |
|
759 } |
|
760 |
|
761 EXPORT_C CMsvOperation* CMsvSession::TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TRequestStatus& aStatus) |
|
762 // |
|
763 // |
|
764 // |
|
765 /** Passes MTM-specific operations asynchronously to the associated Server-side |
|
766 MTM by means of the Message Server. |
|
767 |
|
768 It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL()/InvokeAsyncFunctionL() |
|
769 and CBaseMtmUi::InvokeSyncFunctionL()/InvokeAsyncFunctionL(). It is not used |
|
770 by message client applications. How the passed aSelection and aParameter parameters |
|
771 are used is specific to the operation. |
|
772 |
|
773 Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL() |
|
774 on the relevant Server-side MTM. If the Server-side MTM is not already loaded, |
|
775 then the Message Server loads it. |
|
776 |
|
777 The returned CMsvOperation object completes when the operation is complete. |
|
778 |
|
779 @param aSelection A selection of entries that may be relevant to the operation |
|
780 |
|
781 @param aCommandId The command ID. The interpretation of the command is MTM-specific. |
|
782 |
|
783 @param aParameter A descriptor containing operation-specific parameters |
|
784 @param aStatus The request status to be completed when the operation has finished |
|
785 |
|
786 @leave KErrNoMemory Not enough memory |
|
787 @return The CMsvOperation object used to control the operation. */ |
|
788 { |
|
789 #ifndef _NO_SESSION_LOGGING_ |
|
790 Log(_L("Asynchronous transfer command %d"), aCommandId); |
|
791 #endif |
|
792 |
|
793 // get the mtm |
|
794 TMsvId service; |
|
795 TMsvEntry entry; |
|
796 User::LeaveIfError(iSession->GetEntry(aSelection.At(0), service, entry)); |
|
797 |
|
798 // create and start the operation |
|
799 CMsvEntryOperation* operation = CMsvEntryOperation::NewLC(*this, aStatus); |
|
800 operation->iMtm = entry.iMtm; |
|
801 operation->iService = entry.iServiceId; |
|
802 iSession->TransferCommandL(aSelection, aCommandId, aParameter, operation->Id(), operation->iStatus); |
|
803 operation->Start(); |
|
804 CleanupStack::Pop(operation); |
|
805 return operation; |
|
806 } |
|
807 |
|
808 EXPORT_C void CMsvSession::TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TDes8& aProgress) |
|
809 // |
|
810 // |
|
811 // |
|
812 /** Passes MTM-specific operations synchronously to the associated Server-side |
|
813 MTM by means of the Message Server. |
|
814 |
|
815 It is typically used in the implementation of CBaseMtm::InvokeSyncFunctionL() |
|
816 and CBaseMtmUi::InvokeSyncFunctionL(). It is not used by message client applications. |
|
817 How the passed aSelection and aParameter parameters are used is specific to |
|
818 the operation. |
|
819 |
|
820 Calling this function results in the Message Server calling CBaseServerMtm::StartCommandL() |
|
821 on the relevant Server-side MTM. If the Server-side MTM is not already loaded, |
|
822 then the Message Server loads it. |
|
823 |
|
824 @param aSelection A selection of entries that may be relevant to the operation |
|
825 |
|
826 @param aCommandId The command ID. The interpretation of the command is MTM-specific. |
|
827 |
|
828 @param aParameter A descriptor containing operation-specific parameters |
|
829 @param aProgress Progress information returned from the Message Server |
|
830 @leave KErrNoMemory Not enough memory */ |
|
831 { |
|
832 #ifndef _NO_SESSION_LOGGING_ |
|
833 Log(_L("Synchronous transfer command %d"), aCommandId); |
|
834 #endif |
|
835 |
|
836 TInt id = OperationId(); |
|
837 TInt transErr = iSession->TransferCommandL(aSelection, aCommandId, aParameter, id); |
|
838 TInt compErr = iSession->OperationCompletion(id, aProgress); |
|
839 User::LeaveIfError(transErr); |
|
840 if (compErr && compErr != KErrNotFound) |
|
841 User::Leave(compErr); |
|
842 } |
|
843 |
|
844 // static |
|
845 /** Cleans up an entry that has been added to the cleanup stack using CleanupEntryPushL(). |
|
846 |
|
847 This function defines the clean up function that is called when an entry on the stack |
|
848 needs cleaning up. |
|
849 |
|
850 @param aPtr Pointer to the current message server session |
|
851 */ |
|
852 EXPORT_C void CMsvSession::CleanupEntry(TAny* aPtr) |
|
853 { |
|
854 CMsvSession* session = STATIC_CAST(CMsvSession*, aPtr); |
|
855 session->CleanupEntryDelete(); |
|
856 } |
|
857 |
|
858 EXPORT_C void CMsvSession::CleanupEntryPushL(TMsvId aId) |
|
859 /** Pushes the specified entry ID to the entry cleanup stack. |
|
860 |
|
861 @param aId The ID of the entry to push onto the entry cleanup stack |
|
862 @leave KErrNoMemory The entry will have been pushed onto the entry cleanup stack |
|
863 before the leave occurs */ |
|
864 { |
|
865 iCleanupList->AppendL(aId); |
|
866 CleanupStack::PushL(TCleanupItem(CleanupEntry, this)); |
|
867 iCleanupList->SetReserveL(iCleanupList->Count()+1); |
|
868 } |
|
869 |
|
870 EXPORT_C void CMsvSession::CleanupEntryPop(TInt aCount) |
|
871 /** Pops one or more entries from the entry cleanup stack. |
|
872 |
|
873 @param aCount The number of entries to pop off the entry cleanup stack */ |
|
874 { |
|
875 iCleanupList->Delete(iCleanupList->Count()-aCount, aCount); |
|
876 CleanupStack::Pop(aCount); |
|
877 } |
|
878 |
|
879 void CMsvSession::CleanupEntryDelete() |
|
880 { |
|
881 TInt pos=iCleanupList->Count()-1; |
|
882 RemoveEntry(iCleanupList->At(pos)); |
|
883 iCleanupList->Delete(pos); |
|
884 } |
|
885 |
|
886 EXPORT_C void CMsvSession::IncPcSyncCountL(const CMsvEntrySelection& aSelection) |
|
887 /** Increases the PC synchronisation index field for a selection of entries. |
|
888 |
|
889 @param aSelection Entries for which to increase the PC synchronisation index |
|
890 field */ |
|
891 { |
|
892 #ifndef _NO_SESSION_LOGGING_ |
|
893 Log(_L("Increment sync count")); |
|
894 #endif |
|
895 |
|
896 __ASSERT_DEBUG(aSelection.Count(), PanicServer(EMsvEmptySelection)); |
|
897 iSession->ChangeAttributesL(aSelection, KMsvPcSyncCountAttribute, 0); |
|
898 } |
|
899 |
|
900 EXPORT_C void CMsvSession::DecPcSyncCountL(const CMsvEntrySelection& aSelection) |
|
901 /** Decreases the PC synchronisation index field for a selection of entries. |
|
902 |
|
903 If an entry has its Deleted flag set, and this call causes its PC synchronisation |
|
904 field to become zero, then the entry is permanently deleted. |
|
905 |
|
906 @param aSelection Entries for which to decrease the PC synchronisation index |
|
907 field */ |
|
908 { |
|
909 #ifndef _NO_SESSION_LOGGING_ |
|
910 Log(_L("Decrement sync count")); |
|
911 #endif |
|
912 |
|
913 __ASSERT_DEBUG(aSelection.Count(), PanicServer(EMsvEmptySelection)); |
|
914 iSession->ChangeAttributesL(aSelection, 0, KMsvPcSyncCountAttribute); |
|
915 } |
|
916 |
|
917 EXPORT_C void CMsvSession::GetChildIdsL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection) |
|
918 /** Gets filtered list of children of a specified message entry. |
|
919 |
|
920 @param aId Message entry of which to get children |
|
921 @param aFilter Filter by which various message entries can be excluded |
|
922 @param aSelection On return, a list of message entry IDs */ |
|
923 { |
|
924 __ASSERT_DEBUG(aSelection.Count() == 0, PanicServer(EMsvSelectionNotEmpty)); |
|
925 iSession->GetChildIdsL(aId, aFilter, aSelection); |
|
926 } |
|
927 |
|
928 EXPORT_C void CMsvSession::ChangeAttributesL(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes) |
|
929 /** Provides a quick way to set or clear multiple fields in a selection of entries. |
|
930 |
|
931 Fields to change are specified using a bitmask of TMsvAttribute values. Possible |
|
932 fields that can be changed using this function are: |
|
933 |
|
934 1. PC synchronisation |
|
935 |
|
936 2. Visibility flag |
|
937 |
|
938 3. Read flag |
|
939 |
|
940 4. In-preparation flag |
|
941 |
|
942 5. Connected flag |
|
943 |
|
944 6. New flag |
|
945 |
|
946 @param aSelection The entries to change |
|
947 @param aSetAttributes A bitmask of the fields to set |
|
948 @param aClearAttributes A bitmask of the fields to clear |
|
949 @see TMsvAttribute */ |
|
950 { |
|
951 #ifndef _NO_SESSION_LOGGING_ |
|
952 Log(_L("Change attributes, set %x, clear %x"), aSetAttributes, aClearAttributes); |
|
953 #endif |
|
954 |
|
955 __ASSERT_DEBUG(aSelection.Count(), PanicServer(EMsvEmptySelection)); |
|
956 iSession->ChangeAttributesL(aSelection, aSetAttributes, aClearAttributes); |
|
957 } |
|
958 |
|
959 |
|
960 |
|
961 EXPORT_C CMsvOperation* CMsvSession::ChangeDriveL(TInt aDrive, TRequestStatus& aStatus) |
|
962 // |
|
963 // Creates a child of the context |
|
964 // |
|
965 /** Changes the Message Server current drive to the specified drive. |
|
966 |
|
967 Progress information is provided by a TMsvIndexLoadProgress object. |
|
968 |
|
969 If an error occurs, the index is unchanged. |
|
970 |
|
971 @param aDrive The drive to which to move the Message Server index, specified |
|
972 by a TDriveNumber value |
|
973 @param aStatus Asynchronous completion status |
|
974 @leave KErrServerBusy Cannot change drive because there are outstanding Message |
|
975 Server operations. |
|
976 @return Asynchronous operation used to control the move. The operation's MTM |
|
977 value is set to KUidMsvServerMtm, which can be used to distinguish it from |
|
978 a local operation. |
|
979 @see TDriveNumber |
|
980 @see TMsvIndexLoadProgress */ |
|
981 { |
|
982 #ifndef _NO_SESSION_LOGGING_ |
|
983 Log(_L("Change drive to %d"), aDrive); |
|
984 #endif |
|
985 |
|
986 CMsvEntryOperation* operation = CMsvEntryOperation::NewL(*this, aStatus); |
|
987 CleanupStack::PushL(operation); |
|
988 |
|
989 operation->iMtm = KUidMsvServerMtm; // A different MTM type (like local) to identify this type of operation |
|
990 iSession->ChangeDriveL(aDrive, operation->Id(), operation->iStatus); |
|
991 operation->Start(); |
|
992 |
|
993 CleanupStack::Pop(operation); |
|
994 return operation; |
|
995 } |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 /** Copies the Message Store to the specified drive. |
|
1001 |
|
1002 Progress information is provided by a TMsvCopyProgress object. |
|
1003 |
|
1004 If an error occurs, the Message Store is unchanged. |
|
1005 |
|
1006 @param aDrive The drive to which to copy the Message Store, specified by a TDriveUnit value |
|
1007 @param aStatus Asynchronous completion status |
|
1008 @leave KErrServerBusy Cannot copy store because there are outstanding Message Server operations. |
|
1009 @return Asynchronous operation used to control the move. The operation's MTM value is set to |
|
1010 KUidMsvServerMtm, which can be used to distinguish it from a local operation. |
|
1011 @see TDriveUnit |
|
1012 @see TMsvCopyDeleteProgress */ |
|
1013 |
|
1014 EXPORT_C CMsvOperation* CMsvSession::CopyStoreL(const TDriveUnit& aDrive, TRequestStatus& aStatus) |
|
1015 { |
|
1016 #ifndef _NO_SESSION_LOGGING_ |
|
1017 Log(_L("Copy Message Store to %d"), (TInt)aDrive); |
|
1018 #endif |
|
1019 |
|
1020 CMsvEntryOperation* operation = CMsvEntryOperation::NewL(*this, aStatus); |
|
1021 CleanupStack::PushL(operation); |
|
1022 |
|
1023 operation->iMtm = KUidMsvServerMtm; // A different MTM type (like local) to identify this type of operation |
|
1024 |
|
1025 iSession->CopyStoreL(aDrive, operation->Id(), operation->iStatus); |
|
1026 operation->Start(); |
|
1027 |
|
1028 CleanupStack::Pop(operation); |
|
1029 return operation; |
|
1030 } |
|
1031 |
|
1032 |
|
1033 |
|
1034 /** Deletes the Message Store to the specified drive. |
|
1035 |
|
1036 Progress information is provided by a TMsvDeleteProgress object. |
|
1037 |
|
1038 If an error occurs, the Message Store is unchanged. |
|
1039 |
|
1040 @param aDrive The drive to which to copy the Message Store, specified by a TDriveUnit value |
|
1041 @param aStatus Asynchronous completion status |
|
1042 @leave KErrServerBusy Cannot copy store because there are outstanding Message Server operations. |
|
1043 @return Asynchronous operation used to control the move. The operation's MTM value is set to |
|
1044 KUidMsvServerMtm, which can be used to distinguish it from a local operation. |
|
1045 @see TDriveUnit |
|
1046 @see TMsvCopyDeleteProgress */ |
|
1047 |
|
1048 EXPORT_C CMsvOperation* CMsvSession::DeleteStoreL(const TDriveUnit& aDrive, TRequestStatus& aStatus) |
|
1049 { |
|
1050 #ifndef _NO_SESSION_LOGGING_ |
|
1051 Log(_L("Copy Message Store to %d"), (TInt)aDrive); |
|
1052 #endif |
|
1053 |
|
1054 CMsvEntryOperation* operation = CMsvEntryOperation::NewL(*this, aStatus); |
|
1055 CleanupStack::PushL(operation); |
|
1056 |
|
1057 operation->iMtm = KUidMsvServerMtm; // A different MTM type (like local) to identify this type of operation |
|
1058 |
|
1059 iSession->DeleteStoreL(aDrive, operation->Id(), operation->iStatus); |
|
1060 operation->Start(); |
|
1061 |
|
1062 CleanupStack::Pop(operation); |
|
1063 return operation; |
|
1064 } |
|
1065 |
|
1066 |
|
1067 |
|
1068 EXPORT_C TInt CMsvSession::OutstandingOperationsL() |
|
1069 // |
|
1070 // |
|
1071 // |
|
1072 /** Gets the number of outstanding operations. |
|
1073 |
|
1074 @return The number of outstanding operations */ |
|
1075 { |
|
1076 return iSession->OutstandingOperationsL(); |
|
1077 } |
|
1078 |
|
1079 |
|
1080 /** Gets the additional security capabilities required by a given MTM, over and |
|
1081 above those required by the message server itself. |
|
1082 |
|
1083 @param aMtmTypeUid The type UID of the MTM being queried |
|
1084 @param aCapSet A reference to a TCapabilitySet in which the security capabilities |
|
1085 will be returned. Any existing capabilities will be removed. */ |
|
1086 |
|
1087 EXPORT_C void CMsvSession::GetMtmRequiredCapabilitiesL(TUid aMtmTypeUid, TCapabilitySet& aCapSet) const |
|
1088 { |
|
1089 iSession->GetMtmRequiredCapabilitiesL(aMtmTypeUid, aCapSet); |
|
1090 } |
|
1091 |
|
1092 MMsvStoreManager& CMsvSession::StoreManager() |
|
1093 { |
|
1094 MMsvStoreManager& storeManager = *iSession; |
|
1095 return storeManager; |
|
1096 } |
|
1097 |
|
1098 EXPORT_C RMsvServerSession& CMsvSession::Session() |
|
1099 { |
|
1100 return *iSession; |
|
1101 }; |
|
1102 |
|
1103 EXPORT_C RFs& CMsvSession::FileSession() |
|
1104 /** Allows a Server-side MTM to access the file session handle created by the Message |
|
1105 Server. |
|
1106 |
|
1107 This is preferable, as more efficient, to creating another handle. |
|
1108 |
|
1109 @return File session handle */ |
|
1110 { |
|
1111 return iFs; |
|
1112 } |
|
1113 |
|
1114 EXPORT_C TInt CMsvSession::OperationId() |
|
1115 { |
|
1116 return iOperationId++; |
|
1117 } |
|
1118 |
|
1119 EXPORT_C TInt CMsvSession::StopService(TMsvId aServiceId) |
|
1120 /** Stops any operations that a Server-side MTM for the specified service is running, |
|
1121 and then unloads the Server-side MTM. |
|
1122 |
|
1123 The current operation and any queued operations are cancelled. |
|
1124 |
|
1125 @param aServiceId The ID of the service to stop |
|
1126 @return KErrNone - success; */ |
|
1127 { |
|
1128 return iSession->StopService(aServiceId); |
|
1129 } |
|
1130 |
|
1131 EXPORT_C TBool CMsvSession::ServiceActive(TMsvId aServiceId) |
|
1132 /** Tests whether a Server-side MTM for a particular service is loaded by the Message |
|
1133 Server. |
|
1134 |
|
1135 The Server-side MTM does not have to be executing a command - it may be |
|
1136 waiting for another command. |
|
1137 |
|
1138 @param aServiceId The ID of the relevant service |
|
1139 @return ETrue if the Server-side MTM for the service is loaded, otherwise EFalse */ |
|
1140 { |
|
1141 return iSession->ServiceActive(aServiceId); |
|
1142 } |
|
1143 |
|
1144 EXPORT_C TInt CMsvSession::ServiceProgress(TMsvId aServiceId, TDes8& aProgress) |
|
1145 /** Gets the current progress information from the Server-side MTM for the specified |
|
1146 service. |
|
1147 |
|
1148 It is typically used by User Interface MTMs. The format of the progress information |
|
1149 returned in the aProgress buffer is MTM-specific. |
|
1150 |
|
1151 Calling this function results in the Message Server calling CBaseServerMtm::Progress() |
|
1152 on the relevant Server-side MTM. |
|
1153 |
|
1154 Note that the progress information is independent of which message client |
|
1155 application started the current operation. |
|
1156 |
|
1157 @param aServiceId The ID of the service from which to get the progress information |
|
1158 |
|
1159 @param aProgress On return, a descriptor holding progress information. It is |
|
1160 the caller's responsibility to ensure the descriptor is large enough for this |
|
1161 information. |
|
1162 @return KErrNone - success; KErrNotFound - The service is not active (the relevant Server-side MTM is not loaded |
|
1163 by the Message Server); KErrOverflow - The descriptor was too small for the progress information */ |
|
1164 { |
|
1165 return iSession->ServiceProgress(aServiceId, aProgress); |
|
1166 } |
|
1167 |
|
1168 EXPORT_C void CMsvSession::CloseMessageServer() |
|
1169 /** Closes down the Message Server. |
|
1170 |
|
1171 Normal clients should not use this function, as it will affect other message |
|
1172 clients. |
|
1173 |
|
1174 The function results in the session sending a shutdown session notification |
|
1175 (TMsvSessionEvent::EMsvCloseSession) to all current sessions. The Message |
|
1176 Server closes when all sessions have been closed. */ |
|
1177 { |
|
1178 iSession->CloseMessageServer(); |
|
1179 } |
|
1180 |
|
1181 EXPORT_C void CMsvSession::RemoveEntry(TMsvId aId) |
|
1182 /** Deletes the specified entry from the Message Server. |
|
1183 |
|
1184 The call is guaranteed not to fail. If the entry cannot be deleted immediately, |
|
1185 it will be deleted later. This call should only be used in preference to the |
|
1186 normal deleting mechanism when no error reporting is required, typically in |
|
1187 a destructor. |
|
1188 |
|
1189 @param aId The ID of the entry to remove */ |
|
1190 { |
|
1191 iSession->RemoveEntry(aId); |
|
1192 } |
|
1193 |
|
1194 EXPORT_C TInt CMsvSession::InstallMtmGroup(const TDesC& aFullName) |
|
1195 /** Installs a new group of MTMs. |
|
1196 |
|
1197 It is used by specialised MTM-installation programs. |
|
1198 |
|
1199 @param aFullName The full path name of the MTM group file |
|
1200 @return KErrNone - success; KErrAlreadyExists - MTM already installed */ |
|
1201 { |
|
1202 return iSession->InstallMtmGroup(aFullName); |
|
1203 } |
|
1204 |
|
1205 EXPORT_C TInt CMsvSession::DeInstallMtmGroup(const TDesC& aFullName) |
|
1206 /** Removes an installed MTM. |
|
1207 |
|
1208 It is used by specialised MTM-deinstallation programs. |
|
1209 |
|
1210 @param aFullName The full path name of the MTM group file |
|
1211 @return KErrNone - success; KErrInUse - The MTM is currently being used */ |
|
1212 { |
|
1213 return iSession->DeInstallMtmGroup(aFullName); |
|
1214 } |
|
1215 |
|
1216 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1217 |
|
1218 EXPORT_C CMsvEntry* CMsvSession::GetEntryL(TMsvId aId, TBool aChildrenOfAvailableDrives) |
|
1219 /** Accesses the entry with the specified ID. |
|
1220 Children from all available drives of the specified entry will be fetched depending |
|
1221 on the value of aChildrenOfAvailableDrives. |
|
1222 |
|
1223 If a client is unaware of the entries that exist, it can set aId to KMsvRootIndexEntryId |
|
1224 to obtain the root entry, from where all other entries can be obtained. |
|
1225 |
|
1226 The CMsvEntry object must be deleted by the client when it is no longer required. |
|
1227 |
|
1228 @return A new entry object |
|
1229 @param aId The ID of the entry to access |
|
1230 @param aChildrenOfAvailableDrives Indicates whether children from all available drives are to |
|
1231 be fetched during construction of the entry. However, a value of true is valid only |
|
1232 if aMsvId is one among TMsvId's of Inbox, Outbox, Drafts, Sent or Deleted folders. |
|
1233 |
|
1234 @leave KErrNotFound The requested entry does not exist |
|
1235 @leave KErrArgument aChildrenOfAvailableDrives is set to true and the requested entry is not |
|
1236 one of the standard folders, i.e. Inbox, Outbox, Drafts, Sent or Deleted. |
|
1237 */ |
|
1238 { |
|
1239 return CMsvEntry::NewL(*this, aId, TMsvSelectionOrdering(), aChildrenOfAvailableDrives); |
|
1240 } |
|
1241 |
|
1242 #endif |
|
1243 |
|
1244 EXPORT_C CMsvEntry* CMsvSession::GetEntryL(TMsvId aId) |
|
1245 /** Accesses the entry with the specified ID. |
|
1246 |
|
1247 If a client is unaware of the entries that exist, it can set aId to KMsvRootIndexEntryId |
|
1248 to obtain the root entry, from where all other entries can be obtained. |
|
1249 |
|
1250 The CMsvEntry object must be deleted by the client when it is no longer required. |
|
1251 |
|
1252 @return A new entry object |
|
1253 @param aId The ID of the entry to access |
|
1254 @leave KErrNotFound The requested entry does not exist |
|
1255 */ |
|
1256 { |
|
1257 return CMsvEntry::NewL(*this, aId, TMsvSelectionOrdering()); |
|
1258 } |
|
1259 |
|
1260 EXPORT_C TInt CMsvSession::GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry) |
|
1261 /** Gets the index entry for the specified entry ID. |
|
1262 |
|
1263 @param aId The ID of the entry to access |
|
1264 @param aService On return, the ID of the service that owns the entry |
|
1265 @param aEntry On return, the index entry |
|
1266 @return KErrNone if successful, otherwise one of the system-wide error codes */ |
|
1267 { |
|
1268 return iSession->GetEntry(aId, aService, aEntry); |
|
1269 } |
|
1270 |
|
1271 /** Checks a flag in the message server that is set when the server |
|
1272 deletes a corrupt index file. Then clears the flag. |
|
1273 |
|
1274 It is intended to allow the message centre UI to check whether |
|
1275 a corrupt index has been deleted on startup. If it has the UI |
|
1276 may inform the user about the loss of their messages. |
|
1277 |
|
1278 @return ETrue if a corrupt index flag was present indicating that |
|
1279 a corrupt index file has been deleted since the last time this |
|
1280 function was called. |
|
1281 */ |
|
1282 EXPORT_C TBool CMsvSession::GetAndClearIndexCorruptFlagL() |
|
1283 { |
|
1284 return iSession->GetAndClearIndexCorruptFlagL(); |
|
1285 } |
|
1286 |
|
1287 |
|
1288 EXPORT_C TDriveUnit CMsvSession::CurrentDriveL() |
|
1289 { |
|
1290 TInt drive = iSession->GetMessageDrive(); |
|
1291 User::LeaveIfError(drive); // This can leave if messaging server is killed |
|
1292 return TDriveUnit(drive); |
|
1293 } |
|
1294 |
|
1295 EXPORT_C TBool CMsvSession::DriveContainsStoreL(TDriveUnit aDrive) |
|
1296 { |
|
1297 return iSession->DriveContainsStoreL(aDrive); |
|
1298 } |
|
1299 |
|
1300 /** Checks to see if the currently selected drive contains the correct mail store. |
|
1301 |
|
1302 @return ETrue if the same drive is mounted. otherwise returns EFalse |
|
1303 @capability None |
|
1304 */ |
|
1305 EXPORT_C TBool CMsvSession::MessageStoreDrivePresentL() |
|
1306 { |
|
1307 return iSession->MessageStoreDrivePresentL(); |
|
1308 } |
|
1309 |
|
1310 /** |
|
1311 Get the ID of the access point currently in use by the server side MTM for the |
|
1312 given service ID |
|
1313 |
|
1314 @param aServiceID Service ID |
|
1315 @param aAccessPointId If return code is KErrNone, this will store the access point ID |
|
1316 |
|
1317 @return KErrNone if successful, KErrNotSupported if the server side MTM does |
|
1318 not support this operation, KErrNotFound if the server side MTM is |
|
1319 not connected at the time of the request, or one of the other system |
|
1320 wide error codes. |
|
1321 */ |
|
1322 EXPORT_C TInt CMsvSession::ServiceAccessPointId(TMsvId aServiceId, TUint32& aAccessPointId) |
|
1323 { |
|
1324 TNonOperationMtmDataAccessPointIdBuffer mtmDataAccessPointIdBuffer; |
|
1325 |
|
1326 TInt err = iSession->GetNonOperationMtmData(aServiceId, EMtmDataAccessPointId, mtmDataAccessPointIdBuffer); |
|
1327 |
|
1328 if (err == KErrNone) |
|
1329 { |
|
1330 TNonOperationMtmDataAccessPointId mtmDataAccessPointId = mtmDataAccessPointIdBuffer(); |
|
1331 aAccessPointId = mtmDataAccessPointId.iAccessPointId; |
|
1332 } |
|
1333 |
|
1334 return err; |
|
1335 } |
|
1336 |
|
1337 |
|
1338 |
|
1339 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1340 /** |
|
1341 * |
|
1342 * @return TDriveNumber Drive number of the current drive |
|
1343 * in the preferred drive list. |
|
1344 * @return TUint Priority of the drive. |
|
1345 * |
|
1346 * The function returns the current drive of the Message Server and |
|
1347 * its priority in the preferred drive list. |
|
1348 * |
|
1349 @publishedAll |
|
1350 @released |
|
1351 */ |
|
1352 EXPORT_C void CMsvSession::CurrentDriveInfoL(TDriveNumber& aDriveNumber, TUint& aPriority) |
|
1353 { |
|
1354 iSession->CurrentDriveInfoL(aDriveNumber, aPriority); |
|
1355 } |
|
1356 |
|
1357 |
|
1358 |
|
1359 /** |
|
1360 * |
|
1361 * @return RArray<TDriveNumber> List of drive numbers present in |
|
1362 * the preferred drive list arranged in descending order |
|
1363 * of their priority. |
|
1364 * |
|
1365 * Returns the entire preferred drive list with drive numbers arranged |
|
1366 * in descending order of their priority. |
|
1367 * |
|
1368 @publishedAll |
|
1369 @released |
|
1370 */ |
|
1371 EXPORT_C void CMsvSession::DriveListL(RArray<TDriveNumber>& aDriveList) |
|
1372 { |
|
1373 iSession->DriveListL(aDriveList); |
|
1374 } |
|
1375 |
|
1376 |
|
1377 |
|
1378 /** |
|
1379 * |
|
1380 * @return RArray<TDriveNumber> List of drive numbers of available |
|
1381 * drives present in the preferred drive list arranged in |
|
1382 * descending order of their priority. |
|
1383 * |
|
1384 * Returns a list of available drives in the preferred drive list. |
|
1385 * NOTE: A drive number is available only if it has a valid |
|
1386 * (readable and of correct version) message store in it. |
|
1387 * |
|
1388 @publishedAll |
|
1389 @released |
|
1390 */ |
|
1391 EXPORT_C void CMsvSession::AvailableDriveListL(RArray<TDriveNumber>& aDriveList) |
|
1392 { |
|
1393 iSession->AvailableDriveListL(aDriveList); |
|
1394 } |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 /** |
|
1400 * |
|
1401 * @param TDriveNumber Drive number of the drive |
|
1402 * to be added. |
|
1403 * @param TUint Priority of the drive. |
|
1404 * @return TUint New priority of the added drive. |
|
1405 * |
|
1406 * The function adds the passed drive in the preferred drive list. |
|
1407 * The location of the drive in the list is specified by the priority |
|
1408 * of the drive as specified in the second argument. |
|
1409 * |
|
1410 * - If the priority value of the drive is more than the number of |
|
1411 * elements in the preferred drive list, the function appends the drive |
|
1412 * at the end of the list. The new priority of the drive is returned as |
|
1413 * the second argument. |
|
1414 * - If the priority of the new drive is higher than the current drive |
|
1415 * of message server, and if the new drive has a media in it, the message |
|
1416 * server will perform implicit changeDrive and sends a notification to |
|
1417 * all registered client processes about the change. |
|
1418 * - If the drive does not contain a valid version of message store the |
|
1419 * function updates the drive status to EMsvMessageStoreNotSupported and |
|
1420 * sends appropriate notification to the client process. The drive's content |
|
1421 * will not be visible to any of the client processes. |
|
1422 * - If the message store/message index database in the media is corrupt, |
|
1423 * the server will delete the message store and create a fresh message store |
|
1424 * and related files in the media. |
|
1425 * - If the number of drive already present in the preferred list is eight, |
|
1426 * the function will return appropriate error message. |
|
1427 * - In all cases mentioned above, if the drive is successfully added to the |
|
1428 * preferred drive list the function will also update the central repository |
|
1429 * with the new preferred drive list. |
|
1430 * |
|
1431 @publishedAll |
|
1432 @released |
|
1433 */ |
|
1434 EXPORT_C void CMsvSession::AddDriveL(TDriveNumber aDriveNumber, TUint& aPriority) |
|
1435 { |
|
1436 iSession->AddDriveL(aDriveNumber, aPriority); |
|
1437 } |
|
1438 |
|
1439 |
|
1440 |
|
1441 /** |
|
1442 * |
|
1443 * @param TDriveNumber Drive number of the drive |
|
1444 * to be removed. |
|
1445 * |
|
1446 * The function removes the drive from the preferred |
|
1447 * drive list. If the current drive is being removed, |
|
1448 * the next available drive in the preferred drive list |
|
1449 * becomes the current drive. The device internal drive |
|
1450 * cannot be removed from the preferred drive list. |
|
1451 * Appropriate notification will be sent to the client |
|
1452 * process if there is a change in the current drive. |
|
1453 * The function will also update the central repository |
|
1454 * accordingly. |
|
1455 * |
|
1456 @publishedAll |
|
1457 @released |
|
1458 */ |
|
1459 EXPORT_C void CMsvSession::RemoveDriveL(TDriveNumber aDriveNumber) |
|
1460 { |
|
1461 iSession->RemoveDriveL(aDriveNumber); |
|
1462 } |
|
1463 |
|
1464 |
|
1465 |
|
1466 /** |
|
1467 * |
|
1468 * @param TDriveNumber Drive number of the drive |
|
1469 * to be updated. |
|
1470 * @param TUint Priority of the drive. |
|
1471 * @return TUint New priority of the drive. |
|
1472 * |
|
1473 * The function updates the priority of the drive |
|
1474 * already present in the preferred drive list. If |
|
1475 * the priority being mentioned is greater than the |
|
1476 * number of drives present in the list, the drive |
|
1477 * will be added at the end of the preferred drive list. |
|
1478 * The function will then return the new priority of |
|
1479 * the drive. If updating a priority makes a non-current |
|
1480 * drive the current drive or vice-versa, the function |
|
1481 * will implicitly perform ChangeDrive() and send the |
|
1482 * notification to all registered clients. It will return |
|
1483 * error if the said drive is not already present in the |
|
1484 * preferred drive list. |
|
1485 * |
|
1486 @publishedAll |
|
1487 @released |
|
1488 */ |
|
1489 EXPORT_C void CMsvSession::UpdateDrivePriorityL(TDriveNumber aDriveNumber, TUint& aPriority) |
|
1490 { |
|
1491 iSession->UpdateDrivePriorityL(aDriveNumber, aPriority); |
|
1492 } |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 /** |
|
1498 * |
|
1499 * @param TMsvId ID of the parent entry. |
|
1500 * @param CMsvEntryFilter Filter by which various message entries can be excluded. |
|
1501 * @return aSelection: A list of message entry IDs |
|
1502 * |
|
1503 * @capability None Only children that the client owns are returned. |
|
1504 * @capability ReadUserData All children of the entry are returned |
|
1505 * |
|
1506 * Gets the children of a parent entry specified as first argument. |
|
1507 * If the passed parent is a standard folder the function will fetch |
|
1508 * entries from all drives currently present in the preferred drive list. |
|
1509 * |
|
1510 @publishedAll |
|
1511 @released |
|
1512 */ |
|
1513 EXPORT_C void CMsvSession::GetChildIdsAllL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection) |
|
1514 { |
|
1515 __ASSERT_DEBUG(aSelection.Count() == 0, PanicServer(EMsvSelectionNotEmpty)); |
|
1516 iSession->GetChildIdsAllL(aId, aFilter, aSelection); |
|
1517 } |
|
1518 |
|
1519 |
|
1520 |
|
1521 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
1522 EXPORT_C void CMsvSession::ResetRepositoryL() |
|
1523 { |
|
1524 iSession->ResetRepositoryL(); |
|
1525 } |
|
1526 |
|
1527 EXPORT_C void CMsvSession::PrintCache() |
|
1528 { |
|
1529 iSession->PrintCache(); |
|
1530 } |
|
1531 |
|
1532 #endif // #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
1533 |
|
1534 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
1535 |
|
1536 |
|
1537 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
1538 |
|
1539 /***************************************Converter API's***************************/ |
|
1540 |
|
1541 /** |
|
1542 Retrieves a list of drives with unsupported message store. A store is rendered |
|
1543 unsupported if it has message store older than that on the phone internal memory. |
|
1544 |
|
1545 @param aDriveList Reference to the list that is filled with drives having |
|
1546 unsupported message store. |
|
1547 @return None |
|
1548 |
|
1549 @publishedAll |
|
1550 @released |
|
1551 */ |
|
1552 EXPORT_C void CMsvSession::GetConvertibleDriveListL(RArray<TDriveNumber>& aDriveList) |
|
1553 { |
|
1554 iSession->GetConvertibleDriveListL(aDriveList); |
|
1555 } |
|
1556 |
|
1557 /** |
|
1558 Converts an older version of message store to the current version as seen by message server. |
|
1559 This is an asynchronous API and performs conversion asynchronously so that the caller does not have |
|
1560 to wait for conversion is complete. This API can be used to issue conversion resquest for a single |
|
1561 drive. The conversion starts immediately os the drive is queued if store converter is busy performing |
|
1562 another conversion. |
|
1563 |
|
1564 @param aDrive drive number. |
|
1565 @param aRequestStatus Indicates the completion status of a request made to a service provider. |
|
1566 @return None |
|
1567 |
|
1568 @publishedAll |
|
1569 @released |
|
1570 */ |
|
1571 EXPORT_C void CMsvSession::ConvertMessageStore(TDriveNumber aDrive,TRequestStatus& aStatus) |
|
1572 { |
|
1573 iSession->ConvertMessageStore(aDrive,aStatus); |
|
1574 } |
|
1575 |
|
1576 /** |
|
1577 |
|
1578 @param aDrive Drive number specifying the drive for which conversion status is required.. |
|
1579 @return None |
|
1580 |
|
1581 @publishedAll |
|
1582 @released |
|
1583 */ |
|
1584 EXPORT_C void CMsvSession::GetConversionStatusL(TDriveNumber aDrive) |
|
1585 { |
|
1586 iSession->GetConversionStatusL(aDrive); |
|
1587 } |
|
1588 |
|
1589 /** |
|
1590 Cancels conversion on the specified drive. This API allows cancellation of only one drive |
|
1591 at a time. |
|
1592 |
|
1593 @param aDrive drive number. |
|
1594 @return TInt System wide error codes |
|
1595 @publishedAll |
|
1596 @released |
|
1597 */ |
|
1598 EXPORT_C TInt CMsvSession::CancelConversion(TDriveNumber aDrive) |
|
1599 { |
|
1600 return iSession->CancelConversion(aDrive); |
|
1601 } |
|
1602 |
|
1603 #endif // #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
1604 |
|
1605 //********************************** |
|
1606 // McliUtils |
|
1607 //********************************** |
|
1608 |
|
1609 /** Gets the local progress information from a messaging operation object. |
|
1610 |
|
1611 @param aOperation Operation from which to get progress information |
|
1612 @return Local progress information for aOperation |
|
1613 @panic MSGS 256 aOperation is not a local operation |
|
1614 */ |
|
1615 EXPORT_C TMsvLocalOperationProgress McliUtils::GetLocalProgressL(CMsvOperation& aOperation) |
|
1616 { |
|
1617 __ASSERT_ALWAYS(aOperation.Mtm()==KUidMsvLocalServiceMtm, PanicServer(EMsvNotLocalOperation)); |
|
1618 TPckgBuf<TMsvLocalOperationProgress> progressPack; |
|
1619 progressPack.Copy(aOperation.ProgressL()); |
|
1620 return progressPack(); |
|
1621 } |
|
1622 |
|
1623 /** Gets the final local progress information from a messaging operation object. |
|
1624 |
|
1625 @param aOperation Operation from which to get progress information |
|
1626 @return Local progress information for aOperation |
|
1627 @panic MSGS 256 aOperation is not a local operation |
|
1628 */ |
|
1629 EXPORT_C TMsvLocalOperationProgress McliUtils::GetFinalLocalProgress(CMsvOperation& aOperation) |
|
1630 { |
|
1631 __ASSERT_ALWAYS(aOperation.Mtm()==KUidMsvLocalServiceMtm, PanicServer(EMsvNotLocalOperation)); |
|
1632 TPckgBuf<TMsvLocalOperationProgress> progressPack; |
|
1633 progressPack.Copy(aOperation.FinalProgress()); |
|
1634 return progressPack(); |
|
1635 } |
|
1636 |
|
1637 /** Gets the progress error from a messaging operation object. |
|
1638 |
|
1639 @param aOperation Operation from which to get progress information |
|
1640 @return error of the progress information |
|
1641 */ |
|
1642 EXPORT_C TInt McliUtils::GetProgressErrorL(CMsvOperation& aOperation) |
|
1643 { |
|
1644 TMsvSystemProgress systemProgress; |
|
1645 if (aOperation.Mtm() == KUidMsvLocalServiceMtm) |
|
1646 { |
|
1647 TMsvLocalOperationProgress localProgress = GetLocalProgressL(aOperation); |
|
1648 systemProgress.iErrorCode = localProgress.iError; |
|
1649 } |
|
1650 else |
|
1651 { |
|
1652 User::LeaveIfError(aOperation.SystemProgress(systemProgress)); |
|
1653 } |
|
1654 return systemProgress.iErrorCode; |
|
1655 } |
|
1656 |
|
1657 /** Gets the progress id from a messaging operation object. |
|
1658 |
|
1659 @param aOperation Operation from which to get progress information |
|
1660 @return id of the progress information |
|
1661 */ |
|
1662 EXPORT_C TMsvId McliUtils::GetProgressIdL(CMsvOperation& aOperation) |
|
1663 { |
|
1664 TMsvSystemProgress systemProgress; |
|
1665 if (aOperation.Mtm() == KUidMsvLocalServiceMtm) |
|
1666 { |
|
1667 TMsvLocalOperationProgress localProgress = GetLocalProgressL(aOperation); |
|
1668 systemProgress.iId = localProgress.iId; |
|
1669 } |
|
1670 else |
|
1671 { |
|
1672 User::LeaveIfError(aOperation.SystemProgress(systemProgress)); |
|
1673 } |
|
1674 return systemProgress.iId; |
|
1675 } |