diff -r 2828b4d142c0 -r 4ae315f230bc predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp --- 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