|
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 application UI. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPbk2AppUi.h" |
|
21 |
|
22 // Phonebook 2 |
|
23 #include "CPbk2StartupMonitor.h" |
|
24 #include "CPbk2Application.h" |
|
25 #include "CPbk2Document.h" |
|
26 #include "CPbk2ViewExplorer.h" |
|
27 #include "CPbk2TabGroupContainerExtensionModifier.h" |
|
28 #include "MPbk2ApplicationServices.h" |
|
29 #include "MPbk2ApplicationServices2.h" |
|
30 #include <CPbk2AppViewBase.h> |
|
31 #include <Pbk2DataCaging.hrh> |
|
32 #include <CPbk2StoreManager.h> |
|
33 #include <Pbk2MenuFilteringFlags.hrh> |
|
34 #include <Pbk2Commands.hrh> |
|
35 #include <CPbk2UIExtensionManager.h> |
|
36 #include <MPbk2UIExtensionFactory.h> |
|
37 #include <CPbk2ViewState.h> |
|
38 #include <Phonebook2PrivateCRKeys.h> |
|
39 #include <CPbk2SortOrderManager.h> |
|
40 #include <MPbk2ContactNameFormatter.h> |
|
41 #include <Pbk2ContactNameFormatterFactory.h> |
|
42 #include <CPbk2StorePropertyArray.h> |
|
43 #include <CPbk2FieldPropertyArray.h> |
|
44 #include <CPbk2TabGroupContainer.h> |
|
45 #include <MPbk2ContactViewSupplier.h> |
|
46 #include <Pbk2CommonUi.rsg> |
|
47 #include <Pbk2UID.h> |
|
48 |
|
49 // Virtual Phonebook |
|
50 #include <VPbkVariant.hrh> |
|
51 |
|
52 // System includes |
|
53 #include <aknview.h> |
|
54 #include <eikmenup.h> |
|
55 #include <centralrepository.h> |
|
56 #include <gfxtranseffect/gfxtranseffect.h> |
|
57 #include <akntranseffect.h> |
|
58 |
|
59 // Debugging headers |
|
60 #include <Pbk2Config.hrh> |
|
61 #include <Pbk2Debug.h> |
|
62 #include <Pbk2Profile.h> |
|
63 |
|
64 /// Unnamed namespace for local definitions |
|
65 namespace { |
|
66 |
|
67 _LIT( KPbk2CommandsDllResFileName, "Pbk2Commands.rsc" ); |
|
68 _LIT( KPbk2UiControlsDllResFileName, "Pbk2UiControls.rsc" ); |
|
69 _LIT( KPbk2CommonUiDllResFileName, "Pbk2CommonUi.rsc" ); |
|
70 |
|
71 } /// namespace |
|
72 |
|
73 |
|
74 // -------------------------------------------------------------------------- |
|
75 // CPbk2AppUi::CPbk2AppUi |
|
76 // -------------------------------------------------------------------------- |
|
77 // |
|
78 CPbk2AppUi::CPbk2AppUi() : |
|
79 iUiControlsResourceFile( *iCoeEnv ), |
|
80 iCommandsResourceFile( *iCoeEnv ), |
|
81 iCommonUiResourceFile( *iCoeEnv ) |
|
82 { |
|
83 } |
|
84 |
|
85 // -------------------------------------------------------------------------- |
|
86 // CPbk2AppUi::~CPbk2AppUi |
|
87 // Application views will be deleted by the base class destructor |
|
88 // -------------------------------------------------------------------------- |
|
89 // |
|
90 CPbk2AppUi::~CPbk2AppUi() |
|
91 { |
|
92 CCoeEnv::Static()->RemoveForegroundObserver( *this ); |
|
93 |
|
94 delete iStartupMonitor; |
|
95 delete iTabGroups; |
|
96 delete iViewExplorer; |
|
97 iUiControlsResourceFile.Close(); |
|
98 iCommandsResourceFile.Close(); |
|
99 iCommonUiResourceFile.Close(); |
|
100 Release( iAppUiExtension ); |
|
101 } |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CPbk2AppUi::ConstructL |
|
105 // -------------------------------------------------------------------------- |
|
106 // |
|
107 void CPbk2AppUi::ConstructL() |
|
108 { |
|
109 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
110 ("CPbk2AppUi::ConstructL(0x%x)"), this); |
|
111 |
|
112 PBK2_PROFILE_START(Pbk2Profile::EAppUiConstruction); |
|
113 |
|
114 // Init base class |
|
115 // Use local impl of the LocalVariationFeatureEnabled because app globals |
|
116 // haven't been initialized yet at this point. |
|
117 PBK2_PROFILE_START(Pbk2Profile::EAppUiBaseConstruct); |
|
118 |
|
119 //Set the single click compatibility on |
|
120 if ( LocalVariationFeatureEnabled( EVPbkLVEnableMiddleSoftKey ) ) |
|
121 { |
|
122 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); |
|
123 } |
|
124 else |
|
125 { |
|
126 BaseConstructL( EAknEnableSkin | EAknSingleClickCompatible ); |
|
127 } |
|
128 |
|
129 PBK2_PROFILE_END(Pbk2Profile::EAppUiBaseConstruct); |
|
130 |
|
131 // Load resource files |
|
132 PBK2_PROFILE_START(Pbk2Profile::EAppUiResouceFileLoading); |
|
133 iUiControlsResourceFile.OpenL(KPbk2RomFileDrive, |
|
134 KDC_RESOURCE_FILES_DIR, KPbk2UiControlsDllResFileName); |
|
135 iCommandsResourceFile.OpenL(KPbk2RomFileDrive, |
|
136 KDC_RESOURCE_FILES_DIR, KPbk2CommandsDllResFileName); |
|
137 iCommonUiResourceFile.OpenL(KPbk2RomFileDrive, |
|
138 KDC_RESOURCE_FILES_DIR, KPbk2CommonUiDllResFileName); |
|
139 PBK2_PROFILE_END(Pbk2Profile::EAppUiResouceFileLoading); |
|
140 |
|
141 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
142 ("CPbk2AppUi::ConstructL(0x%x) Creating globals"), this); |
|
143 // Initialize global objects after loading the resource files |
|
144 PBK2_PROFILE_START(Pbk2Profile::EAppUiCreateGlobals); |
|
145 iAppServices = PhonebookDocument()->ApplicationServicesL(); |
|
146 iAppServicesExtension = reinterpret_cast<MPbk2ApplicationServices2*> |
|
147 ( PhonebookDocument()->ApplicationServicesL()-> |
|
148 MPbk2ApplicationServicesExtension( |
|
149 KMPbk2ApplicationServicesExtension2Uid ) ); |
|
150 PhonebookDocument()->CreateGlobalsL(); |
|
151 PBK2_PROFILE_END(Pbk2Profile::EAppUiCreateGlobals); |
|
152 |
|
153 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
154 ("CPbk2AppUi::ConstructL(0x%x) Globals created"), this); |
|
155 |
|
156 // Create view explorer |
|
157 PBK2_PROFILE_START(Pbk2Profile::EAppUiCreateViewExplorer); |
|
158 iViewExplorer = CPbk2ViewExplorer::NewL( *this ); |
|
159 PBK2_PROFILE_END(Pbk2Profile::EAppUiCreateViewExplorer); |
|
160 |
|
161 // Create AppUi extension |
|
162 PBK2_PROFILE_START(Pbk2Profile::EAppUiCreateAppUiExtension); |
|
163 MPbk2UIExtensionFactory* extFactory = |
|
164 PhonebookDocument()->ExtensionManager().FactoryL(); |
|
165 iAppUiExtension = extFactory->CreatePbk2AppUiExtensionL |
|
166 ( iAppServices->ContactManager() ); |
|
167 PBK2_PROFILE_END(Pbk2Profile::EAppUiCreateAppUiExtension); |
|
168 |
|
169 // Create tab group |
|
170 PBK2_PROFILE_START(Pbk2Profile::EViewExplorerConstructionCreateTabGroup); |
|
171 // Allow extensions to extend the tab group |
|
172 CPbk2TabGroupContainerExtensionModifier* tabGroupModifier = |
|
173 CPbk2TabGroupContainerExtensionModifier::NewLC( |
|
174 *iAppUiExtension); |
|
175 // Read and create the tab groups |
|
176 iTabGroups = CPbk2TabGroupContainer::NewL( *iViewExplorer, |
|
177 *tabGroupModifier ); |
|
178 CleanupStack::PopAndDestroy(tabGroupModifier); |
|
179 PBK2_PROFILE_END(Pbk2Profile::EViewExplorerConstructionCreateTabGroup); |
|
180 |
|
181 // Create start-up monitor |
|
182 PBK2_PROFILE_START(Pbk2Profile::EAppUiCreateStartupMonitor); |
|
183 iStartupMonitor = CPbk2StartupMonitor::NewL |
|
184 ( *iAppUiExtension, iAppServices->StoreProperties(), |
|
185 iAppServices->StoreConfiguration(), |
|
186 iAppServices->ContactManager() ); |
|
187 iStartupMonitor->StartupBeginsL(); |
|
188 PBK2_PROFILE_END(Pbk2Profile::EAppUiCreateStartupMonitor); |
|
189 |
|
190 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
191 ("CPbk2AppUi::ConstructL(0x%x) Opening AllContactsView"), this); |
|
192 |
|
193 // Open the all contacts view... |
|
194 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
195 ViewSupplier().AllContactsViewL(); |
|
196 |
|
197 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
198 ("CPbk2AppUi::ConstructL(0x%x) Opening stores"), this); |
|
199 |
|
200 // ...and only after that, order the stores to be opened |
|
201 PBK2_PROFILE_START(Pbk2Profile::EAppUiOpenStores); |
|
202 iAppServicesExtension->StoreManager().OpenStoresL(); |
|
203 PBK2_PROFILE_END(Pbk2Profile::EAppUiOpenStores); |
|
204 |
|
205 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
206 ("CPbk2AppUi::ConstructL(0x%x) Launching names list"), this); |
|
207 |
|
208 // Create views |
|
209 PBK2_PROFILE_START(Pbk2Profile::EAppUiCreateViews); |
|
210 iViewExplorer->CreateViewsL(); |
|
211 PBK2_PROFILE_END(Pbk2Profile::EAppUiCreateViews); |
|
212 |
|
213 CCoeEnv::Static()->AddForegroundObserverL(*this); |
|
214 |
|
215 if ( !IsForeground() ) |
|
216 { |
|
217 if ( ExitHidesInBackground() ) |
|
218 { |
|
219 LeavePbkInMemExitL(); |
|
220 } |
|
221 } |
|
222 |
|
223 PBK2_PROFILE_END(Pbk2Profile::EAppUiConstruction); |
|
224 |
|
225 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
226 ("CPbk2AppUi::ConstructL end")); |
|
227 } |
|
228 |
|
229 // -------------------------------------------------------------------------- |
|
230 // CPbk2AppUi::Document |
|
231 // -------------------------------------------------------------------------- |
|
232 // |
|
233 CPbk2Document* CPbk2AppUi::PhonebookDocument() const |
|
234 { |
|
235 // Explicit cast: the document must always be of type CPbk2Document |
|
236 return static_cast<CPbk2Document*>( Document() ); |
|
237 } |
|
238 |
|
239 // -------------------------------------------------------------------------- |
|
240 // CPbk2AppUi::StoreManager |
|
241 // -------------------------------------------------------------------------- |
|
242 // |
|
243 CPbk2StoreManager& CPbk2AppUi::StoreManager() const |
|
244 { |
|
245 return iAppServicesExtension->StoreManager(); |
|
246 } |
|
247 |
|
248 // -------------------------------------------------------------------------- |
|
249 // CPbk2AppUi::Pbk2Application |
|
250 // -------------------------------------------------------------------------- |
|
251 // |
|
252 CPbk2Application* CPbk2AppUi::Pbk2Application() const |
|
253 { |
|
254 // Explicit cast: the application must always be of type CPbk2Application |
|
255 return static_cast<CPbk2Application*>( Application() ); |
|
256 } |
|
257 |
|
258 // -------------------------------------------------------------------------- |
|
259 // CPbk2AppUi::ExitL |
|
260 // -------------------------------------------------------------------------- |
|
261 // |
|
262 void CPbk2AppUi::ExitL() |
|
263 { |
|
264 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL")); |
|
265 |
|
266 #ifdef _DEBUG |
|
267 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL real exit debug")); |
|
268 CAknViewAppUi::ProcessCommandL( EAknCmdExit ); |
|
269 #else |
|
270 if ( ExitHidesInBackground() ) |
|
271 { |
|
272 LeavePbkInMemExitL(); |
|
273 } |
|
274 else |
|
275 { |
|
276 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL real exit")); |
|
277 CAknViewAppUi::ProcessCommandL( EAknCmdExit ); |
|
278 } |
|
279 #endif |
|
280 |
|
281 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL end")); |
|
282 } |
|
283 |
|
284 // -------------------------------------------------------------------------- |
|
285 // CPbk2AppUi::Exit |
|
286 // -------------------------------------------------------------------------- |
|
287 // |
|
288 void CPbk2AppUi::Exit() |
|
289 { |
|
290 CPbk2AppUiBase::Exit(); |
|
291 } |
|
292 |
|
293 // -------------------------------------------------------------------------- |
|
294 // CPbk2AppUi::ActivatePhonebookViewL |
|
295 // -------------------------------------------------------------------------- |
|
296 // |
|
297 void CPbk2AppUi::ActivatePhonebookViewL |
|
298 ( TUid aViewId, const CPbk2ViewState* aViewState /*=NULL*/ ) |
|
299 { |
|
300 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ActivatePhonebookViewL")); |
|
301 |
|
302 if ( aViewState ) |
|
303 { |
|
304 HBufC8* stateBuf = aViewState->PackLC(); |
|
305 ActivateLocalViewL(aViewId, CPbk2ViewState::Uid(), *stateBuf); |
|
306 CleanupStack::PopAndDestroy(); // stateBuf |
|
307 } |
|
308 else |
|
309 { |
|
310 ActivateLocalViewL(aViewId); |
|
311 } |
|
312 |
|
313 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ActivatePhonebookViewL end")); |
|
314 } |
|
315 |
|
316 // -------------------------------------------------------------------------- |
|
317 // CPbk2AppUi::ActiveView |
|
318 // -------------------------------------------------------------------------- |
|
319 // |
|
320 CPbk2AppViewBase* CPbk2AppUi::ActiveView() const |
|
321 { |
|
322 // Explicit cast: iView must always be of type CPbk2AppViewBase |
|
323 return static_cast<CPbk2AppViewBase*>( iView ); |
|
324 } |
|
325 |
|
326 // -------------------------------------------------------------------------- |
|
327 // CPbk2AppUi::Pbk2ViewExplorer |
|
328 // -------------------------------------------------------------------------- |
|
329 // |
|
330 MPbk2ViewExplorer* CPbk2AppUi::Pbk2ViewExplorer() const |
|
331 { |
|
332 return iViewExplorer; |
|
333 } |
|
334 |
|
335 // -------------------------------------------------------------------------- |
|
336 // CPbk2AppUi::Pbk2StartupMonitor |
|
337 // -------------------------------------------------------------------------- |
|
338 // |
|
339 MPbk2StartupMonitor* CPbk2AppUi::Pbk2StartupMonitor() const |
|
340 { |
|
341 return iStartupMonitor; |
|
342 } |
|
343 |
|
344 // -------------------------------------------------------------------------- |
|
345 // CPbk2AppUi::TabGroup |
|
346 // -------------------------------------------------------------------------- |
|
347 // |
|
348 CPbk2TabGroupContainer* CPbk2AppUi::TabGroups() const |
|
349 { |
|
350 return iTabGroups; |
|
351 } |
|
352 |
|
353 // -------------------------------------------------------------------------- |
|
354 // CPbk2AppUi::KeyEventHandler |
|
355 // -------------------------------------------------------------------------- |
|
356 // |
|
357 MPbk2KeyEventHandler& CPbk2AppUi::KeyEventHandler() |
|
358 { |
|
359 return *this; |
|
360 } |
|
361 |
|
362 // -------------------------------------------------------------------------- |
|
363 // CPbk2AppUi::ApplicationServices |
|
364 // -------------------------------------------------------------------------- |
|
365 // |
|
366 MPbk2ApplicationServices& CPbk2AppUi::ApplicationServices() const |
|
367 { |
|
368 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
369 ("CPbk2AppUi::ApplicationServices() returning 0x%x"), iAppServices ); |
|
370 |
|
371 return *iAppServices; |
|
372 } |
|
373 |
|
374 // -------------------------------------------------------------------------- |
|
375 // CPbk2AppUi::HandleCommandL |
|
376 // -------------------------------------------------------------------------- |
|
377 // |
|
378 void CPbk2AppUi::HandleCommandL( TInt aCommand ) |
|
379 { |
|
380 switch ( aCommand ) |
|
381 { |
|
382 case EEikCmdExit: |
|
383 { |
|
384 // Standard exit command |
|
385 CmdExit(); |
|
386 break; |
|
387 } |
|
388 |
|
389 case EAknCmdHideInBackground: |
|
390 { |
|
391 // Leave app in ram |
|
392 LeavePbkInMemExitL(); |
|
393 break; |
|
394 } |
|
395 |
|
396 case EAknCmdExit: |
|
397 case EAknSoftkeyExit: |
|
398 case EPbk2CmdExit: |
|
399 { |
|
400 // Perhaps leave app in ram |
|
401 ExitL(); |
|
402 break; |
|
403 } |
|
404 |
|
405 case EAknSoftkeyBack: |
|
406 { |
|
407 iViewExplorer->ActivatePreviousViewL( NULL ); |
|
408 break; |
|
409 } |
|
410 |
|
411 default: |
|
412 { |
|
413 CAknViewAppUi::HandleCommandL( aCommand ); |
|
414 break; |
|
415 } |
|
416 } |
|
417 } |
|
418 |
|
419 // -------------------------------------------------------------------------- |
|
420 // CPbk2AppUi::ExitApplication |
|
421 // -------------------------------------------------------------------------- |
|
422 // |
|
423 void CPbk2AppUi::ExitApplication() |
|
424 { |
|
425 Exit(); |
|
426 } |
|
427 |
|
428 // -------------------------------------------------------------------------- |
|
429 // CPbk2AppUi::HandleGainingForeground |
|
430 // -------------------------------------------------------------------------- |
|
431 // |
|
432 void CPbk2AppUi::HandleGainingForeground() |
|
433 { |
|
434 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::HandleGainingForeground")); |
|
435 |
|
436 if ( ExitHidesInBackground() ) |
|
437 { |
|
438 TRAP_IGNORE( iStartupMonitor->RestartStartupL() ); |
|
439 } |
|
440 |
|
441 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::HandleGainingForeground end")); |
|
442 } |
|
443 |
|
444 // -------------------------------------------------------------------------- |
|
445 // CPbk2AppUi::HandleLosingForeground |
|
446 // -------------------------------------------------------------------------- |
|
447 // |
|
448 void CPbk2AppUi::HandleLosingForeground() |
|
449 { |
|
450 PBK2_DEBUG_PRINT( PBK2_DEBUG_STRING( |
|
451 "void CPbk2AppUi::HandleLosingForeground" ) ); |
|
452 |
|
453 // we need to close possible popup menu when application is sent to |
|
454 // background. Otherwise AvKon will likely crash since its |
|
455 // intermediate state array is corrupted. |
|
456 |
|
457 // make sure we have a view |
|
458 if (ActiveView()) |
|
459 { |
|
460 ActiveView()->ClosePopup(); |
|
461 } |
|
462 |
|
463 PBK2_DEBUG_PRINT( PBK2_DEBUG_STRING( |
|
464 "void CPbk2AppUi::HandleLosingForeground end" ) ); |
|
465 } |
|
466 |
|
467 // -------------------------------------------------------------------------- |
|
468 // CPbk2AppUi::DynInitMenuPaneL |
|
469 // -------------------------------------------------------------------------- |
|
470 // |
|
471 void CPbk2AppUi::DynInitMenuPaneL |
|
472 ( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) |
|
473 { |
|
474 // All menu filtering happens elsewhere |
|
475 } |
|
476 |
|
477 // -------------------------------------------------------------------------- |
|
478 // CPbk2AppUi::HandleKeyEventL |
|
479 // -------------------------------------------------------------------------- |
|
480 // |
|
481 TKeyResponse CPbk2AppUi::HandleKeyEventL |
|
482 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
483 { |
|
484 if (Pbk2ProcessKeyEventL(aKeyEvent, aType)) |
|
485 { |
|
486 return EKeyWasConsumed; |
|
487 } |
|
488 return EKeyWasNotConsumed; |
|
489 } |
|
490 |
|
491 // -------------------------------------------------------------------------- |
|
492 // CPbk2AppUi::HandleResourceChangeL |
|
493 // -------------------------------------------------------------------------- |
|
494 // |
|
495 void CPbk2AppUi::HandleResourceChangeL(TInt aType) |
|
496 { |
|
497 CAknAppUiBase::HandleResourceChangeL( aType ); |
|
498 |
|
499 // This is needed to change the application icon when the skin changes |
|
500 // (especially if a contact with a thumbnail is currently selected |
|
501 // and the app icon is not visible) |
|
502 CEikStatusPane* pane = StatusPane(); |
|
503 if ( pane ) |
|
504 { |
|
505 pane->HandleResourceChange( aType ); |
|
506 } |
|
507 } |
|
508 |
|
509 // -------------------------------------------------------------------------- |
|
510 // CPbk2AppUi::HandleForegroundEventL |
|
511 // -------------------------------------------------------------------------- |
|
512 // |
|
513 void CPbk2AppUi::HandleForegroundEventL( TBool aForeground ) |
|
514 { |
|
515 iAppServicesExtension->StoreManager().EnableCompression( aForeground ); |
|
516 |
|
517 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
518 } |
|
519 |
|
520 // -------------------------------------------------------------------------- |
|
521 // CPbk2AppUi::Pbk2ProcessKeyEventL |
|
522 // -------------------------------------------------------------------------- |
|
523 // |
|
524 TBool CPbk2AppUi::Pbk2ProcessKeyEventL |
|
525 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
526 { |
|
527 return iTabGroups->HandleNavigationKeyEventL( aKeyEvent, aType ); |
|
528 } |
|
529 |
|
530 // -------------------------------------------------------------------------- |
|
531 // CPbk2AppUi::CmdExit |
|
532 // -------------------------------------------------------------------------- |
|
533 // |
|
534 inline void CPbk2AppUi::CmdExit() |
|
535 { |
|
536 CAknViewAppUi::Exit(); |
|
537 } |
|
538 |
|
539 // -------------------------------------------------------------------------- |
|
540 // CPbk2AppUi::LocalVariationFeatureEnabled |
|
541 // -------------------------------------------------------------------------- |
|
542 // |
|
543 TBool CPbk2AppUi::LocalVariationFeatureEnabled( TInt aFeatureFlag ) |
|
544 { |
|
545 TBool ret( EFalse ); |
|
546 TInt lvFlags( KErrNotFound ); |
|
547 CRepository* key = NULL; |
|
548 // Read local variation flags |
|
549 TRAPD( err, key = |
|
550 CRepository::NewL( TUid::Uid( KCRUidPhonebook ) ) ); |
|
551 // if NewL fails do not set iLVFlags, new query is made next time |
|
552 if ( err == KErrNone ) |
|
553 { |
|
554 err = key->Get( KPhonebookLocalVariationFlags, lvFlags ); |
|
555 if ( err != KErrNone ) |
|
556 { |
|
557 // If there were problems reading the flags, |
|
558 // assume everything is off |
|
559 lvFlags = 0; |
|
560 } |
|
561 delete key; |
|
562 } |
|
563 |
|
564 if ( lvFlags != KErrNotFound ) |
|
565 { |
|
566 ret = lvFlags & aFeatureFlag; |
|
567 } |
|
568 |
|
569 return ret; |
|
570 } |
|
571 |
|
572 // -------------------------------------------------------------------------- |
|
573 // CPbk2AppUi::LeavePbkInMemExitL |
|
574 // -------------------------------------------------------------------------- |
|
575 // |
|
576 void CPbk2AppUi::LeavePbkInMemExitL() |
|
577 { |
|
578 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::LeavePbkInMemExitL")); |
|
579 |
|
580 // Diasable bring to foreground on view activation event |
|
581 SetCustomControl(1); |
|
582 |
|
583 // Hide application in background |
|
584 HideInBackground(); |
|
585 |
|
586 // Activation of Names list view will send application to |
|
587 // background. Application can not be sent here to background |
|
588 // because activation is asynchronous operation and application |
|
589 // could be set to background before the view activation. |
|
590 CPbk2ViewState* state = CPbk2ViewState::NewLC(); |
|
591 state->SetFlags( CPbk2ViewState::EInitialized | |
|
592 CPbk2ViewState::ESendToBackground ); |
|
593 |
|
594 ActivatePhonebookViewL( Phonebook2::KPbk2NamesListViewUid, state ); |
|
595 |
|
596 CleanupStack::PopAndDestroy( state ); |
|
597 |
|
598 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::LeavePbkInMemExitL end")); |
|
599 } |
|
600 // End of File |