|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Concrete handle search result operation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <badesca.h> |
|
20 #include <ximpprotocolconnection.h> |
|
21 #include <protocolsearchfeature.h> |
|
22 |
|
23 #include <ximppsccontext.h> |
|
24 |
|
25 #include "searchinfoimp.h" |
|
26 #include "operationhandlesearchresult.h" |
|
27 #include "ximpoperationbase.h" |
|
28 #include "ximpidentityimp.h" |
|
29 #include "searchsubscriptionitem.h" |
|
30 #include "searchdatacacheimp.h" |
|
31 |
|
32 #include "ximpobjecthelpers.h" |
|
33 #include "ximprestrictedobjectcollectionimp.h" |
|
34 #include "ximpobjectcollectionimp.h" |
|
35 #include "ximphost.h" |
|
36 |
|
37 #include "protocolsearchdatahostimp.h" |
|
38 #include "searchlogutils.h" |
|
39 #include "searchdatacacheimp.h" |
|
40 |
|
41 #include "ximpsubscriptionitem.h" |
|
42 |
|
43 #include "searchsubscriptionitem.h" |
|
44 |
|
45 |
|
46 // ======== MEMBER FUNCTIONS ======== |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // COperationHandleSearchResult::COperationHandleSearchResult() |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C COperationHandleSearchResult::COperationHandleSearchResult() |
|
53 { |
|
54 XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Started")); |
|
55 XSearchLogger::Log(_L("COperationHandleSearchResult::COperationHandleSearchResult Completed")); |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // COperationHandleSearchResult::ConstructL() |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 void COperationHandleSearchResult::ConstructL( const TDesC8& /*aParamPck */) |
|
64 { |
|
65 XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Started")); |
|
66 iSearchResults=new ( ELeave ) RSearchInfoImpArray; |
|
67 XSearchLogger::Log(_L("COperationHandleSearchResult::ConstructL Completed")); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // COperationHandleSearchResult::~COperationHandleSearchResult() |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 COperationHandleSearchResult::~COperationHandleSearchResult() |
|
75 { |
|
76 XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Started")); |
|
77 |
|
78 XSearchLogger::Log(_L("COperationHandleSearchResult::~COperationHandleSearchResult Completed")); |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // COperationHandleSearchResult::ProcessL() |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void COperationHandleSearchResult::ProcessL() |
|
87 { |
|
88 XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Started")); |
|
89 CXIMPOperationBase::ProcessL(); |
|
90 MXIMPBase* object = NULL; |
|
91 TBool force = ETrue; |
|
92 CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPIdentity::KInterfaceId ); |
|
93 |
|
94 if( object ) |
|
95 { |
|
96 iSearchId = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object ); |
|
97 } |
|
98 else |
|
99 { |
|
100 User::Leave( KErrArgument ); |
|
101 } |
|
102 |
|
103 object = NULL; |
|
104 CXIMPOperationBase::GetObjCollection()->GetByType( object, MXIMPObjectCollection::KInterfaceId ); |
|
105 if( object ) |
|
106 { |
|
107 |
|
108 MXIMPObjectCollection* objectCollection = static_cast<MXIMPObjectCollection*>(object->GetInterface(MXIMPObjectCollection::KInterfaceId,MXIMPBase::EPanicIfUnknown)) ; |
|
109 |
|
110 // CXIMPObjectCollectionImp* objectCollection = |
|
111 // TXIMPGetImpClassOrPanic< CXIMPObjectCollectionImp >::From( *object ); |
|
112 CleanupStack::PushL( objectCollection ); |
|
113 |
|
114 TLinearOrder< CSearchInfoImp > order( ( CSearchInfoImp::InfoLinearOrder )); |
|
115 TXIMPObjectMover< MSearchInfo, CSearchInfoImp >:: |
|
116 MoveFromCollectionToArrayL( *objectCollection, *iSearchResults, order ); |
|
117 CleanupStack::Pop( objectCollection ); |
|
118 delete objectCollection; |
|
119 |
|
120 } |
|
121 else |
|
122 { |
|
123 User::Leave( KErrArgument ); |
|
124 } |
|
125 |
|
126 CProtocolSearchDataHostImp* srchProtocolHost = |
|
127 static_cast <CProtocolSearchDataHostImp*> (iMyHost->GetProtocolHost(MProtocolSearchDataHost::KInterfaceId) ); |
|
128 |
|
129 CSearchSubscriptionItem& searchSubsItem = |
|
130 srchProtocolHost->SearchDataCache().SearchSubscriptionItemLC() ; |
|
131 |
|
132 |
|
133 searchSubsItem.SetSearchResults(iSearchResults); // ownership trasferred |
|
134 searchSubsItem.SetSearchIdL(*iSearchId);// ownership trasferred |
|
135 |
|
136 iSearchResults=NULL; |
|
137 iSearchId=NULL; |
|
138 |
|
139 searchSubsItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force ); |
|
140 CleanupStack::PopAndDestroy(); // searchItem |
|
141 iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone ); |
|
142 XSearchLogger::Log(_L("COperationHandleSearchResult::ProcessL Completed")); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // COperationHandleSearchResult::RequestCompleted() |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 void COperationHandleSearchResult::RequestCompletedL() |
|
150 { |
|
151 XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Started")); |
|
152 CXIMPOperationBase::RequestCompletedL(); |
|
153 XSearchLogger::Log(_L("COperationHandleSearchResult::RequestCompletedL Completed")); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // COperationHandleSearchResult::Type() |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 TInt COperationHandleSearchResult::Type() const |
|
161 { |
|
162 return NSearchOps::EHandleSearchResults; |
|
163 } |
|
164 |
|
165 |
|
166 // End of file |