javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp
changeset 87 1627c337e51e
parent 67 63b81d807542
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
   197 //
   197 //
   198 RPointerArray<CPIMCategoryStateChange>*
   198 RPointerArray<CPIMCategoryStateChange>*
   199 CPIMContactListAdapter::GetExternalCategoryModificationsL()
   199 CPIMContactListAdapter::GetExternalCategoryModificationsL()
   200 {
   200 {
   201     JELOG2(EPim);
   201     JELOG2(EPim);
       
   202     iMutex.Wait();
   202     CallMethodL(this, &CPIMContactListAdapter::IsDatabaseReadyL, iFuncServer);
   203     CallMethodL(this, &CPIMContactListAdapter::IsDatabaseReadyL, iFuncServer);
   203     RPointerArray<CPIMCategoryStateChange>* retval = iCategoryChanges;
   204     RPointerArray<CPIMCategoryStateChange>* retval = iCategoryChanges;
   204     iCategoryChanges = NULL;
   205     iCategoryChanges = NULL;
       
   206     iMutex.Signal();
   205     return retval;
   207     return retval;
   206 }
   208 }
   207 
   209 
   208 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   209 // CPIMContactListAdapter::IsItemsExternallyModified
   211 // CPIMContactListAdapter::IsItemsExternallyModified
   288     iCategoryManager = NULL;
   290     iCategoryManager = NULL;
   289     delete iDatabase;
   291     delete iDatabase;
   290     iDatabase = NULL;
   292     iDatabase = NULL;
   291     delete iMinimalFieldsViewDef;
   293     delete iMinimalFieldsViewDef;
   292     iMinimalFieldsViewDef = NULL;
   294     iMinimalFieldsViewDef = NULL;
       
   295     iMutex.Close();
   293 }
   296 }
   294 
   297 
   295 // -----------------------------------------------------------------------------
   298 // -----------------------------------------------------------------------------
   296 // CPIMContactListAdapter::GetPimListAdapter
   299 // CPIMContactListAdapter::GetPimListAdapter
   297 // Provides access to the MPIMListAdapter representation of this
   300 // Provides access to the MPIMListAdapter representation of this
   638     // Initialize minimal fields view definition
   641     // Initialize minimal fields view definition
   639     iMinimalFieldsViewDef = CContactItemViewDef::NewL(
   642     iMinimalFieldsViewDef = CContactItemViewDef::NewL(
   640                                 CContactItemViewDef::EIncludeFields,
   643                                 CContactItemViewDef::EIncludeFields,
   641                                 CContactItemViewDef::EIncludeHiddenFields);
   644                                 CContactItemViewDef::EIncludeHiddenFields);
   642     InitializeMinimalViewDefinitionL();
   645     InitializeMinimalViewDefinitionL();
       
   646     User::LeaveIfError(iMutex.CreateLocal());
   643 }
   647 }
   644 
   648 
   645 // -----------------------------------------------------------------------------
   649 // -----------------------------------------------------------------------------
   646 // CPIMContactListAdapter::ExternalGroupChangeL
   650 // CPIMContactListAdapter::ExternalGroupChangeL
   647 // Adds an entry to external category change list.
   651 // Adds an entry to external category change list.
   650 //
   654 //
   651 void CPIMContactListAdapter::ExternalGroupChangeL(TContactItemId aId, // Id of the changed category
   655 void CPIMContactListAdapter::ExternalGroupChangeL(TContactItemId aId, // Id of the changed category
   652         TPIMExternalChangeType aType) // type of the change
   656         TPIMExternalChangeType aType) // type of the change
   653 {
   657 {
   654     JELOG2(EPim);
   658     JELOG2(EPim);
       
   659     iMutex.Wait();
   655     iCategoryManager->FlushCache();
   660     iCategoryManager->FlushCache();
   656 
   661 
   657     // This should never happen
   662     // This should never happen
   658     __ASSERT_ALWAYS(iCategoryManager, User::Leave(KErrNotReady));
   663     __ASSERT_ALWAYS(iCategoryManager, User::Leave(KErrNotReady));
   659 
   664 
   700     }
   705     }
   701 
   706 
   702     CleanupStack::PushL(change);
   707     CleanupStack::PushL(change);
   703     User::LeaveIfError(iCategoryChanges->Append(change));
   708     User::LeaveIfError(iCategoryChanges->Append(change));
   704     CleanupStack::Pop(change);
   709     CleanupStack::Pop(change);
       
   710     iMutex.Signal();
   705 }
   711 }
   706 
   712 
   707 // -----------------------------------------------------------------------------
   713 // -----------------------------------------------------------------------------
   708 // CPIMContactListAdapter::ExternalItemChangeL
   714 // CPIMContactListAdapter::ExternalItemChangeL
   709 // Adds an entry to external item change list.
   715 // Adds an entry to external item change list.