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