|
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 "TMCETestUIEngineCmdCreatePoCSession.h" |
|
24 #include "CMCETestUIEngineOutSession.h" |
|
25 #include "CMCETestUIQuestionSingleSelection.h" |
|
26 #include "CMCETestUIEngineProfile.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // TMCETestUIEngineCmdCreatePoCSession::Caption |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TMCETestUIEngineCmdCreatePoCSession::TMCETestUIEngineCmdCreatePoCSession( |
|
34 CMCETestUIEngine& aEngine ) |
|
35 : TMCETestUIEngineCmdBase( aEngine ), |
|
36 iProfile( NULL ) |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // TMCETestUIEngineCmdCreatePoCSession::TMCETestUIEngineCmdCreatePoCSession |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 TMCETestUIEngineCmdCreatePoCSession::TMCETestUIEngineCmdCreatePoCSession( |
|
45 CMCETestUIEngine& aEngine, |
|
46 CMCETestUIEngineProfile& aProfile ) |
|
47 : TMCETestUIEngineCmdBase( aEngine ), |
|
48 iProfile( &aProfile ) |
|
49 { |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // TMCETestUIEngineCmdCreatePoCSession::ExecuteL |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C void TMCETestUIEngineCmdCreatePoCSession::ExecuteL() |
|
57 { |
|
58 iEngine.iOutSessionWithProfile = ETrue; |
|
59 iEngine.iOutSessionWithAPList = EFalse; |
|
60 iEngine.iOutSessionWithAPNumber = EFalse; |
|
61 |
|
62 TSessionType sessionType = EPoCSession; |
|
63 |
|
64 TDirection direction = ENotSpesified; |
|
65 |
|
66 TVideoDirection videoDirection = EVideoNotSpesified; |
|
67 |
|
68 // Solve used profile |
|
69 CMCETestUIEngineProfile* usedProfile = iProfile; |
|
70 |
|
71 if ( !usedProfile ) |
|
72 { |
|
73 const RPointerArray<CMCETestUIEngineProfile>& profiles = |
|
74 iEngine.UsedProfiles(); |
|
75 |
|
76 RPointerArray<CMCETestUIEngineProfile> registeredProfiles; |
|
77 CleanupClosePushL( registeredProfiles ); |
|
78 for ( TInt i = 0; i < profiles.Count(); ++i ) |
|
79 { |
|
80 if ( profiles[i]->IsRegistered() ) |
|
81 { |
|
82 registeredProfiles.AppendL( profiles[i] ); |
|
83 } |
|
84 } |
|
85 |
|
86 if ( registeredProfiles.Count() == 1 ) |
|
87 { |
|
88 usedProfile = registeredProfiles[ 0 ]; |
|
89 } |
|
90 else |
|
91 { |
|
92 CMCETestUIQuestionSingleSelection* profileQuestion = |
|
93 CMCETestUIQuestionSingleSelection::NewLC(); |
|
94 profileQuestion->SetCaptionL( KUserQuestionSelectUsedProfile ); |
|
95 |
|
96 |
|
97 |
|
98 for ( TInt i = 0; i < registeredProfiles.Count(); ++i ) |
|
99 { |
|
100 const TDesC8& providerName = registeredProfiles[i]->ProviderName(); |
|
101 HBufC* providerName16 = HBufC16::NewLC( providerName.Length() ); |
|
102 TPtr providerNamePtr = providerName16->Des(); |
|
103 providerNamePtr.Copy( providerName ); |
|
104 |
|
105 profileQuestion->AddChoiceL( *providerName16 ); |
|
106 |
|
107 CleanupStack::PopAndDestroy( providerName16 ); |
|
108 providerName16 = NULL; |
|
109 } |
|
110 |
|
111 TInt index = iEngine.AskQuestionL( *profileQuestion ); |
|
112 |
|
113 CleanupStack::PopAndDestroy( profileQuestion ); |
|
114 |
|
115 if ( index >= 0 && index < registeredProfiles.Count() ) |
|
116 { |
|
117 usedProfile = registeredProfiles[ index ]; |
|
118 } |
|
119 |
|
120 } |
|
121 CleanupStack::PopAndDestroy(); // registeredProfiles |
|
122 } |
|
123 |
|
124 if ( usedProfile ) |
|
125 { |
|
126 iEngine.CreateOutSessionL( *usedProfile, direction ,videoDirection,sessionType); |
|
127 } |
|
128 else |
|
129 { |
|
130 iEngine.NotifyUser( KUserNotificationSessionCannotCreate ); |
|
131 } |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // TMCETestUIEngineCmdCreatePoCSession::Caption |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 EXPORT_C const TDesC& TMCETestUIEngineCmdCreatePoCSession::Caption() const |
|
139 { |
|
140 return KCommandCaptionCreatePoCSession; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 // End of File |