ui/uiengine/medialistwrapper/src/glxmlgenericobserver.cpp
changeset 23 74c9f037fd5d
child 33 1ee2af37811f
equal deleted inserted replaced
5:f7f0874bfe7d 23:74c9f037fd5d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /*glxmlgenericobserver.cpp*/
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 //Gallery Headers
       
    24 #include <glxtracer.h>                                 // For TRACER
       
    25 #include <glxlog.h>                                     // For Glx Logging
       
    26 #include <glxerrormanager.h>                        //?    // For CGlxErrormanager
       
    27 #include <glxuistd.h>
       
    28 #include <mglxmedialist.h>                              // CGlxMedialist
       
    29 #include <glxthumbnailattributeinfo.h>              //?   // KGlxMediaIdThumbnail
       
    30 #include <glxdrmutility.h>                              // DRM utility class to provide DRM-related functionality
       
    31 #include <mpxmediadrmdefs.h>                            // KMPXMediaDrmProtected
       
    32 
       
    33 
       
    34 #include "glxmlgenericobserver.h"
       
    35 #include "glxmlwrapper_p.h"
       
    36 
       
    37 // ======== MEMBER FUNCTIONS ========
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Two-phased constructor.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CGlxMLGenericObserver* CGlxMLGenericObserver::NewL(
       
    44         MGlxMediaList& aMediaList,GlxMLWrapperPrivate* aMLWrapperPrivate)
       
    45     {
       
    46     TRACER("CGlxMLGenericObserver::NewLC()");
       
    47     CGlxMLGenericObserver* self = 
       
    48             new (ELeave) CGlxMLGenericObserver(aMediaList , aMLWrapperPrivate);
       
    49     //CleanupStack::PushL(self); //To:Do remove the comment later
       
    50     self->ConstructL();
       
    51     //CleanupStack::Pop(self);
       
    52     return self;
       
    53     }
       
    54 // ---------------------------------------------------------------------------
       
    55 // C++ default constructor can NOT contain any code, that
       
    56 // might leave.
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CGlxMLGenericObserver::CGlxMLGenericObserver(MGlxMediaList& aMediaList,
       
    60         GlxMLWrapperPrivate* aMLWrapperPrivate  ) :
       
    61     iMediaList(aMediaList), iMLWrapperPrivate(aMLWrapperPrivate)
       
    62     {
       
    63     TRACER("CGlxMLGenericObserver::CGlxMLGenericObserver");
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // Symbian 2nd phase constructor can leave.
       
    68 // ---------------------------------------------------------------------------
       
    69 //  
       
    70 void CGlxMLGenericObserver::ConstructL()
       
    71     {
       
    72     TRACER("CGlxMLGenericObserver::ConstructL");
       
    73     iMediaList.AddMediaListObserverL(this);
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // Destructor
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CGlxMLGenericObserver::~CGlxMLGenericObserver()
       
    81     {
       
    82     TRACER("CGlxMLGenericObserver::~CGlxMLGenericObserver");
       
    83     iMediaList.RemoveMediaListObserver( this );
       
    84     }
       
    85 
       
    86 // ----------------------------------------------------------------------------
       
    87 // HandleItemAddedL
       
    88 // ----------------------------------------------------------------------------
       
    89 // 
       
    90 void CGlxMLGenericObserver::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, 
       
    91      MGlxMediaList* aList )
       
    92     {
       
    93     TRACER("CGlxMLGenericObserver::HandleItemAddedL()");
       
    94     GLX_DEBUG3("CGlxMLGenericObserver::HandleItemAddedL() aStartIndex(%d),"
       
    95             " aEndIndex(%d)", aStartIndex, aEndIndex);
       
    96 
       
    97     //Forward call to the MLWrapperPrivate
       
    98     iMLWrapperPrivate->HandleItemAddedL( aStartIndex,aEndIndex,aList );
       
    99     }
       
   100 
       
   101 // ----------------------------------------------------------------------------
       
   102 // HandleItemRemoved
       
   103 // ----------------------------------------------------------------------------
       
   104 //  
       
   105 void CGlxMLGenericObserver::HandleItemRemovedL( TInt aStartIndex, 
       
   106         TInt aEndIndex, MGlxMediaList* aList )
       
   107     {
       
   108     TRACER("CGlxMLGenericObserver::HandleItemRemovedL()");
       
   109 	 //Forward call to the MLWrapperPrivate
       
   110     iMLWrapperPrivate->HandleItemRemovedL( aStartIndex,aEndIndex,aList );
       
   111     }
       
   112 
       
   113 // ----------------------------------------------------------------------------
       
   114 // HandleAttributesAvailableL
       
   115 // ----------------------------------------------------------------------------
       
   116 //  
       
   117 void CGlxMLGenericObserver::HandleAttributesAvailableL( TInt aItemIndex, 
       
   118     const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
       
   119     {
       
   120     TRACER("CGlxMLGenericObserver::HandleAttributesAvailableL()");
       
   121 	 //Forward call to the MLWrapperPrivate
       
   122     iMLWrapperPrivate->HandleAttributesAvailableL(aItemIndex,aAttributes,aList);
       
   123     }
       
   124     
       
   125 // ----------------------------------------------------------------------------
       
   126 // HandleFocusChangedL
       
   127 // ----------------------------------------------------------------------------
       
   128 //  
       
   129 void CGlxMLGenericObserver::HandleFocusChangedL( NGlxListDefs::
       
   130     TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, 
       
   131     MGlxMediaList* aList )
       
   132     {
       
   133     TRACER("CGlxMLGenericObserver::HandleFocusChangedL()");
       
   134 	//Forward call to the MLWrapperPrivate
       
   135     iMLWrapperPrivate->HandleFocusChangedL(aType,aNewIndex,aOldIndex,aList );
       
   136     }
       
   137 
       
   138 // ----------------------------------------------------------------------------
       
   139 // HandleItemSelected
       
   140 // ----------------------------------------------------------------------------
       
   141 //  
       
   142 void CGlxMLGenericObserver::HandleItemSelectedL(TInt /*aIndex*/, 
       
   143     TBool /*aSelected*/, MGlxMediaList* /*aList*/ )
       
   144     {
       
   145     TRACER("CGlxMLGenericObserver::HandleItemSelectedL");
       
   146 	//Forward call to the MLWrapperPrivate
       
   147    // iMLWrapperPrivate->HandleFocusChangedL((int)aIndex,(int)aSelected,aList );
       
   148     }
       
   149 
       
   150 // ----------------------------------------------------------------------------
       
   151 // HandleMessageL
       
   152 // ----------------------------------------------------------------------------
       
   153 //    
       
   154  void CGlxMLGenericObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, 
       
   155     MGlxMediaList* /*aList*/ )
       
   156     {
       
   157     TRACER("CGlxMLGenericObserver::HandleMessageL()");
       
   158 	//Forward call to the MLWrapperPrivate
       
   159    // iMLWrapperPrivate->HandleFocusChangedL(aMessage,aList );
       
   160     }
       
   161   
       
   162 // ----------------------------------------------------------------------------
       
   163 // HandleError
       
   164 // ----------------------------------------------------------------------------
       
   165 //
       
   166 void CGlxMLGenericObserver::HandleError( TInt aError ) 
       
   167     {
       
   168     TRACER("CGlxMLGenericObserver::HandleError()");
       
   169     //Forward call to the MLWrapperPrivate
       
   170     iMLWrapperPrivate->HandleError(aError);
       
   171     }
       
   172 
       
   173 // ----------------------------------------------------------------------------
       
   174 // HandleCommandCompleteL
       
   175 // ----------------------------------------------------------------------------
       
   176 //  
       
   177 void CGlxMLGenericObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/, 
       
   178     TInt /*aError*/, MGlxMediaList* /*aList*/ )
       
   179     {
       
   180     TRACER("CGlxMLGenericObserver::HandleCommandCompleteL()");
       
   181 	//Forward call to the MLWrapperPrivate
       
   182     //todo remove comment iMLWrapperPrivate->HandleCommandCompleteL(aCommandResult,aError,aList);
       
   183     }
       
   184   
       
   185 // ----------------------------------------------------------------------------
       
   186 // HandleMediaL
       
   187 // ----------------------------------------------------------------------------
       
   188 //  
       
   189 void CGlxMLGenericObserver::HandleMediaL( TInt aListIndex, MGlxMediaList* aList )
       
   190     {
       
   191     TRACER("CGlxMLGenericObserver::HandleMediaL()");
       
   192 	//Forward call to the MLWrapperPrivate
       
   193     iMLWrapperPrivate->HandleMediaL(aListIndex,aList);
       
   194 
       
   195     }
       
   196   
       
   197 // ----------------------------------------------------------------------------
       
   198 // HandleItemModifiedL
       
   199 // ----------------------------------------------------------------------------
       
   200 //  
       
   201 void CGlxMLGenericObserver::HandleItemModifiedL( const RArray<TInt>& aItemIndexes,
       
   202     MGlxMediaList* aList)
       
   203     {
       
   204     TRACER("CGlxMLGenericObserver::HandleItemModifiedL()");
       
   205 	//Forward call to the MLWrapperPrivate
       
   206     iMLWrapperPrivate->HandleItemModifiedL(aItemIndexes, aList);
       
   207     }
       
   208