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