phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStoreInfo.cpp
branchRCL_3
changeset 23 5586b4d2ec3e
parent 0 e686773b3f54
child 32 2828b4d142c0
--- a/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStoreInfo.cpp	Wed Mar 31 21:13:53 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStoreInfo.cpp	Wed Apr 14 15:45:35 2010 +0300
@@ -74,8 +74,7 @@
 //                
 TInt CContactStoreInfo::NumberOfContactsL() const
     {
-    TInt groupCount = iStore.NativeDatabase().GroupCount();
-    return iStore.NativeDatabase().CountL() - groupCount;
+    return iStore.NativeDatabase().CountL() - NumberOfGroupsL();
     }
 
 // -----------------------------------------------------------------------------
@@ -116,6 +115,14 @@
 //        
 TInt CContactStoreInfo::NumberOfGroupsL() const
     {
+    if( !iGroupsFetched )
+        {
+        CContactIdArray* arr = iStore.NativeDatabase().GetGroupIdListL();
+        iGroupsFetched = ETrue;
+        const TInt count = arr->Count();
+        delete arr;
+        return count;
+        }
     return iStore.NativeDatabase().GroupCount();
     }