|
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 "TMCETestUIEngineCmdCreateSession.h" |
|
24 #include "CMCETestUIEngineOutSession.h" |
|
25 #include "CMCETestUIQuestionSingleSelection.h" |
|
26 #include "CMCETestUIEngineProfile.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // TMCETestUIEngineCmdCreateSession::Caption |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TMCETestUIEngineCmdCreateSession::TMCETestUIEngineCmdCreateSession( |
|
34 CMCETestUIEngine& aEngine ) |
|
35 : TMCETestUIEngineCmdBase( aEngine ), |
|
36 iProfile( NULL ) |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // TMCETestUIEngineCmdCreateSession::TMCETestUIEngineCmdCreateSession |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 TMCETestUIEngineCmdCreateSession::TMCETestUIEngineCmdCreateSession( |
|
45 CMCETestUIEngine& aEngine, |
|
46 CMCETestUIEngineProfile& aProfile ) |
|
47 : TMCETestUIEngineCmdBase( aEngine ), |
|
48 iProfile( &aProfile ) |
|
49 { |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // TMCETestUIEngineCmdCreateSession::ExecuteL |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C void TMCETestUIEngineCmdCreateSession::ExecuteL() |
|
57 { |
|
58 iEngine.iOutSessionWithProfile = ETrue; |
|
59 iEngine.iOutSessionWithAPList = EFalse; |
|
60 iEngine.iOutSessionWithAPNumber = EFalse; |
|
61 TSessionType sessionType = ECustomSession; |
|
62 |
|
63 TDirection direction = ENotSpesified; |
|
64 |
|
65 TVideoDirection videoDirection = EVideoNotSpesified; |
|
66 |
|
67 // Solve used profile |
|
68 CMCETestUIEngineProfile* usedProfile = iProfile; |
|
69 |
|
70 if ( !usedProfile ) |
|
71 { |
|
72 const RPointerArray<CMCETestUIEngineProfile>& profiles = |
|
73 iEngine.UsedProfiles(); |
|
74 |
|
75 RPointerArray<CMCETestUIEngineProfile> registeredProfiles; |
|
76 CleanupClosePushL( registeredProfiles ); |
|
77 for ( TInt i = 0; i < profiles.Count(); ++i ) |
|
78 { |
|
79 if ( profiles[i]->IsRegistered() ) |
|
80 { |
|
81 registeredProfiles.AppendL( profiles[i] ); |
|
82 } |
|
83 } |
|
84 |
|
85 if ( registeredProfiles.Count() == 1 ) |
|
86 { |
|
87 usedProfile = registeredProfiles[ 0 ]; |
|
88 } |
|
89 else |
|
90 { |
|
91 CMCETestUIQuestionSingleSelection* profileQuestion = |
|
92 CMCETestUIQuestionSingleSelection::NewLC(); |
|
93 profileQuestion->SetCaptionL( KUserQuestionSelectUsedProfile ); |
|
94 |
|
95 |
|
96 |
|
97 for ( TInt i = 0; i < registeredProfiles.Count(); ++i ) |
|
98 { |
|
99 const TDesC8& providerName = registeredProfiles[i]->ProviderName(); |
|
100 HBufC* providerName16 = HBufC16::NewLC( providerName.Length() ); |
|
101 TPtr providerNamePtr = providerName16->Des(); |
|
102 providerNamePtr.Copy( providerName ); |
|
103 |
|
104 profileQuestion->AddChoiceL( *providerName16 ); |
|
105 |
|
106 CleanupStack::PopAndDestroy( providerName16 ); |
|
107 providerName16 = NULL; |
|
108 } |
|
109 |
|
110 TInt index = iEngine.AskQuestionL( *profileQuestion ); |
|
111 |
|
112 CleanupStack::PopAndDestroy( profileQuestion ); |
|
113 |
|
114 if ( index >= 0 && index < registeredProfiles.Count() ) |
|
115 { |
|
116 usedProfile = registeredProfiles[ index ]; |
|
117 } |
|
118 |
|
119 } |
|
120 CleanupStack::PopAndDestroy(); // registeredProfiles |
|
121 } |
|
122 |
|
123 if ( usedProfile ) |
|
124 { |
|
125 iEngine.CreateOutSessionL( *usedProfile, direction,videoDirection,sessionType ); |
|
126 } |
|
127 else |
|
128 { |
|
129 iEngine.NotifyUser( KUserNotificationSessionCannotCreate ); |
|
130 } |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // TMCETestUIEngineCmdCreateSession::Caption |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateSession::Caption() const |
|
138 { |
|
139 return KCommandCaptionCreateCustomSession; |
|
140 } |
|
141 |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // TMCETestUIEngineCmdCreateSessionUsingAPList::Caption |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 TMCETestUIEngineCmdCreateSessionUsingAPList::TMCETestUIEngineCmdCreateSessionUsingAPList( |
|
148 CMCETestUIEngine& aEngine ) |
|
149 : TMCETestUIEngineCmdBase( aEngine ) |
|
150 { |
|
151 } |
|
152 |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // TMCETestUIEngineCmdCreateSessionUsingAPList::ExecuteL |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 EXPORT_C void TMCETestUIEngineCmdCreateSessionUsingAPList::ExecuteL() |
|
159 { |
|
160 |
|
161 iEngine.iOutSessionWithProfile = EFalse; |
|
162 iEngine.iOutSessionWithAPList = ETrue; |
|
163 iEngine.iOutSessionWithAPNumber = EFalse; |
|
164 TSessionType sessionType = ECustomSession; |
|
165 |
|
166 TDirection direction = ENotSpesified; |
|
167 |
|
168 TVideoDirection videoDirection = EVideoNotSpesified; |
|
169 |
|
170 // TUint iapId; |
|
171 iEngine.GetIapIdFromAPList(); |
|
172 iEngine.CreateOutSessionL( iEngine.iIapId, direction,videoDirection,sessionType ); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // TMCETestUIEngineCmdCreateSessionUsingAPList::Caption |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateSessionUsingAPList::Caption() const |
|
180 { |
|
181 return KCommandCaptionCreateCustomSessionAPList; |
|
182 } |
|
183 |
|
184 |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // TMCETestUIEngineCmdCreateSessionUsingAPNumber::TMCETestUIEngineCmdCreateSessionUsingAPNumber |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 TMCETestUIEngineCmdCreateSessionUsingAPNumber::TMCETestUIEngineCmdCreateSessionUsingAPNumber( |
|
191 CMCETestUIEngine& aEngine) |
|
192 : TMCETestUIEngineCmdBase( aEngine ) |
|
193 { |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // TMCETestUIEngineCmdCreateSessionUsingAPNumber::ExecuteL |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 EXPORT_C void TMCETestUIEngineCmdCreateSessionUsingAPNumber::ExecuteL() |
|
201 { |
|
202 iEngine.iOutSessionWithProfile = EFalse; |
|
203 iEngine.iOutSessionWithAPList = EFalse; |
|
204 iEngine.iOutSessionWithAPNumber = ETrue; |
|
205 TSessionType sessionType = ECustomSession; |
|
206 |
|
207 TDirection direction = ENotSpesified; |
|
208 |
|
209 TVideoDirection videoDirection = EVideoNotSpesified; |
|
210 |
|
211 TInt iapId; |
|
212 iEngine.GetIapIdL(iapId); |
|
213 iEngine.CreateOutSessionL( iapId, direction,videoDirection,sessionType ); |
|
214 |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // TMCETestUIEngineCmdCreateSessionUsingAPNumber::Caption |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 EXPORT_C const TDesC& TMCETestUIEngineCmdCreateSessionUsingAPNumber::Caption() const |
|
222 { |
|
223 return KCommandCaptionCreateCustomSessionAPNumber; |
|
224 } |
|
225 |
|
226 |
|
227 // End of File |