1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 * in CTSY for use when the CTSY is used with the CTSY Dispatcher. |
20 * in CTSY for use when the CTSY is used with the CTSY Dispatcher. |
21 */ |
21 */ |
22 |
22 |
23 // INCLUDE FILES |
23 // INCLUDE FILES |
24 |
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "cmmphonebookstoretsywithdispatcherTraces.h" |
|
28 #endif |
|
29 |
25 #include "cmmphonebookstoretsy.h" |
30 #include "cmmphonebookstoretsy.h" |
26 #include "cmmphonebookstoreextinterface.h" |
31 #include "cmmphonebookstoreextinterface.h" |
27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
32 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
28 #include "cmmphonetsy.h" |
33 #include "cmmphonetsy.h" |
29 |
34 |
38 //need to replace the whole function as the change is in a TRAPD which itself is a MACRO thus cannot ifdef |
43 //need to replace the whole function as the change is in a TRAPD which itself is a MACRO thus cannot ifdef |
39 |
44 |
40 |
45 |
41 void CMmPhoneBookStoreTsy::CacheEntriesL() |
46 void CMmPhoneBookStoreTsy::CacheEntriesL() |
42 { |
47 { |
43 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - entered"); |
48 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_1, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - entered"); |
44 // Get Phonebook related DLL -static data |
49 // Get Phonebook related DLL -static data |
45 |
50 |
46 // Check if phonebook has been initialized successfully. Caching of ADN |
51 // Check if phonebook has been initialized successfully. Caching of ADN |
47 // entries does not work if phonebook initialize have been failed. |
52 // entries does not work if phonebook initialize have been failed. |
48 if ( iStoreInfoData->iIsPhonebookInitialized && |
53 if ( iStoreInfoData->iIsPhonebookInitialized && |
49 ( EFalse == iStoreInfoData->iIsPhonebookInitializeFailed || |
54 ( EFalse == iStoreInfoData->iIsPhonebookInitializeFailed || |
50 KADNPhoneBook != iPhoneBookType ) ) |
55 KADNPhoneBook != iPhoneBookType ) ) |
51 { |
56 { |
52 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName); |
57 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_2, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", iPhoneBookName); |
53 TInt ret = KErrNone; |
58 TInt ret = KErrNone; |
54 CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
59 CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
55 |
60 |
56 if ( !iCacheReady ) |
61 if ( !iCacheReady ) |
57 { |
62 { |
64 if ( NULL != iPBStoreCache ) |
69 if ( NULL != iPBStoreCache ) |
65 { |
70 { |
66 iPBStoreCache->ResetAndDestroy(); |
71 iPBStoreCache->ResetAndDestroy(); |
67 delete iPBStoreCache; |
72 delete iPBStoreCache; |
68 iPBStoreCache = NULL; |
73 iPBStoreCache = NULL; |
69 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Old cache deleted"); |
74 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_3, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Old cache deleted"); |
70 } |
75 } |
71 |
76 |
72 //Inform phonebook that the cache is not ready for refresh |
77 //Inform phonebook that the cache is not ready for refresh |
73 ResetCacheReady(); |
78 ResetCacheReady(); |
74 |
79 |
76 TRAP( ret, ReadToCacheL();) |
81 TRAP( ret, ReadToCacheL();) |
77 } |
82 } |
78 } |
83 } |
79 else if ( iCacheReady ) |
84 else if ( iCacheReady ) |
80 { |
85 { |
81 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S cache entries ready", &iPhoneBookName); |
86 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_4, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S cache entries ready", iPhoneBookName); |
82 } |
87 } |
83 if ( KErrNone != ret) |
88 if ( KErrNone != ret) |
84 { |
89 { |
85 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S caching failed!", &iPhoneBookName); |
90 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_5, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - PB %S caching failed!", iPhoneBookName); |
86 } |
91 } |
87 } |
92 } |
88 // Phonebook not initialized -> let's do it before caching |
93 // Phonebook not initialized -> let's do it before caching |
89 else if ( ( !iStoreInfoData->iIsPhonebookInitialized |
94 else if ( ( !iStoreInfoData->iIsPhonebookInitialized |
90 || iStoreInfoData->iIsPhonebookInitializeFailed ) |
95 || iStoreInfoData->iIsPhonebookInitializeFailed ) |
91 && !iMmPhoneTsy->IsPBInitActive() ) |
96 && !iMmPhoneTsy->IsPBInitActive() ) |
92 { |
97 { |
93 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Starting initialization PB: %S", &iPhoneBookName); |
98 OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPHONEBOOKSTORETSY_CACHEENTRIESL1_6, "TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Starting initialization PB: %S", iPhoneBookName); |
94 // before phonebook requests, phonebook must be initialized |
99 // before phonebook requests, phonebook must be initialized |
95 iMmPhoneBookStoreExtInterface->InitPhonebook( |
100 iMmPhoneBookStoreExtInterface->InitPhonebook( |
96 EMmTsyPhoneBookStoreInitIPC, iPhoneBookName ); |
101 EMmTsyPhoneBookStoreInitIPC, iPhoneBookName ); |
97 iMmPhoneTsy->SetPBInitActiveStatus( ETrue ); |
102 iMmPhoneTsy->SetPBInitActiveStatus( ETrue ); |
98 } |
103 } |