|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CPS Execute parameter object |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 |
|
21 // User includes |
|
22 #include <debug.h> |
|
23 #include <liwvariant.h> |
|
24 #include <liwgenericparam.h> |
|
25 #include "aicpsexecuteparam.h" |
|
26 |
|
27 // Constants |
|
28 _LIT8( KPublisherId, "publisher" ); |
|
29 _LIT8( KContentType, "content_type" ); |
|
30 _LIT8( KContentId, "content_id" ); |
|
31 _LIT8( KPluginId, "plugin_id"); |
|
32 _LIT8( KType, "type"); |
|
33 _LIT8( KFilter, "filter" ); |
|
34 _LIT8( KActionTrigger, "action_trigger" ); |
|
35 |
|
36 // ======== LOCAL FUNCTIONS ======== |
|
37 |
|
38 // ======== MEMBER FUNCTIONS ======== |
|
39 // --------------------------------------------------------------------------- |
|
40 // CAiCpsExecuteParam::CAiCpsExecuteParam |
|
41 // |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CAiCpsExecuteParam::CAiCpsExecuteParam() |
|
45 { |
|
46 |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CAiCpsExecuteParam::ConstructL |
|
51 // |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CAiCpsExecuteParam::ConstructL( ) |
|
55 { |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CAiCpsExecuteParam::NewL |
|
60 // |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CAiCpsExecuteParam* CAiCpsExecuteParam::NewL() |
|
64 { |
|
65 CAiCpsExecuteParam* self = CAiCpsExecuteParam::NewLC(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CAiCpsExecuteParam::NewLC |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CAiCpsExecuteParam* CAiCpsExecuteParam::NewLC() |
|
76 { |
|
77 CAiCpsExecuteParam* self = new ( ELeave ) CAiCpsExecuteParam; |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 return self; |
|
81 } |
|
82 // --------------------------------------------------------------------------- |
|
83 // CAiCpsExecuteParam::~CAiCpsExecuteParam |
|
84 // |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CAiCpsExecuteParam::~CAiCpsExecuteParam() |
|
88 { |
|
89 delete iPluginId; |
|
90 delete iRegistryType; |
|
91 delete iPublisher; |
|
92 delete iContentType; |
|
93 delete iContentId; |
|
94 iActions.ResetAndDestroy(); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CAiCpsExecuteParam::PluginId |
|
99 // |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 const TDesC& CAiCpsExecuteParam::PluginId() const |
|
103 { |
|
104 return *iPluginId; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CAiCpsExecuteParam::InParamMapLC |
|
109 // |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 CLiwDefaultMap* CAiCpsExecuteParam::InParamMapLC() |
|
113 { |
|
114 CLiwDefaultMap* inParamMap = CLiwDefaultMap::NewLC(); |
|
115 inParamMap->InsertL( KType, TLiwVariant( *iRegistryType )); |
|
116 |
|
117 CLiwDefaultMap* filter = CLiwDefaultMap::NewLC(); |
|
118 filter->InsertL( KPublisherId, TLiwVariant(iPublisher )); |
|
119 filter->InsertL( KContentId, TLiwVariant(iContentId )); |
|
120 filter->InsertL( KContentType, TLiwVariant(iContentType )); |
|
121 |
|
122 CLiwDefaultList* actionsToLaunch = CLiwDefaultList::NewLC(); |
|
123 for ( TInt i=0; i< iActions.Count(); i++) |
|
124 { |
|
125 actionsToLaunch->AppendL( TLiwVariant( *iActions[i])); |
|
126 } |
|
127 filter->InsertL(KActionTrigger, TLiwVariant(actionsToLaunch) ); |
|
128 inParamMap->InsertL( KFilter, TLiwVariant( filter )); |
|
129 |
|
130 CleanupStack::PopAndDestroy( actionsToLaunch ); |
|
131 CleanupStack::PopAndDestroy( filter ); |
|
132 return inParamMap; |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CAiCpsExecuteParam::SetFilterL |
|
137 // |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 void CAiCpsExecuteParam::SetFilterL(CLiwDefaultMap* aMap) |
|
141 { |
|
142 delete iPublisher; |
|
143 delete iContentType; |
|
144 delete iContentId; |
|
145 iPublisher = NULL; |
|
146 iContentType = NULL; |
|
147 iContentId = NULL; |
|
148 |
|
149 TLiwVariant variant; |
|
150 variant.PushL(); |
|
151 |
|
152 if ( aMap->FindL(KPublisherId, variant )) |
|
153 { |
|
154 iPublisher = variant.AsDes().AllocL(); |
|
155 } |
|
156 |
|
157 variant.Reset(); |
|
158 if ( aMap->FindL(KContentType, variant )) |
|
159 { |
|
160 iContentType= variant.AsDes().AllocL(); |
|
161 } |
|
162 |
|
163 variant.Reset(); |
|
164 if ( aMap->FindL(KContentId, variant )) |
|
165 { |
|
166 iContentId= variant.AsDes().AllocL(); |
|
167 } |
|
168 |
|
169 variant.Reset(); |
|
170 CleanupStack::PopAndDestroy( &variant ); |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CAiCpsExecuteParam::SetRegistryTypeL |
|
175 // |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 void CAiCpsExecuteParam::SetRegistryTypeL(const TDesC& aRegistryType) |
|
179 { |
|
180 delete iRegistryType; |
|
181 iRegistryType = NULL; |
|
182 iRegistryType = aRegistryType.AllocL(); |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // CAiCpsExecuteParam::SetPluginIdL |
|
187 // |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 void CAiCpsExecuteParam::SetPluginIdL(const TDesC& aPluginId) |
|
191 { |
|
192 delete iPluginId; |
|
193 iPluginId = NULL; |
|
194 iPluginId = aPluginId.AllocL(); |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CAiCpsExecuteParam::AddActionL |
|
199 // |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 void CAiCpsExecuteParam::AddActionL(const TDesC8& aAction) |
|
203 { |
|
204 iActions.Append(aAction.AllocL()); |
|
205 } |
|
206 |
|
207 // End of file |