|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifdef USING_CTSY_DISPATCHER |
|
17 |
|
18 /** |
|
19 * This file contains additional function definitions for the CMmPhoneBookStoreTsy class |
|
20 * in CTSY for use when the CTSY is used with the CTSY Dispatcher. |
|
21 */ |
|
22 |
|
23 // INCLUDE FILES |
|
24 |
|
25 #include "cmmphonebookstoretsy.h" |
|
26 #include "cmmphonebookstoreextinterface.h" |
|
27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
28 #include "cmmphonetsy.h" |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CMmPhoneBookStoreTsy::CacheEntriesL |
|
32 // This method activates phonebook entry caching. |
|
33 // if phonebook initialization is not done, it is done first. |
|
34 // (other items were commented in a header). |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 |
|
38 //need to replace the whole function as the change is in a TRAPD which itself is a MACRO thus cannot ifdef |
|
39 |
|
40 |
|
41 void CMmPhoneBookStoreTsy::CacheEntriesL() |
|
42 { |
|
43 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - entered"); |
|
44 // Get Phonebook related DLL -static data |
|
45 |
|
46 // Check if phonebook has been initialized successfully. Caching of ADN |
|
47 // entries does not work if phonebook initialize have been failed. |
|
48 if ( iStoreInfoData->iIsPhonebookInitialized && |
|
49 ( EFalse == iStoreInfoData->iIsPhonebookInitializeFailed || |
|
50 KADNPhoneBook != iPhoneBookType ) ) |
|
51 { |
|
52 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName); |
|
53 TInt ret = KErrNone; |
|
54 CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
|
55 |
|
56 if ( !iCacheReady ) |
|
57 { |
|
58 // Check if SIM is ready, and SMS has been cached already |
|
59 if ( ( KADNPhoneBook == iPhoneBookType ) || |
|
60 ( KFDNPhoneBook == iPhoneBookType ) && |
|
61 ( EFalse != bootState->iSIMReady ) ) |
|
62 { |
|
63 // Cache must be reseted after the boot |
|
64 if ( NULL != iPBStoreCache ) |
|
65 { |
|
66 iPBStoreCache->ResetAndDestroy(); |
|
67 delete iPBStoreCache; |
|
68 iPBStoreCache = NULL; |
|
69 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Old cache deleted"); |
|
70 } |
|
71 |
|
72 //Inform phonebook that the cache is not ready for refresh |
|
73 ResetCacheReady(); |
|
74 |
|
75 bootState->iCachingActive = ETrue; |
|
76 TRAP( ret, ReadToCacheL();) |
|
77 } |
|
78 } |
|
79 else if ( iCacheReady ) |
|
80 { |
|
81 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S cache entries ready", &iPhoneBookName); |
|
82 } |
|
83 if ( KErrNone != ret) |
|
84 { |
|
85 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S caching failed!", &iPhoneBookName); |
|
86 } |
|
87 } |
|
88 // Phonebook not initialized -> let's do it before caching |
|
89 else if ( ( !iStoreInfoData->iIsPhonebookInitialized |
|
90 || iStoreInfoData->iIsPhonebookInitializeFailed ) |
|
91 && !iMmPhoneTsy->IsPBInitActive() ) |
|
92 { |
|
93 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Starting initialization PB: %S", &iPhoneBookName); |
|
94 // before phonebook requests, phonebook must be initialized |
|
95 iMmPhoneBookStoreExtInterface->InitPhonebook( |
|
96 EMmTsyPhoneBookStoreInitIPC, iPhoneBookName ); |
|
97 iMmPhoneTsy->SetPBInitActiveStatus( ETrue ); |
|
98 } |
|
99 } |
|
100 |
|
101 #endif //USING_CTSY_DISPATCHER |