719
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
872
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
719
|
5 |
// which accompanies this distribution, and is available
|
872
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
719
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// [TestStep Name]
|
|
15 |
// RemoveSmtpSNAPSetting
|
|
16 |
// [Paramaters]
|
|
17 |
// SmtpAccountName :Name of the Smtp account.
|
|
18 |
// Removes the provisioned SNAP information for the SMTP account.
|
|
19 |
//
|
|
20 |
//
|
|
21 |
|
|
22 |
//User includes
|
|
23 |
#include "T_RemoveSmtpSNAPSetting.h"
|
|
24 |
#include <t_utils.h>
|
|
25 |
#include <t_utilsenumconverter.h>
|
|
26 |
#include <t_utilscentralrepository.h>
|
|
27 |
|
|
28 |
//Epoc include
|
|
29 |
#include <iapprefs.h>
|
|
30 |
|
|
31 |
//Literal used
|
|
32 |
_LIT(KSmtpAccountName,"SmtpAccountName");
|
|
33 |
|
|
34 |
/**
|
|
35 |
Function : CT_MsgRemoveSmtpSNAPSetting
|
|
36 |
Description : Constructor
|
|
37 |
@param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp
|
|
38 |
@return : N/A
|
|
39 |
*/
|
|
40 |
CT_MsgRemoveSmtpSNAPSetting::CT_MsgRemoveSmtpSNAPSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP)
|
|
41 |
:CT_MsgSyncStepSMTP(aSharedDataSMTP)
|
|
42 |
{
|
|
43 |
SetTestStepName(KRemoveSmtpSNAPSetting);
|
|
44 |
}
|
|
45 |
|
|
46 |
/**
|
|
47 |
Function : ReadIni
|
|
48 |
Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
|
|
49 |
@return : TBool
|
|
50 |
*/
|
|
51 |
TBool CT_MsgRemoveSmtpSNAPSetting::ReadIni()
|
|
52 |
{
|
|
53 |
TBool result = ETrue;
|
|
54 |
|
|
55 |
if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName))
|
|
56 |
{
|
|
57 |
ERR_PRINTF1(_L("Smtp account name is not specified"));
|
|
58 |
SetTestStepResult(EFail);
|
|
59 |
result = EFalse;
|
|
60 |
}
|
|
61 |
|
|
62 |
return result;
|
|
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
Function : doTestStepL
|
|
67 |
Description : Removes the provisioned SNAP information from the SMTP account settings of a test case.
|
|
68 |
@return : TVerdict - Test step result
|
|
69 |
*/
|
|
70 |
TVerdict CT_MsgRemoveSmtpSNAPSetting::doTestStepL()
|
|
71 |
{
|
|
72 |
INFO_PRINTF1(_L("Test Step : RemoveSmtpSNAPSetting"));
|
|
73 |
if(ReadIni())
|
|
74 |
{
|
|
75 |
CEmailAccounts* accounts = CEmailAccounts::NewL();
|
|
76 |
CleanupStack::PushL(accounts);
|
|
77 |
|
|
78 |
CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC();
|
|
79 |
|
|
80 |
TSmtpAccount smtpAccountId;
|
|
81 |
CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName, smtpAccountId);
|
|
82 |
|
|
83 |
accounts->LoadSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs);
|
|
84 |
|
|
85 |
smtpIapPrefs->RemoveSNAP();
|
|
86 |
|
|
87 |
accounts->SaveSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs);
|
|
88 |
|
|
89 |
CleanupStack::PopAndDestroy(2,accounts); // smtpIapPrefs, accounts
|
|
90 |
}
|
|
91 |
return TestStepResult();
|
|
92 |
}
|