|
1 /* |
|
2 * Copyright (c) 2005 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: Implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include "TMCETestUIEngineCmdCreateEvent.h" |
|
24 #include "CMCETestUIEngineOutEvent.h" |
|
25 #include "CMCETestUIQuestionSingleSelection.h" |
|
26 #include "CMCETestUIEngineProfile.h" |
|
27 #include "CMCETestUIEngineRefer.h" |
|
28 #include <MceRefer.h> |
|
29 |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // TMCETestUIEngineCmdCreateEvent::Caption |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 TMCETestUIEngineCmdCreateEvent::TMCETestUIEngineCmdCreateEvent( |
|
36 CMCETestUIEngine& aEngine ) |
|
37 : TMCETestUIEngineCmdBase( aEngine ), |
|
38 iProfile( NULL ) |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // TMCETestUIEngineCmdCreateEvent::TMCETestUIEngineCmdCreateEvent |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 TMCETestUIEngineCmdCreateEvent::TMCETestUIEngineCmdCreateEvent( |
|
47 CMCETestUIEngine& aEngine, |
|
48 CMCETestUIEngineProfile& aProfile ) |
|
49 : TMCETestUIEngineCmdBase( aEngine ), |
|
50 iProfile( &aProfile ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // TMCETestUIEngineCmdCreateEvent::ExecuteL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C void TMCETestUIEngineCmdCreateEvent::ExecuteL() |
|
59 { |
|
60 |
|
61 // Solve used profile |
|
62 CMCETestUIEngineProfile* usedProfile = iProfile; |
|
63 |
|
64 if ( !usedProfile ) |
|
65 { |
|
66 const RPointerArray<CMCETestUIEngineProfile>& profiles = |
|
67 iEngine.UsedProfiles(); |
|
68 |
|
69 RPointerArray<CMCETestUIEngineProfile> registeredProfiles; |
|
70 CleanupClosePushL( registeredProfiles ); |
|
71 for ( TInt i = 0; i < profiles.Count(); ++i ) |
|
72 { |
|
73 if ( profiles[i]->IsRegistered() ) |
|
74 { |
|
75 registeredProfiles.AppendL( profiles[i] ); |
|
76 } |
|
77 } |
|
78 |
|
79 if ( registeredProfiles.Count() == 1 ) |
|
80 { |
|
81 usedProfile = registeredProfiles[ 0 ]; |
|
82 } |
|
83 else |
|
84 { |
|
85 CMCETestUIQuestionSingleSelection* profileQuestion = |
|
86 CMCETestUIQuestionSingleSelection::NewLC(); |
|
87 profileQuestion->SetCaptionL( KUserQuestionSelectUsedProfile ); |
|
88 |
|
89 |
|
90 |
|
91 for ( TInt i = 0; i < registeredProfiles.Count(); ++i ) |
|
92 { |
|
93 const TDesC8& providerName = registeredProfiles[i]->ProviderName(); |
|
94 HBufC* providerName16 = HBufC16::NewLC( providerName.Length() ); |
|
95 TPtr providerNamePtr = providerName16->Des(); |
|
96 providerNamePtr.Copy( providerName ); |
|
97 |
|
98 profileQuestion->AddChoiceL( *providerName16 ); |
|
99 |
|
100 CleanupStack::PopAndDestroy( providerName16 ); |
|
101 providerName16 = NULL; |
|
102 } |
|
103 |
|
104 TInt index = iEngine.AskQuestionL( *profileQuestion ); |
|
105 |
|
106 CleanupStack::PopAndDestroy( profileQuestion ); |
|
107 |
|
108 if ( index >= 0 && index < registeredProfiles.Count() ) |
|
109 { |
|
110 usedProfile = registeredProfiles[ index ]; |
|
111 } |
|
112 |
|
113 } |
|
114 CleanupStack::PopAndDestroy(); // registeredProfiles |
|
115 } |
|
116 |
|
117 if ( usedProfile ) |
|
118 { |
|
119 iEngine.CreateOutEventL( *usedProfile ); |
|
120 } |
|
121 else |
|
122 { |
|
123 iEngine.NotifyUser( KUserNotificationEventCannotCreate ); |
|
124 } |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // TMCETestUIEngineCmdCreateEvent::Caption |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateEvent::Caption() const |
|
132 { |
|
133 return KCommandCaptionCreateEvent; |
|
134 } |
|
135 |
|
136 |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // TMCETestUIEngineCmdCreateRefer::Caption |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 TMCETestUIEngineCmdCreateRefer::TMCETestUIEngineCmdCreateRefer( |
|
143 CMCETestUIEngine& aEngine ) |
|
144 : TMCETestUIEngineCmdBase( aEngine ), |
|
145 iProfile( NULL ) |
|
146 { |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // TMCETestUIEngineCmdCreateRefer::TMCETestUIEngineCmdCreateRefer |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 TMCETestUIEngineCmdCreateRefer::TMCETestUIEngineCmdCreateRefer( |
|
154 CMCETestUIEngine& aEngine, |
|
155 CMCETestUIEngineProfile& aProfile ) |
|
156 : TMCETestUIEngineCmdBase( aEngine ), |
|
157 iProfile( &aProfile ) |
|
158 { |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // TMCETestUIEngineCmdCreateRefer::ExecuteL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 EXPORT_C void TMCETestUIEngineCmdCreateRefer::ExecuteL() |
|
166 { |
|
167 |
|
168 // Solve used profile |
|
169 CMCETestUIEngineProfile* usedProfile = iProfile; |
|
170 |
|
171 if ( !usedProfile ) |
|
172 { |
|
173 const RPointerArray<CMCETestUIEngineProfile>& profiles = |
|
174 iEngine.UsedProfiles(); |
|
175 |
|
176 RPointerArray<CMCETestUIEngineProfile> registeredProfiles; |
|
177 CleanupClosePushL( registeredProfiles ); |
|
178 for ( TInt i = 0; i < profiles.Count(); ++i ) |
|
179 { |
|
180 if ( profiles[i]->IsRegistered() ) |
|
181 { |
|
182 registeredProfiles.AppendL( profiles[i] ); |
|
183 } |
|
184 } |
|
185 |
|
186 if ( registeredProfiles.Count() == 1 ) |
|
187 { |
|
188 usedProfile = registeredProfiles[ 0 ]; |
|
189 } |
|
190 else |
|
191 { |
|
192 CMCETestUIQuestionSingleSelection* profileQuestion = |
|
193 CMCETestUIQuestionSingleSelection::NewLC(); |
|
194 profileQuestion->SetCaptionL( KUserQuestionSelectUsedProfile ); |
|
195 |
|
196 |
|
197 |
|
198 for ( TInt i = 0; i < registeredProfiles.Count(); ++i ) |
|
199 { |
|
200 const TDesC8& providerName = registeredProfiles[i]->ProviderName(); |
|
201 HBufC* providerName16 = HBufC16::NewLC( providerName.Length() ); |
|
202 TPtr providerNamePtr = providerName16->Des(); |
|
203 providerNamePtr.Copy( providerName ); |
|
204 |
|
205 profileQuestion->AddChoiceL( *providerName16 ); |
|
206 |
|
207 CleanupStack::PopAndDestroy( providerName16 ); |
|
208 providerName16 = NULL; |
|
209 } |
|
210 |
|
211 TInt index = iEngine.AskQuestionL( *profileQuestion ); |
|
212 |
|
213 CleanupStack::PopAndDestroy( profileQuestion ); |
|
214 |
|
215 if ( index >= 0 && index < registeredProfiles.Count() ) |
|
216 { |
|
217 usedProfile = registeredProfiles[ index ]; |
|
218 } |
|
219 |
|
220 } |
|
221 CleanupStack::PopAndDestroy(); // registeredProfiles |
|
222 } |
|
223 |
|
224 if ( usedProfile ) |
|
225 { |
|
226 iEngine.CreateOutReferL( *usedProfile ); |
|
227 } |
|
228 else |
|
229 { |
|
230 iEngine.NotifyUser( KUserNotificationReferCannotCreate ); |
|
231 } |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // TMCETestUIEngineCmdCreateRefer::Caption |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateRefer::Caption() const |
|
239 { |
|
240 return KCommandCaptionCreateRefer; |
|
241 } |
|
242 |
|
243 |
|
244 // ----------------------------------------------------------------------------- |
|
245 // TMCETestUIEngineCmdCreateRefer::TMCETestUIEngineCmdCreateReferSession |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 TMCETestUIEngineCmdCreateReferSession::TMCETestUIEngineCmdCreateReferSession( |
|
249 CMCETestUIEngine& aEngine ) |
|
250 : TMCETestUIEngineCmdBase( aEngine ), |
|
251 iSession( NULL ) |
|
252 { |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // TMCETestUIEngineCmdCreateReferSession::TMCETestUIEngineCmdCreateReferSession |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 TMCETestUIEngineCmdCreateReferSession::TMCETestUIEngineCmdCreateReferSession( |
|
260 CMCETestUIEngine& aEngine, |
|
261 CMCETestUIEngineSession& aSession ) |
|
262 : TMCETestUIEngineCmdBase( aEngine ), |
|
263 iSession( &aSession ) |
|
264 { |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // TMCETestUIEngineCmdCreateReferSession::ExecuteL |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C void TMCETestUIEngineCmdCreateReferSession::ExecuteL() |
|
272 { |
|
273 iEngine.CreateOutReferL( *iSession ); |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // TMCETestUIEngineCmdCreateReferSession::Caption |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateReferSession::Caption() const |
|
281 { |
|
282 return KCommandCaptionCreateRefer; |
|
283 } |
|
284 // End of File |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // TMCETestUIEngineCmdCreateReferEvent::TMCETestUIEngineCmdCreateReferEvent |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 TMCETestUIEngineCmdCreateReferEvent::TMCETestUIEngineCmdCreateReferEvent( |
|
291 CMCETestUIEngine& aEngine ) |
|
292 : TMCETestUIEngineCmdBase( aEngine ), |
|
293 iEvent( NULL ) |
|
294 { |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // TMCETestUIEngineCmdCreateReferEvent::TMCETestUIEngineCmdCreateReferEvent |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 TMCETestUIEngineCmdCreateReferEvent::TMCETestUIEngineCmdCreateReferEvent( |
|
302 CMCETestUIEngine& aEngine, |
|
303 CMCETestUIEngineEvent& aEvent ) |
|
304 : TMCETestUIEngineCmdBase( aEngine ), |
|
305 iEvent( &aEvent ) |
|
306 { |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // TMCETestUIEngineCmdCreateReferEvent::ExecuteL |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 EXPORT_C void TMCETestUIEngineCmdCreateReferEvent::ExecuteL() |
|
314 { |
|
315 iEngine.CreateOutReferL( *iEvent ); |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // TMCETestUIEngineCmdCreateReferEvent::Caption |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateReferEvent::Caption() const |
|
323 { |
|
324 return KCommandCaptionCreateRefer; |
|
325 } |
|
326 // ----------------------------------------------------------------------------- |
|
327 // TMCETestUIEngineCmdCreateSessionFromRefer::TMCETestUIEngineCmdCreateSessionFromRefer |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 TMCETestUIEngineCmdCreateSessionFromRefer::TMCETestUIEngineCmdCreateSessionFromRefer( |
|
331 CMCETestUIEngine& aEngine ) |
|
332 : TMCETestUIEngineCmdBase( aEngine ), |
|
333 iRefer( NULL ) |
|
334 { |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // TMCETestUIEngineCmdCreateSessionFromRefer::TMCETestUIEngineCmdCreateSessionFromRefer |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 TMCETestUIEngineCmdCreateSessionFromRefer::TMCETestUIEngineCmdCreateSessionFromRefer( |
|
342 CMCETestUIEngine& aEngine, |
|
343 CMCETestUIEngineRefer& aRefer ) |
|
344 : TMCETestUIEngineCmdBase( aEngine ), |
|
345 iRefer( &aRefer ) |
|
346 { |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // TMCETestUIEngineCmdCreateSessionFromRefer::ExecuteL |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 EXPORT_C void TMCETestUIEngineCmdCreateSessionFromRefer::ExecuteL() |
|
354 { |
|
355 iEngine.CreateOutSessionL( iRefer->Refer()); |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // TMCETestUIEngineCmdCreateSessionFromRefer::Caption |
|
360 // ----------------------------------------------------------------------------- |
|
361 // |
|
362 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateSessionFromRefer::Caption() const |
|
363 { |
|
364 return KCommandCaptionCreateSessionFromRefer; |
|
365 } |
|
366 // End of File |
|
367 |