mpengine/src/mpmpxisolatedcollectionhelper.cpp
changeset 58 ed94e1e8390e
parent 54 c5b304f4d89b
equal deleted inserted replaced
54:c5b304f4d89b 58:ed94e1e8390e
    19 #include <mpxcollectionhelperfactory.h>
    19 #include <mpxcollectionhelperfactory.h>
    20 #include <mpxcollectionuihelper.h>
    20 #include <mpxcollectionuihelper.h>
    21 #include <mpxcollectionopenutility.h>
    21 #include <mpxcollectionopenutility.h>
    22 
    22 
    23 #include "mpmpxisolatedcollectionhelper.h"
    23 #include "mpmpxisolatedcollectionhelper.h"
    24 #include "mptrace.h"
    24 #include "mpxlog.h"
       
    25 
       
    26 
    25 
    27 
    26 const TInt KIncrementalDelay = 0;
    28 const TInt KIncrementalDelay = 0;
    27 const TInt KIncrementalFetchBlockSize = 1000;
    29 const TInt KIncrementalFetchBlockSize = 1000;
       
    30 
    28 
    31 
    29 
    32 
    30 /*!
    33 /*!
    31     \class CMpMpxIsolatedCollectionHelper
    34     \class CMpMpxIsolatedCollectionHelper
    32     \brief Helper class to open an isolated collection.
    35     \brief Helper class to open an isolated collection.
    36 
    39 
    37 /*!
    40 /*!
    38  \internal
    41  \internal
    39  Two-phased constructor.
    42  Two-phased constructor.
    40  */
    43  */
    41 CMpMpxIsolatedCollectionHelper* CMpMpxIsolatedCollectionHelper::NewL(
    44 CMpMpxIsolatedCollectionHelper* CMpMpxIsolatedCollectionHelper::NewL( 
    42         MMpMpxIsolatedCollectionHelperObserver* aObserver )
    45         MMpMpxIsolatedCollectionHelperObserver* aObserver )
    43 {
    46     {
    44     CMpMpxIsolatedCollectionHelper* self = NewLC( aObserver );
    47     CMpMpxIsolatedCollectionHelper* self = NewLC( aObserver );
    45     CleanupStack::Pop( self );
    48     CleanupStack::Pop( self );
    46     return self;
    49     return self;
    47 }
    50     }
    48 
    51 
    49 /*!
    52 /*!
    50  \internal
    53  \internal
    51  Two-phased constructor.
    54  Two-phased constructor.
    52  */
    55  */
    53 CMpMpxIsolatedCollectionHelper* CMpMpxIsolatedCollectionHelper::NewLC(
    56 CMpMpxIsolatedCollectionHelper* CMpMpxIsolatedCollectionHelper::NewLC( 
    54         MMpMpxIsolatedCollectionHelperObserver* aObserver )
    57         MMpMpxIsolatedCollectionHelperObserver* aObserver )
    55 {
    58     {
    56     CMpMpxIsolatedCollectionHelper* self =
    59     CMpMpxIsolatedCollectionHelper* self =
    57             new ( ELeave ) CMpMpxIsolatedCollectionHelper( aObserver );
    60             new ( ELeave ) CMpMpxIsolatedCollectionHelper( aObserver );
    58     CleanupStack::PushL( self );
    61     CleanupStack::PushL( self );
    59     self->ConstructL();
    62     self->ConstructL();
    60     return self;
    63     return self;
    61 }
    64     }
    62 
    65 
    63 /*!
    66 /*!
    64  \internal
    67  \internal
    65  Destructor
    68  Destructor
    66  */
    69  */
    67 CMpMpxIsolatedCollectionHelper::~CMpMpxIsolatedCollectionHelper()
    70 CMpMpxIsolatedCollectionHelper::~CMpMpxIsolatedCollectionHelper()
    68 {
    71     {
    69     delete iIncrementalOpenUtil;
    72     delete iIncrementalOpenUtil;
    70 }
    73     }
    71 
    74     
    72 
    75 
    73 /*!
    76 /*!
    74  \internal
    77  \internal
    75  Opens an isolated collection with the /a path.
    78  Opens an isolated collection with the /a path.
    76  */
    79  */
    77 void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath, TInt aIndex, MpOpenMode aMode )
    80 void CMpMpxIsolatedCollectionHelper::OpenCollectionL( CMPXCollectionPath& aPath, TInt aIndex, MpOpenMode aMode )
    78 {
    81     {
    79     TX_ENTRY
       
    80     //Using incremental open to open the collection.
    82     //Using incremental open to open the collection.
    81     iOpenMode = aMode;
    83     iOpenMode = aMode;
    82     // Cancel any reads
    84     // Cancel any reads
    83     iIncrementalOpenUtil->Stop();
    85     iIncrementalOpenUtil->Stop();
    84 
    86 
    89     TArray<TMPXAttribute> ary = attrs.Array();
    91     TArray<TMPXAttribute> ary = attrs.Array();
    90     iIncrementalOpenUtil->SetDelay( KIncrementalDelay );
    92     iIncrementalOpenUtil->SetDelay( KIncrementalDelay );
    91     iIncrementalOpenUtil->StartL( aPath, ary, KIncrementalFetchBlockSize,
    93     iIncrementalOpenUtil->StartL( aPath, ary, KIncrementalFetchBlockSize,
    92                                   aIndex, CMPXCollectionOpenUtility::EFetchDown );
    94                                   aIndex, CMPXCollectionOpenUtility::EFetchDown );
    93     CleanupStack::PopAndDestroy( &attrs );
    95     CleanupStack::PopAndDestroy( &attrs );
    94     TX_EXIT
    96     }
    95 }
       
    96 
    97 
    97 /*!
    98 /*!
    98  \internal
    99  \internal
    99  c++ Contructor
   100  c++ Contructor
   100  */
   101  */
   101 CMpMpxIsolatedCollectionHelper::CMpMpxIsolatedCollectionHelper( MMpMpxIsolatedCollectionHelperObserver* aObserver )
   102 CMpMpxIsolatedCollectionHelper::CMpMpxIsolatedCollectionHelper( MMpMpxIsolatedCollectionHelperObserver* aObserver )
   102     : iObserver( aObserver ),
   103     : iObserver( aObserver ),
   103       iIncrementalOpenUtil( 0 ),
   104       iIncrementalOpenUtil( 0 ),
   104       iFirstIncrementalOpen( EFalse )
   105       iFirstIncrementalOpen( EFalse )
   105 {
   106     {
   106 }
   107     }
   107 
   108 
   108 /*!
   109 /*!
   109  \internal
   110  \internal
   110  Leaving constructor
   111  Leaving constructor
   111  */
   112  */
   112 void CMpMpxIsolatedCollectionHelper::ConstructL()
   113 void CMpMpxIsolatedCollectionHelper::ConstructL()
   113 {
   114     {
   114     iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModeIsolated );
   115     iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModeIsolated );
   115 }
   116 
       
   117     }
   116 
   118 
   117 
   119 
   118 /*!
   120 /*!
   119  \internal
   121  \internal
   120  reimp
   122  reimp
   121  */
   123  */
   122 void CMpMpxIsolatedCollectionHelper::HandleOpenL(
   124 void CMpMpxIsolatedCollectionHelper::HandleOpenL( 
   123     const CMPXMedia& aEntries,
   125     const CMPXMedia& aEntries,
   124     TInt aIndex,
   126     TInt /*aIndex*/,
   125     TBool aComplete,
   127     TBool /*aComplete*/,
   126     TInt aError )
   128     TInt aError )
   127 {
   129     {
   128     Q_UNUSED( aIndex );
   130     if ( iFirstIncrementalOpen )
   129     Q_UNUSED( aComplete );
   131         {
   130     TX_ENTRY_ARGS( "aError=" << aError << "aComplete=" << aComplete );
       
   131     if ( iFirstIncrementalOpen ) {
       
   132         CMPXCollectionPath* cPath = NULL;
   132         CMPXCollectionPath* cPath = NULL;
   133         iFirstIncrementalOpen = EFalse;
   133         iFirstIncrementalOpen = EFalse;
   134         switch( iOpenMode ) {
   134         switch( iOpenMode ) {
   135             case RestorePathMode:
   135         case RestorePathMode:
   136                 cPath = iIncrementalOpenUtil->PathL();
   136             cPath = iIncrementalOpenUtil->PathL();
   137                 CleanupStack::PushL( cPath );
   137             CleanupStack::PushL( cPath );
   138                 iObserver->HandleIsolatedOpenRestorePathL( *cPath, aError );
   138             iObserver->HandleIsolatedOpenRestorePathL( *cPath, aError );
   139                 CleanupStack::PopAndDestroy( cPath );
   139             CleanupStack::PopAndDestroy( cPath );
   140                 break;
   140 
   141             case DefaultMode:
   141             break;
   142             default:
   142         case DefaultMode:
   143                 iObserver->HandleIsolatedOpenL( aEntries, aError );
   143         default:
   144                 break;
   144             iObserver->HandleIsolatedOpenL( aEntries, aError );
   145             }
   145             break;
       
   146         }
       
   147         
       
   148         }
   146     }
   149     }
   147     TX_EXIT
       
   148 }
       
   149 
   150 
   150 /*!
   151 /*!
   151  \internal
   152  \internal
   152   reimp
   153   reimp
   153  */
   154  */
   154 void CMpMpxIsolatedCollectionHelper::HandleOpenL(
   155 void CMpMpxIsolatedCollectionHelper::HandleOpenL( 
   155     const CMPXCollectionPlaylist& aPlaylist,
   156     const CMPXCollectionPlaylist& /*aPlaylist*/,
   156     TInt aError )
   157     TInt /*aError*/ )
   157 {
   158     {
   158     Q_UNUSED( aPlaylist );
   159     }
   159     Q_UNUSED( aError );
       
   160 }
       
   161 
   160 
   162 /*!
   161 /*!
   163  \internal
   162  \internal
   164   reimp
   163   reimp
   165  */
   164  */
   166 void CMpMpxIsolatedCollectionHelper::HandleCollectionMessage(
   165 void CMpMpxIsolatedCollectionHelper::HandleCollectionMessage( 
   167     CMPXMessage* aMsg,
   166     CMPXMessage* /*aMsg*/,
   168     TInt aErr )
   167     TInt /*aErr*/ )
   169 {
   168     {
   170     Q_UNUSED( aMsg );
   169     }
   171     Q_UNUSED( aErr );
       
   172 }
       
   173 
   170 
   174 /*!
   171 /*!
   175  \internal
   172  \internal
   176   reimp
   173   reimp
   177  */
   174  */
   178 void CMpMpxIsolatedCollectionHelper::HandleCollectionMediaL(
   175 void CMpMpxIsolatedCollectionHelper::HandleCollectionMediaL( 
   179     const CMPXMedia& aMedia,
   176     const CMPXMedia& /*aMedia*/,
   180     TInt aError )
   177     TInt /*aError*/ )
   181 {
   178     {
   182     Q_UNUSED( aMedia );
   179     }
   183     Q_UNUSED( aError );
   180     
   184 }
   181 //EOF
   185