|
1 // Copyright (c) 2003-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 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // DoFullImap4Synchronisation |
|
17 // [Action Parameters] |
|
18 // Mtm <input>: Reference to Imap4 client MTM. |
|
19 // [Action Description] |
|
20 // Performs full sync with IPAP4 server. |
|
21 // [APIs Used] |
|
22 // CMsvEntry::SetEntryL |
|
23 // CMsvEntrySelection::AppendL |
|
24 // CImap4ClientMtm::InvokeAsyncFunctionL |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 /** |
|
30 @file |
|
31 */ |
|
32 |
|
33 |
|
34 #include "CMtfTestActionDoFullImap4Synchronisation.h" |
|
35 #include "CMtfTestCase.h" |
|
36 #include "CMtfTestActionParameters.h" |
|
37 #include "MtfTestActionUtilsUser.h" |
|
38 |
|
39 #include <impcmtm.h> |
|
40 |
|
41 |
|
42 CMtfTestAction* CMtfTestActionDoFullImap4Synchronisation::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
43 { |
|
44 CMtfTestActionDoFullImap4Synchronisation* self = new (ELeave) CMtfTestActionDoFullImap4Synchronisation(aTestCase); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(aActionParameters); |
|
47 CleanupStack::Pop(); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 CMtfTestActionDoFullImap4Synchronisation::CMtfTestActionDoFullImap4Synchronisation(CMtfTestCase& aTestCase) |
|
53 : CMtfTestAction(aTestCase) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 CMtfTestActionDoFullImap4Synchronisation::~CMtfTestActionDoFullImap4Synchronisation() |
|
59 { |
|
60 } |
|
61 |
|
62 |
|
63 void CMtfTestActionDoFullImap4Synchronisation::ExecuteActionL() |
|
64 { |
|
65 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDoFullImap4Synchronisation); |
|
66 TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); |
|
67 CImap4ClientMtm* paramMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1)); |
|
68 |
|
69 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
70 CleanupStack::PushL(selection); |
|
71 selection->AppendL(paramServiceId); |
|
72 TBuf8<1> param; |
|
73 iOperation = paramMtm->InvokeAsyncFunctionL(KIMAP4MTMFullSync,*selection,param,iStatus); |
|
74 CleanupStack::PopAndDestroy(selection); |
|
75 CActiveScheduler::Add(this); |
|
76 SetActive(); |
|
77 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDoFullImap4Synchronisation); |
|
78 } |
|
79 |
|
80 |
|
81 void CMtfTestActionDoFullImap4Synchronisation::DoCancel() |
|
82 { |
|
83 iOperation->Cancel(); |
|
84 } |
|
85 |
|
86 |
|
87 void CMtfTestActionDoFullImap4Synchronisation::RunL() |
|
88 { |
|
89 TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus); |
|
90 |
|
91 delete iOperation; |
|
92 |
|
93 if( err != KErrNone ) |
|
94 { |
|
95 TestCase().ERR_PRINTF3( _L("Test Action %S failed with code %d"), &KTestActionDoFullImap4Synchronisation, err ); |
|
96 User::Leave( err ); |
|
97 } |
|
98 |
|
99 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDoFullImap4Synchronisation); |
|
100 TestCase().ActionCompletedL(*this); |
|
101 } |
|
102 |