128 { |
128 { |
129 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::~CMmPhoneBookStoreTsy - PB %S", &iPhoneBookName); |
129 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::~CMmPhoneBookStoreTsy - PB %S", &iPhoneBookName); |
130 |
130 |
131 if ( iMmPhoneTsy ) |
131 if ( iMmPhoneTsy ) |
132 { |
132 { |
133 CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
133 CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
134 |
134 |
135 if ( iMmPhoneTsy->GetCustomTsy() ) |
135 if ( iMmPhoneTsy->GetCustomTsy() ) |
136 { |
136 { |
137 RMmCustomAPI::TPndCacheStatus fdnCacheStatus = |
137 RMmCustomAPI::TPndCacheStatus fdnCacheStatus = |
138 iMmPhoneTsy->GetCustomTsy()->GetPhonebookCacheStatus( KFDNPhoneBook ); |
138 iMmPhoneTsy->GetCustomTsy()->GetPhonebookCacheStatus( KFDNPhoneBook ); |
658 // Set data got from phonebook initialization |
658 // Set data got from phonebook initialization |
659 *iStoreInfoData = *pbInitResp; |
659 *iStoreInfoData = *pbInitResp; |
660 // Reset initialization value |
660 // Reset initialization value |
661 iStoreInfoData->iIsPhonebookInitialized = ETrue; |
661 iStoreInfoData->iIsPhonebookInitialized = ETrue; |
662 iStoreInfoData->iIsPhonebookInitializeFailed = EFalse; |
662 iStoreInfoData->iIsPhonebookInitializeFailed = EFalse; |
663 // Set initialization flag for all phonebooks |
663 iIsPBInitCompleted = ETrue; |
664 for( TInt i = 0; i < iMmPhoneTsy->PBList()->GetNumberOfObjects(); i++ ) |
664 iInitError = aResult; |
665 { |
665 SetMaxNameAndNumLenght(); |
666 //Get pbStore object |
666 // Just in case here, if cache request has been come |
667 CMmPhoneBookStoreTsy* pbStore = iMmPhoneTsy->PBList()->GetMmPBByIndex( i ); |
667 // before initialization is finished. |
668 pbStore->iIsPBInitCompleted = ETrue; |
668 CacheEntriesL(); |
669 pbStore->iInitError = aResult; |
669 } |
670 // Set max name & number length for the current phonebook |
|
671 pbStore->SetMaxNameAndNumLenght(); |
|
672 // Just in case here, if cache request has been come |
|
673 // before initialization is finished. |
|
674 pbStore->CacheEntriesL(); |
|
675 } |
|
676 } |
|
677 else |
670 else |
678 //Initialisation has failed |
671 //Initialisation has failed |
679 { |
672 { |
680 CMmCustomTsy* mmCustom = iMmPhoneTsy->GetCustomTsy(); |
673 CMmCustomTsy* mmCustom = iMmPhoneTsy->GetCustomTsy(); |
681 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CompletePBStoreInitializationL has failed" ); |
674 TFLOGSTRING("TSY: CMmPhoneBookStoreTsy::CompletePBStoreInitializationL has failed" ); |
697 |
690 |
698 // Initializing should be tried again later |
691 // Initializing should be tried again later |
699 iStoreInfoData->iIsPhonebookInitializeFailed = ETrue; |
692 iStoreInfoData->iIsPhonebookInitializeFailed = ETrue; |
700 } |
693 } |
701 } |
694 } |
702 if( iStoreInfoData->iIsPhonebookInitialized ) |
695 |
|
696 |
|
697 if( iStoreInfoData->iIsPhonebookInitialized ) |
|
698 { |
|
699 TTsyReqHandle getInfoHandle = |
|
700 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneStoreGetInfo ); |
|
701 if ( EMultimodePhoneBookStoreReqHandleUnknown != getInfoHandle ) |
703 { |
702 { |
704 TTsyReqHandle getInfoHandle = |
703 iReqHandleType = EMultimodePhoneBookStoreReqHandleUnknown; |
705 iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePhoneStoreGetInfo ); |
704 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg info(*iPhoneBookInfoChanged); |
706 if ( EMultimodePhoneBookStoreReqHandleUnknown != getInfoHandle ) |
705 TInt result = GetInfoL(getInfoHandle, &info); |
|
706 if ( KErrNone != result ) |
707 { |
707 { |
|
708 ReqCompleted( getInfoHandle, result ); |
|
709 } |
|
710 // Save request handle |
|
711 if ( EMultimodePhoneBookStoreReqHandleUnknown != iReqHandleType ) |
|
712 { |
|
713 #ifdef REQHANDLE_TIMER |
|
714 SetTypeOfResponse( iReqHandleType, getInfoHandle ); |
|
715 #else |
|
716 iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, getInfoHandle ); |
|
717 #endif |
708 iReqHandleType = EMultimodePhoneBookStoreReqHandleUnknown; |
718 iReqHandleType = EMultimodePhoneBookStoreReqHandleUnknown; |
709 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg info(*iPhoneBookInfoChanged); |
|
710 TInt result = GetInfoL(getInfoHandle, &info); |
|
711 if ( KErrNone != result ) |
|
712 { |
|
713 ReqCompleted( getInfoHandle, result ); |
|
714 } |
|
715 // Save request handle |
|
716 if ( EMultimodePhoneBookStoreReqHandleUnknown != iReqHandleType ) |
|
717 { |
|
718 #ifdef REQHANDLE_TIMER |
|
719 SetTypeOfResponse( iReqHandleType, getInfoHandle ); |
|
720 #else |
|
721 iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, getInfoHandle ); |
|
722 #endif |
|
723 } |
|
724 |
|
725 } |
719 } |
|
720 |
726 } |
721 } |
727 iMmPhoneTsy->PhoneBookStoreInitCompleteL(iInitError); |
722 } |
|
723 iMmPhoneTsy->PhoneBookStoreInitCompleteL(iInitError); |
728 |
724 |
729 } |
725 } |
730 |
726 |
731 // --------------------------------------------------------------------------- |
727 // --------------------------------------------------------------------------- |
732 // CMmPhoneBookStoreTsy::SetMaxNameAndNumLenght |
728 // CMmPhoneBookStoreTsy::SetMaxNameAndNumLenght |
1100 KADNPhoneBook != iPhoneBookType ) ) |
1096 KADNPhoneBook != iPhoneBookType ) ) |
1101 { |
1097 { |
1102 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName); |
1098 TFLOGSTRING2("TSY: CMmPhoneBookStoreTsy::CacheEntriesL - Cache PB %S ", &iPhoneBookName); |
1103 |
1099 |
1104 TInt ret = KErrNone; |
1100 TInt ret = KErrNone; |
1105 CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
1101 CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
1106 |
1102 |
1107 if ( !iCacheReady ) |
1103 if ( !iCacheReady ) |
1108 { |
1104 { |
1109 // Check if SIM is ready, and SMS has been cached already |
1105 // Check if SIM is ready, and SMS has been cached already |
1110 if ( ( KADNPhoneBook == iPhoneBookType ) || |
1106 if ( ( KADNPhoneBook == iPhoneBookType ) || |
1172 CArrayPtrSeg<CPhoneBookStoreEntry>* entryData; |
1168 CArrayPtrSeg<CPhoneBookStoreEntry>* entryData; |
1173 aDataPackage->UnPackData(entryData); |
1169 aDataPackage->UnPackData(entryData); |
1174 CopyLtsyCacheToCtsyCacheL(entryData); |
1170 CopyLtsyCacheToCtsyCacheL(entryData); |
1175 #endif |
1171 #endif |
1176 |
1172 |
1177 CMmPhoneTsy::CNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
1173 CMmPhoneTsy::TNosBootState* bootState = iMmPhoneTsy->NosBootState(); |
1178 |
1174 |
1179 // If cache were successfully generated, update |
1175 // If cache were successfully generated, update |
1180 // the number of used entries |
1176 // the number of used entries |
1181 if ( KErrNone == aResult ) |
1177 if ( KErrNone == aResult ) |
1182 { |
1178 { |
1772 // - Number to write |
1768 // - Number to write |
1773 // - Email address |
1769 // - Email address |
1774 // - SNE |
1770 // - SNE |
1775 // - ANR/AAS |
1771 // - ANR/AAS |
1776 // - GRP |
1772 // - GRP |
|
1773 |
|
1774 if ( iWriteEntry != NULL ) |
|
1775 { |
|
1776 delete iWriteEntry; |
|
1777 iWriteEntry = NULL; |
|
1778 } |
1777 |
1779 |
1778 // NOTE: when this entry is created, it is always |
1780 // NOTE: when this entry is created, it is always |
1779 // put on the cache in succesfull case. |
1781 // put on the cache in succesfull case. |
1780 iWriteEntry = new( ELeave )CPhoneBookStoreEntry(); |
1782 iWriteEntry = new( ELeave )CPhoneBookStoreEntry(); |
1781 iWriteEntry->ConstructL(); |
1783 iWriteEntry->ConstructL(); |
2127 { |
2129 { |
2128 ReqCompleted( aTsyReqHandle, KErrArgument ); |
2130 ReqCompleted( aTsyReqHandle, KErrArgument ); |
2129 } |
2131 } |
2130 else |
2132 else |
2131 { |
2133 { |
|
2134 if ( iDeleteEntry == NULL ) |
|
2135 { |
|
2136 delete iDeleteEntry; |
|
2137 iDeleteEntry = NULL; |
|
2138 } |
|
2139 |
2132 // These are done for updating cache |
2140 // These are done for updating cache |
2133 iDeleteEntry = new ( ELeave ) CPhoneBookStoreEntry; |
2141 iDeleteEntry = new ( ELeave ) CPhoneBookStoreEntry; |
2134 iDeleteEntry->ConstructL(); |
2142 iDeleteEntry->ConstructL(); |
2135 iDeleteEntry->iLocation = static_cast<TUint16>( *aIndex ); |
2143 iDeleteEntry->iLocation = static_cast<TUint16>( *aIndex ); |
2136 |
2144 |