photosgallery/viewframework/views/fullscreenview/src/glxslmpfavmlobserver.cpp
changeset 0 4e91876724a2
child 2 7d9067c6fcb1
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    Implementation of Single line meta pane favourites observer
       
    15 *
       
    16 */
       
    17 
       
    18 #include <glxcollectionpluginalbums.hrh>            // Albums collection plugin implementation id
       
    19 #include <glxfilterfactory.h>                       // FilterFactory
       
    20 #include <mglxmedialist.h>                          // CGlxMedialist
       
    21 #include <glxattributecontext.h>                    // Attribute context
       
    22 #include <glxuistd.h>                               // Attribute fetch priority
       
    23 #include <glxtracer.h>
       
    24 #include <glxlog.h>
       
    25 #include <glxslmpfavmlobserver.h>
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // NewL()
       
    29 // ---------------------------------------------------------------------------
       
    30 //  
       
    31 CGlxSLMPFavMLObserver* CGlxSLMPFavMLObserver::NewL( CGlxSinleLineMetaPane& aSingleLineMetapane,
       
    32         TInt aFocusIndex, MGlxMediaList* aList)
       
    33     {
       
    34     TRACER("CGlxSLMPFavMLObserver::NewL()");
       
    35     CGlxSLMPFavMLObserver* self = new(ELeave) CGlxSLMPFavMLObserver(aSingleLineMetapane);
       
    36     CleanupStack::PushL(self);
       
    37     self->ConstructL(aFocusIndex, aList);
       
    38     CleanupStack::Pop(self);
       
    39     return self;
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CGlxSLMPFavMLObserver()
       
    44 // ---------------------------------------------------------------------------
       
    45 //  
       
    46 CGlxSLMPFavMLObserver::CGlxSLMPFavMLObserver(CGlxSinleLineMetaPane& aSingleLineMetaPane) 
       
    47             : iSingleLineMetaPane( aSingleLineMetaPane)
       
    48     {
       
    49     TRACER("CGlxSLMPFavMLObserver::CGlxSLMPFavMLObserver()");
       
    50     // Nothing done here
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // ~CGlxSLMPFavMLObserver()
       
    55 // ---------------------------------------------------------------------------
       
    56 //  
       
    57 CGlxSLMPFavMLObserver::~CGlxSLMPFavMLObserver()
       
    58     {
       
    59     TRACER("CGlxSLMPFavMLObserver::~CGlxSLMPFavMLObserver()");
       
    60     if (iFavMediaList)
       
    61         {
       
    62         iFavMediaList->RemoveMediaListObserver(this);
       
    63         iFavMediaList->RemoveContext( iFavAttribContext );
       
    64         delete iFavAttribContext;
       
    65         iFavMediaList->Close();
       
    66         }
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // ConstructL()
       
    71 // ---------------------------------------------------------------------------
       
    72 //  
       
    73 void CGlxSLMPFavMLObserver::ConstructL(TInt aFocusIndex, MGlxMediaList* aList)
       
    74     {
       
    75     TRACER("CGlxSLMPFavMLObserver::ConstructL()");
       
    76     CMPXCollectionPath* favCollection = CMPXCollectionPath::NewL();
       
    77     CleanupStack::PushL(favCollection);
       
    78     // The target collection has to be appeneded with the albums plugin id
       
    79     favCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid);
       
    80     // The target collection has also to be appeneded with the the relation id.
       
    81     // appending another level into the albums to get favourites and 1 is the relation id of albums
       
    82     favCollection->AppendL( TMPXItemId(1) );
       
    83     favCollection->Set( 0 );
       
    84     const TGlxMedia& item = aList->Item(aFocusIndex);
       
    85     const TDesC& uri = item.Uri();
       
    86     CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(item.Uri());  
       
    87     CleanupStack::PushL(filter);
       
    88 
       
    89     // Create the media list
       
    90     iFavMediaList =  MGlxMediaList::InstanceL( *favCollection, 
       
    91                       TGlxHierarchyId(KGlxCollectionPluginAlbumsDllUid), filter );
       
    92     CleanupStack::PopAndDestroy( filter );
       
    93     CleanupStack::PopAndDestroy( favCollection );
       
    94     iFavMediaList->AddMediaListObserverL(this);
       
    95     iFavAttribContext = CGlxDefaultAttributeContext::NewL();
       
    96     // add all the attributes needed in handleattributes available
       
    97     // this is because even
       
    98     iFavAttribContext->AddAttributeL( KMPXMediaGeneralCount );
       
    99     // Using priority as same as UMP view's album pane
       
   100     iFavMediaList->AddContextL( iFavAttribContext, KGlxFetchContextPriorityLow );
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // HandleAttributesAvailableL()
       
   105 // ---------------------------------------------------------------------------
       
   106 //  
       
   107 void CGlxSLMPFavMLObserver::HandleAttributesAvailableL(TInt/* aItemIndex*/, 
       
   108         const RArray<TMPXAttribute>& /*aAttributes*/, MGlxMediaList* /*aList*/)
       
   109     {
       
   110     TRACER("CGlxSLMPFavMLObserver::HandleAttributesAvailableL()");
       
   111     // No Implementation Required
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // HandleItemAddedL()
       
   116 // ---------------------------------------------------------------------------
       
   117 //  
       
   118 void CGlxSLMPFavMLObserver::HandleItemAddedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/,
       
   119         MGlxMediaList* aList )
       
   120     {
       
   121     TRACER("CGlxSLMPFavMLObserver::HandleItemAddedL()");
       
   122     GLX_LOG_INFO1("CGlxSLMPFavMLObserver::HandleItemAddedL() medialist count = %d", aList->Count());
       
   123     // Passing ETrue as mediacount denotes item present in medialist 
       
   124     iSingleLineMetaPane.HandleUpdateIconL(ETrue);
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------------------------
       
   128 // HandleItemRemovedL()
       
   129 // ---------------------------------------------------------------------------
       
   130 //  
       
   131 void CGlxSLMPFavMLObserver::HandleItemRemovedL( TInt /*aStartIndex*/, TInt /*aEndIndex*/,
       
   132         MGlxMediaList* /*aList */)
       
   133     {
       
   134     TRACER("CGlxSLMPFavMLObserver::HandleItemRemovedL()");
       
   135     // Passing EFalse as mediacount 0 denotes item not present in medialist 
       
   136     iSingleLineMetaPane.HandleUpdateIconL(EFalse);
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // HandleFocusChangedL()
       
   141 // ---------------------------------------------------------------------------
       
   142 //  
       
   143 void CGlxSLMPFavMLObserver::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, 
       
   144         TInt /*aNewIndex*/, TInt /*aOldIndex*/, MGlxMediaList* /*aList*/ )
       
   145     {
       
   146     TRACER("CGlxSLMPFavMLObserver::HandleFocusChangedL()");
       
   147     // No Implementation Required
       
   148     }
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // HandleItemSelectedL()
       
   152 // ---------------------------------------------------------------------------
       
   153 //  
       
   154 void CGlxSLMPFavMLObserver::HandleItemSelectedL(TInt /*aIndex*/, TBool /*aSelected*/,
       
   155         MGlxMediaList* /*aList*/ )
       
   156     {
       
   157     TRACER("CGlxSLMPFavMLObserver::HandleItemSelectedL()");
       
   158     // No Implementation Required
       
   159     }
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // HandleMessageL()
       
   163 // ---------------------------------------------------------------------------
       
   164 //  
       
   165 void CGlxSLMPFavMLObserver::HandleMessageL( const CMPXMessage& /*aMessage*/, 
       
   166         MGlxMediaList* /*aList*/ )
       
   167     {
       
   168     TRACER("CGlxSLMPFavMLObserver::HandleMessageL()");
       
   169     // No Implementation Required
       
   170     }
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // HandleError()
       
   174 // ---------------------------------------------------------------------------
       
   175 //  
       
   176 void CGlxSLMPFavMLObserver::HandleError( TInt /*aError*/ )
       
   177     {
       
   178     TRACER("CGlxSLMPFavMLObserver::HandleError()");
       
   179     // No Implementation Required
       
   180     }
       
   181 
       
   182 // ---------------------------------------------------------------------------
       
   183 // HandleCommandCompleteL()
       
   184 // ---------------------------------------------------------------------------
       
   185 //  
       
   186 void CGlxSLMPFavMLObserver::HandleCommandCompleteL( CMPXCommand* /*aCommandResult*/,
       
   187         TInt /*aError*/, MGlxMediaList* /*aList*/ )
       
   188     {
       
   189     TRACER("CGlxSLMPFavMLObserver::HandleCommandCompleteL()");
       
   190     // No Implementation Required
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // HandleMediaL()
       
   195 // ---------------------------------------------------------------------------
       
   196 //  
       
   197 void CGlxSLMPFavMLObserver::HandleMediaL( TInt /*aListIndex*/, MGlxMediaList* /*aList*/ )
       
   198     {
       
   199     TRACER("CGlxSLMPFavMLObserver::HandleMediaL()");
       
   200     // No Implementation Required
       
   201     }
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // HandleItemModifiedL()
       
   205 // ---------------------------------------------------------------------------
       
   206 //  
       
   207 void CGlxSLMPFavMLObserver::HandleItemModifiedL( const RArray<TInt>& /*aItemIndexes*/, 
       
   208         MGlxMediaList* /*aList*/ )
       
   209     {
       
   210     TRACER("CGlxSLMPFavMLObserver::HandleItemModifiedL()");
       
   211     // No Implementation Required
       
   212     }
       
   213 
       
   214 
       
   215 //EOF