|
1 /* |
|
2 * Copyright (c) 2007 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 of CPhoneExtensionHandler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDES |
|
19 |
|
20 #include <eikmenup.h> |
|
21 #include <spsettings.h> |
|
22 #include <spentry.h> |
|
23 #include <spproperty.h> |
|
24 #include <phoneui.rsg> |
|
25 #include <avkon.rsg> |
|
26 #include <phoneuivoip.rsg> |
|
27 #include <StringLoader.h> |
|
28 |
|
29 #include "cphoneextensionhandler.h" |
|
30 #include "cphonemainresourceresolver.h" |
|
31 #include "cphonelogger.h" |
|
32 #include "phoneappvoipcommands.hrh" |
|
33 #include "phonerssvoip.h" |
|
34 #include "cphonemenuextensionwrapper.h" |
|
35 #include "tphonetouchpanewrapper.h" |
|
36 |
|
37 |
|
38 // ================= MEMBER FUNCTIONS ======================= |
|
39 |
|
40 // C++ default constructor can NOT contain any code, that |
|
41 // might leave. |
|
42 // |
|
43 CPhoneExtensionHandler::CPhoneExtensionHandler() |
|
44 { |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------- |
|
48 // CPhoneExtensionHandler::~CPhoneStateIdleVoIP() |
|
49 // Destructor |
|
50 // ----------------------------------------------------------- |
|
51 // |
|
52 CPhoneExtensionHandler::~CPhoneExtensionHandler() |
|
53 { |
|
54 iPlugins.ResetAndDestroy(); |
|
55 REComSession::FinalClose(); |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------- |
|
59 // CPhoneExtensionHandler::ConstructL() |
|
60 // Constructor |
|
61 // ----------------------------------------------------------- |
|
62 // |
|
63 void CPhoneExtensionHandler::ConstructL() |
|
64 { |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------- |
|
68 // CPhoneExtensionHandler::NewL() |
|
69 // Constructor |
|
70 // ----------------------------------------------------------- |
|
71 // |
|
72 CPhoneExtensionHandler* CPhoneExtensionHandler::NewL( ) |
|
73 { |
|
74 CPhoneExtensionHandler* self = new (ELeave) CPhoneExtensionHandler(); |
|
75 |
|
76 CleanupStack::PushL( self ); |
|
77 self->ConstructL(); |
|
78 CleanupStack::Pop( self ); |
|
79 |
|
80 return self; |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------- |
|
84 // CPhoneExtensionHandler::HandleCommandL |
|
85 // ----------------------------------------------------------- |
|
86 // |
|
87 TBool CPhoneExtensionHandler::HandleCommandL( |
|
88 TUint aServiceId, |
|
89 TInt aCommand ) |
|
90 { |
|
91 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
92 "CPhoneExtensionHandler::HandleCommandL" ); |
|
93 |
|
94 CTelMenuExtension* interface = MenuExtensionL( aServiceId ); |
|
95 |
|
96 return interface->HandleCommandL( aCommand ); |
|
97 } |
|
98 |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------- |
|
102 // CPhoneExtensionHandler::CustomizeTouchPaneButtonsL |
|
103 // ----------------------------------------------------------- |
|
104 // |
|
105 void CPhoneExtensionHandler::CustomizeTouchPaneButtonsL( |
|
106 TUint aServiceId, |
|
107 RArray<CTelMenuExtension::TCallInfo>& aArray, |
|
108 MBubbleTouchPaneInterface& aTouchPane ) |
|
109 { |
|
110 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
111 "CPhoneExtensionHandler::CustomizeTouchPaneButtonsL" ); |
|
112 |
|
113 CTelMenuExtension* interface = MenuExtensionL( aServiceId ); |
|
114 |
|
115 TPhTouchPaneWrapper wrapper( aTouchPane ); |
|
116 interface->ModifyExtensionsTouchPaneButtonsL( |
|
117 aArray, |
|
118 wrapper); |
|
119 } |
|
120 |
|
121 |
|
122 // ----------------------------------------------------------- |
|
123 // CPhoneExtensionHandler::ModifyInCallMenuL |
|
124 // ----------------------------------------------------------- |
|
125 // |
|
126 void CPhoneExtensionHandler::ModifyInCallMenuL( |
|
127 TUint aServiceId, |
|
128 RArray<CTelMenuExtension::TCallInfo>& aArray, |
|
129 TInt aResourceId, |
|
130 CEikMenuPane& aMenuPane ) |
|
131 { |
|
132 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
133 "CPhoneExtensionHandler::ModifyInCallMenuL" ); |
|
134 |
|
135 if ( aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && |
|
136 aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && |
|
137 aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT && |
|
138 R_PHONEUI_NEW_CALL_MENU_VOIP != aResourceId ) |
|
139 { |
|
140 |
|
141 // Load xSP ECOM plugin |
|
142 CTelMenuExtension* interface = MenuExtensionL( aServiceId ); |
|
143 |
|
144 __PHONELOG( EBasic, PhoneUIVoIPExtension, |
|
145 "CPhoneExtensionHandler::ModifyInCallMenuL, plugin exists" ); |
|
146 // Add unattended transfer option to menu |
|
147 AddUnattendedTransferMenuItemL( aMenuPane ); |
|
148 |
|
149 // Let plugin modify menu pane |
|
150 interface->ModifyExtensionsCallMenuL( aArray, aMenuPane ); |
|
151 } |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------- |
|
155 // CPhoneExtensionHandler::ResolveImplementationUidL |
|
156 // ----------------------------------------------------------- |
|
157 // |
|
158 TUid CPhoneExtensionHandler::ResolveImplementationUidL( |
|
159 TUint32 aServiceId, TServicePropertyName aPropertyName ) |
|
160 { |
|
161 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
162 "CPhoneExtensionHandler::ResolveImplementationUidL" ); |
|
163 |
|
164 TUid implUid = { 0 }; |
|
165 CSPEntry* entry = CSPEntry::NewLC(); |
|
166 |
|
167 CSPSettings* spSettings = CSPSettings::NewLC(); |
|
168 |
|
169 User::LeaveIfError( |
|
170 spSettings->FindEntryL( aServiceId, *entry ) ); |
|
171 |
|
172 CleanupStack::PopAndDestroy( spSettings ); |
|
173 |
|
174 const CSPProperty* property = NULL; |
|
175 User::LeaveIfError( entry->GetProperty( property, aPropertyName ) ); |
|
176 |
|
177 if ( property ) |
|
178 { |
|
179 TInt temp(0); |
|
180 User::LeaveIfError( property->GetValue( temp ) ); |
|
181 implUid.iUid = temp; |
|
182 } |
|
183 |
|
184 CleanupStack::PopAndDestroy( entry ); |
|
185 return implUid; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------- |
|
189 // CPhoneExtensionHandler::AddUnattendedTransferMenuItem |
|
190 // ----------------------------------------------------------- |
|
191 // |
|
192 void CPhoneExtensionHandler::AddUnattendedTransferMenuItemL( |
|
193 CEikMenuPane& aMenuPane ) |
|
194 { |
|
195 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
196 "CPhoneExtensionHandler::AddUnattendedTransferMenuItemL" ); |
|
197 |
|
198 HBufC* string = StringLoader::LoadLC( |
|
199 CPhoneMainResourceResolver::Instance()-> |
|
200 ResolveResourceID( EPhoneVoIPUnattendedTransferOption ) ); |
|
201 CEikMenuPaneItem::SData data; |
|
202 data.iCascadeId=0; |
|
203 data.iText = *string; |
|
204 data.iFlags=0; |
|
205 data.iCommandId = EPhoneInCallCmdUnattendedTransfer; |
|
206 |
|
207 // Try to find index of EPhoneInCallCmdGoToIdle command |
|
208 // unattended transfer item will be placed above it if found |
|
209 TInt index = KErrNotFound; |
|
210 TInt menuItemCount = aMenuPane.NumberOfItemsInPane(); |
|
211 for ( TInt i= 0 ; i < menuItemCount; i++ ) |
|
212 { |
|
213 if ( aMenuPane.MenuItemCommandId( i ) == EPhoneInCallCmdGoToIdle ) |
|
214 { |
|
215 index = i; |
|
216 break; |
|
217 } |
|
218 } |
|
219 |
|
220 if ( KErrNotFound < index ) |
|
221 { |
|
222 aMenuPane.InsertMenuItemL( data, index ); |
|
223 } |
|
224 else |
|
225 { |
|
226 aMenuPane.AddMenuItemL( data ); |
|
227 } |
|
228 |
|
229 CleanupStack::PopAndDestroy( string ); |
|
230 } |
|
231 |
|
232 // ---------------------------------------------------------- |
|
233 // CPhoneExtensionHandler::MenuExtensionL |
|
234 // (other items were commented in a header). |
|
235 // ----------------------------------------------------------- |
|
236 // |
|
237 CTelMenuExtension* CPhoneExtensionHandler::MenuExtensionL( TUint aServiceId ) |
|
238 { |
|
239 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
240 "CPhoneExtensionHandler::MenuExtensionL" ); |
|
241 |
|
242 TUid pluginUid = ResolveImplementationUidL( aServiceId, |
|
243 EPropertyCallMenuHandlerPluginId ); |
|
244 |
|
245 CPhMenuExtensionWrapper* wrapper = NULL; |
|
246 TInt pluginInd = |
|
247 iPlugins.Find( pluginUid, CPhMenuExtensionWrapper::MatchByUid ); |
|
248 if ( KErrNotFound == pluginInd ) |
|
249 { |
|
250 wrapper = CPhMenuExtensionWrapper::NewLC( pluginUid ); |
|
251 iPlugins.AppendL( wrapper ); |
|
252 CleanupStack::Pop( wrapper ); |
|
253 } |
|
254 else |
|
255 { |
|
256 wrapper = iPlugins[pluginInd]; |
|
257 } |
|
258 |
|
259 __ASSERT_ALWAYS( NULL != wrapper, User::Leave( KErrNotFound ) ); |
|
260 return wrapper; |
|
261 } |
|
262 |
|
263 |
|
264 // End of File |