|
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 "TMCETestUIEngineCmdSelectProfile.h" |
|
24 #include "CMCETestUIEngineProfileContainer.h" |
|
25 #include "CMCETestUIQuestionSingleSelection.h" |
|
26 #include "CMCETestUIEngineProfile.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // TMCETestUIEngineCmdSelectProfile::TMCETestUIEngineCmdSelectProfile |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TMCETestUIEngineCmdSelectProfile::TMCETestUIEngineCmdSelectProfile( |
|
34 CMCETestUIEngine& aEngine ) |
|
35 :TMCETestUIEngineCmdBase( aEngine ) |
|
36 { |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // TMCETestUIEngineCmdSelectProfile::ExecuteL |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C void TMCETestUIEngineCmdSelectProfile::ExecuteL() |
|
44 { |
|
45 |
|
46 CMCETestUIEngineProfileContainer& profileContainer = |
|
47 iEngine.ProfileContainer(); |
|
48 |
|
49 const RPointerArray<CMCETestUIEngineProfile>& profiles = |
|
50 profileContainer.AvailableProfiles(); |
|
51 |
|
52 CMCETestUIQuestionSingleSelection* question = |
|
53 CMCETestUIQuestionSingleSelection::NewLC(); |
|
54 |
|
55 question->SetCaptionL( KUserQuestionSelectProfile ); |
|
56 |
|
57 for ( TInt i = 0; i < profiles.Count(); ++i ) |
|
58 { |
|
59 const TDesC8& providerName = profiles[i]->ProviderName(); |
|
60 HBufC* providerName16 = HBufC16::NewLC( providerName.Length() ); |
|
61 TPtr providerNamePtr = providerName16->Des(); |
|
62 providerNamePtr.Copy( providerName ); |
|
63 |
|
64 question->AddChoiceL( *providerName16 ); |
|
65 |
|
66 CleanupStack::PopAndDestroy( providerName16 ); |
|
67 providerName16 = NULL; |
|
68 } |
|
69 |
|
70 TInt selectedProfile = iEngine.AskQuestionL( *question ); |
|
71 |
|
72 CleanupStack::PopAndDestroy( question ); |
|
73 |
|
74 if ( selectedProfile >= 0 && selectedProfile < profiles.Count() ) |
|
75 { |
|
76 profileContainer.TakeProfileIntoUseL( *(profiles[selectedProfile]) ); |
|
77 } |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // TMCETestUIEngineCmdSelectProfile::Caption |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C const TDesC& TMCETestUIEngineCmdSelectProfile::Caption() const |
|
85 { |
|
86 return KCommandCaptionSelectProfile; |
|
87 } |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 // End of File |