videocollection/hgmyvideos/src/vcxhgmyvideosvideolistimpl.cpp
branchRCL_3
changeset 8 ce5ada96ab30
parent 6 7d91903f795f
child 9 5294c000a26d
equal deleted inserted replaced
6:7d91903f795f 8:ce5ada96ab30
    54 #include "vcxhgmyvideoscollectionclient.h"
    54 #include "vcxhgmyvideoscollectionclient.h"
    55 #include "vcxhgmyvideos.hrh"
    55 #include "vcxhgmyvideos.hrh"
    56 #include "vcxhgmyvideosvideocopier.h"
    56 #include "vcxhgmyvideosvideocopier.h"
    57 #include "vcxhgmyvideospanics.h"
    57 #include "vcxhgmyvideospanics.h"
    58 #include "vcxhgmyvideosupnpinterface.h"
    58 #include "vcxhgmyvideosupnpinterface.h"
    59 #include "vcxhgtelephonyclient.h"
       
    60 #ifdef RD_VIDEO_AS_RINGING_TONE
    59 #ifdef RD_VIDEO_AS_RINGING_TONE
    61 #include "vcxhgmyvideosaiwmenuhandler.h"
    60 #include "vcxhgmyvideosaiwmenuhandler.h"
    62 #endif
    61 #endif
    63 
    62 
    64 _LIT( KVcxHgMyVideosMifFile, "\\resource\\apps\\vcxhgmyvideosicons.mif" );
    63 _LIT( KVcxHgMyVideosMifFile, "\\resource\\apps\\vcxhgmyvideosicons.mif" );
   102 //
   101 //
   103 CVcxHgMyVideosVideoListImpl::CVcxHgMyVideosVideoListImpl( 
   102 CVcxHgMyVideosVideoListImpl::CVcxHgMyVideosVideoListImpl( 
   104         CVcxHgMyVideosModel& aModel,
   103         CVcxHgMyVideosModel& aModel,
   105         CVcxHgMyVideosMainView& aView,
   104         CVcxHgMyVideosMainView& aView,
   106         CHgScroller& aScroller )
   105         CHgScroller& aScroller )
   107   : CVcxHgMyVideosListBase( aModel, aView, aScroller ),
   106   : CVcxHgMyVideosListBase( aModel, aView, aScroller )
   108     iCurrentlyPlayedVideo( KErrNotFound ),
       
   109     iMultipleMarkingActive( EFalse )
       
   110 #ifdef RD_VIDEO_AS_RINGING_TONE
   107 #ifdef RD_VIDEO_AS_RINGING_TONE
   111     , iAiwMenuHandler( NULL )
   108     , iAiwMenuHandler( NULL )
   112 #endif
   109 #endif
   113     {
   110     {
   114     }
   111     }
   180 // -----------------------------------------------------------------------------
   177 // -----------------------------------------------------------------------------
   181 //
   178 //
   182 CVcxHgMyVideosVideoListImpl::~CVcxHgMyVideosVideoListImpl()
   179 CVcxHgMyVideosVideoListImpl::~CVcxHgMyVideosVideoListImpl()
   183     {
   180     {
   184     CloseDeleteWaitNote();
   181     CloseDeleteWaitNote();
   185     delete iTelephonyClient;
       
   186     delete iCenRep;
       
   187     delete iUPnP;
   182     delete iUPnP;
   188     delete iVideoCopier;
   183     delete iVideoCopier;
   189     delete iVideoModel;
   184     delete iVideoModel;
   190     delete iSendUi;
   185     delete iSendUi;
   191 #ifdef RD_VIDEO_AS_RINGING_TONE
   186 #ifdef RD_VIDEO_AS_RINGING_TONE
   467     
   462     
   468     // Currently only play one video
   463     // Currently only play one video
   469     // Need to handle multiply selected videos
   464     // Need to handle multiply selected videos
   470     for ( TInt i = operationTargets.Count() - 1; i >= 0; i-- )
   465     for ( TInt i = operationTargets.Count() - 1; i >= 0; i-- )
   471         {
   466         {
   472         CheckParentalControlL( iVideoModel->VideoAgeProfileL( operationTargets[i] ) );
       
   473 
       
   474         if( !iUPnP->IsStarted() )
   467         if( !iUPnP->IsStarted() )
   475             {    
   468             {
   476             TVideoPlayerCustomMessage* videoInfo = new (ELeave) TVideoPlayerCustomMessage;
   469             iVideoModel->PlayVideoL( operationTargets[i] );
   477             CleanupStack::PushL( videoInfo );
   470 
   478             TInt mpxId1( 0 );
   471             iModel.SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStatePlayer );
   479                        
       
   480             if ( iVideoModel->GetVideoPlayerCustomMessage( operationTargets[i], *videoInfo, mpxId1 )
       
   481                  == KErrNone )
       
   482                 {
       
   483                 iCurrentlyPlayedVideo = operationTargets[i];
       
   484        
       
   485                 iVideoModel->PlayVideoL( operationTargets[i] );
       
   486 
       
   487                 iModel.SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStatePlayer );
       
   488                 iModel.SetVideoAsLastWatchedL( *videoInfo, mpxId1,
       
   489                    iVideoModel->VideoAgeProfileL( iCurrentlyPlayedVideo ) );
       
   490                 
       
   491                 //Sometimes MDS has database locked and this fails, we still want to start the playback -> trap ignore
       
   492                 TRAP_IGNORE( iVideoModel->ClearNewVideoIndicatorL( iCurrentlyPlayedVideo ) );
       
   493                 }
       
   494             else
       
   495                 {
       
   496                 // Error notes?
       
   497                 }
       
   498             CleanupStack::PopAndDestroy( videoInfo );
       
   499             }
   472             }
   500         else // UPnP started
   473         else // UPnP started
   501             {
   474             {
   502             TInt err(KErrNone); 
   475             TInt err(KErrNone); 
   503             
   476             
   592     
   565     
   593     TInt count = iVideoModel->VideoCount();
   566     TInt count = iVideoModel->VideoCount();
   594     TInt highlight = Highlight();
   567     TInt highlight = Highlight();
   595 
   568 
   596     // Set menu visibility information.
   569     // Set menu visibility information.
   597     showStartMarking = !iMultipleMarkingActive;
   570     TBool markingMode( IsMarking() );
   598     showEndMarking = iMultipleMarkingActive;
   571     showStartMarking = !markingMode;
       
   572     showEndMarking = markingMode;
   599     aShowMarkAll = ( ( count > 0 ) && ( markedVideos.Count() < count ) );
   573     aShowMarkAll = ( ( count > 0 ) && ( markedVideos.Count() < count ) );
   600     aShowUnmarkAll = ( ( count > 0 ) && ( markedVideos.Count() > 0 ) );
   574     aShowUnmarkAll = ( ( count > 0 ) && ( markedVideos.Count() > 0 ) );
   601     aShowMarkSubmenu = ( showStartMarking || showEndMarking || aShowMarkAll || aShowUnmarkAll );
   575     aShowMarkSubmenu = ( showStartMarking || showEndMarking || aShowMarkAll || aShowUnmarkAll );
   602     
   576     
   603     CleanupStack::PopAndDestroy( &markedVideos );
   577     CleanupStack::PopAndDestroy( &markedVideos );
   618             StartMarkingMode();
   592             StartMarkingMode();
   619             break;
   593             break;
   620             }
   594             }
   621         case EVcxHgMyVideosCmdStopMarking:
   595         case EVcxHgMyVideosCmdStopMarking:
   622             {
   596             {
       
   597             iVideoModel->HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll );
   623             EndMarkingMode();
   598             EndMarkingMode();
   624             break;
   599             break;
   625             }
   600             }
   626         case EVcxHgMyVideosCmdMark:
   601         case EVcxHgMyVideosCmdMark:
   627         case EVcxHgMyVideosCmdMarkAll:
   602         case EVcxHgMyVideosCmdMarkAll:
   875         if( count == 0 )
   850         if( count == 0 )
   876             {
   851             {
   877             // Dont show "Sort by" if list is empty.
   852             // Dont show "Sort by" if list is empty.
   878             aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdSortSubMenu, ETrue );
   853             aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdSortSubMenu, ETrue );
   879             }
   854             }
       
   855         
       
   856         // Hide "Settings" menu item
       
   857         aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdOpenSettings, ETrue );
   880         }
   858         }
   881 #ifdef RD_VIDEO_AS_RINGING_TONE
   859 #ifdef RD_VIDEO_AS_RINGING_TONE
   882     else if ( aResourceId == R_VCXHGMYVIDEOS_USE_AS_SUBMENU )
   860     else if ( aResourceId == R_VCXHGMYVIDEOS_USE_AS_SUBMENU )
   883         {
   861         {
   884         RArray<TInt> operationTargets;
   862         RArray<TInt> operationTargets;
   979         {
   957         {
   980         return R_VCXHGMYVIDEOS_MSK_CONTEXTMENU;
   958         return R_VCXHGMYVIDEOS_MSK_CONTEXTMENU;
   981         }
   959         }
   982     }
   960     }
   983 
   961 
   984 // -----------------------------------------------------------------------------
       
   985 // CVcxHgMyVideosVideoListImpl::CheckParentalControlL()
       
   986 // -----------------------------------------------------------------------------
       
   987 //
       
   988 void CVcxHgMyVideosVideoListImpl::CheckParentalControlL( TUint32 aAgeProfile )
       
   989     {
       
   990     TInt parentControlSetting( KVcxMyvideosCenRepParentControlKeyDefault );
       
   991     TInt error( KErrNone );
       
   992     if ( !iCenRep )
       
   993         {
       
   994         TRAP( error, iCenRep = CRepository::NewL( TUid::Uid( KVcxMyVideosCenRepUid ) ) )
       
   995         }
       
   996     if ( error == KErrNone )
       
   997         {
       
   998         error = iCenRep->Get( KVcxMyvideosCenRepParentControlKey, parentControlSetting );
       
   999         if ( error == KErrNone && parentControlSetting != KVcxMyvideosCenRepParentControlKeyOff )
       
  1000             {
       
  1001             // Parental control has been set
       
  1002             if ( static_cast<TInt>( aAgeProfile ) >= parentControlSetting )
       
  1003                 {
       
  1004                 // Must ask lock code to allow playing
       
  1005                 if ( !iTelephonyClient )
       
  1006                     {
       
  1007                     iTelephonyClient = new( ELeave ) CVcxHgTelephonyClient();
       
  1008                     }
       
  1009                 if ( !iTelephonyClient->CheckLockCodeL() )
       
  1010                     {
       
  1011                     User::Leave( KErrPermissionDenied );
       
  1012                     }
       
  1013                 }
       
  1014             }
       
  1015         }
       
  1016     }
       
  1017 
       
  1018 // ---------------------------------------------------------------------------
   962 // ---------------------------------------------------------------------------
  1019 // CVcxHgMyVideosVideoListImpl::StartMarkingMode()
   963 // CVcxHgMyVideosVideoListImpl::StartMarkingMode()
  1020 // ---------------------------------------------------------------------------
   964 // ---------------------------------------------------------------------------
  1021 //  
   965 //  
  1022 void CVcxHgMyVideosVideoListImpl::StartMarkingMode()
   966 void CVcxHgMyVideosVideoListImpl::StartMarkingMode()
  1023     {
   967     {
  1024     IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::StartMarkingMode() iMultipleMarkingActive = %d", iMultipleMarkingActive );
   968     IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::StartMarkingMode() IsMarking = %d", IsMarking() );
  1025     
   969     
  1026     // Start multiple marking mode
   970     // Start multiple marking mode
  1027     if ( iModel.TouchSupport() )
   971     if ( iModel.TouchSupport() )
  1028         {
   972         {
  1029         iScroller->SetFlags( CHgScroller::EHgScrollerSelectionMode );
   973         iScroller->SetFlags( CHgScroller::EHgScrollerSelectionMode );
  1030         iMultipleMarkingActive = ETrue;
       
  1031         }
   974         }
  1032     }
   975     }
  1033 
   976 
  1034 // ---------------------------------------------------------------------------
   977 // ---------------------------------------------------------------------------
  1035 // CVcxHgMyVideosVideoListImpl::EndMarkingMode()
   978 // CVcxHgMyVideosVideoListImpl::EndMarkingMode()
  1036 // ---------------------------------------------------------------------------
   979 // ---------------------------------------------------------------------------
  1037 //  
   980 //  
  1038 void CVcxHgMyVideosVideoListImpl::EndMarkingMode()
   981 void CVcxHgMyVideosVideoListImpl::EndMarkingMode()
  1039     {
   982     {
  1040     IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::EndMarkingMode() iMultipleMarkingActive = %d", iMultipleMarkingActive );
   983     IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # CVcxHgMyVideosVideoListImpl::EndMarkingMode() IsMarking = %d", IsMarking() );
  1041 
   984 
  1042     // End multiple marking mode
   985     // End multiple marking mode
  1043     iScroller->ClearFlags( CHgScroller::EHgScrollerSelectionMode );
   986     iScroller->ClearFlags( CHgScroller::EHgScrollerSelectionMode );
  1044     iMultipleMarkingActive = EFalse;
       
  1045     }
   987     }
  1046 
   988 
  1047 // ---------------------------------------------------------------------------
   989 // ---------------------------------------------------------------------------
  1048 // CVcxHgMyVideosVideoListImpl::HandleSendL()
   990 // CVcxHgMyVideosVideoListImpl::HandleSendL()
  1049 // ---------------------------------------------------------------------------
   991 // ---------------------------------------------------------------------------