25 #include "cainnerentry.h" |
25 #include "cainnerentry.h" |
26 #include "cainnerquery.h" |
26 #include "cainnerquery.h" |
27 #include "caobjectadapter.h" |
27 #include "caobjectadapter.h" |
28 #include "caentriesarray.h" |
28 #include "caentriesarray.h" |
29 #include "caidsarray.h" |
29 #include "caidsarray.h" |
30 #include "cahandlerengine.h" |
|
31 #include "caarraycleanup.inl" |
30 #include "caarraycleanup.inl" |
32 |
31 |
33 #include "caentry.h" |
32 #include "caentry.h" |
34 #include "caquery.h" |
33 #include "caquery.h" |
35 #include "cadefs.h" |
34 #include "cadefs.h" |
36 |
35 #include "cahandlerproxy.h" |
|
36 #include "caqtsfhandlerloader.h" |
37 |
37 |
38 //---------------------------------------------------------------------------- |
38 //---------------------------------------------------------------------------- |
39 // |
39 // |
40 //---------------------------------------------------------------------------- |
40 //---------------------------------------------------------------------------- |
41 CaClientProxy::CaClientProxy(): |
41 CaClientProxy::CaClientProxy(): |
42 mHandler(NULL) |
42 mCommandHandler(new CaHandlerProxy(new CaQtSfHandlerLoader())) |
43 { |
43 { |
44 } |
44 } |
45 |
45 |
46 //---------------------------------------------------------------------------- |
46 //---------------------------------------------------------------------------- |
47 // |
47 // |
48 //---------------------------------------------------------------------------- |
48 //---------------------------------------------------------------------------- |
49 CaClientProxy::~CaClientProxy() |
49 CaClientProxy::~CaClientProxy() |
50 { |
50 { |
51 mSession.Close(); |
51 mSession.Close(); |
52 delete mHandler; |
52 |
53 } |
53 } |
54 |
54 |
55 //---------------------------------------------------------------------------- |
55 //---------------------------------------------------------------------------- |
56 // |
56 // |
57 //---------------------------------------------------------------------------- |
57 //---------------------------------------------------------------------------- |
170 // |
170 // |
171 //---------------------------------------------------------------------------- |
171 //---------------------------------------------------------------------------- |
172 ErrorCode CaClientProxy::executeCommand(const CaEntry &entry, |
172 ErrorCode CaClientProxy::executeCommand(const CaEntry &entry, |
173 const QString &command) |
173 const QString &command) |
174 { |
174 { |
175 TRAPD(error, executeCommandL(entry, command)); |
175 TInt error = mCommandHandler->execute(entry, command); |
176 |
176 |
177 USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error (" |
177 USE_QDEBUG_IF(error) << "CaClientProxy::executeCommand - Error (" |
178 << error << ")"; |
178 << error << ")"; |
179 |
179 |
180 return CaObjectAdapter::convertErrorCode(error); |
180 return CaObjectAdapter::convertErrorCode(error); |
327 CaObjectAdapter::convertL(results, sourceIdList); |
327 CaObjectAdapter::convertL(results, sourceIdList); |
328 CleanupStack::PopAndDestroy(&results); |
328 CleanupStack::PopAndDestroy(&results); |
329 CleanupStack::PopAndDestroy(innerQuery); |
329 CleanupStack::PopAndDestroy(innerQuery); |
330 } |
330 } |
331 |
331 |
332 //---------------------------------------------------------------------------- |
332 |
333 // |
333 //---------------------------------------------------------------------------- |
334 //---------------------------------------------------------------------------- |
334 // |
335 void CaClientProxy::executeCommandL(const CaEntry &entry, |
335 //---------------------------------------------------------------------------- |
336 const QString &command) |
336 void CaClientProxy::touchL(const CaEntry &entry) |
337 { |
337 { |
338 CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); |
338 CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); |
|
339 |
339 CaObjectAdapter::convertL(entry, *innerEntry); |
340 CaObjectAdapter::convertL(entry, *innerEntry); |
340 |
341 |
341 TPtrC16 commandPtr16( |
342 mSession.TouchL(*innerEntry); |
342 reinterpret_cast<const TUint16 *>(command.utf16())); |
343 |
343 HBufC8 *convertedCommand = CnvUtfConverter::ConvertFromUnicodeToUtf7L( |
|
344 commandPtr16, false); |
|
345 CleanupStack::PushL(convertedCommand); |
|
346 if (!mHandler) { |
|
347 mHandler = CCaHandlerEngine::NewL(); |
|
348 } |
|
349 mHandler->HandleCommandL(*innerEntry, convertedCommand->Des()); |
|
350 CleanupStack::PopAndDestroy(convertedCommand); |
|
351 CleanupStack::PopAndDestroy(innerEntry); |
344 CleanupStack::PopAndDestroy(innerEntry); |
352 } |
345 } |
353 |
346 |
354 //---------------------------------------------------------------------------- |
347 //---------------------------------------------------------------------------- |
355 // |
348 // |
356 //---------------------------------------------------------------------------- |
349 //---------------------------------------------------------------------------- |
357 void CaClientProxy::touchL(const CaEntry &entry) |
|
358 { |
|
359 CCaInnerEntry *innerEntry = CCaInnerEntry::NewLC(); |
|
360 |
|
361 CaObjectAdapter::convertL(entry, *innerEntry); |
|
362 |
|
363 mSession.TouchL(*innerEntry); |
|
364 |
|
365 CleanupStack::PopAndDestroy(innerEntry); |
|
366 } |
|
367 |
|
368 //---------------------------------------------------------------------------- |
|
369 // |
|
370 //---------------------------------------------------------------------------- |
|
371 void CaClientProxy::customSortL(const QList<int> &entryIdList, int groupId) |
350 void CaClientProxy::customSortL(const QList<int> &entryIdList, int groupId) |
372 { |
351 { |
373 RCaIdsArray array; |
352 RCaIdsArray array; |
374 CleanupClosePushL(array); |
353 CleanupClosePushL(array); |
375 CaObjectAdapter::convertL(entryIdList, array); |
354 CaObjectAdapter::convertL(entryIdList, array); |