719
|
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 the License "Symbian Foundation License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// [TestStep Name]
|
|
15 |
// DeletePopAccount
|
|
16 |
// [Paramaters]
|
|
17 |
// PopAccountName <input> : Name of the Pop account to be Deleted
|
|
18 |
// For deleteing all the Pop accounts "all" can be used
|
|
19 |
// and it is case insensitive.
|
|
20 |
// [Test Step Description]
|
|
21 |
// Deletes the Pop account(s) in the Central Repository
|
|
22 |
// [APIs Used]
|
|
23 |
// CEmailAccounts::DeletePopAccountL
|
|
24 |
//
|
|
25 |
//
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
/**
|
|
30 |
@file
|
|
31 |
*/
|
|
32 |
|
|
33 |
|
|
34 |
// User include
|
|
35 |
#include "T_DeletePopAccount.h"
|
|
36 |
|
|
37 |
|
|
38 |
// epoc inlcudes
|
|
39 |
#include<cemailaccounts.h>
|
|
40 |
|
|
41 |
// Literals used
|
|
42 |
_LIT(KPopAccountName,"PopAccountName");
|
|
43 |
|
|
44 |
|
|
45 |
/**
|
|
46 |
CT_MsgDeletePopAccount()
|
|
47 |
Sets the teststep name to KDeletePopAccount
|
|
48 |
|
|
49 |
@param aSharedDataPOP
|
|
50 |
Data shared across the POP test steps. Ex. Session
|
|
51 |
*/
|
|
52 |
CT_MsgDeletePopAccount::CT_MsgDeletePopAccount(CT_MsgSharedDataPop& aSharedDataPOP)
|
|
53 |
: CT_MsgSyncStepPOP(aSharedDataPOP)
|
|
54 |
{
|
|
55 |
SetTestStepName(KDeletePopAccount);
|
|
56 |
}
|
|
57 |
|
|
58 |
/**
|
|
59 |
~CT_MsgDeletePopAccount()
|
|
60 |
Destructor
|
|
61 |
*/
|
|
62 |
CT_MsgDeletePopAccount::~CT_MsgDeletePopAccount()
|
|
63 |
{
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
/**
|
|
69 |
doTestStepL()
|
|
70 |
Reads the POP account name from the ini file. If ALL string is mentioned in the .ini file
|
|
71 |
it deletes all the IMAP accounts, Else deletes the IMAP account whose name is
|
|
72 |
mentioned in the ini file
|
|
73 |
|
|
74 |
@return
|
|
75 |
Returns the test step result
|
|
76 |
*/
|
|
77 |
TVerdict CT_MsgDeletePopAccount::doTestStepL()
|
|
78 |
{
|
|
79 |
INFO_PRINTF1(_L("Test Step: Delete Pop Account"));
|
|
80 |
TPtrC popAccountName;
|
|
81 |
// Read Pop Account Name from ini file
|
|
82 |
if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
|
|
83 |
{
|
|
84 |
ERR_PRINTF1(_L("Account name not specified"));
|
|
85 |
SetTestStepResult(EFail);
|
|
86 |
}
|
|
87 |
else
|
|
88 |
{
|
|
89 |
CEmailAccounts* account = CEmailAccounts::NewLC();
|
|
90 |
|
|
91 |
RArray<TPopAccount> arrayPop3Accounts;
|
|
92 |
CleanupClosePushL(arrayPop3Accounts);
|
|
93 |
account->GetPopAccountsL(arrayPop3Accounts);
|
|
94 |
TInt count=arrayPop3Accounts.Count();
|
|
95 |
|
|
96 |
TBuf<12> temp(popAccountName);
|
|
97 |
temp.UpperCase(); // Making case insensitive
|
|
98 |
if(temp.CompareC(_L("ALL")) == 0)
|
|
99 |
{
|
|
100 |
INFO_PRINTF2(_L("Deleting all accounts. Total = %d"), count);
|
|
101 |
for(TInt i=0; i<count; i++)
|
|
102 |
{
|
|
103 |
TPopAccount id = arrayPop3Accounts[i];
|
|
104 |
account->DeletePopAccountL(id);
|
|
105 |
}
|
|
106 |
}
|
|
107 |
else
|
|
108 |
{
|
|
109 |
TBool deleteFlag = EFalse;
|
|
110 |
for(TInt i = 0; i < count; i++)
|
|
111 |
{
|
|
112 |
if(popAccountName.CompareC(arrayPop3Accounts[i].iPopAccountName) == 0)
|
|
113 |
{
|
|
114 |
account->DeletePopAccountL(arrayPop3Accounts[i]);
|
|
115 |
// Just ensure that if we try to delete it again we hopefuly get an error
|
|
116 |
// or can see that it has been deleted.
|
|
117 |
arrayPop3Accounts.Remove(i);
|
|
118 |
deleteFlag = ETrue;
|
|
119 |
break;
|
|
120 |
}
|
|
121 |
}
|
|
122 |
if(deleteFlag)
|
|
123 |
{
|
|
124 |
INFO_PRINTF2(_L("Pop acount \" %S \" deleted"), &popAccountName);
|
|
125 |
}
|
|
126 |
else
|
|
127 |
{
|
|
128 |
ERR_PRINTF2(_L("Pop acount \" %S \" not found"), &popAccountName);
|
|
129 |
SetTestStepResult(EFail);
|
|
130 |
User::Leave(KErrNotFound);
|
|
131 |
}
|
|
132 |
}
|
|
133 |
CleanupStack::PopAndDestroy(2, account); //arrayPop3Accounts,account
|
|
134 |
}
|
|
135 |
return TestStepResult();
|
|
136 |
}
|