phonebookengines/contactsmodel/cntmodel/src/ccontactdatabase.cpp
branchRCL_3
changeset 23 5586b4d2ec3e
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
21:b3431bff8c19 23:5586b4d2ec3e
   672  @deprecated
   672  @deprecated
   673  @capability None
   673  @capability None
   674  @return A pointer to an array of sort preferences of the contact database.
   674  @return A pointer to an array of sort preferences of the contact database.
   675 */
   675 */
   676 EXPORT_C const CArrayFix<CContactDatabase::TSortPref>* CContactDatabase::SortOrder() const
   676 EXPORT_C const CArrayFix<CContactDatabase::TSortPref>* CContactDatabase::SortOrder() const
   677 	{
   677     {
   678 	return iCntSvr->GetSortPreferenceL(); // this can leave
   678     CArrayFix<CContactDatabase::TSortPref>* prefs = NULL;
   679 	}
   679     TRAPD( err, prefs = iCntSvr->GetSortPreferenceL() );
       
   680     if ( err != KErrNone )
       
   681         {
       
   682 	prefs = NULL; // return NULL if have some error
       
   683 	}
       
   684     return prefs;
       
   685     }
   680 
   686 
   681 
   687 
   682 /** 
   688 /** 
   683 Adds a new contact item to the database and returns its ID.
   689 Adds a new contact item to the database and returns its ID.
   684 
   690 
  2324 		cntItem->CardFields().UpdateFieldL(newfieldSet[ii],matchCount);
  2330 		cntItem->CardFields().UpdateFieldL(newfieldSet[ii],matchCount);
  2325 		}
  2331 		}
  2326 		
  2332 		
  2327 	doCommitContactL(*cntItem,ETrue,ETrue);
  2333 	doCommitContactL(*cntItem,ETrue,ETrue);
  2328 	if (!count)
  2334 	if (!count)
  2329 		{
  2335 	    {
  2330 		doDeleteContactL(aContactId,ETrue,ETrue);
  2336 	    doDeleteContactL(aContactId,ETrue,ETrue);
  2331 		delete cntItem;
  2337 	    CleanupStack::PopAndDestroy(cntItem); // Pop and destroy cntItem
  2332 		cntItem = NULL;
  2338 
  2333 		}
  2339 	    cntItem = NULL;
       
  2340 	    CleanupStack::PushL(cntItem); // push a NULL ptr to cleanup stack
       
  2341 	    }
  2334 
  2342 
  2335 	if(cntItem != NULL)
  2343 	if(cntItem != NULL)
  2336 		{
  2344 	    {
  2337 		CleanupStack::Pop(cntItem);
  2345 	    CheckTemplateField(*cntItem);
  2338 		CleanupStack::Pop(); // Pop the lock
  2346 	    }
  2339 		CleanupStack::PopAndDestroy(viewDef);	
  2347 	CleanupStack::Pop(); // cntItem
  2340 		CheckTemplateField(*cntItem);
  2348 	CleanupStack::Pop(); // Pop the lock
  2341 	
  2349 	CleanupStack::PopAndDestroy(viewDef);	
  2342 		CleanupStack::PushL(cntItem);	
  2350 	CleanupStack::PushL(cntItem);	
  2343 		}
       
  2344 	return(cntItem);
  2351 	return(cntItem);
  2345 	}
  2352 	}
  2346 
  2353 
  2347 
  2354 
  2348 /**
  2355 /**