|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: MPX My Videos collection plugin's MDS database class* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 //#include <harvesterclient.h> |
|
21 //#include <mpxlog.h> |
|
22 #include <mdequery.h> |
|
23 #include <mdeconstants.h> |
|
24 #include <mdequery.h> |
|
25 #include <mpxmedia.h> |
|
26 #include <vcxmyvideosdefs.h> |
|
27 #include <mpxmediacontainerdefs.h> |
|
28 #include <mpxmediageneraldefs.h> |
|
29 #include <mpxmediageneralextdefs.h> |
|
30 #include <mpxmediaarray.h> |
|
31 #include <mpxmediavideodefs.h> |
|
32 #include "vcxmyvideosmdsdb_stub.h" |
|
33 #include "vcxmyvideoscollectionutil.h" |
|
34 |
|
35 |
|
36 const TInt KInvalidId( -100 ); |
|
37 const TInt KMPXIdNotFound( 998 ); |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CVcxMdsShutdownMonitor::NewL() |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CVcxMdsShutdownMonitor* CVcxMdsShutdownMonitor::NewL( MVcxMdsShutdownMonitorObserver& aObserver, |
|
44 const TUid& aKeyCategory, |
|
45 const TInt aPropertyKey, |
|
46 TBool aDefineKey) |
|
47 { |
|
48 CVcxMdsShutdownMonitor* self = new( ELeave )CVcxMdsShutdownMonitor( aObserver, |
|
49 aKeyCategory, |
|
50 aPropertyKey, |
|
51 aDefineKey); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CVcxMdsShutdownMonitor::CVcxMdsShutdownMonitor() |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CVcxMdsShutdownMonitor::CVcxMdsShutdownMonitor( MVcxMdsShutdownMonitorObserver& aObserver, |
|
63 const TUid& aKeyCategory, |
|
64 const TInt aPropertyKey, |
|
65 TBool aDefineKey) |
|
66 : CActive( CActive::EPriorityStandard ), iObserver( aObserver ), |
|
67 iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey ) |
|
68 { |
|
69 CActiveScheduler::Add( this ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CVcxMdsShutdownMonitor::ConstructL() |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CVcxMdsShutdownMonitor::ConstructL() |
|
77 { |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CVcxMdsShutdownMonitor::~CVcxMdsShutdownMonitor() |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CVcxMdsShutdownMonitor::~CVcxMdsShutdownMonitor() |
|
85 { |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CVcxMdsShutdownMonitor::RunL() |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CVcxMdsShutdownMonitor::RunL() |
|
93 { |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CVcxMdsShutdownMonitor::DoCancel() |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CVcxMdsShutdownMonitor::DoCancel() |
|
101 { |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CVcxMyVideosMdsDb::CVcxMyVideosMdsDb |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 CVcxMyVideosMdsDb::CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver, |
|
109 RFs& aFs, MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver ) |
|
110 : iFs( aFs ), iMdsDbObserver(aObserver), iAlbumsObserver(aAlbumsObserver) |
|
111 { |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CVcxMyVideosMdsDb::ConstructL |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CVcxMyVideosMdsDb::ConstructL() |
|
120 { |
|
121 //iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this ); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CVcxMyVideosMdsDb::OpenMdsSessionL |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CVcxMyVideosMdsDb::OpenMdsSessionL() |
|
129 { |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CVcxMyVideosMdsDb::HandleObjectPresentNotification( CMdESession& /*aSession*/, |
|
136 TBool /*aPresent*/, const RArray<TItemId>& /*aObjectIdArray*/) |
|
137 { |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewL( MVcxMyVideosMdsDbObserver* aObserver, |
|
144 RFs& aFs, MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver ) |
|
145 { |
|
146 CVcxMyVideosMdsDb* self = |
|
147 CVcxMyVideosMdsDb::NewLC( aObserver, aFs, aAlbumsObserver ); |
|
148 CleanupStack::Pop( self ); |
|
149 return self; |
|
150 } |
|
151 |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewLC( MVcxMyVideosMdsDbObserver* aObserver, |
|
157 RFs& aFs, MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver ) |
|
158 { |
|
159 CVcxMyVideosMdsDb* self = new( ELeave ) CVcxMyVideosMdsDb( aObserver, aFs, aAlbumsObserver ); |
|
160 CleanupStack::PushL( self ); |
|
161 self->ConstructL(); |
|
162 return self; |
|
163 } |
|
164 |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb() |
|
170 { |
|
171 delete iVideoQuery; |
|
172 delete iMdsSession; |
|
173 delete iActiveSchedulerWait; |
|
174 delete iAsyncHandleQueryCompleteCaller; |
|
175 delete iMdsShutdownMonitor; |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // CVcxMyVideosMdsDb::Cancel |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 void CVcxMyVideosMdsDb::Cancel( TRequestType /*aType*/ ) |
|
183 { |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CVcxMyVideosMdsDb::AddVideoL |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 void CVcxMyVideosMdsDb::AddVideoL( |
|
191 CMPXMedia& /*aVideo*/, |
|
192 TUint32& /*aMdsId*/ ) |
|
193 { |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // CVcxMyVideosMdsDb::RemoveVideo |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 TInt CVcxMyVideosMdsDb::RemoveVideo( TUint32 /*aMdsId*/ ) |
|
201 { |
|
202 return 0; |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // CVcxMyVideosMdsDb::UpdateVideoL |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CVcxMyVideosMdsDb::UpdateVideoL( CMPXMedia& /*aVideo*/ ) |
|
210 { |
|
211 } |
|
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // CVcxMyVideosMdsDb::CreateVideoListL |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 void CVcxMyVideosMdsDb::CreateVideoListL( TVcxMyVideosSortingOrder /*aSortingOrder*/, |
|
218 TBool /*aAscending*/, TBool /*aFullDetails*/, CMPXMedia*& /*aVideoList*/ ) |
|
219 { |
|
220 } |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // CVcxMyVideosMdsDb::DoCreateVideoListL |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CVcxMyVideosMdsDb::DoCreateVideoListL( TVcxMyVideosSortingOrder /*aSortingOrder*/, |
|
227 TBool /*aAscending*/, TBool /*aFullDetails*/, CMPXMedia*& aVideoList ) |
|
228 { |
|
229 iVideoList = aVideoList; |
|
230 CMPXMediaArray* mediaArray = iVideoList->Value<CMPXMediaArray>(KMPXMediaArrayContents); |
|
231 CleanupStack::PushL( mediaArray ); |
|
232 for( TInt i = 0; i < 10; i++ ) |
|
233 { |
|
234 TMPXItemId mpxId( i, 0 ); |
|
235 |
|
236 CMPXMedia* newMedia = CMPXMedia::NewL(); |
|
237 CleanupStack::PushL( newMedia ); |
|
238 newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId ); |
|
239 newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId ); |
|
240 mediaArray->AppendL( *newMedia ); |
|
241 CleanupStack::PopAndDestroy( newMedia ); |
|
242 } |
|
243 CleanupStack::Pop( mediaArray ); |
|
244 |
|
245 iVideoList->SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() ); |
|
246 } |
|
247 |
|
248 // --------------------------------------------------------------------------- |
|
249 // From class MMdEQueryObserver. |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 void CVcxMyVideosMdsDb::HandleQueryNewResults( |
|
253 CMdEQuery& /*aQuery*/, |
|
254 TInt /*aFirstNewItemIndex*/, |
|
255 TInt /*aNewItemCount*/ ) |
|
256 { |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // Leaving version of HandleQueryNewResults. |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 void CVcxMyVideosMdsDb::DoHandleQueryNewResultsL( |
|
264 CMdEQuery& /*aQuery*/, |
|
265 TInt /*aFirstNewItemIndex*/, |
|
266 TInt /*aNewItemCount*/ ) |
|
267 { |
|
268 } |
|
269 |
|
270 |
|
271 |
|
272 // --------------------------------------------------------------------------- |
|
273 // From class MMdEQueryObserver. |
|
274 // --------------------------------------------------------------------------- |
|
275 // |
|
276 void CVcxMyVideosMdsDb::HandleQueryCompleted( |
|
277 CMdEQuery& /*aQuery*/, |
|
278 TInt /*aError*/) |
|
279 { |
|
280 //iAsyncHandleQueryCompleteCaller->CallBack(); |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------------------------- |
|
284 // CVcxMyVideosMdsDb::AsyncHandleQueryCompleted |
|
285 // --------------------------------------------------------------------------- |
|
286 // |
|
287 TInt CVcxMyVideosMdsDb::AsyncHandleQueryCompleted( TAny* /*aThis*/ ) |
|
288 { |
|
289 return KErrNone; |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // CVcxMyVideosMdsDb::CreateVideoL |
|
294 // --------------------------------------------------------------------------- |
|
295 // |
|
296 CMPXMedia* CVcxMyVideosMdsDb::CreateVideoL( TUint32 aId, TBool /*aFullDetails*/ ) |
|
297 { |
|
298 if( aId == KInvalidId ) |
|
299 { |
|
300 return NULL; |
|
301 } |
|
302 |
|
303 if( aId == KMPXIdNotFound ) |
|
304 { |
|
305 return NULL; |
|
306 } |
|
307 |
|
308 CMPXMedia* video = CMPXMedia::NewL( ); |
|
309 CleanupStack::PushL( video ); |
|
310 TMPXItemId id( aId, KVcxMvcMediaTypeVideo ); |
|
311 video->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
312 CleanupStack::Pop( video ); |
|
313 return video; |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // From class MMdESessionObserver. |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 void CVcxMyVideosMdsDb::HandleSessionOpened( |
|
321 CMdESession& /*aSession*/, |
|
322 TInt /*aError*/) |
|
323 { |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // From class MMdESessionObserver. |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 void CVcxMyVideosMdsDb::HandleSessionError( |
|
331 CMdESession& /*aSession*/, |
|
332 TInt aError) |
|
333 { |
|
334 iMdsDbObserver->HandleCreateVideoListResp( iVideoList, aError, ETrue ); |
|
335 } |
|
336 |
|
337 // --------------------------------------------------------------------------- |
|
338 // CVcxMyVideosMdsDb::HandleObjectNotification |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 void CVcxMyVideosMdsDb::HandleObjectNotification( |
|
342 CMdESession& /*aSession*/, |
|
343 TObserverNotificationType /*aType*/, |
|
344 const RArray<TItemId>& /*aObjectIdArray*/) |
|
345 { |
|
346 //TRAP_IGNORE( DoHandleObjectNotificationL( aType, aObjectIdArray )); |
|
347 } |
|
348 |
|
349 // --------------------------------------------------------------------------- |
|
350 // CVcxMyVideosMdsDb::ObjectL |
|
351 // --------------------------------------------------------------------------- |
|
352 // |
|
353 CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId /*aId*/, TBool /*aIsVideo*/ ) |
|
354 { |
|
355 return NULL; |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------------------------- |
|
359 // CVcxMyVideosMdsDb::Object2MediaL |
|
360 // --------------------------------------------------------------------------- |
|
361 // |
|
362 void CVcxMyVideosMdsDb::Object2MediaL( |
|
363 CMdEObject& /*aObject*/, |
|
364 CMPXMedia& /*aVideo*/, |
|
365 TBool /*aFullDetails*/ ) |
|
366 { |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // CVcxMyVideosMdsDb::Media2ObjectL |
|
371 // Called by AddVideoL() |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 void CVcxMyVideosMdsDb::Media2ObjectL( |
|
375 CMPXMedia& /*aVideo*/, |
|
376 CMdEObject& /*aObject*/) |
|
377 { |
|
378 } |
|
379 |
|
380 // --------------------------------------------------------------------------- |
|
381 // CVcxMyVideosMdsDb::SetCreationDateToObjectL |
|
382 // --------------------------------------------------------------------------- |
|
383 // |
|
384 void CVcxMyVideosMdsDb::SetCreationDateToObjectL( const CMPXMedia& /*aVideo*/, CMdEObject& /*aObject*/ ) |
|
385 { |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------------------------- |
|
389 // CVcxMyVideosMdsDb::GetSchemaDefinitionsL |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 void CVcxMyVideosMdsDb::GetSchemaDefinitionsL() |
|
393 { |
|
394 } |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // CVcxMyVideosMdsDb::DoHandleObjectNotificationL |
|
398 // --------------------------------------------------------------------------- |
|
399 // |
|
400 void CVcxMyVideosMdsDb::DoHandleObjectNotificationL( |
|
401 TObserverNotificationType /*aType*/, |
|
402 const RArray<TItemId>& /*aObjectIdArray*/ ) |
|
403 { |
|
404 } |
|
405 |
|
406 // --------------------------------------------------------------------------- |
|
407 // CVcxMyVideosMdsDb::SetCreationAndModifiedDatesL |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 void CVcxMyVideosMdsDb::SetCreationAndModifiedDatesL( CMdEObject& /*aObject*/ ) |
|
411 { |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // CVcxMyVideosMdsDb::MdsSessionL |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 CMdESession& CVcxMyVideosMdsDb::MdsSessionL() |
|
419 { |
|
420 return *iMdsSession; |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------------------------- |
|
424 // CVcxMyVideosMdsDb::ShutdownNotification |
|
425 // From MVcxMdsShutDownMonitorObserver |
|
426 // --------------------------------------------------------------------------- |
|
427 // |
|
428 void CVcxMyVideosMdsDb::ShutdownNotification( TInt /*aShutdownState*/ ) |
|
429 { |
|
430 } |