predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp
branchRCL_3
changeset 12 4ae315f230bc
parent 7 b3431bff8c19
child 13 a6539d1e8e43
--- a/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -23,6 +23,7 @@
 
 // USER INCLUDE
 #include "CPsPropertyHandler.h"
+#include "CPsUpdateHandler.h"
 #include "CPcsDebug.h"
 #include "CPsPattern.h"
 
@@ -41,7 +42,7 @@
 
     PRINT ( _L("End CPSRequestHandler::NewL") );
 
-    return (self);
+    return self;
     }
 
 // -----------------------------------------------------------------------------
@@ -74,6 +75,11 @@
     // Initiate the property handler
     iPropertyHandler = CPsPropertyHandler::NewL(this);
 
+    // Initiate handlers for cache updating
+    iContactAddedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactAddedCounter );
+    iContactModifiedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactModifiedCounter );
+    iContactRemovedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactRemovedCounter );
+    
     // Initialize the contact id converter
     iConverter = NULL;
 
@@ -107,39 +113,15 @@
     // Close the session
     iSession.Close();
 
-    // Cleanup
-    if (iSearchQueryBuffer)
-        {
-        delete iSearchQueryBuffer;
-        }
-
-    if (iPendingSearchQueryBuffer)
-        {
-        delete iPendingSearchQueryBuffer;
-        }
-
-    if (iSearchDataBuffer)
-        {
-        delete iSearchDataBuffer;
-        }
-
-    if (iSearchResultsBuffer)
-        {
-        delete iSearchResultsBuffer;
-        iSearchResultsBuffer = NULL;
-        }
-
-    if (iPropertyHandler)
-        {
-        delete iPropertyHandler;
-        iPropertyHandler = NULL;
-        }
-
-    if (iConverter)
-        {
-        delete iConverter;
-        iConverter = NULL;
-        }
+    delete iSearchQueryBuffer;
+    delete iPendingSearchQueryBuffer;
+    delete iSearchDataBuffer;
+    delete iSearchResultsBuffer;
+    delete iPropertyHandler;
+    delete iContactAddedHandler;
+    delete iContactModifiedHandler;
+    delete iContactRemovedHandler;
+    delete iConverter;
 
     iObservers.Reset();
     iObservers.Close();
@@ -1125,7 +1107,7 @@
     TInt fieldCount = resultStream.ReadUint16L();
 
     // Fields
-    for (int i = 0; i < fieldCount; i++)
+    for (TInt i = 0; i < fieldCount; i++)
         {
         TInt fieldId = resultStream.ReadUint16L();
         aDataOrder.Append(fieldId);
@@ -1266,7 +1248,18 @@
     iSearchDataBuffer = NULL;
 
     PRINT ( _L("End CPSRequestHandler::ChangeSortOrderL") );
+    }
 
+// -----------------------------------------------------------------------------
+// CPSRequestHandler::NotifyCachingStatus()
+// 
+// -----------------------------------------------------------------------------
+void CPSRequestHandler::NotifyCachingStatus( TCachingStatus aStatus, TInt aError )
+    {
+    for ( TInt i = 0; i < iObservers.Count(); i++ )
+        {
+        iObservers[i]->CachingStatus(aStatus, aError);
+        }
     }
 
 // End of File