34
|
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 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: Provides albums support utilizing MDS.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <mpxlog.h>
|
|
22 |
#include <mdesession.h>
|
|
23 |
#include <mdeconstants.h>
|
|
24 |
#include <mdequery.h>
|
|
25 |
#include <mpxmedia.h>
|
|
26 |
#include <mpxmediaarray.h>
|
|
27 |
#include <mpxmediacontainerdefs.h>
|
|
28 |
#include <mpxmediageneraldefs.h>
|
|
29 |
#include "vcxmyvideosmdsalbums.h"
|
|
30 |
#include "vcxmyvideosmdsdb.h"
|
|
31 |
#include "vcxmyvideoscollectionutil.h"
|
|
32 |
#include "vcxmyvideosmdscmdqueue.h"
|
|
33 |
|
|
34 |
// ============================ MEMBER FUNCTIONS =============================
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
// Constructor
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CVcxMyVideosMdsAlbums::CVcxMyVideosMdsAlbums( CVcxMyVideosMdsDb& aMdsDb,
|
|
41 |
MVcxMyVideosMdsAlbumsObserver* aObserver )
|
|
42 |
: CActive( EPriorityStandard ), iMdsDb( aMdsDb ), iObserver(aObserver)
|
|
43 |
{
|
|
44 |
}
|
|
45 |
|
|
46 |
// ---------------------------------------------------------------------------
|
|
47 |
// 2nd-phase constructor
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
//
|
|
50 |
void CVcxMyVideosMdsAlbums::ConstructL()
|
|
51 |
{
|
|
52 |
GetSchemaDefinitionsL();
|
|
53 |
CActiveScheduler::Add( this );
|
|
54 |
|
|
55 |
if ( iObserver )
|
|
56 |
{
|
|
57 |
//ENotifyAdd and ENotifyModify are not supported
|
|
58 |
iMdsDb.iMdsSession->AddRelationItemObserverL( *this, NULL,
|
|
59 |
ENotifyRemove, iMdsDb.iNamespaceDef );
|
|
60 |
|
|
61 |
#if 0
|
|
62 |
// We receive only IDs from here. We need to make query to get
|
|
63 |
// relation objects-> slow to use. We use the response from
|
|
64 |
// the add operation instead. This way we don't receive
|
|
65 |
// add events if someone else adds videos to our albums
|
|
66 |
// but the performance is the best possible.
|
|
67 |
iMdsDb.iMdsSession->AddRelationObserverL( *this, NULL,
|
|
68 |
ENotifyAdd | ENotifyModify | ENotifyRemove );
|
|
69 |
#endif
|
|
70 |
}
|
|
71 |
|
|
72 |
//TODO: do we need this?
|
|
73 |
//iMdsDb.iMdsSession->AddRelationPresentObserverL();
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// Two-Phase Constructor
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
CVcxMyVideosMdsAlbums* CVcxMyVideosMdsAlbums::NewL( CVcxMyVideosMdsDb& aMdsDb,
|
|
81 |
MVcxMyVideosMdsAlbumsObserver* aObserver )
|
|
82 |
{
|
|
83 |
CVcxMyVideosMdsAlbums* self = new(ELeave) CVcxMyVideosMdsAlbums( aMdsDb, aObserver );
|
|
84 |
CleanupStack::PushL( self );
|
|
85 |
self->ConstructL();
|
|
86 |
CleanupStack::Pop( self );
|
|
87 |
return self;
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// Destructor
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
CVcxMyVideosMdsAlbums::~CVcxMyVideosMdsAlbums()
|
|
95 |
{
|
|
96 |
delete iAlbumQuery;
|
|
97 |
delete iVideoQuery;
|
|
98 |
delete iRelationQuery;
|
|
99 |
delete iAlbumList;
|
|
100 |
iItemArray.Close();
|
|
101 |
iResultBuffer.Close();
|
|
102 |
}
|
|
103 |
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
// CVcxMyVideosMdsAlbums::Cancel
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
void CVcxMyVideosMdsAlbums::Cancel( CVcxMyVideosMdsDb::TRequestType aType )
|
|
109 |
{
|
|
110 |
if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbums )
|
|
111 |
{
|
|
112 |
if ( iAlbumQuery )
|
|
113 |
{
|
|
114 |
iAlbumQuery->Cancel();
|
|
115 |
}
|
|
116 |
}
|
|
117 |
|
|
118 |
if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbumContentIds )
|
|
119 |
{
|
|
120 |
if ( iRelationQuery )
|
|
121 |
{
|
|
122 |
iRelationQuery->Cancel();
|
|
123 |
}
|
|
124 |
}
|
|
125 |
|
|
126 |
if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbumContentVideos )
|
|
127 |
{
|
|
128 |
if ( iVideoQuery )
|
|
129 |
{
|
|
130 |
iVideoQuery->Cancel();
|
|
131 |
}
|
|
132 |
}
|
|
133 |
|
|
134 |
|
|
135 |
//TODO: cancel for "add to album"
|
|
136 |
|
|
137 |
//TODO: cancel for "remove from album"
|
|
138 |
|
|
139 |
//TODO: cancel for "remove albums"
|
|
140 |
|
|
141 |
// Seems like the only way to cancel these is to close session to MDS and reopen it...
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
// CVcxMyVideosMdsAlbums::GetAlbumsL
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CVcxMyVideosMdsAlbums::GetAlbumsL( CMPXMedia* aAlbumList,
|
|
149 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
150 |
{
|
|
151 |
CVcxMyVideosMdsCmdGetAlbums* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbums;
|
|
152 |
CleanupStack::PushL( cmd );
|
|
153 |
cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbums;
|
|
154 |
cmd->iClient = &aClient;
|
|
155 |
cmd->iAlbumList = aAlbumList;
|
|
156 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
157 |
CleanupStack::Pop( cmd );
|
|
158 |
}
|
|
159 |
|
|
160 |
// ---------------------------------------------------------------------------
|
|
161 |
// CVcxMyVideosMdsAlbums::DoGetAlbumsL
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
void CVcxMyVideosMdsAlbums::DoGetAlbumsL( CMPXMedia* aAlbumList,
|
|
165 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
166 |
{
|
|
167 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumsL() start");
|
|
168 |
|
|
169 |
iAlbumList = aAlbumList; //store pointer to album list, we do not own this
|
|
170 |
iClient = &aClient;
|
|
171 |
|
|
172 |
delete iAlbumQuery;
|
|
173 |
iAlbumQuery = NULL;
|
|
174 |
|
|
175 |
iAlbumQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iAlbumObjectDef, this );
|
|
176 |
|
|
177 |
CMdELogicCondition& rootCondition = iAlbumQuery->Conditions();
|
|
178 |
rootCondition.SetOperator( ELogicConditionOperatorOr );
|
|
179 |
rootCondition.AddObjectConditionL( *iAlbumObjectDef );
|
|
180 |
rootCondition.AddPropertyConditionL( *iTypePropertyDef,
|
|
181 |
TMdEIntRange( MdeConstants::Album::EAlbumUser, MdeConstants::Album::EAlbumUser,
|
|
182 |
EMdERangeTypeEqual ) );
|
|
183 |
|
|
184 |
iAlbumQuery->FindL();
|
|
185 |
|
|
186 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumsL() exit");
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
// CVcxMyVideosMdsAlbums::GetAlbumContentIdsL
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
void CVcxMyVideosMdsAlbums::GetAlbumContentIdsL( TUint32 aAlbumId,
|
|
194 |
RArray<TVcxMyVideosAlbumVideo>& aContentArray,
|
|
195 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
196 |
{
|
|
197 |
CVcxMyVideosMdsCmdGetAlbumContentIds* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbumContentIds;
|
|
198 |
CleanupStack::PushL( cmd ); // 1->
|
|
199 |
cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbumContentIds;
|
|
200 |
cmd->iClient = &aClient;
|
|
201 |
cmd->iAlbumId = aAlbumId;
|
|
202 |
cmd->iAlbumContent = &aContentArray;
|
|
203 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
204 |
CleanupStack::Pop( cmd ); // <-1
|
|
205 |
}
|
|
206 |
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
// CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL
|
|
209 |
// ---------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
void CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL( TUint32 aAlbumId,
|
|
212 |
RArray<TVcxMyVideosAlbumVideo>& aContentArray,
|
|
213 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
214 |
{
|
|
215 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL() start");
|
|
216 |
|
|
217 |
delete iRelationQuery;
|
|
218 |
iRelationQuery = NULL;
|
|
219 |
|
|
220 |
iClient = &aClient;
|
|
221 |
iAlbumId = aAlbumId;
|
|
222 |
iAlbumContent = &aContentArray;
|
|
223 |
|
|
224 |
iRelationQuery = iMdsDb.iMdsSession->NewRelationQueryL( *iNamespaceDef, this );
|
|
225 |
|
|
226 |
CMdELogicCondition& rootCondition = iRelationQuery->Conditions();
|
|
227 |
|
|
228 |
//relation left side contains and...
|
|
229 |
CMdERelationCondition& relationCondition =
|
|
230 |
rootCondition.AddRelationConditionL( *iContainsRelationDef, ERelationConditionSideLeft); // "AND"
|
|
231 |
|
|
232 |
CMdELogicCondition& leftCondition = relationCondition.LeftL();
|
|
233 |
CMdELogicCondition& rightCondition = relationCondition.RightL();
|
|
234 |
|
|
235 |
//...left side is album...
|
|
236 |
leftCondition.AddObjectConditionL( *iAlbumObjectDef );
|
|
237 |
//...and left id is aAlbumId..
|
|
238 |
leftCondition.AddObjectConditionL( aAlbumId );
|
|
239 |
|
|
240 |
//Right side is video
|
|
241 |
rightCondition.AddObjectConditionL( *iMdsDb.iVideoObjectDef );
|
|
242 |
|
|
243 |
iRelationQuery->FindL();
|
|
244 |
|
|
245 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL() exit");
|
|
246 |
}
|
|
247 |
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
// CVcxMyVideosMdsAlbums::GetAlbumContentVideosL
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
void CVcxMyVideosMdsAlbums::GetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
|
|
253 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
254 |
{
|
|
255 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::GetAlbumContentVideosL() start");
|
|
256 |
|
|
257 |
CVcxMyVideosMdsCmdGetAlbumContentVideos* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbumContentVideos;
|
|
258 |
CleanupStack::PushL( cmd ); // 1->
|
|
259 |
cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbumContentVideos;
|
|
260 |
cmd->iClient = &aClient;
|
|
261 |
cmd->iAlbumId = aAlbumId;
|
|
262 |
cmd->iAlbumContentVideos = &aVideoList;
|
|
263 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
264 |
CleanupStack::Pop( cmd ); // <-1
|
|
265 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::GetAlbumContentVideosL() exit");
|
|
266 |
}
|
|
267 |
|
|
268 |
// ---------------------------------------------------------------------------
|
|
269 |
// CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL
|
|
270 |
// ---------------------------------------------------------------------------
|
|
271 |
//
|
|
272 |
void CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
|
|
273 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
274 |
{
|
|
275 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL() start");
|
|
276 |
|
|
277 |
delete iVideoQuery;
|
|
278 |
iVideoQuery = NULL;
|
|
279 |
|
|
280 |
iClient = &aClient;
|
|
281 |
iVideoList = &aVideoList;
|
|
282 |
iAlbumId = aAlbumId;
|
|
283 |
|
|
284 |
iVideoQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iMdsDb.iVideoObjectDef, this );
|
|
285 |
CMdELogicCondition& rootCondition = iVideoQuery->Conditions();
|
|
286 |
CMdERelationCondition& relationCondition =
|
|
287 |
rootCondition.AddRelationConditionL( *iContainsRelationDef );
|
|
288 |
|
|
289 |
CMdELogicCondition& leftCondition = relationCondition.LeftL();
|
|
290 |
CMdELogicCondition& rightCondition = relationCondition.RightL();
|
|
291 |
|
|
292 |
//...left side is an album...
|
|
293 |
leftCondition.AddObjectConditionL( *iAlbumObjectDef );
|
|
294 |
//...and left id is aAlbumId..
|
|
295 |
leftCondition.AddObjectConditionL( aAlbumId );
|
|
296 |
|
|
297 |
//and queried object is on the right side of the relation
|
|
298 |
relationCondition.SetSide( ERelationConditionSideRight );
|
|
299 |
|
|
300 |
const TInt maxItemsInQueryResult = 500;
|
|
301 |
iVideoQuery->FindL( KMdEQueryDefaultMaxCount, maxItemsInQueryResult );
|
|
302 |
|
|
303 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL() exit");
|
|
304 |
}
|
|
305 |
|
|
306 |
// ---------------------------------------------------------------------------
|
|
307 |
// CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL
|
|
308 |
// ---------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
void CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL()
|
|
311 |
{
|
|
312 |
iNamespaceDef = &(iMdsDb.iMdsSession->GetDefaultNamespaceDefL());
|
|
313 |
|
|
314 |
_LIT( KVcxAlbumObjectName, "Album" );
|
|
315 |
iAlbumObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxAlbumObjectName ));
|
|
316 |
|
|
317 |
_LIT( KVcxTypePropertyName, "Type" );
|
|
318 |
iTypePropertyDef = &(iAlbumObjectDef->GetPropertyDefL( KVcxTypePropertyName ));
|
|
319 |
|
|
320 |
_LIT( KVcxContainsRelationName, "Contains" );
|
|
321 |
iContainsRelationDef =
|
|
322 |
&(iNamespaceDef->GetRelationDefL( KVcxContainsRelationName ));
|
|
323 |
}
|
|
324 |
|
|
325 |
// ---------------------------------------------------------------------------
|
|
326 |
// CVcxMyVideosMdsAlbums::Object2MediaL
|
|
327 |
// For album objects only.
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
//
|
|
330 |
void CVcxMyVideosMdsAlbums::Object2MediaL(
|
|
331 |
CMdEObject& aObject,
|
|
332 |
CMPXMedia& aAlbum )
|
|
333 |
{
|
|
334 |
aAlbum.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup );
|
|
335 |
|
|
336 |
CMdEProperty* property = NULL;
|
|
337 |
|
|
338 |
// ID
|
|
339 |
TMPXItemId mpxId;
|
|
340 |
mpxId.iId1 = aObject.Id();
|
|
341 |
mpxId.iId2 = 2;
|
|
342 |
aAlbum.SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, mpxId );
|
|
343 |
|
|
344 |
// TITLE
|
|
345 |
if ( aObject.Property( *iMdsDb.iTitlePropertyDef, property, 0 ) != KErrNotFound )
|
|
346 |
{
|
|
347 |
aAlbum.SetTextValueL( KMPXMediaGeneralTitle,
|
|
348 |
static_cast<CMdETextProperty*>(property)->Value());
|
|
349 |
}
|
|
350 |
|
|
351 |
// CREATION DATE
|
|
352 |
if ( aObject.Property( *iMdsDb.iCreationDatePropertyDef, property, 0 ) != KErrNotFound )
|
|
353 |
{
|
|
354 |
aAlbum.SetTObjectValueL<TInt64>( KMPXMediaGeneralDate,
|
|
355 |
static_cast<CMdETimeProperty*>(property)->Value().Int64() );
|
|
356 |
}
|
|
357 |
|
|
358 |
// MODIFIED DATE
|
|
359 |
if ( aObject.Property( *iMdsDb.iLastModifiedDatePropertyDef, property, 0 ) != KErrNotFound )
|
|
360 |
{
|
|
361 |
aAlbum.SetTObjectValueL<TInt64>( KVcxMediaMyVideosModifiedDate,
|
|
362 |
static_cast<CMdETimeProperty*>(property)->Value().Int64() );
|
|
363 |
}
|
|
364 |
|
|
365 |
#if 0 //TODO
|
|
366 |
// ALBUM TYPE
|
|
367 |
if ( aObject.Property( *iTypePropertyDef, property, 0 ) != KErrNotFound )
|
|
368 |
{
|
|
369 |
aAlbum.SetTObjectValueL<TUint16>( KVcxMediaMyVideosAlbumType,
|
|
370 |
static_cast<CMdETUint16Property*>(property)->Value() );
|
|
371 |
}
|
|
372 |
#endif
|
|
373 |
|
|
374 |
//TODO: usage count
|
|
375 |
|
|
376 |
aAlbum.SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
|
|
377 |
aAlbum.SetTObjectValueL( KMPXMediaGeneralCategory, EMPXNoCategory );
|
|
378 |
aAlbum.SetTObjectValueL( KVcxMediaMyVideosCategoryItemCount, 0 );
|
|
379 |
aAlbum.SetTObjectValueL( KVcxMediaMyVideosCategoryNewItemCount, 0 );
|
|
380 |
|
|
381 |
}
|
|
382 |
|
|
383 |
// ---------------------------------------------------------------------------
|
|
384 |
// CVcxMyVideosMdsAlbums::Media2ObjectL
|
|
385 |
// Called by AddAlbumL()
|
|
386 |
// ---------------------------------------------------------------------------
|
|
387 |
//
|
|
388 |
void CVcxMyVideosMdsAlbums::Media2ObjectL(
|
|
389 |
CMPXMedia& aAlbum,
|
|
390 |
CMdEObject& aObject)
|
|
391 |
{
|
|
392 |
CMdEProperty* property;
|
|
393 |
|
|
394 |
// MDS ID
|
|
395 |
|
|
396 |
// TITLE (NAME)
|
|
397 |
if ( aAlbum.IsSupported( KMPXMediaGeneralTitle ) )
|
|
398 |
{
|
|
399 |
if ( aObject.Property( *iMdsDb.iTitlePropertyDef, property, 0 ) != KErrNotFound )
|
|
400 |
{
|
|
401 |
static_cast<CMdETextProperty*>(property)->SetValueL(
|
|
402 |
aAlbum.ValueText( KMPXMediaGeneralTitle ) );
|
|
403 |
}
|
|
404 |
else
|
|
405 |
{
|
|
406 |
aObject.AddTextPropertyL(
|
|
407 |
*iMdsDb.iTitlePropertyDef, aAlbum.ValueText( KMPXMediaGeneralTitle ) );
|
|
408 |
}
|
|
409 |
}
|
|
410 |
|
|
411 |
// KMPXMediaGeneralDate ( creation date )
|
|
412 |
if ( aAlbum.IsSupported( KMPXMediaGeneralDate ) )
|
|
413 |
{
|
|
414 |
TInt64 creationDateInt64 = 0;
|
|
415 |
creationDateInt64 = aAlbum.ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
|
|
416 |
TTime creationDate( creationDateInt64 );
|
|
417 |
if ( aObject.Property( *iMdsDb.iCreationDatePropertyDef, property, 0 ) != KErrNotFound )
|
|
418 |
{
|
|
419 |
static_cast<CMdETimeProperty*>(property)->SetValueL( creationDate );
|
|
420 |
}
|
|
421 |
else
|
|
422 |
{
|
|
423 |
aObject.AddTimePropertyL( *iMdsDb.iCreationDatePropertyDef, creationDate );
|
|
424 |
}
|
|
425 |
}
|
|
426 |
|
|
427 |
// KVcxMediaMyVideosModifiedDate
|
|
428 |
if ( aAlbum.IsSupported( KVcxMediaMyVideosModifiedDate ) )
|
|
429 |
{
|
|
430 |
TInt64 modifiedDateInt64 = aAlbum.ValueTObjectL<TInt64>( KVcxMediaMyVideosModifiedDate );
|
|
431 |
TTime modifiedDate( modifiedDateInt64 );
|
|
432 |
if ( aObject.Property( *iMdsDb.iLastModifiedDatePropertyDef, property, 0 ) != KErrNotFound )
|
|
433 |
{
|
|
434 |
static_cast<CMdETimeProperty*>(property)->SetValueL( modifiedDate );
|
|
435 |
}
|
|
436 |
else
|
|
437 |
{
|
|
438 |
aObject.AddTimePropertyL( *iMdsDb.iLastModifiedDatePropertyDef, modifiedDate );
|
|
439 |
}
|
|
440 |
}
|
|
441 |
}
|
|
442 |
|
|
443 |
// ---------------------------------------------------------------------------
|
|
444 |
// CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL
|
|
445 |
// ---------------------------------------------------------------------------
|
|
446 |
//
|
|
447 |
void CVcxMyVideosMdsAlbums::HandleQueryNewResults(CMdEQuery& aQuery,
|
|
448 |
TInt aFirstNewItemIndex,
|
|
449 |
TInt aNewItemCount )
|
|
450 |
{
|
|
451 |
if ( &aQuery == iVideoQuery )
|
|
452 |
{
|
|
453 |
TRAPD( err, HandleVideoQueryResultsL( aQuery, KErrNone,
|
|
454 |
aFirstNewItemIndex, aNewItemCount, EFalse /* completed */ ) );
|
|
455 |
if ( err != KErrNone )
|
|
456 |
{
|
|
457 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleVideoQueryResultsL() left: %d", err);
|
|
458 |
}
|
|
459 |
}
|
|
460 |
}
|
|
461 |
|
|
462 |
// ---------------------------------------------------------------------------
|
|
463 |
// CVcxMyVideosMdsAlbums::HandleQueryCompleted
|
|
464 |
// ---------------------------------------------------------------------------
|
|
465 |
//
|
|
466 |
void CVcxMyVideosMdsAlbums::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError )
|
|
467 |
{
|
|
468 |
if ( &aQuery == iAlbumQuery )
|
|
469 |
{
|
|
470 |
TRAPD( err, HandleAlbumQueryCompletedL( aQuery, aError ) );
|
|
471 |
if ( err != KErrNone )
|
|
472 |
{
|
|
473 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleAlbumQueryCompletedL() left: %d", err);
|
|
474 |
}
|
|
475 |
}
|
|
476 |
else if ( &aQuery == iVideoQuery )
|
|
477 |
{
|
|
478 |
TRAPD( err, HandleVideoQueryResultsL( aQuery, aError, 0, 0, ETrue /* completed */ ) );
|
|
479 |
if ( err != KErrNone )
|
|
480 |
{
|
|
481 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleVideoQueryResultsL() left: %d", err);
|
|
482 |
}
|
|
483 |
}
|
|
484 |
else if ( &aQuery == iRelationQuery )
|
|
485 |
{
|
|
486 |
TRAPD( err, HandleRelationQueryCompletedL( aQuery, aError ) );
|
|
487 |
if ( err != KErrNone )
|
|
488 |
{
|
|
489 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleRelationQueryCompletedL() left: %d", err);
|
|
490 |
}
|
|
491 |
}
|
|
492 |
|
|
493 |
iMdsDb.iCmdQueue->CmdFinished();
|
|
494 |
}
|
|
495 |
|
|
496 |
// ---------------------------------------------------------------------------
|
|
497 |
// CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL
|
|
498 |
// ---------------------------------------------------------------------------
|
|
499 |
//
|
|
500 |
void CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL( CMdEQuery& /*aQuery*/, TInt aError )
|
|
501 |
{
|
|
502 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL() start");
|
|
503 |
|
|
504 |
if ( aError != KErrNone )
|
|
505 |
{
|
|
506 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object query failed with error: %d", aError);
|
|
507 |
return;
|
|
508 |
}
|
|
509 |
|
|
510 |
CMPXMediaArray* array = iAlbumList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
|
|
511 |
|
|
512 |
CMPXMedia* media;
|
|
513 |
TInt count = iAlbumQuery->Count();
|
|
514 |
|
|
515 |
iAlbumList->SetTObjectValueL<TInt>( KMPXMediaArrayCount, count );
|
|
516 |
|
|
517 |
for ( TInt i = 0; i < count; i++ )
|
|
518 |
{
|
|
519 |
CMdEObject& object = iAlbumQuery->Result( i );
|
|
520 |
|
|
521 |
media = CMPXMedia::NewL();
|
|
522 |
CleanupStack::PushL( media ); // 1->
|
|
523 |
|
|
524 |
Object2MediaL( object, *media );
|
|
525 |
|
|
526 |
#ifdef _DEBUG
|
|
527 |
TBuf<200> title;
|
|
528 |
title = TVcxMyVideosCollectionUtil::Title( *media );
|
|
529 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object title: %S", &title);
|
|
530 |
#endif
|
|
531 |
|
|
532 |
array->AppendL( media );
|
|
533 |
|
|
534 |
CleanupStack::Pop( media ); // <-1
|
|
535 |
}
|
|
536 |
|
|
537 |
iClient->HandleGetAlbumsResp( iAlbumList );
|
|
538 |
iAlbumList = NULL;
|
|
539 |
|
|
540 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL() exit");
|
|
541 |
}
|
|
542 |
|
|
543 |
// ---------------------------------------------------------------------------
|
|
544 |
// CVcxMyVideosMdsAlbums::HandleVideoQueryCompletedL
|
|
545 |
// ---------------------------------------------------------------------------
|
|
546 |
//
|
|
547 |
void CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL( CMdEQuery& /*aQuery*/, TInt aError,
|
|
548 |
TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete )
|
|
549 |
{
|
|
550 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL() start");
|
|
551 |
|
|
552 |
if ( aComplete )
|
|
553 |
{
|
|
554 |
// error code given only if completed
|
|
555 |
if ( aError != KErrNone )
|
|
556 |
{
|
|
557 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object query failed with error: %d", aError);
|
|
558 |
}
|
|
559 |
|
|
560 |
iClient->HandleGetAlbumContentVideosResp( iAlbumId, *iVideoList,
|
|
561 |
aError, aFirstNewItemIndex, aNewItemCount, aComplete );
|
|
562 |
return;
|
|
563 |
}
|
|
564 |
|
|
565 |
CMPXMediaArray* array = iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
|
|
566 |
|
|
567 |
CMPXMedia* media;
|
|
568 |
TInt count = iVideoQuery->Count();
|
|
569 |
|
|
570 |
iVideoList->SetTObjectValueL<TInt>( KMPXMediaArrayCount, count );
|
|
571 |
|
|
572 |
for ( TInt i = aFirstNewItemIndex; i < count; i++ )
|
|
573 |
{
|
|
574 |
CMdEObject& object = iVideoQuery->Result( i );
|
|
575 |
|
|
576 |
media = CMPXMedia::NewL();
|
|
577 |
CleanupStack::PushL( media ); // 1->
|
|
578 |
|
|
579 |
iMdsDb.Object2MediaL( object, *media );
|
|
580 |
|
|
581 |
#ifdef _DEBUG
|
|
582 |
TBuf<200> title;
|
|
583 |
title = TVcxMyVideosCollectionUtil::Title( *media );
|
|
584 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object title: %S", &title);
|
|
585 |
#endif
|
|
586 |
|
|
587 |
array->AppendL( media );
|
|
588 |
|
|
589 |
CleanupStack::Pop( media ); // <-1
|
|
590 |
}
|
|
591 |
|
|
592 |
iClient->HandleGetAlbumContentVideosResp( iAlbumId, *iVideoList,
|
|
593 |
aError, aFirstNewItemIndex, aNewItemCount, aComplete );
|
|
594 |
iVideoList = NULL;
|
|
595 |
|
|
596 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL() exit");
|
|
597 |
}
|
|
598 |
|
|
599 |
// ---------------------------------------------------------------------------
|
|
600 |
// CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL
|
|
601 |
// ---------------------------------------------------------------------------
|
|
602 |
//
|
|
603 |
void CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL( CMdEQuery& /*aQuery*/, TInt aError )
|
|
604 |
{
|
|
605 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL() start");
|
|
606 |
|
|
607 |
if ( aError != KErrNone )
|
|
608 |
{
|
|
609 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: relation query failed with error: %d", aError);
|
|
610 |
return;
|
|
611 |
}
|
|
612 |
|
|
613 |
TInt count = iRelationQuery->Count();
|
|
614 |
TVcxMyVideosAlbumVideo video;
|
|
615 |
for ( TInt i = 0; i < count; i++ )
|
|
616 |
{
|
|
617 |
MPX_DEBUG4("Relation (id = %d): %d contains %d", iRelationQuery->Result( i ).Id(),
|
|
618 |
iRelationQuery->Result( i ).LeftObjectId(),
|
|
619 |
iRelationQuery->Result( i ).RightObjectId());
|
|
620 |
video.iMdsId = iRelationQuery->Result( i ).RightObjectId();
|
|
621 |
video.iRelationMdsId = iRelationQuery->Result( i ).Id();
|
|
622 |
iAlbumContent->AppendL( video );
|
|
623 |
}
|
|
624 |
|
|
625 |
iClient->HandleGetAlbumContentIdsResp( iAlbumId, *iAlbumContent );
|
|
626 |
|
|
627 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL() exit");
|
|
628 |
}
|
|
629 |
|
|
630 |
// ---------------------------------------------------------------------------
|
|
631 |
// CVcxMyVideosMdsAlbums::AddVideosToAlbumL
|
|
632 |
// ---------------------------------------------------------------------------
|
|
633 |
//
|
|
634 |
void CVcxMyVideosMdsAlbums::AddVideosToAlbumL( CMPXMedia* aCmd,
|
|
635 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
636 |
{
|
|
637 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddVideosToAlbumL() start");
|
|
638 |
|
|
639 |
CVcxMyVideosMdsCmdAddVideosToAlbum* cmd = new (ELeave) CVcxMyVideosMdsCmdAddVideosToAlbum;
|
|
640 |
CleanupStack::PushL( cmd ); // 1->
|
|
641 |
cmd->iCmdType = CVcxMyVideosMdsDb::EAddVideosToAlbum;
|
|
642 |
cmd->iClient = &aClient;
|
|
643 |
cmd->iMpxCmd = aCmd;
|
|
644 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
645 |
CleanupStack::Pop( cmd ); // <-1
|
|
646 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddVideosToAlbumL() exit");
|
|
647 |
}
|
|
648 |
|
|
649 |
// ---------------------------------------------------------------------------
|
|
650 |
// CVcxMyVideosMdsAlbums::DoAddVideosToAlbumL
|
|
651 |
// Called by iMdsDb.iCmdQueue
|
|
652 |
// ---------------------------------------------------------------------------
|
|
653 |
//
|
|
654 |
void CVcxMyVideosMdsAlbums::DoAddVideosToAlbumL( CMPXMedia* aCmd,
|
|
655 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
656 |
{
|
|
657 |
iItemArray.Reset();
|
|
658 |
iResultBuffer.Close();
|
|
659 |
CMdERelation* relation;
|
|
660 |
CMPXMediaArray* videoArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aCmd );
|
|
661 |
|
|
662 |
TInt albumId = TVcxMyVideosCollectionUtil::Uint32ValueL( *aCmd );
|
|
663 |
|
|
664 |
TInt count = videoArray->Count();
|
|
665 |
iItemArray.Reserve( count );
|
|
666 |
for ( TInt i = 0; i < count; i++ )
|
|
667 |
{
|
|
668 |
relation = iMdsDb.iMdsSession->NewRelationL(
|
|
669 |
*iContainsRelationDef, albumId,
|
|
670 |
TVcxMyVideosCollectionUtil::IdL( *videoArray->AtL( i ) ) );
|
|
671 |
CleanupStack::PushL( relation );
|
|
672 |
iItemArray.AppendL( relation );
|
|
673 |
CleanupStack::Pop( relation );
|
|
674 |
}
|
|
675 |
|
|
676 |
iClient = &aClient;
|
|
677 |
iMpxCmd = aCmd;
|
|
678 |
|
|
679 |
iAsyncOperation = EVcxAddVideosToAlbum;
|
|
680 |
|
|
681 |
iMdsDb.iMdsSession->AddItemsAsyncL( iItemArray, iStatus, iResultBuffer );
|
|
682 |
SetActive();
|
|
683 |
}
|
|
684 |
|
|
685 |
// ---------------------------------------------------------------------------
|
|
686 |
// CVcxMyVideosMdsAlbums::RemoveRelationsL
|
|
687 |
// ---------------------------------------------------------------------------
|
|
688 |
//
|
|
689 |
void CVcxMyVideosMdsAlbums::RemoveRelationsL( RArray<TUint32>& aRelationIds,
|
|
690 |
RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
691 |
{
|
|
692 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveRelationsL() start");
|
|
693 |
|
|
694 |
CVcxMyVideosMdsCmdRemoveRelations* cmd = new (ELeave) CVcxMyVideosMdsCmdRemoveRelations;
|
|
695 |
CleanupStack::PushL( cmd ); // 1->
|
|
696 |
cmd->iCmdType = CVcxMyVideosMdsDb::ERemoveRelations;
|
|
697 |
cmd->iClient = &aClient;
|
|
698 |
cmd->iRelationIds = &aRelationIds;
|
|
699 |
cmd->iResults = &aResults;
|
|
700 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
701 |
CleanupStack::Pop( cmd ); // <-1
|
|
702 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveRelationsL() exit");
|
|
703 |
}
|
|
704 |
|
|
705 |
// ---------------------------------------------------------------------------
|
|
706 |
// CVcxMyVideosMdsAlbums::DoRemoveRelationsL
|
|
707 |
// ---------------------------------------------------------------------------
|
|
708 |
//
|
|
709 |
void CVcxMyVideosMdsAlbums::DoRemoveRelationsL( RArray<TUint32>& aRelationIds,
|
|
710 |
RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
711 |
{
|
|
712 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveRelationsL() start");
|
|
713 |
|
|
714 |
iResultBuffer.Close();
|
|
715 |
|
|
716 |
iClient = &aClient;
|
|
717 |
iResultArrayUint32 = &aResults;
|
|
718 |
iIdArray = &aRelationIds;
|
|
719 |
|
|
720 |
iAsyncOperation = EVcxRemoveRelations;
|
|
721 |
|
|
722 |
iMdsDb.iMdsSession->RemoveRelationsAsyncL( *iIdArray, iStatus, iResultBuffer, iNamespaceDef );
|
|
723 |
SetActive();
|
|
724 |
|
|
725 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveRelationsL() exit");
|
|
726 |
}
|
|
727 |
|
|
728 |
// ---------------------------------------------------------------------------
|
|
729 |
// CVcxMyVideosMdsAlbums::AddAlbumL
|
|
730 |
// ---------------------------------------------------------------------------
|
|
731 |
//
|
|
732 |
void CVcxMyVideosMdsAlbums::AddAlbumL( CMPXMedia& aAlbum )
|
|
733 |
{
|
|
734 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddAlbumL() start");
|
|
735 |
|
|
736 |
if ( !iMdsDb.iMdsSession )
|
|
737 |
{
|
|
738 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: no mds session(%d), leaving", iMdsDb.iMdsError);
|
|
739 |
User::Leave( iMdsDb.iMdsError );
|
|
740 |
}
|
|
741 |
|
|
742 |
CMdEObject* object = iMdsDb.iMdsSession->NewObjectLC(
|
|
743 |
*iAlbumObjectDef, KNullDesC ); // 1->
|
|
744 |
|
|
745 |
Media2ObjectL( aAlbum, *object );
|
|
746 |
iMdsDb.SetCreationAndModifiedDatesL( *object );
|
|
747 |
|
|
748 |
TUint32 mdsId;
|
|
749 |
|
|
750 |
#ifdef _DEBUG
|
|
751 |
TRAPD( err, mdsId = iMdsDb.iMdsSession->AddObjectL( *object ) );
|
|
752 |
|
|
753 |
if ( err != KErrNone )
|
|
754 |
{
|
|
755 |
MPX_DEBUG2( "CVcxMyVideosMdsAlbums:: iMdsDb.iMdsSession->AddObjectL leaved with error: %d", err );
|
|
756 |
User::Leave( err );
|
|
757 |
}
|
|
758 |
#else
|
|
759 |
|
|
760 |
mdsId = iMdsDb.iMdsSession->AddObjectL( *object );
|
|
761 |
|
|
762 |
#endif
|
|
763 |
|
|
764 |
if ( mdsId == KNoId )
|
|
765 |
{
|
|
766 |
MPX_DEBUG1( "CVcxMyVideosMdsAlbums::AddAlbumL could not add new album" );
|
|
767 |
User::Leave( KErrGeneral );
|
|
768 |
}
|
|
769 |
|
|
770 |
MPX_DEBUG2( "CVcxMyVideosMdsAlbums::AddAlbumL album created, mds id: %d", mdsId );
|
|
771 |
|
|
772 |
aAlbum.SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, TMPXItemId( mdsId, KVcxMvcMediaTypeAlbum ) );
|
|
773 |
|
|
774 |
CleanupStack::PopAndDestroy( object ); // <-1
|
|
775 |
|
|
776 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddAlbumL() exit");
|
|
777 |
}
|
|
778 |
|
|
779 |
// ---------------------------------------------------------------------------
|
|
780 |
// CVcxMyVideosMdsAlbums::RemoveAlbumsL
|
|
781 |
// ---------------------------------------------------------------------------
|
|
782 |
//
|
|
783 |
void CVcxMyVideosMdsAlbums::RemoveAlbumsL( CMPXMedia* aMpxCmd, MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
784 |
{
|
|
785 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveAlbumsL() start");
|
|
786 |
|
|
787 |
CVcxMyVideosMdsCmdRemoveAlbums* cmd = new (ELeave) CVcxMyVideosMdsCmdRemoveAlbums;
|
|
788 |
CleanupStack::PushL( cmd ); // 1->
|
|
789 |
cmd->iCmdType = CVcxMyVideosMdsDb::ERemoveAlbums;
|
|
790 |
cmd->iClient = &aClient;
|
|
791 |
cmd->iMpxCmd = aMpxCmd;
|
|
792 |
iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
|
|
793 |
CleanupStack::Pop( cmd ); // <-1
|
|
794 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveAlbumsL() exit");
|
|
795 |
}
|
|
796 |
|
|
797 |
// ---------------------------------------------------------------------------
|
|
798 |
// CVcxMyVideosMdsAlbums::DoRemoveAlbumsL
|
|
799 |
// ---------------------------------------------------------------------------
|
|
800 |
//
|
|
801 |
void CVcxMyVideosMdsAlbums::DoRemoveAlbumsL( CMPXMedia* aMpxCmd,
|
|
802 |
MVcxMyVideosMdsAlbumsObserver& aClient )
|
|
803 |
{
|
|
804 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveAlbumsL() start");
|
|
805 |
|
|
806 |
iResultBuffer.Close();
|
|
807 |
|
|
808 |
iClient = &aClient;
|
|
809 |
iMpxCmd = aMpxCmd;
|
|
810 |
|
|
811 |
RArray<TUint32> idArray;
|
|
812 |
CleanupClosePushL( idArray );
|
|
813 |
|
|
814 |
CMPXMediaArray* mediaArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aMpxCmd );
|
|
815 |
|
|
816 |
TVcxMyVideosCollectionUtil::GetIdsFromMediaArrayL( *mediaArray, idArray );
|
|
817 |
|
|
818 |
iAsyncOperation = EVcxRemoveAlbums;
|
|
819 |
|
|
820 |
iMdsDb.iMdsSession->RemoveObjectsAsyncL( idArray, iStatus, iResultBuffer, iNamespaceDef );
|
|
821 |
|
|
822 |
CleanupStack::PopAndDestroy( &idArray );
|
|
823 |
SetActive();
|
|
824 |
|
|
825 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveAlbumsL() exit");
|
|
826 |
}
|
|
827 |
|
|
828 |
// ---------------------------------------------------------------------------
|
|
829 |
// CVcxMyVideosMdsAlbums::RunL
|
|
830 |
// From CActive.
|
|
831 |
// ---------------------------------------------------------------------------
|
|
832 |
//
|
|
833 |
void CVcxMyVideosMdsAlbums::RunL()
|
|
834 |
{
|
|
835 |
#ifdef _DEBUG
|
|
836 |
TInt status = iStatus.Int();
|
|
837 |
if ( status != KErrNone )
|
|
838 |
{
|
|
839 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums::RunL() iStatus = %d", status);
|
|
840 |
}
|
|
841 |
#endif
|
|
842 |
|
|
843 |
switch ( iAsyncOperation )
|
|
844 |
{
|
|
845 |
case EVcxAddVideosToAlbum:
|
|
846 |
{
|
|
847 |
HandleAddVideosToAlbumCompletedL();
|
|
848 |
}
|
|
849 |
break;
|
|
850 |
|
|
851 |
case EVcxRemoveRelations:
|
|
852 |
HandleRemoveRelationsCompletedL();
|
|
853 |
break;
|
|
854 |
|
|
855 |
case EVcxRemoveAlbums:
|
|
856 |
HandleRemoveAlbumsCompletedL();
|
|
857 |
break;
|
|
858 |
}
|
|
859 |
|
|
860 |
iMdsDb.iCmdQueue->CmdFinished();
|
|
861 |
}
|
|
862 |
|
|
863 |
//TODO: implement RunError
|
|
864 |
|
|
865 |
// ---------------------------------------------------------------------------
|
|
866 |
// CVcxMyVideosMdsAlbums::RunL
|
|
867 |
// From CActive.
|
|
868 |
// ---------------------------------------------------------------------------
|
|
869 |
//
|
|
870 |
void CVcxMyVideosMdsAlbums::DoCancel()
|
|
871 |
{
|
|
872 |
//TODO:
|
|
873 |
}
|
|
874 |
|
|
875 |
// ---------------------------------------------------------------------------
|
|
876 |
// CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL
|
|
877 |
// ---------------------------------------------------------------------------
|
|
878 |
//
|
|
879 |
void CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL()
|
|
880 |
{
|
|
881 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL() start");
|
|
882 |
|
|
883 |
iMdsDb.iMdsSession->DeserializeItemsL( iResultBuffer, iItemArray );
|
|
884 |
|
|
885 |
iClient->HandleAddVideosToAlbumResp( iMpxCmd, iItemArray );
|
|
886 |
iResultBuffer.Close();
|
|
887 |
iItemArray.Close();
|
|
888 |
|
|
889 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL() exit");
|
|
890 |
}
|
|
891 |
|
|
892 |
// ---------------------------------------------------------------------------
|
|
893 |
// CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL
|
|
894 |
// ---------------------------------------------------------------------------
|
|
895 |
//
|
|
896 |
void CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL()
|
|
897 |
{
|
|
898 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() start");
|
|
899 |
|
|
900 |
iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, NULL, NULL, iResultArrayUint32 );
|
|
901 |
|
|
902 |
#ifdef _DEBUG
|
|
903 |
TItemId result;
|
|
904 |
TInt count = iResultArrayUint32->Count();
|
|
905 |
for ( TInt i = 0; i < count; i++ )
|
|
906 |
{
|
|
907 |
result = (*iResultArrayUint32)[i];
|
|
908 |
MPX_DEBUG3("relation remove result[%d] = %d", i, result);
|
|
909 |
}
|
|
910 |
#endif
|
|
911 |
|
|
912 |
iClient->HandleRemoveRelationsResp( *iIdArray, *iResultArrayUint32 );
|
|
913 |
|
|
914 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() exit");
|
|
915 |
}
|
|
916 |
|
|
917 |
// ---------------------------------------------------------------------------
|
|
918 |
// CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL
|
|
919 |
// ---------------------------------------------------------------------------
|
|
920 |
//
|
|
921 |
void CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL()
|
|
922 |
{
|
|
923 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL() start");
|
|
924 |
|
|
925 |
RArray<TUint32> resultArray;
|
|
926 |
resultArray.Reset();
|
|
927 |
CleanupClosePushL( resultArray );
|
|
928 |
|
|
929 |
iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, &resultArray, NULL, NULL );
|
|
930 |
|
|
931 |
#ifdef _DEBUG
|
|
932 |
TItemId result;
|
|
933 |
TInt count = resultArray.Count();
|
|
934 |
|
|
935 |
MPX_DEBUG2("CVcxMyVideosMdsAlbums:: remove albums result count = %d", count);
|
|
936 |
|
|
937 |
for ( TInt i = 0; i < count; i++ )
|
|
938 |
{
|
|
939 |
result = resultArray[i];
|
|
940 |
MPX_DEBUG3("CVcxMyVideosMdsAlbums:: remove albums result[%d] = %d", i, result);
|
|
941 |
}
|
|
942 |
#endif
|
|
943 |
|
|
944 |
iClient->HandleRemoveAlbumsResp( iMpxCmd, resultArray );
|
|
945 |
|
|
946 |
CleanupStack::PopAndDestroy( &resultArray );
|
|
947 |
|
|
948 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() exit");
|
|
949 |
}
|
|
950 |
|
|
951 |
// ----------------------------------------------------------------------------
|
|
952 |
// CVcxMyVideosMdsAlbums::HandleRelationItemNotification
|
|
953 |
// From MMdERelationItemObserver
|
|
954 |
// ----------------------------------------------------------------------------
|
|
955 |
//
|
|
956 |
void CVcxMyVideosMdsAlbums::HandleRelationItemNotification(CMdESession& /*aSession*/,
|
|
957 |
TObserverNotificationType aType,
|
|
958 |
const RArray<TMdERelation>& aRelationArray)
|
|
959 |
{
|
|
960 |
iObserver->HandleRelationEvent( aType, aRelationArray );
|
|
961 |
}
|
|
962 |
|
|
963 |
#if 0 //not used
|
|
964 |
// ----------------------------------------------------------------------------
|
|
965 |
// CVcxMyVideosMdsAlbums::HandleRelationNotification
|
|
966 |
// From MMdERelationObserver
|
|
967 |
// ----------------------------------------------------------------------------
|
|
968 |
//
|
|
969 |
void CVcxMyVideosMdsAlbums::HandleRelationNotification(CMdESession& /*aSession*/,
|
|
970 |
TObserverNotificationType aType,
|
|
971 |
const RArray<TItemId>& aRelationIdArray)
|
|
972 |
{
|
|
973 |
iObserver->HandleRelationIdEvent( aType, aRelationIdArray );
|
|
974 |
|
|
975 |
switch ( aType )
|
|
976 |
{
|
|
977 |
case ENotifyAdd:
|
|
978 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyAdd");
|
|
979 |
break;
|
|
980 |
case ENotifyModify:
|
|
981 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyModify");
|
|
982 |
break;
|
|
983 |
case ENotifyRemove:
|
|
984 |
MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyRemove");
|
|
985 |
break;
|
|
986 |
}
|
|
987 |
}
|
|
988 |
#endif
|
|
989 |
|
|
990 |
// END OF FILE
|