videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp
changeset 30 4f111d64a341
parent 0 96612d01cf9f
equal deleted inserted replaced
2:dec420019252 30:4f111d64a341
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 #define MVCOLLECTION_10_1_DISABLE_DOWNLOADS
    19 
       
    20 
    19 
    21 // INCLUDE FILES
    20 // INCLUDE FILES
    22 #include <mpxlog.h>
    21 #include <mpxlog.h>
    23 #include <utf.h>
    22 #include <utf.h>
    24 #include <mpxmediacontainerdefs.h>
    23 #include <mpxmediacontainerdefs.h>
   128 // ----------------------------------------------------------------------------
   127 // ----------------------------------------------------------------------------
   129 //
   128 //
   130 CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil()
   129 CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil()
   131     {
   130     {
   132     MPX_FUNC("CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil");
   131     MPX_FUNC("CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil");
       
   132 
       
   133 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   134     return;
       
   135 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   136 
   133     iDownloadManager.Disconnect(); //disconnects all downloads and puts them to pause
   137     iDownloadManager.Disconnect(); //disconnects all downloads and puts them to pause
   134     iDownloadManager.Close();
   138     iDownloadManager.Close();
   135     delete iDownloadDeleteTimer;
   139     delete iDownloadDeleteTimer;
   136     iDownloadsToDelete.Close();
   140     iDownloadsToDelete.Close();
   137     iDeleteContent.Close();
   141     iDeleteContent.Close();
   138 
   142  
   139     if ( iConnUtil )
   143     if ( iConnUtil )
   140         {
   144         {
   141         iConnUtil->RemoveObserver( this );
   145         iConnUtil->RemoveObserver( this );
   142         iConnUtil->DecreaseReferenceCount();
   146         iConnUtil->DecreaseReferenceCount();
   143         }
   147         }
   163 //
   167 //
   164 void CVcxMyVideosDownloadUtil::ConstructL ()
   168 void CVcxMyVideosDownloadUtil::ConstructL ()
   165     {
   169     {
   166     MPX_FUNC("CVcxMyVideosDownloadUtil::ConstructL");
   170     MPX_FUNC("CVcxMyVideosDownloadUtil::ConstructL");
   167     
   171     
       
   172 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   173     return;
       
   174 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   175     
   168     TUid uid = TUid::Uid( KVcxUidMyVideosMpxCollection );
   176     TUid uid = TUid::Uid( KVcxUidMyVideosMpxCollection );
   169 
   177 
   170     iDownloadManager.ConnectL( uid, *this, ETrue );
   178     iDownloadManager.ConnectL( uid, *this, ETrue );
   171     
   179     
   172     iDownloadDeleteTimer = CVcxMyVideosTimer::NewL( 0, *this );
   180     iDownloadDeleteTimer = CVcxMyVideosTimer::NewL( 0, *this );
   186 // ----------------------------------------------------------------------------
   194 // ----------------------------------------------------------------------------
   187 //
   195 //
   188 void CVcxMyVideosDownloadUtil::StartDownloadL( CMPXMedia& aDownload )
   196 void CVcxMyVideosDownloadUtil::StartDownloadL( CMPXMedia& aDownload )
   189     {
   197     {
   190     MPX_FUNC("CVcxMyVideosDownloadUtil::StartDownloadL");
   198     MPX_FUNC("CVcxMyVideosDownloadUtil::StartDownloadL");
       
   199     
       
   200 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   201     return;
       
   202 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   203     
   191     // Requesting a new connection, update state
   204     // Requesting a new connection, update state
   192     iRoamingOngoing = EFalse;
   205     iRoamingOngoing = EFalse;
   193     TInt err( KErrNone );
   206     TInt err( KErrNone );
   194 
   207 
   195     TUint32 iap( 0 );
   208     TUint32 iap( 0 );
   292 // CVcxMyVideosDownloadUtil::PauseDownload
   305 // CVcxMyVideosDownloadUtil::PauseDownload
   293 // ----------------------------------------------------------------------------
   306 // ----------------------------------------------------------------------------
   294 //
   307 //
   295 TInt CVcxMyVideosDownloadUtil::PauseDownload( TUint32 aDownloadId )
   308 TInt CVcxMyVideosDownloadUtil::PauseDownload( TUint32 aDownloadId )
   296     {
   309     {
       
   310 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   311     return 0;
       
   312 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   313     
   297     RHttpDownload* download = Download( aDownloadId );
   314     RHttpDownload* download = Download( aDownloadId );
   298     
   315     
   299     if ( !download )
   316     if ( !download )
   300         {
   317         {
   301         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: no download found");
   318         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: no download found");
   311 //
   328 //
   312 void CVcxMyVideosDownloadUtil::HandleDMgrEventL( RHttpDownload& aDownload,
   329 void CVcxMyVideosDownloadUtil::HandleDMgrEventL( RHttpDownload& aDownload,
   313     THttpDownloadEvent aEvent )
   330     THttpDownloadEvent aEvent )
   314     {
   331     {
   315     MPX_FUNC("CVcxMyVideosDownloadUtil::HandleDMgrEventL");
   332     MPX_FUNC("CVcxMyVideosDownloadUtil::HandleDMgrEventL");
       
   333 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   334     return;
       
   335 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
   316 
   336 
   317     TInt32 downloadId;
   337     TInt32 downloadId;
   318     aDownload.GetIntAttribute( EDlAttrId, downloadId );
   338     aDownload.GetIntAttribute( EDlAttrId, downloadId );
   319 
   339 
   320 #ifdef _DEBUG
   340 #ifdef _DEBUG
   455 // CVcxMyVideosDownloadUtil::Download
   475 // CVcxMyVideosDownloadUtil::Download
   456 // ---------------------------------------------------------
   476 // ---------------------------------------------------------
   457 //        
   477 //        
   458 RHttpDownload* CVcxMyVideosDownloadUtil::Download( TUint32 aDownloadId )
   478 RHttpDownload* CVcxMyVideosDownloadUtil::Download( TUint32 aDownloadId )
   459     {
   479     {
       
   480 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   481     return 0;
       
   482 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   483     
   460     if ( aDownloadId == 0 )
   484     if ( aDownloadId == 0 )
   461         {
   485         {
   462         return NULL;
   486         return NULL;
   463         }
   487         }
   464     
   488     
   484 // ---------------------------------------------------------
   508 // ---------------------------------------------------------
   485 //        
   509 //        
   486 RHttpDownload* CVcxMyVideosDownloadUtil::Download( const TDesC& aFileName )
   510 RHttpDownload* CVcxMyVideosDownloadUtil::Download( const TDesC& aFileName )
   487     {    
   511     {    
   488     MPX_FUNC("CVcxMyVideosDownloadUtil::Download()");
   512     MPX_FUNC("CVcxMyVideosDownloadUtil::Download()");
       
   513 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   514     return 0;
       
   515 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
   489 
   516 
   490     TInt count = iDownloadManager.CurrentDownloads().Count();
   517     TInt count = iDownloadManager.CurrentDownloads().Count();
   491     TInt i;
   518     TInt i;
   492     
   519     
   493     for ( i = 0; i < count; i++ )
   520     for ( i = 0; i < count; i++ )
   523 //
   550 //
   524 TInt CVcxMyVideosDownloadUtil::CancelDownload( TInt32 aId, TBool aDeleteContent )
   551 TInt CVcxMyVideosDownloadUtil::CancelDownload( TInt32 aId, TBool aDeleteContent )
   525     {
   552     {
   526     MPX_FUNC("CVcxMyVideosDownloadUtil::CancelDownload");
   553     MPX_FUNC("CVcxMyVideosDownloadUtil::CancelDownload");
   527 
   554 
       
   555 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   556     return 0;
       
   557 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   558 
       
   559 
   528     if ( iDownloadManager.CurrentDownloads().Count() < 1 )
   560     if ( iDownloadManager.CurrentDownloads().Count() < 1 )
   529         {
   561         {
   530         return KErrNotFound;
   562         return KErrNotFound;
   531         }
   563         }
   532     
   564     
   557 // -----------------------------------------------------------------------------
   589 // -----------------------------------------------------------------------------
   558 //    
   590 //    
   559 TBool CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL()
   591 TBool CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL()
   560     {
   592     {
   561     MPX_FUNC("CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL");
   593     MPX_FUNC("CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL");
       
   594 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   595     return EFalse;
       
   596 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   597     
   562     iDownloadManager.Disconnect();
   598     iDownloadManager.Disconnect();
   563     iRoamingOngoing = ETrue;
   599     iRoamingOngoing = ETrue;
   564     return ETrue;
   600     return ETrue;
   565     }
   601     }
   566     
   602     
   569 // -----------------------------------------------------------------------------
   605 // -----------------------------------------------------------------------------
   570 // 
   606 // 
   571 void  CVcxMyVideosDownloadUtil::IapChangedL()
   607 void  CVcxMyVideosDownloadUtil::IapChangedL()
   572     {
   608     {
   573     MPX_FUNC("CVcxMyVideosDownloadUtil::IapChangedL");	
   609     MPX_FUNC("CVcxMyVideosDownloadUtil::IapChangedL");	
       
   610 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   611     return;
       
   612 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   613     
   574     if ( !iRoamingOngoing )
   614     if ( !iRoamingOngoing )
   575         {
   615         {
   576 		// This is not roaming situation, must not call GetIap()
   616 		// This is not roaming situation, must not call GetIap()
   577         return;
   617         return;
   578         }
   618         }
   599 //
   639 //
   600 void CVcxMyVideosDownloadUtil::GetDownloadState(
   640 void CVcxMyVideosDownloadUtil::GetDownloadState(
   601         RHttpDownload& aDownload,
   641         RHttpDownload& aDownload,
   602         TVcxMyVideosDownloadState& aDownloadState )
   642         TVcxMyVideosDownloadState& aDownloadState )
   603     {
   643     {
       
   644 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   645     return;
       
   646 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   647         
   604     TInt32 dlStateInDlManager;
   648     TInt32 dlStateInDlManager;
   605     aDownload.GetIntAttribute( EDlAttrState, dlStateInDlManager );
   649     aDownload.GetIntAttribute( EDlAttrState, dlStateInDlManager );
   606 
   650 
   607     switch( dlStateInDlManager )
   651     switch( dlStateInDlManager )
   608         {
   652         {
   634 // -----------------------------------------------------------------------------
   678 // -----------------------------------------------------------------------------
   635 //
   679 //
   636 TInt8 CVcxMyVideosDownloadUtil::DownloadProgress( RHttpDownload& aDownload, TUint64& aDownloaded,
   680 TInt8 CVcxMyVideosDownloadUtil::DownloadProgress( RHttpDownload& aDownload, TUint64& aDownloaded,
   637                                                    TBool aAllowSilentReset )
   681                                                    TBool aAllowSilentReset )
   638     {
   682     {
       
   683 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   684     return 0;
       
   685 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   686         
   639     TInt64 downloaded;
   687     TInt64 downloaded;
   640     TInt32 fullSize;
   688     TInt32 fullSize;
   641 
   689 
   642     TBool isProgressive;
   690     TBool isProgressive;
   643     aDownload.GetBoolAttribute( EDlAttrProgressive, isProgressive );
   691     aDownload.GetBoolAttribute( EDlAttrProgressive, isProgressive );
   701 // CVcxMyVideosDownloadUtil::GetS60DlStateDes
   749 // CVcxMyVideosDownloadUtil::GetS60DlStateDes
   702 // -----------------------------------------------------------------------------
   750 // -----------------------------------------------------------------------------
   703 //
   751 //
   704 const TDesC& CVcxMyVideosDownloadUtil::GetS60DlStateDes( TInt32 aState )
   752 const TDesC& CVcxMyVideosDownloadUtil::GetS60DlStateDes( TInt32 aState )
   705     {
   753     {
       
   754 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   755     return KVcxUnknownStateDes;
       
   756 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   757         
   706     switch ( aState )
   758     switch ( aState )
   707         {
   759         {
   708         case EHttpDlCreated:
   760         case EHttpDlCreated:
   709             return KVcxHttpDlCreatedDes;
   761             return KVcxHttpDlCreatedDes;
   710             
   762             
   762 // CVcxMyVideosDownloadUtil::GetS60DlProgressDes
   814 // CVcxMyVideosDownloadUtil::GetS60DlProgressDes
   763 // -----------------------------------------------------------------------------
   815 // -----------------------------------------------------------------------------
   764 //
   816 //
   765 const TDesC& CVcxMyVideosDownloadUtil::GetS60DlProgressDes( TInt32 aProgress )
   817 const TDesC& CVcxMyVideosDownloadUtil::GetS60DlProgressDes( TInt32 aProgress )
   766     {
   818     {
       
   819 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   820     return KVcxUnknownProgressDes;
       
   821 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   822         
   767     switch ( aProgress )
   823     switch ( aProgress )
   768         {
   824         {
   769         case EHttpProgNone:
   825         case EHttpProgNone:
   770             return KVcxHttpProgNoneDes;
   826             return KVcxHttpProgNoneDes;
   771             
   827             
   848 // CVcxMyVideosDownloadUtil::DeleteDownloadAsync
   904 // CVcxMyVideosDownloadUtil::DeleteDownloadAsync
   849 // -----------------------------------------------------------------------------
   905 // -----------------------------------------------------------------------------
   850 //
   906 //
   851 void CVcxMyVideosDownloadUtil::DeleteDownloadAsync( TInt32 aDownloadId, TBool aDeleteContent )
   907 void CVcxMyVideosDownloadUtil::DeleteDownloadAsync( TInt32 aDownloadId, TBool aDeleteContent )
   852     {
   908     {
       
   909 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   910     return;
       
   911 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   912         
   853     iDownloadsToDelete.Append( aDownloadId );
   913     iDownloadsToDelete.Append( aDownloadId );
   854     iDeleteContent.Append( aDeleteContent );
   914     iDeleteContent.Append( aDeleteContent );
   855     if ( !iDownloadDeleteTimer->IsActive() )
   915     if ( !iDownloadDeleteTimer->IsActive() )
   856         {
   916         {
   857         iDownloadDeleteTimer->After( 0 );
   917         iDownloadDeleteTimer->After( 0 );
   862 // CVcxMyVideosDownloadUtil::TimerExpired
   922 // CVcxMyVideosDownloadUtil::TimerExpired
   863 // -----------------------------------------------------------------------------
   923 // -----------------------------------------------------------------------------
   864 //
   924 //
   865 void CVcxMyVideosDownloadUtil::TimerExpired( CVcxMyVideosTimer* aTimer )
   925 void CVcxMyVideosDownloadUtil::TimerExpired( CVcxMyVideosTimer* aTimer )
   866     {
   926     {
       
   927 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   928     return;
       
   929 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   930         
   867     if ( aTimer == iDownloadDeleteTimer )
   931     if ( aTimer == iDownloadDeleteTimer )
   868         {
   932         {
   869         for ( TInt i = 0; i < iDownloadsToDelete.Count(); i++ )
   933         for ( TInt i = 0; i < iDownloadsToDelete.Count(); i++ )
   870             {
   934             {
   871             CancelDownload( iDownloadsToDelete[i], iDeleteContent[i] );
   935             CancelDownload( iDownloadsToDelete[i], iDeleteContent[i] );
   909 // ----------------------------------------------------------------------------
   973 // ----------------------------------------------------------------------------
   910 //
   974 //
   911 void CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL( CMPXMedia& aVideoList )
   975 void CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL( CMPXMedia& aVideoList )
   912     {
   976     {
   913     MPX_FUNC("CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL");
   977     MPX_FUNC("CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL");
       
   978 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
   979     return;
       
   980 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
   914     
   981     
   915     const CDownloadArray& downloads = Downloads();
   982     const CDownloadArray& downloads = Downloads();
   916 
   983 
   917     CMPXMediaArray* videoArray = aVideoList.Value<CMPXMediaArray>(
   984     CMPXMediaArray* videoArray = aVideoList.Value<CMPXMediaArray>(
   918                                 KMPXMediaArrayContents);    
   985                                 KMPXMediaArrayContents);    
   948 // CVcxMyVideosDownloadUtil::NotifyDownloadStarted
  1015 // CVcxMyVideosDownloadUtil::NotifyDownloadStarted
   949 // ----------------------------------------------------------------------------
  1016 // ----------------------------------------------------------------------------
   950 //
  1017 //
   951 void CVcxMyVideosDownloadUtil::NotifyDownloadStarted()
  1018 void CVcxMyVideosDownloadUtil::NotifyDownloadStarted()
   952     {
  1019     {
       
  1020 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1021     return;
       
  1022 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1023     
   953     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
  1024     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
   954                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
  1025                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
   955                                         KVcxNsMpxEventDownloadStarted ,
  1026                                         KVcxNsMpxEventDownloadStarted ,
   956                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
  1027                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
   957                                         KNullDesC8() );
  1028                                         KNullDesC8() );
   961 // CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads
  1032 // CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads
   962 // ----------------------------------------------------------------------------
  1033 // ----------------------------------------------------------------------------
   963 //
  1034 //
   964 void CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads()
  1035 void CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads()
   965     {
  1036     {
       
  1037 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1038     return;
       
  1039 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1040         
   966     if ( !ActiveDownloadCount() )
  1041     if ( !ActiveDownloadCount() )
   967         {
  1042         {
   968         iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
  1043         iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
   969                                             TUid::Uid( KVcxNsMpxMediatorCategory ), 
  1044                                             TUid::Uid( KVcxNsMpxMediatorCategory ), 
   970                                             KVcxNsMpxEventAllDownloadsEnded,
  1045                                             KVcxNsMpxEventAllDownloadsEnded,
   977 // CVcxMyVideosDownloadUtil::NotifyDownloadCompleted
  1052 // CVcxMyVideosDownloadUtil::NotifyDownloadCompleted
   978 // ----------------------------------------------------------------------------
  1053 // ----------------------------------------------------------------------------
   979 //
  1054 //
   980 void CVcxMyVideosDownloadUtil::NotifyDownloadCompleted( const TDesC8& aMsg )
  1055 void CVcxMyVideosDownloadUtil::NotifyDownloadCompleted( const TDesC8& aMsg )
   981     {
  1056     {
       
  1057 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1058     return;
       
  1059 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1060         
   982     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
  1061     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
   983                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
  1062                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
   984                                         KVcxNsMpxEventDownloadCompleted,
  1063                                         KVcxNsMpxEventDownloadCompleted,
   985                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
  1064                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
   986                                         aMsg );
  1065                                         aMsg );
   990 // CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased
  1069 // CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased
   991 // ----------------------------------------------------------------------------
  1070 // ----------------------------------------------------------------------------
   992 //
  1071 //
   993 void CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased( const TDesC8& aMsg )
  1072 void CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased( const TDesC8& aMsg )
   994     {
  1073     {
       
  1074 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1075     return;
       
  1076 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1077         
   995     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
  1078     iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
   996                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
  1079                                         TUid::Uid( KVcxNsMpxMediatorCategory ), 
   997                                         KVcxNsMpxEventNewVideosCountDecreased,
  1080                                         KVcxNsMpxEventNewVideosCountDecreased,
   998                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
  1081                                         TVersion( KVcxNsMpxEventVersion, 0, 0 ),
   999                                         aMsg );
  1082                                         aMsg );
  1003 // CVcxMyVideosDownloadUtil::ActiveDownloadCount
  1086 // CVcxMyVideosDownloadUtil::ActiveDownloadCount
  1004 // ----------------------------------------------------------------------------
  1087 // ----------------------------------------------------------------------------
  1005 //
  1088 //
  1006 TInt32 CVcxMyVideosDownloadUtil::ActiveDownloadCount()
  1089 TInt32 CVcxMyVideosDownloadUtil::ActiveDownloadCount()
  1007     {
  1090     {
       
  1091 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1092     return 0;
       
  1093 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1094         
  1008     const CDownloadArray& dlarray = Downloads();
  1095     const CDownloadArray& dlarray = Downloads();
  1009     
  1096     
  1010     TInt32 dlCount( 0 );
  1097     TInt32 dlCount( 0 );
  1011     
  1098     
  1012     TVcxMyVideosDownloadState state;
  1099     TVcxMyVideosDownloadState state;
  1030 HBufC* CVcxMyVideosDownloadUtil::CreateFilePathL( const CMPXMedia& aMedia )
  1117 HBufC* CVcxMyVideosDownloadUtil::CreateFilePathL( const CMPXMedia& aMedia )
  1031     {
  1118     {
  1032     MPX_FUNC("CVcxMyVideosDownloadUtil::CreateFilePathL");
  1119     MPX_FUNC("CVcxMyVideosDownloadUtil::CreateFilePathL");
  1033     
  1120     
  1034     HBufC* path = HBufC::NewL( KMaxPathLength );
  1121     HBufC* path = HBufC::NewL( KMaxPathLength );
       
  1122 
       
  1123 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1124     return path;
       
  1125 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1126 
       
  1127 
  1035     CleanupStack::PushL( path ); // 1->
  1128     CleanupStack::PushL( path ); // 1->
  1036     
  1129     
  1037     TPtr pathPtr( path->Des() );
  1130     TPtr pathPtr( path->Des() );
  1038     
  1131     
  1039     UsedMemoryDesL(); // generates new value to iUsedMemoryDrivePath
  1132     UsedMemoryDesL(); // generates new value to iUsedMemoryDrivePath
  1087 // ----------------------------------------------------------------------------
  1180 // ----------------------------------------------------------------------------
  1088 //
  1181 //
  1089 void CVcxMyVideosDownloadUtil::GeneratePathL( const CMPXMedia& aMedia, TDes& aPath, TInt aCounter )
  1182 void CVcxMyVideosDownloadUtil::GeneratePathL( const CMPXMedia& aMedia, TDes& aPath, TInt aCounter )
  1090     {
  1183     {
  1091     MPX_FUNC("CVcxMyVideosDownloadUtil::GeneratePathL");
  1184     MPX_FUNC("CVcxMyVideosDownloadUtil::GeneratePathL");
       
  1185 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1186     return;
       
  1187 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
  1092 
  1188 
  1093     _LIT( KBasePathNormal, "\\My Videos\\Downloads\\" );
  1189     _LIT( KBasePathNormal, "\\My Videos\\Downloads\\" );
  1094     _LIT( KBasePathSystemDrive, "\\Data\\My Videos\\Downloads\\" );
  1190     _LIT( KBasePathSystemDrive, "\\Data\\My Videos\\Downloads\\" );
  1095     
  1191     
  1096     aPath.Zero();
  1192     aPath.Zero();
  1234 // Finds subdir and stores it to iSubDir
  1330 // Finds subdir and stores it to iSubDir
  1235 // ----------------------------------------------------------------------------
  1331 // ----------------------------------------------------------------------------
  1236 //
  1332 //
  1237 void CVcxMyVideosDownloadUtil::FindSubDirL( const TDesC& aPath )
  1333 void CVcxMyVideosDownloadUtil::FindSubDirL( const TDesC& aPath )
  1238     {
  1334     {
       
  1335 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1336     return;
       
  1337 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1338         
  1239     MPX_FUNC("CVcxMyVideosDownloadUtil::FindSubDirL");
  1339     MPX_FUNC("CVcxMyVideosDownloadUtil::FindSubDirL");
  1240 
  1340 
  1241     MPX_DEBUG2("CVcxMyVideosDownloadUtil:: aPath = %S", &aPath);
  1341     MPX_DEBUG2("CVcxMyVideosDownloadUtil:: aPath = %S", &aPath);
  1242 
  1342 
  1243     _LIT(KSubDirFormatterDes, "%d\\");
  1343     _LIT(KSubDirFormatterDes, "%d\\");
  1289 // ----------------------------------------------------------------------------
  1389 // ----------------------------------------------------------------------------
  1290 //
  1390 //
  1291 TInt CVcxMyVideosDownloadUtil::FileCountL( const TDesC& aPath )
  1391 TInt CVcxMyVideosDownloadUtil::FileCountL( const TDesC& aPath )
  1292     {
  1392     {
  1293     TInt count = 0; // return 0 in case of fail
  1393     TInt count = 0; // return 0 in case of fail
       
  1394 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1395     return 0;
       
  1396 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1397     
  1294     
  1398     
  1295     CDir* dir = NULL;
  1399     CDir* dir = NULL;
  1296     TInt err = iFs.GetDir( aPath, KEntryAttNormal | KEntryAttMatchMask, ESortBySize, dir );
  1400     TInt err = iFs.GetDir( aPath, KEntryAttNormal | KEntryAttMatchMask, ESortBySize, dir );
  1297     if ( err != KErrNone )
  1401     if ( err != KErrNone )
  1298         {
  1402         {
  1311 // ----------------------------------------------------------------------------
  1415 // ----------------------------------------------------------------------------
  1312 //
  1416 //
  1313 const TDesC& CVcxMyVideosDownloadUtil::UsedMemoryDesL()
  1417 const TDesC& CVcxMyVideosDownloadUtil::UsedMemoryDesL()
  1314     {
  1418     {
  1315     MPX_FUNC("CVcxMyVideosDownloadUtil::UsedMemoryDesL");
  1419     MPX_FUNC("CVcxMyVideosDownloadUtil::UsedMemoryDesL");
       
  1420 
       
  1421 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1422     return iUsedMemoryDrivePath;
       
  1423 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
  1316 
  1424 
  1317     CVcxMyVideosDriveMonitor* driveMonitor = CVcxMyVideosDriveMonitor::NewL( iFs );
  1425     CVcxMyVideosDriveMonitor* driveMonitor = CVcxMyVideosDriveMonitor::NewL( iFs );
  1318     CleanupStack::PushL( driveMonitor ); // 1->
  1426     CleanupStack::PushL( driveMonitor ); // 1->
  1319     driveMonitor->GetUsedMemoryL( iUsedDrive );    
  1427     driveMonitor->GetUsedMemoryL( iUsedDrive );    
  1320     CleanupStack::PopAndDestroy( driveMonitor ); // <-1
  1428     CleanupStack::PopAndDestroy( driveMonitor ); // <-1
  1331 // CVcxMyVideosDownloadUtil::StopProgressTimer
  1439 // CVcxMyVideosDownloadUtil::StopProgressTimer
  1332 // ----------------------------------------------------------------------------
  1440 // ----------------------------------------------------------------------------
  1333 //
  1441 //
  1334 void CVcxMyVideosDownloadUtil::StopProgressTimer()
  1442 void CVcxMyVideosDownloadUtil::StopProgressTimer()
  1335     {
  1443     {
       
  1444 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1445     return;
       
  1446 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1447         
  1336     if ( ActiveDownloadCount() == 0 )
  1448     if ( ActiveDownloadCount() == 0 )
  1337         {
  1449         {
  1338         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: stopped iDownloadProgressTimer");
  1450         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: stopped iDownloadProgressTimer");
  1339         iDownloadProgressTimer->Cancel();
  1451         iDownloadProgressTimer->Cancel();
  1340         }
  1452         }
  1344 // CVcxMyVideosDownloadUtil::StartProgressTimer
  1456 // CVcxMyVideosDownloadUtil::StartProgressTimer
  1345 // ----------------------------------------------------------------------------
  1457 // ----------------------------------------------------------------------------
  1346 //
  1458 //
  1347 void CVcxMyVideosDownloadUtil::StartProgressTimer()
  1459 void CVcxMyVideosDownloadUtil::StartProgressTimer()
  1348     {
  1460     {
       
  1461 #ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1462     return;
       
  1463 #endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
       
  1464 
  1349     if ( !iDownloadProgressTimer->IsActive() && ActiveDownloadCount() > 0 )
  1465     if ( !iDownloadProgressTimer->IsActive() && ActiveDownloadCount() > 0 )
  1350         {
  1466         {
  1351         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: started iDownloadProgressTimer");
  1467         MPX_DEBUG1("CVcxMyVideosDownloadUtil:: started iDownloadProgressTimer");
  1352         iDownloadProgressTimer->After( 3000000 );
  1468         iDownloadProgressTimer->After( 3000000 );
  1353         }
  1469         }