creator/engine/src/creator_contactsetcache.cpp
changeset 19 4b22a598b890
parent 17 4f2773374eff
child 31 e7a04a6385be
--- a/creator/engine/src/creator_contactsetcache.cpp	Fri May 14 15:53:02 2010 +0300
+++ b/creator/engine/src/creator_contactsetcache.cpp	Thu May 27 12:52:19 2010 +0300
@@ -32,9 +32,31 @@
     return iLinkId;
     }
 
+void CCreatorContactSet::AppendL(QContactLocalId aContactLink)
+    {
+    iContactLinks.AppendL(aContactLink);
+    }
+
+RArray<QContactLocalId> CCreatorContactSet::ContactLinks()
+    {
+    return iContactLinks;
+    }
+
+const RArray<QContactLocalId> CCreatorContactSet::ContactLinks() const
+    {
+    return iContactLinks;
+    }
+
+
+TInt CCreatorContactSet::NumberOfExistingContacts() const
+    {
+    return iNumOfExistingContacts;
+    }
 
 CCreatorContactSet::~CCreatorContactSet()
     {
+    iContactLinks.Reset();
+    iContactLinks.Close();
     }
 
 
@@ -50,6 +72,10 @@
     static CContactLinkCacheImp* NewL();
     virtual ~CContactLinkCacheImp();
     virtual void AppendL(CCreatorContactSet* aContactSet); 
+
+    virtual RArray<QContactLocalId> ContactLinks(TInt aLinkId);
+    virtual const RArray<QContactLocalId> ContactLinks(TInt aLinkId) const;
+
     virtual RPointerArray<CCreatorContactSet>& ContactSets();
     virtual const RPointerArray<CCreatorContactSet>& ContactSets() const;
     virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const;
@@ -58,6 +84,9 @@
 private:
     void ConstructL();
     CContactLinkCacheImp();
+    
+    RArray<QContactLocalId> iEmptyLinks;
+
     RPointerArray<CCreatorContactSet> iContactSets;
     CCreatorContactSet* iDummyContactSet;
 };
@@ -83,6 +112,9 @@
 
 CContactLinkCacheImp::~CContactLinkCacheImp()
     {
+    iEmptyLinks.Reset();// just in case...
+    iEmptyLinks.Close();
+
     iContactSets.ResetAndDestroy();
     iContactSets.Close();
     delete iDummyContactSet;
@@ -91,6 +123,30 @@
     {
     iContactSets.AppendL(aContactSet);
     }
+RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId)
+    {
+    for( TInt i = 0; i < iContactSets.Count(); ++i )
+        {
+        if( iContactSets[i]->LinkId() == aLinkId )
+            {
+            return iContactSets[i]->ContactLinks();
+            }
+        }
+    return iEmptyLinks;
+    }
+
+const RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId) const
+    {
+    for( TInt i = 0; i < iContactSets.Count(); ++i )
+        {
+        if( iContactSets[i]->LinkId() == aLinkId )
+            {
+            return iContactSets[i]->ContactLinks();
+            }
+        }
+    return iEmptyLinks;
+    }
+
 
 const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const
     {