|
1 // Copyright (c) 2006-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 // SetImap4ServiceLongIdleParameters |
|
17 // [Action Parameters] |
|
18 // Session <input>: Reference to the session. |
|
19 // ServiceId <input>: Value of the Imap4 service id. |
|
20 // (ConfigIndexSettingsFile) <input>: Value of config index for settings file. Default is 0. |
|
21 // [Action Description] |
|
22 // Sets parameters of Imap4 service. |
|
23 // [APIs Used] |
|
24 // CMsvEntry::SetEntryL |
|
25 // CMsvEntry::EditStoreL |
|
26 // CImImap4Settings::Reset |
|
27 // CImImap4Settings::SetServerAddressL |
|
28 // CImImap4Settings::SetLoginNameL |
|
29 // CImImap4Settings::SetPasswordL |
|
30 // CImImap4Settings::StoreL |
|
31 // CMsvStore::CommitL |
|
32 // __ACTION_INFO_END__ |
|
33 // |
|
34 // |
|
35 |
|
36 /** |
|
37 @file |
|
38 */ |
|
39 |
|
40 #include <msvapi.h> |
|
41 #include <imapset.h> |
|
42 |
|
43 #include <cemailaccounts.h> |
|
44 #include <iapprefs.h> |
|
45 |
|
46 #include "Cmtftestactionsetimap4serviceLongidleparameters.h" |
|
47 #include "CMtfTestCase.h" |
|
48 #include "CMtfTestActionParameters.h" |
|
49 #include "CMtfConfigurationType.h" |
|
50 |
|
51 CMtfTestAction* CMtfTestActionSetImap4ServiceLongIdleParameters::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
52 { |
|
53 CMtfTestActionSetImap4ServiceLongIdleParameters* self = new (ELeave) CMtfTestActionSetImap4ServiceLongIdleParameters(aTestCase); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(aActionParameters); |
|
56 CleanupStack::Pop(); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 CMtfTestActionSetImap4ServiceLongIdleParameters::CMtfTestActionSetImap4ServiceLongIdleParameters(CMtfTestCase& aTestCase) |
|
62 : CMtfSynchronousTestAction(aTestCase) |
|
63 { |
|
64 } |
|
65 |
|
66 |
|
67 CMtfTestActionSetImap4ServiceLongIdleParameters::~CMtfTestActionSetImap4ServiceLongIdleParameters() |
|
68 { |
|
69 delete iParser; |
|
70 } |
|
71 |
|
72 |
|
73 void CMtfTestActionSetImap4ServiceLongIdleParameters::ExecuteActionL() |
|
74 { |
|
75 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetImap4ServiceLongIdleParameters); |
|
76 CMsvSession* paramSession = |
|
77 ObtainParameterReferenceL<CMsvSession>( TestCase(), ActionParameters().Parameter(0)); |
|
78 TMsvId paramServiceId = |
|
79 ObtainValueParameterL<TMsvId>( TestCase(), ActionParameters().Parameter(1)); |
|
80 TBool paramIsImapIdleSelected = |
|
81 ObtainValueParameterL<TBool>( TestCase(), ActionParameters().Parameter(2), ETrue); |
|
82 TInt paramImapIdleTimeout = |
|
83 ObtainValueParameterL<TInt>( TestCase(), ActionParameters().Parameter(3), 1680); |
|
84 TInt paramImapSyncRate = ObtainValueParameterL<TInt>( TestCase(), ActionParameters().Parameter(4), 300); |
|
85 |
|
86 CImImap4Settings* settings = new(ELeave) CImImap4Settings(); |
|
87 CleanupStack::PushL(settings); |
|
88 |
|
89 CEmailAccounts *accounts = CEmailAccounts::NewLC(); |
|
90 TImapAccount imapAccount; |
|
91 accounts->GetImapAccountL(paramServiceId, imapAccount); |
|
92 accounts->LoadImapSettingsL(imapAccount, *settings); |
|
93 |
|
94 settings->SetImapIdle(paramIsImapIdleSelected); |
|
95 settings->SetImapIdleTimeoutL(paramImapIdleTimeout); |
|
96 settings->SetSyncRateL(paramImapSyncRate); |
|
97 |
|
98 accounts->SaveImapSettingsL(imapAccount, *settings); |
|
99 CleanupStack::PopAndDestroy(2, settings); |
|
100 |
|
101 TestCase().INFO_PRINTF1( _L("SetImap4ServiceLongIdleparameters completed") ); |
|
102 TestCase().ActionCompletedL(*this); |
|
103 } |
|
104 |