javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp
branchRCL_3
changeset 25 ae942d28ec0e
parent 14 04becd199f91
child 26 2455ef1f5bbc
equal deleted inserted replaced
24:6c158198356e 25:ae942d28ec0e
   191         const CContactCard& aCard) // Item to update
   191         const CContactCard& aCard) // Item to update
   192 {
   192 {
   193     JELOG2(EPim);
   193     JELOG2(EPim);
   194     const CDesCArray& pimCategories = aItem.ItemData().Categories();
   194     const CDesCArray& pimCategories = aItem.ItemData().Categories();
   195     const TInt pimCategoryCount = pimCategories.Count();
   195     const TInt pimCategoryCount = pimCategories.Count();
   196     TBool* newCategoryTable = new(ELeave) TBool[pimCategoryCount];
   196     CArrayFix<TInt>* newCategoryTable = new(ELeave) CArrayFixFlat<TInt> (pimCategoryCount);
   197     CleanupArrayDeletePushL(newCategoryTable);
   197     CleanupStack::PushL(newCategoryTable);    
   198     TInt i = 0;
   198     TInt i = 0;
   199     for (i = 0; i < pimCategoryCount; i++)
   199     for (i = 0; i < pimCategoryCount; i++)
   200     {
   200     {
   201         newCategoryTable[i] = ETrue;
   201         newCategoryTable->InsertL(TRUE,i);
   202     }
   202     }
   203 
   203 
   204     CContactIdArray* cardCategories = aCard.GroupsJoinedLC();
   204     CContactIdArray* cardCategories = aCard.GroupsJoinedLC();
   205     TContactItemId id = aItem.ContactItemIdL();
   205     TContactItemId id = aItem.ContactItemIdL();
   206 
   206 
   218             // removed group
   218             // removed group
   219             iCategoryManager.RemoveFromGroupL(id, groupId);
   219             iCategoryManager.RemoveFromGroupL(id, groupId);
   220         }
   220         }
   221         else
   221         else
   222         {
   222         {
   223             // old group
   223 			// old group
   224             newCategoryTable[pos] = EFalse;
   224             newCategoryTable->InsertL(FALSE,pos);
   225         }
   225         }
   226     }
   226     }
   227     // then add new categories
   227     // then add new categories
   228     for (i = 0; i < pimCategoryCount; i++)
   228     for (i = 0; i < pimCategoryCount; i++)
   229     {
   229     {
   230         if (newCategoryTable[i])
   230         if (newCategoryTable->At(i))
   231         {
   231         {
   232             TPtrC category = pimCategories[i];
   232             TPtrC category = pimCategories[i];
   233             iCategoryManager.AddToGroupL(id, category);
   233             iCategoryManager.AddToGroupL(id, category);
   234         }
   234         }
   235     }
   235     }