diff -r 5586b4d2ec3e -r 0d28c1c5b6dd phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp --- a/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Wed Apr 14 15:45:35 2010 +0300 +++ b/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Tue Apr 27 16:23:35 2010 +0300 @@ -101,6 +101,9 @@ #include #include "SpdiaContainer.h" +#include +#include +#include // LOCAL CONSTANTS AND MACROS //This order is based on 'Standard field ids' (PbkFields.hrh) @@ -149,7 +152,34 @@ _LIT(KDesTab2, "\t\t"); +class TXspIconHelper + { + public: + TXspIconHelper( TInt aIndex, const TDesC& aLable); + TInt IconIndex() const; + TDesC& LableText(); + private: + TInt iIndex; + TBuf<50> iLableText; + + }; + +TXspIconHelper::TXspIconHelper(TInt aIndex, const TDesC& aLable): + iIndex (aIndex), + iLableText (aLable) + { + } + +inline TInt TXspIconHelper::IconIndex() const + { + return iIndex; + } + +inline TDesC& TXspIconHelper::LableText() + { + return iLableText; + } // --------------------------------------------------------- // CSpeedDialPrivate::NewL() @@ -266,6 +296,7 @@ iServiceHandler->AttachL( R_SPEEDDIAL_EMAIL_SELECTION_INTEREST ); iServiceHandler->AttachL( R_SPDIA_SINGLE_ASSIGN_INTEREST ); iWait = new( ELeave )CActiveSchedulerWait(); + iWaitFetchmail = new( ELeave )CActiveSchedulerWait(); iError = KErrNone; @@ -461,6 +492,8 @@ delete iRemoveConfirmQueryDialog; iRemoveConfirmQueryDialog = NULL; } + + ixspIconInfoArray.Close(); } // --------------------------------------------------------- @@ -539,18 +572,30 @@ MPbk2FieldPropertyArray* aPropertyArray = Pbk2FieldPropertiesFactory::CreateLC(*fieldTypeList,&iContactManager->FsSession() ); - for(count =0; count < aPropertyArray->Count(); ++ count) + ixspIconInfoArray.Reset(); + const TInt arrayCount = aPropertyArray->Count(); + for(count =0; count < arrayCount; ++ count) { icon = pbk2IconFactory->CreateIconL(aPropertyArray->At(count).IconId()); - aArray->AppendL(icon); - } - + aArray->AppendL(icon); + + // Append xSP icon info to helper array + if ( aPropertyArray->At(count).FieldType().FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP ) + { + const MPbk2FieldProperty& property = aPropertyArray->At(count); + MPbk2FieldProperty2* property2 = reinterpret_cast + ( const_cast ( property ).FieldPropertyExtension( + KMPbk2FieldPropertyExtension2Uid ) ); + + TXspIconHelper helper( aArray->Count()-1, property2->XSpName() ); + ixspIconInfoArray.AppendL( helper ); + } + } CleanupStack::PopAndDestroy(aPropertyArray); delete fieldTypeList; delete pbk2IconFactory; - } // --------------------------------------------------------- // CSpeedDialPrivate::VoiceMailL @@ -1031,11 +1076,6 @@ // --------------------------------------------------------- TInt CSpeedDialPrivate::SetIconArrayL(CArrayPtrFlat* aArray) { - CFbsBitmap* bitmap,*mask; - bitmap = NULL; - mask= NULL; - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - if ( aArray != NULL ) { aArray->ResetAndDestroy(); @@ -1045,45 +1085,62 @@ return 0; } - TInt existThumb(0); + CreateIndexIconsL( aArray ); + CreateFieldIconsL( aArray ); + + TInt existThumb = 0; + const TInt count = iSdmArray->Count(); + for (TInt index(0); index < count; index++) + { + if (CreateIndexIconL(index, (*iSdmArray)[index], existThumb > 0? EFalse: ETrue)) + { + ++existThumb; + } + } + + return existThumb; + } + +// --------------------------------------------------------- +// CSpeedDialPrivate::CreateIndexIconsL +// +// --------------------------------------------------------- +TInt CSpeedDialPrivate::CreateIndexIconsL( CArrayPtrFlat* aArray ) + { + CFbsBitmap* bitmap,*mask; + bitmap = NULL; + mask= NULL; + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + for (TInt index(0); index < iSdmArray->Count(); index++) { if(index == 0) - { - TUid uidVmbx; - uidVmbx.iUid =KVmbxUid; - AknsUtils::CreateAppIconLC( skinInstance,uidVmbx, EAknsAppIconTypeContext,bitmap ,mask); - CleanupStack::Pop(2); - } + { + TUid uidVmbx; + uidVmbx.iUid =KVmbxUid; + AknsUtils::CreateAppIconLC( skinInstance,uidVmbx, EAknsAppIconTypeContext,bitmap ,mask); + CleanupStack::Pop(2); + } else - { + { if(User::Language() == ELangHindi) - { + { AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,iDialHindiBmp[index], iDialHindiBmpMask[index] ); - } + } else - { + { AknsUtils::CreateIconL(skinInstance, (*iDialSkinBmp)[index],bitmap,mask,iBmpPath,iDialBmp[index], iDialBmpMask[index] ); - } - } + } + } + CGulIcon* icon = CGulIcon::NewL(bitmap,mask); - CleanupStack::PushL(icon); - aArray->AppendL(icon); + CleanupStack::PushL(icon); + aArray->AppendL(icon); + CleanupStack::Pop(); // icon + } + + } - if (CreateIndexIconL(index, - (*iSdmArray)[index], existThumb > 0? EFalse: ETrue)) - { - ++existThumb; - } - CleanupStack::Pop(); // icon - } - - CreateFieldIconsL(aArray); - - return existThumb; - } - - // --------------------------------------------------------- // CSpeedDialPrivate::VoiceMailTypeL // @@ -1465,7 +1522,7 @@ //Push const MVPbkFieldType* fieldType = field->BestMatchingFieldType(); - TInt iconindex = FindIconIndex(fieldType->FieldTypeResId()); + TInt iconindex = FindIconIndex(fieldType->FieldTypeResId(), field ); (*iSdmArray)[aIndex].SetIconIndex(iconindex); //No need to fetch thumbnail now...will be updated while grid is @@ -1631,11 +1688,11 @@ outParamList, 0, this); } ); - iOperationComplete = EFalse; + iFetchmailComplete = EFalse; // Wait till the contact is selected - while ( !iOperationComplete ) + while ( !iFetchmailComplete ) { - Wait(); + WaitFetchMail(); } iFetchmail = EFalse; return iMail; @@ -2550,15 +2607,33 @@ iMail = HBufC::NewL(length); iMail->Des().Append(paramMail->Value().AsDes()); } - iOperationComplete = ETrue; - Release(); - + + if( iFetchmail ) + { + iFetchmailComplete = ETrue; + ReleaseFetchMail(); + } + else + { + iOperationComplete = ETrue; + Release(); + } + } else if (aEventId == KAiwEventCanceled) { iError = KErrCancel; - iOperationComplete = ETrue; - Release(); + + if( iFetchmail ) + { + iFetchmailComplete = ETrue; + ReleaseFetchMail(); + } + else + { + iOperationComplete = ETrue; + Release(); + } } else if (aEventId == KAiwEventError) { @@ -2995,7 +3070,7 @@ { fieldId = field->BestMatchingFieldType()->FieldTypeResId(); } - aSdmData.SetIconIndex(FindIconIndex(fieldId)); + aSdmData.SetIconIndex(FindIconIndex(fieldId, field )); // check for the functionality, why he is checking has thumbnail before adding @@ -3042,16 +3117,36 @@ // --------------------------------------------------------- // -TInt CSpeedDialPrivate::FindIconIndex(TInt aId) const +TInt CSpeedDialPrivate::FindIconIndex( TInt aId, MVPbkStoreContactField* aField ) //const { TInt index(KNullIndexData); - for (TInt n(0); index == KNullIndexData && n < (sizeof KFieldIds/sizeof KFieldIds[0]); ++n) - { - if ((TUint)aId == KFieldIds[n] ) + + // If impp field, find xSP icon info from helper + if ( aField && ( aId == R_VPBK_FIELD_TYPE_IMPP ) ) + { + TPtrC scheme = MVPbkContactFieldUriData::Cast( aField->FieldData()).Scheme(); + + const TInt count = ixspIconInfoArray.Count(); + for ( TInt i=0; i < count; i++ ) + { + if ( !scheme.CompareF( ixspIconInfoArray[i].LableText() ) ) + { + index = ixspIconInfoArray[i].IconIndex(); + break; + } + } + } + // If not impp field, calculate icon index as below + else + { + for (TInt n(0); index == KNullIndexData && n < (sizeof KFieldIds/sizeof KFieldIds[0]); ++n) { - index = n + iSdmCount; + if ((TUint)aId == KFieldIds[n] ) + { + index = n + iSdmCount; + } } - } + } return index; } @@ -3419,6 +3514,32 @@ } // --------------------------------------------------------- +// CSpeedDialPrivate::WaitFetchMail +// +// --------------------------------------------------------- +// +void CSpeedDialPrivate::WaitFetchMail() + { + if ( !( iWaitFetchmail->IsStarted() ) ) + { + iWaitFetchmail->Start(); + } + } + +// --------------------------------------------------------- +// CSpeedDialPrivate::ReleaseFetchMail +// +// --------------------------------------------------------- +// +void CSpeedDialPrivate::ReleaseFetchMail() + { + if ( iWaitFetchmail->IsStarted() ) + { + iWaitFetchmail->AsyncStop(); + } + } + +// --------------------------------------------------------- // CSpeedDialPrivate::Cancel // To cancel the aiw event // ---------------------------------------------------------