|
1 /* |
|
2 * Copyright (c) 2005-2009 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: Implementation of object, relation and event query |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "mdequeryimpl.h" |
|
20 |
|
21 #include "mdesessionimpl.h" |
|
22 #include "mdeasynchronousfindao.h" |
|
23 #include "mdeobject.h" |
|
24 #include "mderelation.h" |
|
25 #include "mdeevent.h" |
|
26 |
|
27 |
|
28 |
|
29 CMdEObjectQueryImpl* CMdEObjectQueryImpl::NewL( CMdESessionImpl& aSessionImpl, |
|
30 CMdENamespaceDef& aNamespaceDef, CMdEObjectDef& aObjectDef, |
|
31 RPointerArray<CMdEObjectDef>* aObjectDefs, RMdEEngineSession& aSession ) |
|
32 { |
|
33 CMdEObjectQueryImpl* self = CMdEObjectQueryImpl::NewLC( aSessionImpl, aNamespaceDef, |
|
34 aObjectDef, aObjectDefs, aSession ); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CMdEObjectQueryImpl* CMdEObjectQueryImpl::NewLC( CMdESessionImpl& aSessionImpl, |
|
40 CMdENamespaceDef& aNamespaceDef, CMdEObjectDef& aObjectDef, |
|
41 RPointerArray<CMdEObjectDef>* aObjectDefs, RMdEEngineSession& aSession ) |
|
42 { |
|
43 CMdEObjectQueryImpl* self = new ( ELeave ) CMdEObjectQueryImpl( aSessionImpl, aNamespaceDef, |
|
44 aObjectDef, aObjectDefs ); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL( aSessionImpl, aSession ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 CMdEObjectQueryImpl::CMdEObjectQueryImpl( |
|
51 CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef, |
|
52 CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs ) |
|
53 : CMdEObjectQuery( aSessionImpl, aNamespaceDef, aObjectDef, aObjectDefs ) |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 void CMdEObjectQueryImpl::ConstructL( CMdESessionImpl& aSessionImpl, |
|
59 RMdEEngineSession& aSession ) |
|
60 { |
|
61 ObjectQueryConstructL(); |
|
62 iAsyncFind = CMdEAsynchronousFindAO::NewL( *this, aSessionImpl, aSession ); |
|
63 } |
|
64 |
|
65 |
|
66 CMdEObjectQueryImpl::~CMdEObjectQueryImpl() |
|
67 { |
|
68 if( iAsyncFind ) |
|
69 { |
|
70 iAsyncFind->Cancel(); |
|
71 |
|
72 delete iAsyncFind; |
|
73 } |
|
74 } |
|
75 |
|
76 |
|
77 void CMdEObjectQueryImpl::DoFindL( TUint aMaxCount, TUint aNotifyCount ) |
|
78 { |
|
79 iAsyncFind->DoFindL( aMaxCount, aNotifyCount ); |
|
80 SetState( EStateSearching ); |
|
81 } |
|
82 |
|
83 |
|
84 void CMdEObjectQueryImpl::DoCancel() |
|
85 { |
|
86 // Stop searching. |
|
87 iAsyncFind->Cancel(); |
|
88 SetState( EStateError ); |
|
89 } |
|
90 |
|
91 |
|
92 void CMdEObjectQueryImpl::DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList ) |
|
93 { |
|
94 NotifyNewResultsL( aResultList ); |
|
95 } |
|
96 |
|
97 |
|
98 void CMdEObjectQueryImpl::DoNotifyResultsL( RArray<TItemId>& aResultIdList ) |
|
99 { |
|
100 NotifyNewResultsL( aResultIdList ); |
|
101 } |
|
102 |
|
103 void CMdEObjectQueryImpl::DoNotifyResultsL( CDesCArray& aResults ) |
|
104 { |
|
105 NotifyNewResultsL( aResults ); |
|
106 } |
|
107 |
|
108 void CMdEObjectQueryImpl::DoNotifyResults( TInt aResultCount ) |
|
109 { |
|
110 NotifyNewResults( aResultCount ); |
|
111 } |
|
112 |
|
113 void CMdEObjectQueryImpl::DoNotifyCompleted( TInt aError ) |
|
114 { |
|
115 SetState( aError ? EStateError : EStateCompleted ); |
|
116 NotifyCompleted( aError ); |
|
117 } |
|
118 |
|
119 |
|
120 CMdERelationQueryImpl* CMdERelationQueryImpl::NewL( CMdESessionImpl& aSessionImpl, |
|
121 CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession ) |
|
122 { |
|
123 CMdERelationQueryImpl* self = CMdERelationQueryImpl::NewLC( aSessionImpl, |
|
124 aNamespaceDef, aSession ); |
|
125 CleanupStack::Pop( self ); |
|
126 return self; |
|
127 } |
|
128 |
|
129 CMdERelationQueryImpl* CMdERelationQueryImpl::NewLC( CMdESessionImpl& aSessionImpl, |
|
130 CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession ) |
|
131 { |
|
132 CMdERelationQueryImpl* self = new ( ELeave ) CMdERelationQueryImpl( aSessionImpl, aNamespaceDef ); |
|
133 CleanupStack::PushL( self ); |
|
134 self->ConstructL( aSessionImpl, aSession ); |
|
135 return self; |
|
136 } |
|
137 |
|
138 CMdERelationQueryImpl::CMdERelationQueryImpl( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef ) |
|
139 : CMdERelationQuery( aSessionImpl, aNamespaceDef ) |
|
140 { |
|
141 } |
|
142 |
|
143 |
|
144 void CMdERelationQueryImpl::ConstructL( CMdESessionImpl& aSessionImpl, |
|
145 RMdEEngineSession& aSession ) |
|
146 { |
|
147 RelationQueryConstructL(); |
|
148 iAsyncFind = CMdEAsynchronousFindAO::NewL( *this, aSessionImpl, aSession ); |
|
149 } |
|
150 |
|
151 |
|
152 CMdERelationQueryImpl::~CMdERelationQueryImpl() |
|
153 { |
|
154 delete iAsyncFind; |
|
155 } |
|
156 |
|
157 |
|
158 void CMdERelationQueryImpl::DoFindL( TUint aMaxCount, TUint aNotifyCount ) |
|
159 { |
|
160 iAsyncFind->DoFindL( aMaxCount, aNotifyCount ); |
|
161 SetState( EStateSearching ); |
|
162 } |
|
163 |
|
164 |
|
165 void CMdERelationQueryImpl::DoCancel() |
|
166 { |
|
167 // Stop searching. |
|
168 iAsyncFind->Cancel(); |
|
169 SetState( EStateError ); |
|
170 } |
|
171 |
|
172 void CMdERelationQueryImpl::DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList ) |
|
173 { |
|
174 NotifyNewResultsL( aResultList ); |
|
175 } |
|
176 |
|
177 void CMdERelationQueryImpl::DoNotifyResultsL( RArray<TItemId>& aResultIdList ) |
|
178 { |
|
179 NotifyNewResultsL( aResultIdList ); |
|
180 } |
|
181 |
|
182 void CMdERelationQueryImpl::DoNotifyResults( TUint32 aResultCount ) |
|
183 { |
|
184 NotifyNewResults( aResultCount ); |
|
185 } |
|
186 |
|
187 void CMdERelationQueryImpl::DoNotifyCompleted( TInt aError ) |
|
188 { |
|
189 SetState( aError ? EStateError : EStateCompleted ); |
|
190 NotifyCompleted( aError ); |
|
191 } |
|
192 |
|
193 |
|
194 CMdEEventQueryImpl::CMdEEventQueryImpl( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef ) |
|
195 : CMdEEventQuery( aSessionImpl, aNamespaceDef ) |
|
196 { |
|
197 } |
|
198 |
|
199 |
|
200 CMdEEventQueryImpl* CMdEEventQueryImpl::NewL( CMdESessionImpl& aSessionImpl, |
|
201 CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession ) |
|
202 { |
|
203 CMdEEventQueryImpl* self = CMdEEventQueryImpl::NewLC( aSessionImpl, |
|
204 aNamespaceDef, aSession ); |
|
205 CleanupStack::Pop( self ); |
|
206 return self; |
|
207 } |
|
208 |
|
209 CMdEEventQueryImpl* CMdEEventQueryImpl::NewLC( CMdESessionImpl& aSessionImpl, |
|
210 CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession ) |
|
211 { |
|
212 CMdEEventQueryImpl* self = new ( ELeave ) CMdEEventQueryImpl( aSessionImpl, aNamespaceDef ); |
|
213 CleanupStack::PushL( self ); |
|
214 self->ConstructL( aSessionImpl, aSession ); |
|
215 return self; |
|
216 } |
|
217 |
|
218 void CMdEEventQueryImpl::ConstructL( CMdESessionImpl& aSessionImpl, |
|
219 RMdEEngineSession& aSession ) |
|
220 { |
|
221 EventQueryConstructL(); |
|
222 iAsyncFind = CMdEAsynchronousFindAO::NewL( *this, aSessionImpl, aSession ); |
|
223 } |
|
224 |
|
225 |
|
226 CMdEEventQueryImpl::~CMdEEventQueryImpl() |
|
227 { |
|
228 delete iAsyncFind; |
|
229 } |
|
230 |
|
231 |
|
232 void CMdEEventQueryImpl::DoFindL( TUint aMaxCount, TUint aNotifyCount ) |
|
233 { |
|
234 iAsyncFind->DoFindL( aMaxCount, aNotifyCount ); |
|
235 SetState( EStateSearching ); |
|
236 } |
|
237 |
|
238 |
|
239 void CMdEEventQueryImpl::DoCancel() |
|
240 { |
|
241 // Stop searching. |
|
242 iAsyncFind->Cancel(); |
|
243 SetState( EStateError ); |
|
244 } |
|
245 |
|
246 void CMdEEventQueryImpl::DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList ) |
|
247 { |
|
248 NotifyNewResultsL( aResultList ); |
|
249 } |
|
250 |
|
251 void CMdEEventQueryImpl::DoNotifyResultsL( RArray<TItemId>& aResultIdList ) |
|
252 { |
|
253 NotifyNewResultsL( aResultIdList ); |
|
254 } |
|
255 |
|
256 void CMdEEventQueryImpl::DoNotifyResults( TUint32 aResultCount ) |
|
257 { |
|
258 NotifyNewResults( aResultCount ); |
|
259 } |
|
260 |
|
261 void CMdEEventQueryImpl::DoNotifyCompleted( TInt aError ) |
|
262 { |
|
263 SetState( aError ? EStateError : EStateCompleted ); |
|
264 NotifyCompleted( aError ); |
|
265 } |