equal
deleted
inserted
replaced
21 #include <CPsRequestHandler.h> |
21 #include <CPsRequestHandler.h> |
22 #include <RPsSession.h> |
22 #include <RPsSession.h> |
23 |
23 |
24 // USER INCLUDE |
24 // USER INCLUDE |
25 #include "CPsPropertyHandler.h" |
25 #include "CPsPropertyHandler.h" |
|
26 #include "CPsUpdateHandler.h" |
26 #include "CPcsDebug.h" |
27 #include "CPcsDebug.h" |
27 #include "CPsPattern.h" |
28 #include "CPsPattern.h" |
28 |
29 |
29 // ========================= MEMBER FUNCTIONS ================================== |
30 // ========================= MEMBER FUNCTIONS ================================== |
30 |
31 |
39 CPSRequestHandler* self = NewLC(); |
40 CPSRequestHandler* self = NewLC(); |
40 CleanupStack::Pop(self); |
41 CleanupStack::Pop(self); |
41 |
42 |
42 PRINT ( _L("End CPSRequestHandler::NewL") ); |
43 PRINT ( _L("End CPSRequestHandler::NewL") ); |
43 |
44 |
44 return (self); |
45 return self; |
45 } |
46 } |
46 |
47 |
47 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
48 // CPSRequestHandler::NewLC() |
49 // CPSRequestHandler::NewLC() |
49 // Two-phased constructor. |
50 // Two-phased constructor. |
72 User::LeaveIfError(iSession.Connect()); |
73 User::LeaveIfError(iSession.Connect()); |
73 |
74 |
74 // Initiate the property handler |
75 // Initiate the property handler |
75 iPropertyHandler = CPsPropertyHandler::NewL(this); |
76 iPropertyHandler = CPsPropertyHandler::NewL(this); |
76 |
77 |
|
78 // Initiate handlers for cache updating |
|
79 iContactAddedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactAddedCounter ); |
|
80 iContactModifiedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactModifiedCounter ); |
|
81 iContactRemovedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactRemovedCounter ); |
|
82 |
77 // Initialize the contact id converter |
83 // Initialize the contact id converter |
78 iConverter = NULL; |
84 iConverter = NULL; |
79 |
85 |
80 PRINT ( _L("End CPSRequestHandler::ConstructL") ); |
86 PRINT ( _L("End CPSRequestHandler::ConstructL") ); |
81 } |
87 } |
105 Cancel(); // Causes call to DoCancel() |
111 Cancel(); // Causes call to DoCancel() |
106 |
112 |
107 // Close the session |
113 // Close the session |
108 iSession.Close(); |
114 iSession.Close(); |
109 |
115 |
110 // Cleanup |
116 delete iSearchQueryBuffer; |
111 if (iSearchQueryBuffer) |
117 delete iPendingSearchQueryBuffer; |
112 { |
118 delete iSearchDataBuffer; |
113 delete iSearchQueryBuffer; |
119 delete iSearchResultsBuffer; |
114 } |
120 delete iPropertyHandler; |
115 |
121 delete iContactAddedHandler; |
116 if (iPendingSearchQueryBuffer) |
122 delete iContactModifiedHandler; |
117 { |
123 delete iContactRemovedHandler; |
118 delete iPendingSearchQueryBuffer; |
124 delete iConverter; |
119 } |
|
120 |
|
121 if (iSearchDataBuffer) |
|
122 { |
|
123 delete iSearchDataBuffer; |
|
124 } |
|
125 |
|
126 if (iSearchResultsBuffer) |
|
127 { |
|
128 delete iSearchResultsBuffer; |
|
129 iSearchResultsBuffer = NULL; |
|
130 } |
|
131 |
|
132 if (iPropertyHandler) |
|
133 { |
|
134 delete iPropertyHandler; |
|
135 iPropertyHandler = NULL; |
|
136 } |
|
137 |
|
138 if (iConverter) |
|
139 { |
|
140 delete iConverter; |
|
141 iConverter = NULL; |
|
142 } |
|
143 |
125 |
144 iObservers.Reset(); |
126 iObservers.Reset(); |
145 iObservers.Close(); |
127 iObservers.Close(); |
146 |
128 |
147 PRINT ( _L("End CPSRequestHandler::~CPSRequestHandler") ); |
129 PRINT ( _L("End CPSRequestHandler::~CPSRequestHandler") ); |
1123 |
1105 |
1124 // Number of fields |
1106 // Number of fields |
1125 TInt fieldCount = resultStream.ReadUint16L(); |
1107 TInt fieldCount = resultStream.ReadUint16L(); |
1126 |
1108 |
1127 // Fields |
1109 // Fields |
1128 for (int i = 0; i < fieldCount; i++) |
1110 for (TInt i = 0; i < fieldCount; i++) |
1129 { |
1111 { |
1130 TInt fieldId = resultStream.ReadUint16L(); |
1112 TInt fieldId = resultStream.ReadUint16L(); |
1131 aDataOrder.Append(fieldId); |
1113 aDataOrder.Append(fieldId); |
1132 } |
1114 } |
1133 |
1115 |
1264 delete iSearchDataBuffer; |
1246 delete iSearchDataBuffer; |
1265 CleanupStack::PopAndDestroy(2, dataBuf); // dataStream, dataBuf |
1247 CleanupStack::PopAndDestroy(2, dataBuf); // dataStream, dataBuf |
1266 iSearchDataBuffer = NULL; |
1248 iSearchDataBuffer = NULL; |
1267 |
1249 |
1268 PRINT ( _L("End CPSRequestHandler::ChangeSortOrderL") ); |
1250 PRINT ( _L("End CPSRequestHandler::ChangeSortOrderL") ); |
1269 |
1251 } |
|
1252 |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // CPSRequestHandler::NotifyCachingStatus() |
|
1255 // |
|
1256 // ----------------------------------------------------------------------------- |
|
1257 void CPSRequestHandler::NotifyCachingStatus( TCachingStatus aStatus, TInt aError ) |
|
1258 { |
|
1259 for ( TInt i = 0; i < iObservers.Count(); i++ ) |
|
1260 { |
|
1261 iObservers[i]->CachingStatus(aStatus, aError); |
|
1262 } |
1270 } |
1263 } |
1271 |
1264 |
1272 // End of File |
1265 // End of File |