videocollection/hgmyvideos/src/vcxhgmyvideoscollectionclient.cpp
branchRCL_3
changeset 8 ce5ada96ab30
parent 6 7d91903f795f
child 10 112a725ff2c2
equal deleted inserted replaced
6:7d91903f795f 8:ce5ada96ab30
   103 // CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient()
   103 // CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient()
   104 // -----------------------------------------------------------------------------
   104 // -----------------------------------------------------------------------------
   105 //
   105 //
   106 CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient()
   106 CVcxHgMyVideosCollectionClient::~CVcxHgMyVideosCollectionClient()
   107     {
   107     {
   108     delete iLatestMpxMedia;
       
   109     delete iDownloadClient;
   108     delete iDownloadClient;
   110     if ( iCollectionUtility )
   109     if ( iCollectionUtility )
   111         {
   110         {
   112         iCollectionUtility->Close();
   111         iCollectionUtility->Close();
   113         }
   112         }
   378     path->AppendL( aMpxItemId );
   377     path->AppendL( aMpxItemId );
   379     path->SelectL( aMpxItemId );
   378     path->SelectL( aMpxItemId );
   380     
   379     
   381     iCollectionUtility->Collection().OpenL( *path );
   380     iCollectionUtility->Collection().OpenL( *path );
   382     CleanupStack::PopAndDestroy(path);
   381     CleanupStack::PopAndDestroy(path);
   383     }
       
   384 
       
   385 // -----------------------------------------------------------------------------
       
   386 // CVcxHgMyVideosCollectionClient::SetAttributeL()
       
   387 // -----------------------------------------------------------------------------
       
   388 //
       
   389 void CVcxHgMyVideosCollectionClient::SetAttributeL( const CMPXMedia& aMedia,
       
   390                                                     const TMPXAttribute& aAttribute,
       
   391                                                     const TUint32 aValue )
       
   392     {
       
   393     if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() )
       
   394         {
       
   395         CMPXMedia* updatedMedia = CMPXMedia::NewL();
       
   396         CleanupStack::PushL( updatedMedia );
       
   397         CMPXCommand* cmd = CMPXCommand::NewL();
       
   398         CleanupStack::PushL( cmd );
       
   399 
       
   400         updatedMedia->SetTObjectValueL<TMPXItemId>( 
       
   401             KMPXMediaGeneralId,
       
   402             aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   403         updatedMedia->SetTObjectValueL<TUint32>( aAttribute, aValue );
       
   404 
       
   405         cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
       
   406         cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
       
   407         cmd->SetCObjectValueL( KMPXCommandColSetMedia, updatedMedia );
       
   408         cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId,
       
   409                                KVcxUidMyVideosMpxCollection );
       
   410 
       
   411         iCollectionUtility->Collection().CommandL( *cmd );
       
   412         
       
   413         CleanupStack::PopAndDestroy( cmd );
       
   414         CleanupStack::PopAndDestroy( updatedMedia );
       
   415         }
       
   416     }
       
   417 
       
   418 // -----------------------------------------------------------------------------
       
   419 // CVcxHgMyVideosCollectionClient::SetAttributeL()
       
   420 // -----------------------------------------------------------------------------
       
   421 //
       
   422 void CVcxHgMyVideosCollectionClient::SetAttributeL( const CMPXMedia& aMedia,
       
   423                                                     const TMPXAttribute& aAttribute,
       
   424                                                     const TReal32 aValue )
       
   425     {
       
   426     if ( ! HasPendingCommand() && ! iDownloadClient->HasPendingCommand() )
       
   427         {
       
   428         CMPXMedia* updatedMedia = CMPXMedia::NewL();
       
   429         CleanupStack::PushL( updatedMedia );
       
   430         CMPXCommand* cmd = CMPXCommand::NewL();
       
   431         CleanupStack::PushL( cmd );
       
   432 
       
   433         updatedMedia->SetTObjectValueL<TMPXItemId>( 
       
   434             KMPXMediaGeneralId,
       
   435             aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
       
   436         updatedMedia->SetTObjectValueL<TReal32>( aAttribute, aValue );
       
   437 
       
   438         cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
       
   439         cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
       
   440         cmd->SetCObjectValueL( KMPXCommandColSetMedia, updatedMedia );
       
   441         cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId,
       
   442                                KVcxUidMyVideosMpxCollection );
       
   443 
       
   444         iCollectionUtility->Collection().CommandL( *cmd );
       
   445 
       
   446         CleanupStack::PopAndDestroy( cmd );
       
   447         CleanupStack::PopAndDestroy( updatedMedia );
       
   448         }
       
   449     }
       
   450 
       
   451 // -----------------------------------------------------------------------------
       
   452 // CVcxHgMyVideosCollectionClient::GetLatestFetchedMpxMediaL()
       
   453 // -----------------------------------------------------------------------------
       
   454 //
       
   455 CMPXMedia* CVcxHgMyVideosCollectionClient::GetLatestFetchedMpxMediaL()
       
   456     {
       
   457     return iLatestMpxMedia;
       
   458     }
   382     }
   459 
   383 
   460 // -----------------------------------------------------------------------------
   384 // -----------------------------------------------------------------------------
   461 // CVcxHgMyVideosCollectionClient::FetchMpxMediaByMpxIdL()
   385 // CVcxHgMyVideosCollectionClient::FetchMpxMediaByMpxIdL()
   462 // -----------------------------------------------------------------------------
   386 // -----------------------------------------------------------------------------
   603                         case KVcxMessageMyVideosGetMediasByMpxIdResp:
   527                         case KVcxMessageMyVideosGetMediasByMpxIdResp:
   604                             HandleGetMediasByMpxIdRespL( aMessage, aError );
   528                             HandleGetMediasByMpxIdRespL( aMessage, aError );
   605                             break;
   529                             break;
   606                         case KVcxMessageMyVideosItemsAppended:
   530                         case KVcxMessageMyVideosItemsAppended:
   607                             HandleMyVideosItemsAppendedL( aMessage, aError );
   531                             HandleMyVideosItemsAppendedL( aMessage, aError );
       
   532                             break;
       
   533                         case KVcxMessageMyVideosListComplete:
       
   534                             HandleMyVideosListCompleteL( aMessage, aError );
   608                             break;
   535                             break;
   609                         case KVcxMessageMyVideosDeleteStarted:
   536                         case KVcxMessageMyVideosDeleteStarted:
   610                         case KVcxMessageMyVideosDeleteResp:
   537                         case KVcxMessageMyVideosDeleteResp:
   611                             HandleMyVideosDeleteMessageL( aMessage, aError );
   538                             HandleMyVideosDeleteMessageL( aMessage, aError );
   612                             break;
   539                             break;
   715                 CMPXMediaArray* categoryArray = CMPXMediaArray::NewL( *pointerArray );
   642                 CMPXMediaArray* categoryArray = CMPXMediaArray::NewL( *pointerArray );
   716                 CleanupStack::PushL( categoryArray );
   643                 CleanupStack::PushL( categoryArray );
   717 
   644 
   718                 if ( iCategoryModelObserver )
   645                 if ( iCategoryModelObserver )
   719                     {
   646                     {
   720                     iCategoryModelObserver->NewCategoryListL( categoryArray );
   647                     TBool isPartial( EFalse );
       
   648                     if ( aEntries.IsSupported( KVcxMediaMyVideosVideoListIsPartial ) )
       
   649                         {
       
   650                         isPartial = aEntries.ValueTObjectL<TBool>( KVcxMediaMyVideosVideoListIsPartial );
       
   651                         }
       
   652                     iCategoryModelObserver->NewCategoryListL( categoryArray, isPartial );
   721                     CleanupStack::Pop( categoryArray );
   653                     CleanupStack::Pop( categoryArray );
   722                     }
   654                     }
   723                 else
   655                 else
   724                     {
   656                     {
   725                     CleanupStack::PopAndDestroy( categoryArray );
   657                     CleanupStack::PopAndDestroy( categoryArray );
   876     // to re-open the list.
   808     // to re-open the list.
   877     if ( eventlevel == KVcxHgEventLevelRoot )
   809     if ( eventlevel == KVcxHgEventLevelRoot )
   878         {
   810         {
   879         IPTVLOGSTRING_LOW_LEVEL( 
   811         IPTVLOGSTRING_LOW_LEVEL( 
   880             "MPX My Videos UI # HandleMyVideosItemsChangedL() - MMC plugged/unplugged." );
   812             "MPX My Videos UI # HandleMyVideosItemsChangedL() - MMC plugged/unplugged." );
   881 
       
   882         // Show "Refreshing view" information note.
       
   883         HBufC* text = StringLoader::LoadLC( R_VCXHGMYVIDEOS_REFRESHING );
       
   884         CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote();
       
   885         note->ExecuteLD( *text );
       
   886         CleanupStack::PopAndDestroy( text );
       
   887         
   813         
   888         if ( levels == KVcxMpxLevelCategories )
   814         if ( levels == KVcxMpxLevelCategories )
   889             {
   815             {
   890             iCollectionUtility->Collection().OpenL();
   816             iCollectionUtility->Collection().OpenL();
   891             }
   817             }
   892         }
   818         }
   893     else
   819     else
   894         {
   820         {
   895         if ( levels == KVcxMpxLevelCategories )
   821         if ( levels == KVcxMpxLevelCategories )
   896             {
   822             {
   897             if ( iCategoryModelObserver && eventlevel == KVcxHgEventLevelCategory )
   823             if ( iCategoryModelObserver )
   898                 {
   824                 {
   899                 iCategoryModelObserver->CategoryModifiedL( eventType, eventData );
   825                 iCategoryModelObserver->CategoryModifiedL( eventType, eventData );
   900                 }        
   826                 }        
   901             }
   827             }
   902         else if ( levels == KVcxMpxLevelVideos )
   828         else if ( levels == KVcxMpxLevelVideos )
  1127             	    {
  1053             	    {
  1128             	    CMPXMedia* media = CMPXMedia::NewL( *( ( *array )[0] ) );
  1054             	    CMPXMedia* media = CMPXMedia::NewL( *( ( *array )[0] ) );
  1129                     // Ownership is transferred.
  1055                     // Ownership is transferred.
  1130             	    iVideoModelObserver->VideoFetchingCompletedL( media );  
  1056             	    iVideoModelObserver->VideoFetchingCompletedL( media );  
  1131             	    }
  1057             	    }
  1132             
  1058                 
  1133                 delete iLatestMpxMedia;
  1059                 else if ( iCategoryModelObserver )
  1134                 iLatestMpxMedia = NULL;
  1060                     {
  1135                 iLatestMpxMedia = CMPXMedia::NewL( *( ( *array )[0] ) );
  1061                     CMPXMedia* media = CMPXMedia::NewL( *( ( *array )[0] ) );
       
  1062                     // Ownership is transferred.
       
  1063                     iCategoryModelObserver->VideoFetchingCompletedL( media );  
       
  1064                     }
  1136                 }
  1065                 }
  1137 			}
  1066 			}
  1138         CleanupStack::PopAndDestroy( entries );
  1067         CleanupStack::PopAndDestroy( entries );
       
  1068         }
       
  1069     }
       
  1070 
       
  1071 // -----------------------------------------------------------------------------
       
  1072 // 
       
  1073 // -----------------------------------------------------------------------------
       
  1074 //
       
  1075 void CVcxHgMyVideosCollectionClient::HandleMyVideosListCompleteL( CMPXMessage* /*aMessage*/,
       
  1076                                                                   TInt aError )
       
  1077     {
       
  1078     IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # HandleMyVideosListCompleteL()" );
       
  1079     if ( aError == KErrNone )
       
  1080         {
       
  1081         if ( iCategoryModelObserver )
       
  1082             {
       
  1083             iCategoryModelObserver->CategoryListFetchingCompletedL();
       
  1084             }
  1139         }
  1085         }
  1140     }
  1086     }
  1141 
  1087 
  1142 // -----------------------------------------------------------------------------
  1088 // -----------------------------------------------------------------------------
  1143 // CVcxHgMyVideosCollectionClient::HandleGetVideoDetailsRespL()
  1089 // CVcxHgMyVideosCollectionClient::HandleGetVideoDetailsRespL()