|
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 // CreateFolder |
|
17 // [Action Parameters] |
|
18 // Session <input>: Reference to the session. |
|
19 // ParentId <input>: Value of the parent id. |
|
20 // MtmUid <input>: Value of the MTM uid. |
|
21 // ServiceId <input>: Value of the the service id. |
|
22 // (Priority) <input>: Value of the entry priority. Default is medium priority. |
|
23 // (ReadOnlyFlag) <input>: Value of the read only flag. Default is false. |
|
24 // (VisibleFlag) <input>: Value of the visible flag. Default is true. |
|
25 // (Description) <input>: Name of the description. Default is blank. |
|
26 // (Details) <input>: Name of the details. Default is blank. |
|
27 // FolderId <output>: Value of the created folder id. |
|
28 // [Action Description] |
|
29 // Creates a folder on the specified parent. |
|
30 // [APIs Used] |
|
31 // TMsvEntry::iType |
|
32 // TMsvEntry::SetPriority |
|
33 // TMsvEntry::iMtm |
|
34 // TMsvEntry::iServiceId |
|
35 // TMsvEntry::SetReadOnly |
|
36 // TMsvEntry::SetVisible |
|
37 // TMsvEntry::iDescription |
|
38 // TMsvEntry::iDetails |
|
39 // TMsvEntry::iDate |
|
40 // TMsvEntry::Id |
|
41 // CMsvEntry::SetEntryL |
|
42 // CMsvEntry::CreateL |
|
43 // CMsvEntry::OwningService |
|
44 // __ACTION_INFO_END__ |
|
45 // |
|
46 // |
|
47 |
|
48 /** |
|
49 @file |
|
50 */ |
|
51 |
|
52 |
|
53 #include "CMtfTestActionCreateFolder.h" |
|
54 #include "CMtfTestCase.h" |
|
55 #include "CMtfTestActionParameters.h" |
|
56 #include "MtfTestActionUtilsUser.h" |
|
57 |
|
58 #include <miutset.h> |
|
59 |
|
60 |
|
61 CMtfTestAction* CMtfTestActionCreateFolder::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
62 { |
|
63 CMtfTestActionCreateFolder* self = new (ELeave) CMtfTestActionCreateFolder(aTestCase); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(aActionParameters); |
|
66 CleanupStack::Pop(); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 CMtfTestActionCreateFolder::CMtfTestActionCreateFolder(CMtfTestCase& aTestCase) |
|
72 : CMtfTestAction(aTestCase) |
|
73 { |
|
74 } |
|
75 |
|
76 |
|
77 CMtfTestActionCreateFolder::~CMtfTestActionCreateFolder() |
|
78 { |
|
79 delete iBlank; |
|
80 } |
|
81 |
|
82 |
|
83 void CMtfTestActionCreateFolder::ExecuteActionL() |
|
84 { |
|
85 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateFolder); |
|
86 iBlank = KNullDesC().AllocL(); |
|
87 |
|
88 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
89 TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); |
|
90 TUid paramMtmUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(2)); |
|
91 TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(3)); |
|
92 TMsvPriority paramPriority = ObtainValueParameterL<TMsvPriority>(TestCase(),ActionParameters().Parameter(4),EMsvMediumPriority); |
|
93 TInt paramReadOnlyFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(5),EFalse); |
|
94 TInt paramVisibleFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(6),ETrue); |
|
95 HBufC* paramDescription = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(7),iBlank); |
|
96 HBufC* paramDetails = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(8),iBlank); |
|
97 |
|
98 iIndexEntry.iType = KUidMsvFolderEntry; |
|
99 iIndexEntry.iMtm = paramMtmUid; |
|
100 iIndexEntry.iServiceId = paramServiceId; |
|
101 iIndexEntry.SetPriority(TMsvPriority(paramPriority)); |
|
102 iIndexEntry.SetReadOnly(paramReadOnlyFlag); |
|
103 iIndexEntry.SetVisible(paramVisibleFlag); |
|
104 iIndexEntry.iDescription.Set(paramDescription->Des()); |
|
105 iIndexEntry.iDetails.Set(paramDetails->Des()); |
|
106 iIndexEntry.iDate.HomeTime(); |
|
107 |
|
108 CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering()); |
|
109 CleanupStack::PushL(entry); |
|
110 entry->SetEntryL(paramParentId); |
|
111 if (entry->OwningService() == KMsvLocalServiceIndexEntryId) |
|
112 { |
|
113 entry->CreateL(iIndexEntry); |
|
114 TMsvId paramFolderId; |
|
115 paramFolderId = iIndexEntry.Id(); |
|
116 |
|
117 StoreParameterL<TMsvId>(TestCase(),paramFolderId,ActionParameters().Parameter(9)); |
|
118 |
|
119 TestCase().ActionCompletedL(*this); |
|
120 } |
|
121 else |
|
122 { |
|
123 iOperation = entry->CreateL(iIndexEntry,iStatus); |
|
124 SetActive(); |
|
125 } |
|
126 CleanupStack::PopAndDestroy(entry); |
|
127 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateFolder); |
|
128 } |
|
129 |
|
130 |
|
131 void CMtfTestActionCreateFolder::DoCancel() |
|
132 { |
|
133 iOperation->Cancel(); |
|
134 } |
|
135 |
|
136 |
|
137 void CMtfTestActionCreateFolder::RunL() |
|
138 { |
|
139 TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus); |
|
140 delete iOperation; |
|
141 User::LeaveIfError(err); |
|
142 |
|
143 TMsvId paramFolderId; |
|
144 paramFolderId = iIndexEntry.Id(); |
|
145 StoreParameterL<TMsvId>(TestCase(),paramFolderId,ActionParameters().Parameter(9)); |
|
146 |
|
147 TestCase().ActionCompletedL(*this); |
|
148 } |
|
149 |
|
150 |
|
151 |
|
152 |