63
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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: Phonebook 2 USIM UI Extension plug-in.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "CPsu2UIExtensionPlugin.h"
|
|
21 |
|
|
22 |
// Phonebook 2
|
|
23 |
#include "CPsu2CopyToSimCmd.h"
|
|
24 |
#include "CPsu2CopyFromPbkCmd.h"
|
|
25 |
#include "CPsu2LaunchViewCmd.h"
|
|
26 |
#include "Pbk2USimUI.hrh"
|
|
27 |
#include "CPsu2ViewManager.h"
|
|
28 |
#include "CPsu2OwnNumbersView.h"
|
|
29 |
#include "CPsu2ServiceDialingView.h"
|
|
30 |
#include "CPsu2FixedDialingView.h"
|
|
31 |
#include "CPsu2ServiceDialingInfoView.h"
|
|
32 |
#include "CPsu2FixedDialingInfoView.h"
|
|
33 |
#include "CPsu2ContactEditorExtension.h"
|
|
34 |
#include "CPsu2CopyAllToPbkCmd.h"
|
|
35 |
|
|
36 |
#include <MPbk2ContactUiControl.h>
|
|
37 |
#include <CPbk2StorePropertyArray.h>
|
|
38 |
#include <CPbk2AppViewBase.h>
|
|
39 |
#include <CPbk2StoreProperty.h>
|
|
40 |
#include <CPbk2StoreViewDefinition.h>
|
|
41 |
#include <CPbk2ApplicationServices.h>
|
|
42 |
#include <MPbk2AppUi.h>
|
|
43 |
#include <MPbk2StoreValidityInformer.h>
|
|
44 |
#include <Pbk2ViewId.hrh>
|
|
45 |
|
|
46 |
// Virtual Phonebook
|
|
47 |
#include <VPbkContactStoreUris.h>
|
|
48 |
#include <TVPbkContactStoreUriPtr.h>
|
|
49 |
#include <CVPbkContactManager.h>
|
|
50 |
#include <MVPbkContactStoreList.h>
|
|
51 |
#include <MVPbkContactStore.h>
|
|
52 |
#include <MVPbkBaseContact.h>
|
|
53 |
#include <CVPbkContactStoreUriArray.h>
|
|
54 |
#include <CVPbkContactViewDefinition.h>
|
|
55 |
|
|
56 |
// System includes
|
|
57 |
#include <barsread.h>
|
|
58 |
#include <coemain.h>
|
|
59 |
#include <vwsdef.h>
|
|
60 |
#include <csxhelp/phob.hlp.hrh>
|
|
61 |
#include <avkon.hrh>
|
|
62 |
|
|
63 |
#include <MPbk2CommandHandler.h>
|
|
64 |
|
|
65 |
// --------------------------------------------------------------------------
|
|
66 |
// CPsu2UIExtensionPlugin::CPsu2UIExtensionPlugin
|
|
67 |
// --------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CPsu2UIExtensionPlugin::CPsu2UIExtensionPlugin()
|
|
70 |
:iEndKeyPressed( EFalse )
|
|
71 |
{
|
|
72 |
}
|
|
73 |
|
|
74 |
// --------------------------------------------------------------------------
|
|
75 |
// CPsu2UIExtensionPlugin::~CPsu2UIExtensionPlugin
|
|
76 |
// --------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CPsu2UIExtensionPlugin::~CPsu2UIExtensionPlugin()
|
|
79 |
{
|
|
80 |
delete iViewManager;
|
|
81 |
Release( iAppServices );
|
|
82 |
}
|
|
83 |
|
|
84 |
// --------------------------------------------------------------------------
|
|
85 |
// CPsu2UIExtensionPlugin::ConstructL
|
|
86 |
// --------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
inline void CPsu2UIExtensionPlugin::ConstructL()
|
|
89 |
{
|
|
90 |
iAppServices = CPbk2ApplicationServices::InstanceL();
|
|
91 |
|
|
92 |
iViewManager = CPsu2ViewManager::NewL();
|
|
93 |
}
|
|
94 |
|
|
95 |
// --------------------------------------------------------------------------
|
|
96 |
// CPsu2UIExtensionPlugin::NewL
|
|
97 |
// --------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
CPsu2UIExtensionPlugin* CPsu2UIExtensionPlugin::NewL()
|
|
100 |
{
|
|
101 |
CPsu2UIExtensionPlugin* self = new( ELeave ) CPsu2UIExtensionPlugin();
|
|
102 |
CleanupStack::PushL( self );
|
|
103 |
self->ConstructL();
|
|
104 |
CleanupStack::Pop( self );
|
|
105 |
return self;
|
|
106 |
}
|
|
107 |
|
|
108 |
// --------------------------------------------------------------------------
|
|
109 |
// CPsu2UIExtensionPlugin::CreateExtensionViewL
|
|
110 |
// --------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
MPbk2UIExtensionView* CPsu2UIExtensionPlugin::CreateExtensionViewL
|
|
113 |
( TUid aViewId, CPbk2UIExtensionView& aView )
|
|
114 |
{
|
|
115 |
MPbk2UIExtensionView* ret = NULL;
|
|
116 |
|
|
117 |
if ( aViewId == TUid::Uid( EPsu2OwnNumberViewId ) )
|
|
118 |
{
|
|
119 |
ret = CPsu2OwnNumbersView::NewL( aView, *iViewManager );
|
|
120 |
}
|
|
121 |
else if ( aViewId == TUid::Uid( EPsu2ServiceDialingViewId ) )
|
|
122 |
{
|
|
123 |
ret = CPsu2ServiceDialingView::NewL( aView, *iViewManager );
|
|
124 |
}
|
|
125 |
else if ( aViewId == TUid::Uid( EPsu2FixedDialingViewId ) )
|
|
126 |
{
|
|
127 |
ret = CPsu2FixedDialingView::NewL( aView, *iViewManager );
|
|
128 |
}
|
|
129 |
else if ( aViewId == TUid::Uid( EPsu2ServiceDialingInfoViewId ) )
|
|
130 |
{
|
|
131 |
ret = CPsu2ServiceDialingInfoView::NewL( aView, *iViewManager );
|
|
132 |
}
|
|
133 |
else if ( aViewId == TUid::Uid( EPsu2FixedDialingInfoViewId ) )
|
|
134 |
{
|
|
135 |
ret = CPsu2FixedDialingInfoView::NewL( aView, *iViewManager );
|
|
136 |
}
|
|
137 |
|
|
138 |
return ret;
|
|
139 |
}
|
|
140 |
|
|
141 |
// --------------------------------------------------------------------------
|
|
142 |
// CPsu2UIExtensionPlugin::DynInitMenuPaneL
|
|
143 |
// --------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
void CPsu2UIExtensionPlugin::DynInitMenuPaneL
|
|
146 |
( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/,
|
|
147 |
MPbk2ContactUiControl& /*aControl*/ )
|
|
148 |
{
|
|
149 |
// Do nothing
|
|
150 |
}
|
|
151 |
|
|
152 |
// --------------------------------------------------------------------------
|
|
153 |
// CPsu2UIExtensionPlugin::UpdateStorePropertiesL
|
|
154 |
// --------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void CPsu2UIExtensionPlugin::UpdateStorePropertiesL
|
|
157 |
( CPbk2StorePropertyArray& /*aPropertyArray*/ )
|
|
158 |
{
|
|
159 |
// Do nothing
|
|
160 |
}
|
|
161 |
|
|
162 |
// --------------------------------------------------------------------------
|
|
163 |
// CPsu2UIExtensionPlugin::CreatePbk2ContactEditorExtensionL
|
|
164 |
// --------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
MPbk2ContactEditorExtension*
|
|
167 |
CPsu2UIExtensionPlugin::CreatePbk2ContactEditorExtensionL
|
|
168 |
( CVPbkContactManager& aContactManager,
|
|
169 |
MVPbkStoreContact& aContact,
|
|
170 |
MPbk2ContactEditorControl& aEditorControl )
|
|
171 |
{
|
|
172 |
return CPsu2ContactEditorExtension::NewL
|
|
173 |
( aContactManager, aContact, aEditorControl );
|
|
174 |
}
|
|
175 |
|
|
176 |
// --------------------------------------------------------------------------
|
|
177 |
// CPsu2UIExtensionPlugin::CreatePbk2UiControlExtensionL
|
|
178 |
// --------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
MPbk2ContactUiControlExtension*
|
|
181 |
CPsu2UIExtensionPlugin::CreatePbk2UiControlExtensionL
|
|
182 |
( CVPbkContactManager& /*aContactManager*/ )
|
|
183 |
{
|
|
184 |
return NULL;
|
|
185 |
}
|
|
186 |
|
|
187 |
// --------------------------------------------------------------------------
|
|
188 |
// CPmuUIExtensionPlugin::CreatePbk2SettingsViewExtensionL
|
|
189 |
// --------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
MPbk2SettingsViewExtension* CPsu2UIExtensionPlugin::
|
|
192 |
CreatePbk2SettingsViewExtensionL
|
|
193 |
( CVPbkContactManager& /*aContactManager*/ )
|
|
194 |
{
|
|
195 |
return NULL;
|
|
196 |
}
|
|
197 |
|
|
198 |
// --------------------------------------------------------------------------
|
|
199 |
// CPsu2UIExtensionPlugin::CreatePbk2AppUiExtensionL
|
|
200 |
// --------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
MPbk2AppUiExtension* CPsu2UIExtensionPlugin::CreatePbk2AppUiExtensionL
|
|
203 |
( CVPbkContactManager& /*aContactManager*/ )
|
|
204 |
{
|
|
205 |
return NULL;
|
|
206 |
}
|
|
207 |
|
|
208 |
// --------------------------------------------------------------------------
|
|
209 |
// CPsu2UIExtensionPlugin::CreatePbk2CommandForIdL
|
|
210 |
// --------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
MPbk2Command* CPsu2UIExtensionPlugin::CreatePbk2CommandForIdL
|
|
213 |
( TInt aCommandId, MPbk2ContactUiControl& aUiControl) const
|
|
214 |
{
|
|
215 |
MPbk2Command* result = NULL;
|
|
216 |
switch (aCommandId)
|
|
217 |
{
|
|
218 |
case EPbk2CmdCopyContacts: // Pbk2 copy query uses this
|
|
219 |
{
|
|
220 |
MVPbkContactStore* target =
|
|
221 |
GetTargetForCopyOrNullL( aUiControl );
|
|
222 |
if (target)
|
|
223 |
{
|
|
224 |
result = CPsu2CopyToSimCmd::NewL( aUiControl,*target );
|
|
225 |
}
|
|
226 |
break;
|
|
227 |
}
|
|
228 |
case EPsu2CmdLaunchOwnNumberView:
|
|
229 |
{
|
|
230 |
result = CPsu2LaunchViewCmd::NewL(*iViewManager,
|
|
231 |
EPsu2OwnNumberViewId);
|
|
232 |
break;
|
|
233 |
}
|
|
234 |
case EPsu2CmdLaunchServiceDialingView:
|
|
235 |
{
|
|
236 |
result = CPsu2LaunchViewCmd::NewL(*iViewManager,
|
|
237 |
EPsu2ServiceDialingViewId);
|
|
238 |
break;
|
|
239 |
}
|
|
240 |
case EPsu2CmdLaunchFixedDialingView:
|
|
241 |
{
|
|
242 |
result = CPsu2LaunchViewCmd::NewL(*iViewManager,
|
|
243 |
EPsu2FixedDialingViewId);
|
|
244 |
break;
|
|
245 |
}
|
|
246 |
case EPsu2CmdCopyFromContacts:
|
|
247 |
{
|
|
248 |
MVPbkContactStore* target = iAppServices->ContactManager().
|
|
249 |
ContactStoresL().Find(VPbkContactStoreUris::SimGlobalFdnUri());
|
|
250 |
result = CPsu2CopyFromPbkCmd::NewL( *target, aUiControl, const_cast<CPsu2UIExtensionPlugin*>( this ) );
|
|
251 |
break;
|
|
252 |
}
|
|
253 |
case EPsu2CmdCopyToContacts:
|
|
254 |
{
|
|
255 |
result = CPsu2CopyAllToPbkCmd::NewL();
|
|
256 |
}
|
|
257 |
}
|
|
258 |
|
|
259 |
return result;
|
|
260 |
}
|
|
261 |
|
|
262 |
// --------------------------------------------------------------------------
|
|
263 |
// CPsu2UIExtensionPlugin::CreatePbk2AiwInterestForIdL
|
|
264 |
// --------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
MPbk2AiwInterestItem* CPsu2UIExtensionPlugin::CreatePbk2AiwInterestForIdL
|
|
267 |
( TInt /*aInterestId*/,
|
|
268 |
CAiwServiceHandler& /*aServiceHandler*/ ) const
|
|
269 |
{
|
|
270 |
// Do nothing
|
|
271 |
return NULL;
|
|
272 |
}
|
|
273 |
|
|
274 |
// --------------------------------------------------------------------------
|
|
275 |
// CPsu2UIExtensionPlugin::GetHelpContextL
|
|
276 |
// --------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
TBool CPsu2UIExtensionPlugin::GetHelpContextL
|
|
279 |
( TCoeHelpContext& aContext, const CPbk2AppViewBase& aView,
|
|
280 |
MPbk2ContactUiControl& /*aUiControl*/ )
|
|
281 |
{
|
|
282 |
|
|
283 |
TBool helpFound( EFalse );
|
|
284 |
switch ( aView.ViewId().iViewUid.iUid )
|
|
285 |
{
|
|
286 |
case EPsu2ServiceDialingViewId: // FALLTHROUGH
|
|
287 |
case EPsu2ServiceDialingInfoViewId:
|
|
288 |
{
|
|
289 |
aContext.iContext = KSDN_HLP_APP;
|
|
290 |
helpFound = ETrue;
|
|
291 |
break;
|
|
292 |
}
|
|
293 |
case EPsu2FixedDialingViewId:
|
|
294 |
{
|
|
295 |
aContext.iContext = KFDN_HLP_FDN_VIEW;
|
|
296 |
helpFound = ETrue;
|
|
297 |
break;
|
|
298 |
}
|
|
299 |
case EPsu2FixedDialingInfoViewId:
|
|
300 |
{
|
|
301 |
aContext.iContext = KFDN_HLP_FDN_NUMBER_VIEW;
|
|
302 |
helpFound = ETrue;
|
|
303 |
break;
|
|
304 |
}
|
|
305 |
case EPbk2NamesListViewId:
|
|
306 |
{
|
|
307 |
if ( OnlyStoreShownL
|
|
308 |
( VPbkContactStoreUris::SimGlobalAdnUri() ) )
|
|
309 |
{
|
|
310 |
aContext.iContext = KPHOB_HLP_SIM_LIST;
|
|
311 |
helpFound = ETrue;
|
|
312 |
}
|
|
313 |
else if ( OnlyStoreShownL
|
|
314 |
( VPbkContactStoreUris::SimGlobalSdnUri() ) )
|
|
315 |
{
|
|
316 |
aContext.iContext = KSDN_HLP_APP;
|
|
317 |
helpFound = ETrue;
|
|
318 |
}
|
|
319 |
break;
|
|
320 |
}
|
|
321 |
case EPbk2ContactInfoViewId:
|
|
322 |
{
|
|
323 |
if ( OnlyStoreShownL
|
|
324 |
( VPbkContactStoreUris::SimGlobalAdnUri() ) )
|
|
325 |
{
|
|
326 |
aContext.iContext = KHLP_CCA_DETAILS;
|
|
327 |
helpFound = ETrue;
|
|
328 |
}
|
|
329 |
else if ( OnlyStoreShownL
|
|
330 |
( VPbkContactStoreUris::SimGlobalSdnUri() ) )
|
|
331 |
{
|
|
332 |
aContext.iContext = KSDN_HLP_APP;
|
|
333 |
helpFound = ETrue;
|
|
334 |
}
|
|
335 |
break;
|
|
336 |
}
|
|
337 |
default:
|
|
338 |
{
|
|
339 |
// Unknown view, no help
|
|
340 |
break;
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
if ( helpFound )
|
|
345 |
{
|
|
346 |
// set uid to phonebook uid because
|
|
347 |
// that is used in all phonebook helps
|
|
348 |
aContext.iMajor = aView.ApplicationUid();
|
|
349 |
}
|
|
350 |
|
|
351 |
return helpFound;
|
|
352 |
}
|
|
353 |
|
|
354 |
// --------------------------------------------------------------------------
|
|
355 |
// CPsu2UIExtensionPlugin::ApplyDynamicViewGraphChangesL
|
|
356 |
// --------------------------------------------------------------------------
|
|
357 |
//
|
|
358 |
void CPsu2UIExtensionPlugin::ApplyDynamicViewGraphChangesL
|
|
359 |
( CPbk2ViewGraph& /*aViewGraph*/ )
|
|
360 |
{
|
|
361 |
// Do nothing
|
|
362 |
}
|
|
363 |
|
|
364 |
// --------------------------------------------------------------------------
|
|
365 |
// CPsu2UIExtensionPlugin::ApplyDynamicPluginInformationDataL
|
|
366 |
// --------------------------------------------------------------------------
|
|
367 |
//
|
|
368 |
void CPsu2UIExtensionPlugin::ApplyDynamicPluginInformationDataL
|
|
369 |
( CPbk2UIExtensionInformation& /*aUiExtensionInformation*/ )
|
|
370 |
{
|
|
371 |
// Do nothing
|
|
372 |
}
|
|
373 |
|
|
374 |
// --------------------------------------------------------------------------
|
|
375 |
// CPsu2UIExtensionPlugin::GetTargetForCopyOrNullL
|
|
376 |
// --------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
MVPbkContactStore* CPsu2UIExtensionPlugin::GetTargetForCopyOrNullL(
|
|
379 |
MPbk2ContactUiControl& aUiControl) const
|
|
380 |
{
|
|
381 |
MVPbkContactStore* target = NULL;
|
|
382 |
CArrayPtr<MVPbkContactStore>* stores =
|
|
383 |
aUiControl.SelectedContactStoresL();
|
|
384 |
const TInt oneSelectedStore = 1;
|
|
385 |
if (stores && stores->Count() == oneSelectedStore)
|
|
386 |
{
|
|
387 |
// Allow copying only to global ADN store
|
|
388 |
CleanupStack::PushL(stores);
|
|
389 |
MVPbkContactStore* temp = iAppServices->ContactManager().
|
|
390 |
ContactStoresL().Find(
|
|
391 |
VPbkContactStoreUris::SimGlobalAdnUri() );
|
|
392 |
if ((*stores)[0] == temp)
|
|
393 |
{
|
|
394 |
target = temp;
|
|
395 |
}
|
|
396 |
CleanupStack::PopAndDestroy(stores);
|
|
397 |
}
|
|
398 |
else
|
|
399 |
{
|
|
400 |
delete stores;
|
|
401 |
}
|
|
402 |
return target;
|
|
403 |
}
|
|
404 |
|
|
405 |
// --------------------------------------------------------------------------
|
|
406 |
// CPsu2UIExtensionPlugin::OnlyStoreShownL
|
|
407 |
// --------------------------------------------------------------------------
|
|
408 |
//
|
|
409 |
TBool CPsu2UIExtensionPlugin::OnlyStoreShownL( const TDesC& aStoreUri )
|
|
410 |
{
|
|
411 |
TBool ret( EFalse );
|
|
412 |
CVPbkContactStoreUriArray* uriArray = iAppServices->
|
|
413 |
StoreValidityInformer().CurrentlyValidShownStoresL();
|
|
414 |
if ( uriArray && uriArray->Count() == 1 )
|
|
415 |
{
|
|
416 |
TVPbkContactStoreUriPtr shownUriPtr = (*uriArray)[0];
|
|
417 |
TVPbkContactStoreUriPtr uriPtr( aStoreUri );
|
|
418 |
if ( uriPtr.Compare( shownUriPtr,
|
|
419 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents )
|
|
420 |
== 0 )
|
|
421 |
{
|
|
422 |
ret = ETrue;
|
|
423 |
}
|
|
424 |
}
|
|
425 |
delete uriArray;
|
|
426 |
|
|
427 |
return ret;
|
|
428 |
}
|
|
429 |
|
|
430 |
// --------------------------------------------------------------------------
|
|
431 |
// CPsu2UIExtensionPlugin::UIExtensionPluginExtension
|
|
432 |
// --------------------------------------------------------------------------
|
|
433 |
//
|
|
434 |
TAny* CPsu2UIExtensionPlugin::UIExtensionPluginExtension( TUid aExtensionUid )
|
|
435 |
{
|
|
436 |
TAny* ret = NULL;
|
|
437 |
if (aExtensionUid == ImplementationUid())
|
|
438 |
{
|
|
439 |
ret = static_cast<MPbk2PluginCommandListerner*>( this );
|
|
440 |
}
|
|
441 |
return ret;
|
|
442 |
}
|
|
443 |
|
|
444 |
// --------------------------------------------------------------------------
|
|
445 |
// CPsu2UIExtensionPlugin::HandlePbk2Command
|
|
446 |
// --------------------------------------------------------------------------
|
|
447 |
//
|
|
448 |
void CPsu2UIExtensionPlugin::HandlePbk2Command( TInt aCommand )
|
|
449 |
{
|
|
450 |
switch( aCommand )
|
|
451 |
{
|
|
452 |
// Pbk2 goes to the backgound
|
|
453 |
case EAknCmdHideInBackground:
|
|
454 |
{
|
|
455 |
iEndKeyPressed = ETrue;
|
|
456 |
}
|
|
457 |
break;
|
|
458 |
|
|
459 |
default:
|
|
460 |
break;
|
|
461 |
}
|
|
462 |
}
|
|
463 |
|
|
464 |
// --------------------------------------------------------------------------
|
|
465 |
// CPsu2UIExtensionPlugin::IsEndKeyPressed
|
|
466 |
// --------------------------------------------------------------------------
|
|
467 |
//
|
|
468 |
TBool CPsu2UIExtensionPlugin::IsEndKeyPressed()
|
|
469 |
{
|
|
470 |
return iEndKeyPressed;
|
|
471 |
}
|
|
472 |
|
|
473 |
// --------------------------------------------------------------------------
|
|
474 |
// CPsu2UIExtensionPlugin::ClearEndKeyPressedFlag
|
|
475 |
// --------------------------------------------------------------------------
|
|
476 |
//
|
|
477 |
void CPsu2UIExtensionPlugin::ClearEndKeyPressedFlag()
|
|
478 |
{
|
|
479 |
iEndKeyPressed = EFalse;
|
|
480 |
}
|
|
481 |
|
|
482 |
// End of File
|