videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp
changeset 30 4f111d64a341
parent 2 dec420019252
child 34 bbb98528c666
equal deleted inserted replaced
2:dec420019252 30:4f111d64a341
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:    MPX My Videos collection plugin's MDS database class*
    14 * Description:   MPX My Videos collection plugin's MDS database class*
    15 */
    15 */
    16 
       
    17 
    16 
    18 
    17 
    19 
    18 
    20 //#include <harvesterclient.h>
    19 //#include <harvesterclient.h>
    21 #include <mpxlog.h>
    20 #include <mpxlog.h>
    29 #include <mpxmediageneralextdefs.h>
    28 #include <mpxmediageneralextdefs.h>
    30 #include <mpxmediaarray.h>
    29 #include <mpxmediaarray.h>
    31 #include <mpxmediavideodefs.h>
    30 #include <mpxmediavideodefs.h>
    32 #include "vcxmyvideosmdsdb.h"
    31 #include "vcxmyvideosmdsdb.h"
    33 #include "vcxmyvideoscollectionutil.h"
    32 #include "vcxmyvideoscollectionutil.h"
       
    33 #include "vcxmyvideosmdsalbums.h"
       
    34 #include "vcxmyvideoscollectionutil.h"
       
    35 #include "vcxmyvideosmdscmdqueue.h"
    34 
    36 
    35 _LIT( KVcxVideoObjectName, "Video" );
    37 _LIT( KVcxVideoObjectName, "Video" );
    36                                                               //1 (ID)
    38                                                               //1 (ID)
    37 _LIT( KVcxTitlePropertyName, "Title" );                       //2
    39 _LIT( KVcxTitlePropertyName, "Title" );                       //2
    38 _LIT( KVcxDescriptionPropertyName, "Description" );           //3
    40 _LIT( KVcxDescriptionPropertyName, "Description" );           //3
    76 //
    78 //
    77 void CVcxMyVideosMdsDb::ConstructL()
    79 void CVcxMyVideosMdsDb::ConstructL()
    78     {
    80     {
    79     MPX_FUNC( "CVcxMyVideosMdsDb::ConstructL" );
    81     MPX_FUNC( "CVcxMyVideosMdsDb::ConstructL" );
    80 
    82 
       
    83     iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this );
       
    84 
    81     iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
    85     iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
    82     
    86     
    83     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL CMdESession::NewL" );
    87     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL CMdESession::NewL" );
    84 
    88 
    85     //  Create session
    89     //  Create session
    86     iMDSError = KErrNone;
    90     iMdsError = KErrNone;
    87 
    91 
    88     iMDSSession = CMdESession::NewL( *this );
    92     iMdsSession = CMdESession::NewL( *this );
    89     if (!iMDSSession)
    93     if (!iMdsSession)
    90         {
    94         {
    91         //  Failed to create session, leave
    95         //  Failed to create session, leave
    92         User::Leave( iMDSError );
    96         User::Leave( iMdsError );
    93         }
    97         }
    94 
    98 
    95     //  Wait until session opened
    99     //  Wait until session opened
    96     iActiveSchedulerWait->Start();
   100     iActiveSchedulerWait->Start();
    97 
   101 
    98     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" );
   102     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" );
    99 
   103 
   100     if ( iMDSError != KErrNone )
   104     if ( iMdsError != KErrNone )
   101         {
   105         {
   102         MPX_DEBUG2("Failed to create session to MDS: %d", iMDSError);
   106         MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError);
   103         User::LeaveIfError( iMDSError );
   107         User::LeaveIfError( iMdsError );
   104         }
   108         }
   105 
   109 
   106     //  Get the schema definitions
   110     //  Get the schema definitions
   107     iMDSError = KErrNone;
   111     iMdsError = KErrNone;
   108     GetSchemaDefinitionsL();
   112     GetSchemaDefinitionsL();
   109 
   113 
   110     //  Is schema ok
   114     //  Is schema ok
   111     if ( iMDSError != KErrNone )
   115     if ( iMdsError != KErrNone )
   112         {
   116         {
   113         //  Schema not loaded, abort
   117         //  Schema not loaded, abort
   114         User::Leave( iMDSError );
   118         User::Leave( iMdsError );
   115         }
   119         }
   116 
   120 
   117     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL Adding observers" );
   121     MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL Adding observers" );
   118 
   122 
   119     // We order all object notifications. If we set video condition, then we wont
   123     // We order all object notifications. If we set video condition, then we wont
   120     // receive remove notifications at all (mds feature). Extra notifications
   124     // receive remove notifications at all (mds feature). Extra notifications
   121     // do not bother us much since we try to fetch the item from the db
   125     // do not bother us much since we try to fetch the item from the db
   122     // after the add notification anyways, and then we use video condition.
   126     // after the add notification anyways, and then we use video condition.
   123     // Eventually extra events are ignored.    
   127     // Eventually extra events are ignored.    
   124     iMDSSession->AddObjectObserverL( *this, NULL );
   128     iMdsSession->AddObjectObserverL( *this, NULL );
   125     
   129     
   126     iMDSSession->AddObjectPresentObserverL( *this );    
   130     iMdsSession->AddObjectPresentObserverL( *this );
       
   131     
       
   132     iAlbums = CVcxMyVideosMdsAlbums::NewL( *this );
       
   133     
       
   134     TCallBack callBack( AsyncHandleQueryCompleted, this );    
       
   135     iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack,
       
   136             CActive::EPriorityStandard );
   127     }
   137     }
   128 
   138 
   129 // ---------------------------------------------------------------------------
   139 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
   131 //
   141 //
   180 //
   190 //
   181 CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()
   191 CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()
   182     {
   192     {
   183     MPX_FUNC( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()" );
   193     MPX_FUNC( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()" );
   184 
   194 
   185     if ( iMDSSession )
       
   186         {
       
   187         TRAP_IGNORE( iMDSSession->RemoveObjectObserverL( *this ) );        
       
   188         }
       
   189 
       
   190     Cancel();
   195     Cancel();
   191     
   196 
       
   197     delete iCmdQueue;    
       
   198 
       
   199     if ( iMdsSession )
       
   200         {
       
   201         TRAP_IGNORE( iMdsSession->RemoveObjectObserverL( *this ) );        
       
   202         }
       
   203 
   192     delete iVideoQuery;
   204     delete iVideoQuery;
   193     delete iMDSSession;
   205     delete iAlbums;
       
   206     delete iMdsSession;
   194     delete iActiveSchedulerWait;
   207     delete iActiveSchedulerWait;
       
   208     delete iAsyncHandleQueryCompleteCaller;
   195     }
   209     }
   196 
   210 
   197 // ---------------------------------------------------------------------------
   211 // ---------------------------------------------------------------------------
   198 // CVcxMyVideosMdsDb::Cancel
   212 // CVcxMyVideosMdsDb::Cancel
   199 // ---------------------------------------------------------------------------
   213 // ---------------------------------------------------------------------------
   200 //
   214 //
   201 void CVcxMyVideosMdsDb::Cancel()
   215 void CVcxMyVideosMdsDb::Cancel( TRequestType aType )
   202     {
   216     {
   203     MPX_FUNC("CVcxMyVideosMdsDb::Cancel()");
   217     MPX_FUNC("CVcxMyVideosMdsDb::Cancel()");
   204     
   218     
   205     if ( iVideoQuery )
   219     iCmdQueue->Cancel( aType );
   206         {
   220     
   207         iVideoQuery->Cancel();
   221     if ( aType == EAll || aType == EGetVideoList )
   208         }
   222         {
   209     iVideoListFetchingIsOngoing = EFalse;
   223         if ( iVideoQuery )
       
   224             {
       
   225             iVideoQuery->Cancel();
       
   226             }
       
   227         iVideoListFetchingIsOngoing = EFalse;
       
   228         }
       
   229 
       
   230     iAlbums->Cancel( aType );    
   210     }
   231     }
   211     
   232     
   212 // ---------------------------------------------------------------------------
   233 // ---------------------------------------------------------------------------
   213 // CVcxMyVideosMdsDb::AddVideoL
   234 // CVcxMyVideosMdsDb::AddVideoL
   214 // ---------------------------------------------------------------------------
   235 // ---------------------------------------------------------------------------
   217         CMPXMedia& aVideo, 
   238         CMPXMedia& aVideo, 
   218         TUint32& aMdsId )
   239         TUint32& aMdsId )
   219     {
   240     {
   220     MPX_FUNC( "CVcxMyVideosMdsDb::AddVideoL" );
   241     MPX_FUNC( "CVcxMyVideosMdsDb::AddVideoL" );
   221 
   242 
   222     if ( !iMDSSession )
   243     if ( !iMdsSession )
   223         {
   244         {
   224         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
   245         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
   225         User::Leave( iMDSError );
   246         User::Leave( iMdsError );
   226         }
   247         }
   227          
   248          
   228     CMdEObject* object = iMDSSession->NewObjectLC(
   249     CMdEObject* object = iMdsSession->NewObjectLC(
   229             *iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1->
   250             *iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1->
   230 
   251 
   231     // check if the file exists and use the creation time from the file
   252     // check if the file exists and use the creation time from the file
   232     
   253     
   233     TTime time;
   254     TTime time;
   258                 aVideo.ValueText( KMPXMediaGeneralMimeType ) );
   279                 aVideo.ValueText( KMPXMediaGeneralMimeType ) );
   259             }
   280             }
   260         }
   281         }
   261 
   282 
   262     Media2ObjectL( aVideo, *object );
   283     Media2ObjectL( aVideo, *object );
   263     TRAPD( err, aMdsId = iMDSSession->AddObjectL( *object ) );
   284     TRAPD( err, aMdsId = iMdsSession->AddObjectL( *object ) );
   264 
   285 
   265     if ( err != KErrNone )
   286     if ( err != KErrNone )
   266         {
   287         {
   267         MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->AddObjectL leaved with error: %d", err );
   288         MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->AddObjectL leaved with error: %d", err );
   268         User::Leave( err );
   289         User::Leave( err );
   269         }
   290         }
   270         
   291         
   271     if ( aMdsId == KNoId )
   292     if ( aMdsId == KNoId )
   272         {
   293         {
   288 //
   309 //
   289 TInt CVcxMyVideosMdsDb::RemoveVideo( TUint32 aMdsId )
   310 TInt CVcxMyVideosMdsDb::RemoveVideo( TUint32 aMdsId )
   290     {
   311     {
   291     MPX_FUNC( "CVcxMyVideosMdsDb::RemoveVideoL" );
   312     MPX_FUNC( "CVcxMyVideosMdsDb::RemoveVideoL" );
   292 
   313 
   293     if ( !iMDSSession )
   314     if ( !iMdsSession )
   294         {
   315         {
   295         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMDSError);
   316         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMdsError);
   296         return iMDSError;
   317         return iMdsError;
   297         }
   318         }
   298 
   319 
   299     TInt retValue( KErrNone );
   320     TInt retValue( KErrNone );
   300     TItemId id( 0 ); //init to avoid warning
   321     TItemId id( 0 ); //init to avoid warning
   301 
   322 
   302     MPX_DEBUG2( "CVcxMyVideosMdsDb:: removing object %d", aMdsId );
   323     MPX_DEBUG2( "CVcxMyVideosMdsDb:: removing object %d", aMdsId );
   303     
   324     
   304     TRAPD( err,  id = iMDSSession->RemoveObjectL( aMdsId ) );
   325     TRAPD( err,  id = iMdsSession->RemoveObjectL( aMdsId ) );
   305 
   326 
   306     if ( err == KErrNone )
   327     if ( err == KErrNone )
   307         {
   328         {
   308         if ( id == KNoId )
   329         if ( id == KNoId )
   309             {
   330             {
   315             MPX_DEBUG1( "CVcxMyVideosMdsDb:: remove successful" );
   336             MPX_DEBUG1( "CVcxMyVideosMdsDb:: remove successful" );
   316             }
   337             }
   317         }
   338         }
   318     else
   339     else
   319         {
   340         {
   320         MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->RemoveObjectL left: %d", err );
   341         MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->RemoveObjectL left: %d", err );
   321         retValue = err;        
   342         retValue = err;        
   322         }
   343         }
   323         
   344         
   324     return retValue;
   345     return retValue;
   325     }
   346     }
   330 //
   351 //
   331 void CVcxMyVideosMdsDb::UpdateVideoL( CMPXMedia& aVideo )
   352 void CVcxMyVideosMdsDb::UpdateVideoL( CMPXMedia& aVideo )
   332     {
   353     {
   333     MPX_FUNC( "CVcxMyVideosMdsDb::UpdateVideoL" );
   354     MPX_FUNC( "CVcxMyVideosMdsDb::UpdateVideoL" );
   334 
   355 
   335     if ( !iMDSSession )
   356     if ( !iMdsSession )
   336         {
   357         {
   337         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
   358         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
   338         User::Leave( iMDSError );
   359         User::Leave( iMdsError );
   339         }
   360         }
   340 
   361 
   341     TMPXItemId mpxId = aVideo.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
   362     TMPXItemId mpxId = aVideo.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
   342 
   363 
   343     MPX_DEBUG2("CVcxMyVideosMdsDb::UpdateVideoL updating object %d ", mpxId.iId1);
   364     MPX_DEBUG2("CVcxMyVideosMdsDb::UpdateVideoL updating object %d ", mpxId.iId1);
   344     
   365     
   345     CMdEObject* object =
   366     CMdEObject* object =
   346             iMDSSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
   367             iMdsSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
   347     if ( object == NULL )
   368     if ( object == NULL )
   348         {
   369         {
   349         // No object with this ID was found!
   370         // No object with this ID was found!
   350         MPX_DEBUG1("CVcxMyVideosMdsDb::UpdateVideoL no object found");
   371         MPX_DEBUG1("CVcxMyVideosMdsDb::UpdateVideoL no object found");
   351         User::Leave( KErrNotFound );
   372         User::Leave( KErrNotFound );
   358             {
   379             {
   359             CleanupStack::PushL( object ); // 1->
   380             CleanupStack::PushL( object ); // 1->
   360             
   381             
   361             Media2ObjectL( aVideo, *object );
   382             Media2ObjectL( aVideo, *object );
   362             
   383             
   363             iMDSSession->CommitObjectL(*object);
   384             iMdsSession->CommitObjectL(*object);
   364 
   385 
   365             CleanupStack::PopAndDestroy(object);
   386             CleanupStack::PopAndDestroy(object);
   366             }
   387             }
   367         else
   388         else
   368             {
   389             {
   380 //
   401 //
   381 void CVcxMyVideosMdsDb::CreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
   402 void CVcxMyVideosMdsDb::CreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
   382         TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
   403         TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
   383     {
   404     {
   384     MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" );
   405     MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" );
   385 
   406     
   386     if ( !iMDSSession )
   407     CVcxMyVideosMdsCmdGetVideoList* cmd = CVcxMyVideosMdsCmdGetVideoList::NewL();
   387         {
   408     cmd->iCmdType      = CVcxMyVideosMdsDb::EGetVideoList;
   388         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
   409     cmd->iSortingOrder = aSortingOrder;
   389         User::Leave( iMDSError );
   410     cmd->iAscending    = aAscending;
       
   411     cmd->iFullDetails  = aFullDetails;
       
   412     cmd->iVideoList    = &aVideoList;
       
   413 
       
   414     iCmdQueue->ExecuteCmdL( cmd ); //ownership moves
       
   415     }
       
   416     
       
   417 // ---------------------------------------------------------------------------
       
   418 // CVcxMyVideosMdsDb::DoCreateVideoListL
       
   419 // ---------------------------------------------------------------------------
       
   420 //
       
   421 void CVcxMyVideosMdsDb::DoCreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
       
   422         TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
       
   423     {
       
   424     MPX_FUNC( "CVcxMyVideosMdsDb::DoCreateVideoListL" );
       
   425 
       
   426     if ( !iMdsSession )
       
   427         {
       
   428         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
       
   429         User::Leave( iMdsError );
   390         }
   430         }
   391         
   431         
   392     if ( iVideoListFetchingIsOngoing )
   432     if ( iVideoListFetchingIsOngoing )
   393         {
   433         {
   394         MPX_DEBUG1("CVcxMyVideosMdsDb:: video list fetching already going on, returning current list");
   434         MPX_DEBUG1("CVcxMyVideosMdsDb:: video list fetching already going on, returning current list");
   403     CMPXMediaArray* mediaArray = aVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
   443     CMPXMediaArray* mediaArray = aVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
   404     
   444     
   405     delete iVideoQuery;
   445     delete iVideoQuery;
   406     iVideoQuery = NULL;
   446     iVideoQuery = NULL;
   407     
   447     
   408     iVideoQuery = iMDSSession->NewObjectQueryL(
   448     iVideoQuery = iMdsSession->NewObjectQueryL(
   409             *iNamespaceDef,
   449             *iNamespaceDef,
   410             *iVideoObjectDef,
   450             *iVideoObjectDef,
   411             this);
   451             this);
   412 
   452 
   413     iVideoQuery->SetResultMode( EQueryResultModeItem );
   453     iVideoQuery->SetResultMode( EQueryResultModeItem );
   548 // ---------------------------------------------------------------------------
   588 // ---------------------------------------------------------------------------
   549 // From class MMdEQueryObserver.
   589 // From class MMdEQueryObserver.
   550 // ---------------------------------------------------------------------------
   590 // ---------------------------------------------------------------------------
   551 //
   591 //
   552 void CVcxMyVideosMdsDb::HandleQueryCompleted(
   592 void CVcxMyVideosMdsDb::HandleQueryCompleted(
   553 #if _DEBUG
       
   554         CMdEQuery& aQuery,
       
   555 #else
       
   556         CMdEQuery& /*aQuery*/,
   593         CMdEQuery& /*aQuery*/,
       
   594         TInt /*aError*/)
       
   595     {
       
   596     iAsyncHandleQueryCompleteCaller->CallBack();
       
   597     }
       
   598 
       
   599 // ---------------------------------------------------------------------------
       
   600 // CVcxMyVideosMdsDb::AsyncHandleQueryCompleted
       
   601 // ---------------------------------------------------------------------------
       
   602 //
       
   603 TInt CVcxMyVideosMdsDb::AsyncHandleQueryCompleted( TAny* aThis )
       
   604     {
       
   605     MPX_FUNC( "CVcxMyVideosMdsDb::AsyncHandleQueryCompleted" );
       
   606 
       
   607     CVcxMyVideosMdsDb* thisObj = static_cast<CVcxMyVideosMdsDb*>( aThis );
       
   608     
       
   609     if ( !thisObj->iVideoList )
       
   610         {
       
   611         MPX_DEBUG1("CVcxMyVideosMdsDb:: iVideoList is NULL, should never happen");
       
   612         return KErrNone;
       
   613         }
       
   614 
       
   615 #ifdef _DEBUG
       
   616     CMPXMediaArray* array = thisObj->iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
   557 #endif
   617 #endif
   558         TInt /*aError*/)
   618 
   559     {
   619     MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", thisObj->iVideoQuery->Count());
   560     MPX_FUNC( "CVcxMyVideosMdsDb::HandleQueryCompleted" );
       
   561 
       
   562     if ( !iVideoList )
       
   563         {
       
   564         MPX_DEBUG1("CVcxMyVideosMdsDb:: iVideoList is NULL, should never happen");
       
   565         return;
       
   566         }
       
   567 
       
   568 #ifdef _DEBUG
       
   569     CMPXMediaArray* array = iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
       
   570 #endif
       
   571 
       
   572     MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", aQuery.Count());
       
   573     MPX_DEBUG2("CVcxMyVideosMdsDb:: iVideoList contains %d items", array->Count());
   620     MPX_DEBUG2("CVcxMyVideosMdsDb:: iVideoList contains %d items", array->Count());
   574     
   621     
   575     if (iActiveSchedulerWait->IsStarted())
   622     if ( thisObj->iActiveSchedulerWait->IsStarted() )
   576         {
   623         {
   577         iActiveSchedulerWait->AsyncStop();
   624         thisObj->iActiveSchedulerWait->AsyncStop();
   578         }
   625         }
   579     
   626     
   580     iVideoListFetchingIsOngoing = EFalse;
   627     thisObj->iVideoListFetchingIsOngoing = EFalse;
   581     iMdsDbObserver->HandleCreateVideoListResp( iVideoList, KErrNotFound /* KErrNotFound = no new items */,
   628     thisObj->iMdsDbObserver->HandleCreateVideoListResp( thisObj->iVideoList, KErrNotFound /* KErrNotFound = no new items */,
   582             ETrue /* complete */);
   629             ETrue /* complete */);
   583     
   630     
   584     iVideoList = NULL; // not owned by us -> just clear
   631     thisObj->iVideoList = NULL; // not owned by us -> just clear
       
   632     
       
   633     thisObj->iCmdQueue->CmdFinished();
       
   634     return KErrNone;
   585     }
   635     }
   586 
   636 
   587 // ---------------------------------------------------------------------------
   637 // ---------------------------------------------------------------------------
   588 // CVcxMyVideosMdsDb::CreateVideoL
   638 // CVcxMyVideosMdsDb::CreateVideoL
   589 // ---------------------------------------------------------------------------
   639 // ---------------------------------------------------------------------------
   626 
   676 
   627     if ( aError != KErrNone )
   677     if ( aError != KErrNone )
   628         {
   678         {
   629         MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionOpened: %d", aError );
   679         MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionOpened: %d", aError );
   630 
   680 
   631         iMDSError = aError;
   681         iMdsError = aError;
   632         delete iMDSSession;
   682         delete iMdsSession;
   633         iMDSSession = NULL;
   683         iMdsSession = NULL;
   634         }
   684         }
   635     }
   685     }
   636 
   686 
   637 // ---------------------------------------------------------------------------
   687 // ---------------------------------------------------------------------------
   638 // From class MMdESessionObserver.
   688 // From class MMdESessionObserver.
   660                 ETrue /* complete */);
   710                 ETrue /* complete */);
   661         }
   711         }
   662         
   712         
   663     MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionError: %d", aError );
   713     MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionError: %d", aError );
   664 
   714 
   665     iMDSError = aError;
   715     iMdsError = aError;
   666     delete iMDSSession;
   716     delete iMdsSession;
   667     iMDSSession = NULL;
   717     iMdsSession = NULL;
   668     }
   718     }
   669 
   719 
   670 // ---------------------------------------------------------------------------
   720 // ---------------------------------------------------------------------------
   671 // CVcxMyVideosMdsDb::HandleObjectNotification
   721 // CVcxMyVideosMdsDb::HandleObjectNotification
   672 // ---------------------------------------------------------------------------
   722 // ---------------------------------------------------------------------------
   674 void CVcxMyVideosMdsDb::HandleObjectNotification(
   724 void CVcxMyVideosMdsDb::HandleObjectNotification(
   675         CMdESession& /*aSession*/,
   725         CMdESession& /*aSession*/,
   676         TObserverNotificationType aType,
   726         TObserverNotificationType aType,
   677         const RArray<TItemId>& aObjectIdArray)
   727         const RArray<TItemId>& aObjectIdArray)
   678     {
   728     {
   679     TRAP( iMDSError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
   729     TRAP( iMdsError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
   680     }
   730     }
   681     
   731     
   682 // ---------------------------------------------------------------------------
   732 // ---------------------------------------------------------------------------
   683 // CVcxMyVideosMdsDb::ObjectL
   733 // CVcxMyVideosMdsDb::ObjectL
   684 // ---------------------------------------------------------------------------
   734 // ---------------------------------------------------------------------------
   685 //
   735 //
   686 CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId )
   736 CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId )
   687     {
   737     {
   688     if ( !iMDSSession )
   738     if ( !iMdsSession )
   689         {
   739         {
   690         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
   740         MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
   691         User::Leave( iMDSError );
   741         User::Leave( iMdsError );
   692         }
   742         }
   693 
   743 
   694     //  If the id is not valid, just return NULL, because
   744     //  If the id is not valid, just return NULL, because
   695     //  iMDSSession->GetObjectL leaves in that case
   745     //  iMdsSession->GetObjectL leaves in that case
   696     if ( aId == KNoId )
   746     if ( aId == KNoId )
   697         {
   747         {
   698         return NULL;
   748         return NULL;
   699         }
   749         }
   700 
   750 
   701     CMdEObject* object = iMDSSession->GetObjectL( aId, *iVideoObjectDef );
   751     CMdEObject* object = iMdsSession->GetObjectL( aId, *iVideoObjectDef );
   702 
   752 
   703     if ( object )
   753     if ( object )
   704         {
   754         {
   705         MPX_DEBUG2( "CVcxMyVideosMdsDb::ObjectL found, id: %d", aId );
   755         MPX_DEBUG2( "CVcxMyVideosMdsDb::ObjectL found, id: %d", aId );
   706         }
   756         }
  1383 void CVcxMyVideosMdsDb::GetSchemaDefinitionsL()
  1433 void CVcxMyVideosMdsDb::GetSchemaDefinitionsL()
  1384     {
  1434     {
  1385     MPX_FUNC( "CVcxMyVideosMdsDb::GetSchemaDefinitionsL" );
  1435     MPX_FUNC( "CVcxMyVideosMdsDb::GetSchemaDefinitionsL" );
  1386 
  1436 
  1387     //  Namespace
  1437     //  Namespace
  1388     iNamespaceDef = &(iMDSSession->GetDefaultNamespaceDefL());
  1438     iNamespaceDef = &(iMdsSession->GetDefaultNamespaceDefL());
  1389     
  1439     
  1390     //  Default object definitions
  1440     //  Default object definitions
  1391     iVideoObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxVideoObjectName ));
  1441     iVideoObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxVideoObjectName ));
  1392 
  1442 
  1393     //  Base object property definitions
  1443     //  Base object property definitions
  1418     iDrmPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1468     iDrmPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1419             KVcxDrmPropertyName )); //part of flags (7)
  1469             KVcxDrmPropertyName )); //part of flags (7)
  1420     iRatingPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1470     iRatingPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1421             KVcxRatingPropertyName )); //19
  1471             KVcxRatingPropertyName )); //19
  1422     iBitratePropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1472     iBitratePropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1423             KVcxBitratePropertyName )); //20
  1473                 KVcxBitratePropertyName )); //20
  1424     iAudioFourCcPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1474     iAudioFourCcPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1425             KVcxAudioFourCcPropertyName )); //21
  1475                 KVcxAudioFourCcPropertyName )); //21
  1426     iWidthPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1476     iWidthPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1427             KVcxWidthPropertyName )); //22
  1477             KVcxWidthPropertyName )); //22
  1428     iHeightPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1478     iHeightPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1429             KVcxHeightPropertyName )); //23
  1479             KVcxHeightPropertyName )); //23
  1430     iArtistPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
  1480     iArtistPropertyDef = &(iVideoObjectDef->GetPropertyDefL(