photosgallery/contentharvesterplugin/src/glxcontentharvesterplugin.cpp
changeset 0 4e91876724a2
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:    Updates CPS storage
       
    15  *
       
    16  */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 //photo headers
       
    21 
       
    22 
       
    23 #include <glxattributecontext.h>
       
    24 #include <glxtracer.h>
       
    25 #include <glxlog.h>
       
    26 #include <mglxmedialist.h>       // for MGlxMediaList
       
    27 #include <glxcollectiongeneraldefs.h>
       
    28 #include <glxgallery.hrh>               // for KGlxGalleryApplicationUid
       
    29 #include <mpxcollectionutility.h>
       
    30 #include <glxcollectionpluginmonths.hrh>
       
    31 #include <glxuistd.h>
       
    32 
       
    33 #include <MtpPrivatePSKeys.h>
       
    34 #include <e32property.h>
       
    35 
       
    36 //local headers
       
    37 #include "glxcontentharvesterplugin.h"
       
    38 #include "glxcontentharvesterplugin.hrh"
       
    39 #include "glxmapconstants.h"
       
    40 
       
    41 #include "glxcontentharvesterpluginmonths.h"
       
    42 #include "glxcontentharvesterpluginalbums.h"
       
    43 #include "glxcontentharvesterplugintags.h"
       
    44 #include "glxcontentharvesterpluginall.h"
       
    45 
       
    46 
       
    47 
       
    48 
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ==============================
       
    51 
       
    52 // ----------------------------------------------------------------------------
       
    53 // Constructor
       
    54 // ----------------------------------------------------------------------------
       
    55 //
       
    56 CGlxContentHarvesterPlugin::CGlxContentHarvesterPlugin( MLiwInterface* aCPSInterface )
       
    57     {
       
    58     TRACER( "CGlxContentHarvesterPlugin::CGlxContentHarvesterPlugin" );
       
    59     iCPSInterface = aCPSInterface;
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // Symbian 2nd phase constructor can leave.
       
    64 // ----------------------------------------------------------------------------
       
    65 //
       
    66 void CGlxContentHarvesterPlugin::ConstructL()
       
    67     {
       
    68     TRACER( "CGlxContentHarvesterPlugin::ConstructL" );
       
    69 
       
    70     CreateMedialistL();
       
    71 
       
    72 	// Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder    
       
    73     CGlxContentHarvesterPluginAll* allContents = CGlxContentHarvesterPluginAll::NewLC(iCPSInterface,this);
       
    74     iEntries.AppendL(allContents);
       
    75     CleanupStack::Pop(allContents); 
       
    76 
       
    77     CGlxContentHarvesterPluginMonths* monthsContents = CGlxContentHarvesterPluginMonths::NewLC(iCPSInterface,this);
       
    78     iEntries.AppendL(monthsContents);
       
    79     CleanupStack::Pop(monthsContents); 
       
    80 
       
    81     CGlxContentHarvesterPluginAlbums* albumContents = CGlxContentHarvesterPluginAlbums::NewLC(iCPSInterface,this);
       
    82     iEntries.AppendL(albumContents);
       
    83     CleanupStack::Pop(albumContents);  
       
    84 
       
    85     CGlxContentHarvesterPluginTags* tagContents = CGlxContentHarvesterPluginTags::NewLC(iCPSInterface,this);
       
    86     iEntries.AppendL(tagContents);
       
    87     CleanupStack::Pop(tagContents);
       
    88     for(TInt pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++)
       
    89         {
       
    90         iCollectionIndexes.Insert(KErrNotFound, pluginIndex);
       
    91         }
       
    92     }
       
    93 
       
    94 // ----------------------------------------------------------------------------
       
    95 // Two-phased constructor.
       
    96 // ----------------------------------------------------------------------------
       
    97 //
       
    98 CGlxContentHarvesterPlugin* CGlxContentHarvesterPlugin::NewL(  MLiwInterface* aCPSInterface )
       
    99     {
       
   100     TRACER( "CGlxContentHarvesterPlugin::NewL" );
       
   101     CGlxContentHarvesterPlugin* self = new ( ELeave ) CGlxContentHarvesterPlugin( aCPSInterface );
       
   102     CleanupStack::PushL(self);
       
   103     self->ConstructL();
       
   104     CleanupStack::Pop(self);
       
   105     return self;
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // Destructor
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 CGlxContentHarvesterPlugin::~CGlxContentHarvesterPlugin()
       
   113     {
       
   114     TRACER( "CGlxContentHarvesterPlugin::~CGlxContentHarvesterPlugin" );
       
   115     // destroy entries
       
   116     iEntries.ResetAndDestroy();
       
   117     DestroyMedialist();
       
   118     iCollectionIndexes.Reset();
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // This function updates information in CPS storage
       
   123 // ----------------------------------------------------------------------------
       
   124 //	
       
   125 void CGlxContentHarvesterPlugin::UpdateL() 
       
   126     {
       
   127     TRACER( "CGlxContentHarvesterPlugin::UpdateL" );
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // CGlxContentHarvesterPlugin::CollectionPathLC( )
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 CMPXCollectionPath* CGlxContentHarvesterPlugin::CollectionPathLC( 
       
   135         const TGlxMediaId& aPluginId ) const
       
   136         {
       
   137         TRACER( "CGlxContentHarvesterPlugin::CollectionPathLC" );
       
   138         // create the collection path - uses the category ID from the constructor    
       
   139         CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   140         CleanupStack::PushL( path );
       
   141         path->AppendL( aPluginId.Value() );               
       
   142         return path;
       
   143         }
       
   144 
       
   145 // ----------------------------------------------------------------------------
       
   146 // CGlxContentHarvesterPlugin::HandleItemAddedL
       
   147 // ----------------------------------------------------------------------------
       
   148 //
       
   149 void CGlxContentHarvesterPlugin::HandleItemAddedL(TInt /*aStartIndex*/, TInt /*aEndIndex*/, 
       
   150         MGlxMediaList*/* aList*/)
       
   151     {
       
   152     // Do Nothing
       
   153     TRACER( "CGlxContentHarvesterPlugin::HandleItemAddedL" );
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 // CGlxContentHarvesterPlugin::HandleMediaL
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 void CGlxContentHarvesterPlugin::HandleMediaL(TInt /*aListIndex*/, 
       
   161         MGlxMediaList* /*aList*/)
       
   162     {
       
   163     // Do nothing
       
   164     TRACER( "CGlxContentHarvesterPlugin::HandleMediaL" );
       
   165     } 
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // CGlxContentHarvesterPlugin::HandleItemRemovedL
       
   169 // ---------------------------------------------------------------------------
       
   170 //
       
   171 void CGlxContentHarvesterPlugin::HandleItemRemovedL(TInt /*aStartIndex*/, 
       
   172         TInt /*aEndIndex*/, 
       
   173         MGlxMediaList* /*aList*/)
       
   174     {
       
   175     // Do nothing
       
   176     TRACER( "CGlxContentHarvesterPlugin::HandleItemRemovedL" );
       
   177     }
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // CGlxContentHarvesterPlugin::HandleItemModifiedL
       
   181 // ---------------------------------------------------------------------------
       
   182 //
       
   183 void CGlxContentHarvesterPlugin::HandleItemModifiedL(
       
   184         const RArray<TInt>& aItemIndexes, 
       
   185         MGlxMediaList* /*aList*/)
       
   186     {
       
   187     TRACER( "CGlxContentHarvesterPlugin::HandleItemModifiedL" );
       
   188     TInt countOfIndexesChanged = aItemIndexes.Count();
       
   189     for (TInt i = 0; i < countOfIndexesChanged ; i++ )
       
   190         {
       
   191         UpdateDataInCPSL(i);
       
   192         }
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // CGlxContentHarvesterPlugin::HandleAttributesAvailableL
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 void CGlxContentHarvesterPlugin::HandleAttributesAvailableL(TInt aItemIndex, 
       
   200         const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/)
       
   201     {
       
   202     TRACER( "CGlxContentHarvesterPlugin::HandleAttributesAvailableL" );
       
   203     TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle);
       
   204     TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match );
       
   205     GLX_LOG_INFO1("CGlxContentHarvesterPlugin::HandleAttributesAvailableL,aItemIndex=%d",aItemIndex);
       
   206     if (KErrNotFound != aAttributes.Find(subTitleAttrib, match))
       
   207         {
       
   208         GLX_LOG_INFO("CGlxContentHarvesterPlugin::HandleAttributesAvailableL,MATCH Found");
       
   209         if (aItemIndex < KTotalCollection)
       
   210             {
       
   211             TInt mediaCount = iEntries[aItemIndex]->Count();
       
   212             GLX_LOG_INFO1("GlxCH: HandleAttributesAvailableL mediaCount(%d)", mediaCount);
       
   213             if (iCollectionIndexes[aItemIndex] != mediaCount)
       
   214                 {
       
   215 		        GLX_LOG_INFO("GlxCH: *** UpdateDataInCPSL ***");
       
   216                 SetRefreshNeeded(ETrue);
       
   217                 UpdateDataInCPSL(aItemIndex);
       
   218                 iCollectionIndexes[aItemIndex] = mediaCount;
       
   219                 
       
   220                 // Fix for ESLM-7WKJZR :: Sometimes Thumbnails are not updating when 
       
   221                 // connecting/disconnecting USB 
       
   222                 // If there is a change in media count, when photo suite is in forground,                
       
   223                 // Update preview thumbnails of all collections.
       
   224                 if(SuiteInFocus())
       
   225                 	{
       
   226                 	GLX_LOG_INFO("CGlxContentHarvesterPlugin : *** SuiteInFocus ***");
       
   227                 	iEntries[aItemIndex]->UpdatePreviewThumbnailListL();
       
   228                 	}
       
   229                 }
       
   230             }
       
   231         }
       
   232     }
       
   233 
       
   234 // ---------------------------------------------------------------------------
       
   235 // CGlxContentHarvesterPlugin::HandleFocusChangedL
       
   236 // ---------------------------------------------------------------------------
       
   237 //
       
   238 void CGlxContentHarvesterPlugin::HandleFocusChangedL(
       
   239         NGlxListDefs::TFocusChangeType /*aType*/, 
       
   240         TInt /*aNewIndex*/, 
       
   241         TInt /*aOldIndex*/, 
       
   242         MGlxMediaList* /*aList*/)
       
   243     {
       
   244     // Do nothing
       
   245     TRACER( "CGlxContentHarvesterPlugin::HandleFocusChangedL" );
       
   246     }
       
   247 
       
   248 // ---------------------------------------------------------------------------
       
   249 // CGlxContentHarvesterPlugin::HandleItemSelectedL
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void CGlxContentHarvesterPlugin::HandleItemSelectedL(TInt /*aIndex*/, 
       
   253         TBool /*aSelected*/, 
       
   254         MGlxMediaList* /*aList*/)
       
   255     {
       
   256     // Do nothing
       
   257     TRACER( "CGlxContentHarvesterPlugin::HandleItemSelectedL" );
       
   258     }
       
   259 
       
   260 // ---------------------------------------------------------------------------
       
   261 // CGlxContentHarvesterPlugin::HandleMessageL
       
   262 // ---------------------------------------------------------------------------
       
   263 //
       
   264 void CGlxContentHarvesterPlugin::HandleMessageL(const CMPXMessage& /*aMessage*/, 
       
   265         MGlxMediaList* /*aList*/)
       
   266     {
       
   267     // Do nothing
       
   268     TRACER( "CGlxContentHarvesterPlugin::HandleMessageL" );
       
   269     }   
       
   270 
       
   271 // ---------------------------------------------------------------------------
       
   272 // CGlxContentHarvesterPlugin::FillInputListWithDataL
       
   273 // ---------------------------------------------------------------------------
       
   274 //
       
   275 void CGlxContentHarvesterPlugin::FillInputListWithDataL( 
       
   276         CLiwGenericParamList* aInParamList,
       
   277         const TDesC& aPublisherId, const TDesC& aContentType, 
       
   278         TInt aCollection)
       
   279     {
       
   280     TRACER( "CGlxContentHarvesterPlugin::FillInputListWithDataL" );
       
   281 
       
   282     if(iMediaList)
       
   283         {     
       
   284         aInParamList->Reset();
       
   285         if (!iCPSInterface) 
       
   286             {
       
   287             User::Leave( KErrNotFound );
       
   288             } 
       
   289         else
       
   290             {
       
   291             TLiwGenericParam cptype( KType, TLiwVariant( KCpData ));
       
   292             aInParamList->AppendL( cptype );
       
   293 
       
   294             CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
       
   295             CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
       
   296 
       
   297             TBuf8<KMaxName> subTitleTxt;
       
   298             const TGlxMedia& glxMedia = iMediaList->Item(aCollection);
       
   299             switch (aCollection)
       
   300                 {
       
   301 				// Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder
       
   302                 case KItemIndexAll:
       
   303                     subTitleTxt.Append(KAllSubtitle);
       
   304                     break;
       
   305 
       
   306                 case KItemIndexMonths:
       
   307                     subTitleTxt.Append(KMonthsSubtitle);
       
   308                     break;
       
   309 
       
   310                 case KItemIndexAlbums:
       
   311                     subTitleTxt.Append(KAlbumsSubtitle);
       
   312                     break;
       
   313 
       
   314                 case KItemIndexTags:
       
   315                     subTitleTxt.Append(KTagsSubtitle);
       
   316                     break;
       
   317 
       
   318                 default:
       
   319                     break;
       
   320                 }
       
   321 
       
   322 #ifdef _DEBUG
       
   323             TPtrC pStr=  glxMedia.SubTitle();
       
   324             TBuf<KMaxName> buf;
       
   325             buf.Copy(pStr);
       
   326             GLX_LOG_INFO1("CGlxContentHarvesterPlugin::FillInputListWithDataL,SUB TITLE=%S", &subTitleTxt);
       
   327             GLX_LOG_INFO1("CGlxContentHarvesterPlugin::FillInputListWithDataL,SUB TITLE=%S", &buf);
       
   328 #endif            
       
   329 
       
   330             map->Remove(subTitleTxt);
       
   331             map->InsertL( subTitleTxt,  TLiwVariant( glxMedia.SubTitle() ) );
       
   332 
       
   333             cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
       
   334             cpdatamap->InsertL( KContentType, TLiwVariant( aContentType )); 
       
   335             cpdatamap->InsertL( KContentId, TLiwVariant( KContId1 ));
       
   336             cpdatamap->InsertL( KDataMap, TLiwVariant(map) );
       
   337 
       
   338             TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ));        
       
   339             aInParamList->AppendL( item );
       
   340             CleanupStack::PopAndDestroy( map );
       
   341             CleanupStack::PopAndDestroy( cpdatamap );
       
   342             item.Reset();
       
   343             cptype.Reset(); 
       
   344             }
       
   345         }
       
   346     }
       
   347 
       
   348 // ----------------------------------------------------------------------------
       
   349 // CGlxContentHarvesterPlugin::UpdateDataInCPSL()
       
   350 // ----------------------------------------------------------------------------
       
   351 //  
       
   352 void CGlxContentHarvesterPlugin::UpdateDataInCPSL(TInt aCollection) 
       
   353     {
       
   354     TRACER( "CGlxContentHarvesterPlugin::UpdateDataInCPSL" );
       
   355     GLX_LOG_INFO1("GlxCH::UpdateDataInCPSL(%d)", aCollection);
       
   356 
       
   357     TInt mtpStatus = KErrNotFound;
       
   358     RProperty::Get(KMtpPSUid, KMtpPSStatus, mtpStatus);
       
   359     GLX_LOG_INFO1("GlxCH::UpdateDataInCPSL mtpStatus(%d)",mtpStatus);
       
   360     if ( (mtpStatus != KErrNotFound) &&
       
   361          (mtpStatus != EMtpPSStatusUninitialized) )
       
   362 		{
       
   363 	 	if (!SuiteInFocus())
       
   364 	        {
       
   365 	        GLX_LOG_INFO("GlxCH: *** MTP ACTIVE & SUITE NOT IN FOCUS ***");
       
   366     	    return;
       
   367         	}
       
   368 		}
       
   369 
       
   370     //update data in CPS
       
   371     CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC();
       
   372     CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC();
       
   373     TBuf<KMaxName> publisherTxt;
       
   374     TBuf<KMaxName> contTypeTxt;
       
   375 
       
   376     switch (aCollection)
       
   377         {
       
   378 		// Bug Fix @ ESLM-7VWF28 :: " Downloads " collection folder is replaced by " ALL " collection folder
       
   379         case KItemIndexAll:
       
   380             publisherTxt.Append(KPublisherTextAll);
       
   381             contTypeTxt.Append(KContTypeTextAll);
       
   382             break;
       
   383 
       
   384         case KItemIndexMonths:
       
   385             publisherTxt.Append(KPublisherTextMonths);
       
   386             contTypeTxt.Append(KContTypeTextMonths);
       
   387             break;
       
   388 
       
   389         case KItemIndexAlbums:
       
   390             publisherTxt.Append(KPublisherTextAlbums);
       
   391             contTypeTxt.Append(KContTypeTextAlbums);
       
   392             break;
       
   393 
       
   394         case KItemIndexTags:
       
   395             publisherTxt.Append(KPublisherTextTags);
       
   396             contTypeTxt.Append(KContTypeTextTags);
       
   397             break;
       
   398 
       
   399         default:
       
   400             break;
       
   401         }
       
   402 
       
   403     FillInputListWithDataL(inParamList, publisherTxt, contTypeTxt, aCollection);
       
   404 
       
   405     iCPSInterface->ExecuteCmdL( KAdd,  *inParamList, *outParamList );
       
   406     CleanupStack::PopAndDestroy(outParamList);
       
   407     CleanupStack::PopAndDestroy(inParamList);
       
   408     } 
       
   409 
       
   410 // ---------------------------------------------------------------------------
       
   411 // CGlxContentHarvesterPlugin::CreateMedialistL
       
   412 // ---------------------------------------------------------------------------
       
   413 //
       
   414 void CGlxContentHarvesterPlugin::CreateMedialistL()
       
   415     {
       
   416     TRACER( "CGlxContentHarvesterPlugin::CreateMedialistL" );
       
   417     if(!iMediaList)
       
   418         {
       
   419         CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   420         CleanupStack::PushL(path);
       
   421         iMediaList = MGlxMediaList::InstanceL( *path );
       
   422         CreateContextsL();
       
   423         iMediaList->AddMediaListObserverL( this ); 
       
   424         CleanupStack::PopAndDestroy( path );
       
   425         }
       
   426     }
       
   427 
       
   428 // ---------------------------------------------------------------------------
       
   429 // CGlxContentHarvesterPlugin::DestroyMedialist
       
   430 // ---------------------------------------------------------------------------
       
   431 //
       
   432 void CGlxContentHarvesterPlugin::DestroyMedialist()
       
   433     {
       
   434     TRACER( "CGlxContentHarvesterPlugin::DestroyMedialist" );
       
   435     if( iMediaList )
       
   436         {
       
   437         iMediaList->RemoveMediaListObserver( this );
       
   438         iMediaList->RemoveContext(iSubtitleAttributeContext);
       
   439         delete iSubtitleAttributeContext;
       
   440         iSubtitleAttributeContext = NULL;
       
   441         iMediaList->Close();
       
   442         iMediaList = NULL;
       
   443         }
       
   444     }
       
   445 
       
   446 // ---------------------------------------------------------------------------
       
   447 // CGlxContentHarvesterPlugin::CreateContextsL
       
   448 // ---------------------------------------------------------------------------
       
   449 //
       
   450 void CGlxContentHarvesterPlugin::CreateContextsL()
       
   451     {
       
   452     TRACER( "CGlxContentHarvesterPlugin::CreateContextsL" );
       
   453     iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL();
       
   454     iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, KListDataWindowSize );
       
   455     iSubtitleAttributeContext->AddAttributeL( KGlxMediaCollectionPluginSpecificSubTitle );
       
   456     iMediaList->AddContextL( iSubtitleAttributeContext, KMaxInt );
       
   457     }
       
   458 
       
   459 // ---------------------------------------------------------------------------
       
   460 // CGlxContentHarvesterPlugin::HandleError
       
   461 // ---------------------------------------------------------------------------
       
   462 //
       
   463 void CGlxContentHarvesterPlugin::HandleError(TInt /*aError*/)
       
   464     {
       
   465     TRACER( "CGlxContentHarvesterPlugin::HandleError" );    
       
   466     }
       
   467 
       
   468 // ---------------------------------------------------------------------------
       
   469 // CGlxContentHarvesterPlugin::UpdatePlugins
       
   470 // ---------------------------------------------------------------------------
       
   471 //
       
   472 void CGlxContentHarvesterPlugin::UpdatePlugins(TBool aUpdate)
       
   473     {
       
   474     TRACER( "CGlxContentHarvesterPlugin::UpdatePlugins" );  
       
   475     TInt pluginIndex;
       
   476     if(aUpdate)
       
   477         {
       
   478         if(IsRefreshNeeded())
       
   479             {
       
   480             GLX_LOG_INFO1("CGlxContentHarvesterPlugin::UpdatePlugins=%d",iIsRefreshNeeded);
       
   481             for(pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++)
       
   482                 {
       
   483                 iEntries[pluginIndex]->UpdatePreviewThumbnailListL();
       
   484                 }
       
   485             SetRefreshNeeded(EFalse);
       
   486             }
       
   487         }
       
   488     else
       
   489         {
       
   490         //This check is added here,since all the collection are not created on the power 
       
   491         // up of the phone,so we dont need to remove the context at that stage else it will panic.
       
   492         if(iEntries.Count()== KTotalCollection)
       
   493             {
       
   494             for(pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++)
       
   495                 {
       
   496                 iEntries[pluginIndex]->RemoveContextAndObserver();
       
   497                 }
       
   498             //before exiting the matrix menu , need to set this to true
       
   499             //when again matrix menu is launched,the thumbnails has to be updated
       
   500             //this use case is when we have not modified any items in the photos
       
   501             //so refreshneeded will not be set and UpdatePreviewThumbnailListL is not called when
       
   502             //matrix menu gets the focused,so update the refresh state
       
   503             SetRefreshNeeded(ETrue);
       
   504             }
       
   505         }
       
   506     }
       
   507 
       
   508 // ---------------------------------------------------------------------------
       
   509 // CGlxContentHarvesterPlugin::IsRefreshNeeded
       
   510 // ---------------------------------------------------------------------------
       
   511 //
       
   512 TBool CGlxContentHarvesterPlugin::IsRefreshNeeded()
       
   513     {
       
   514     TRACER( "CGlxContentHarvesterPlugin::IsRefreshNeeded" );  
       
   515     GLX_LOG_INFO1("CGlxContentHarvesterPlugin::IsRefreshNeeded(%d)", iIsRefreshNeeded);
       
   516     return iIsRefreshNeeded;
       
   517     }
       
   518 // ---------------------------------------------------------------------------
       
   519 // CGlxContentHarvesterPlugin::SetRefreshNeeded
       
   520 // ---------------------------------------------------------------------------
       
   521 //
       
   522 void CGlxContentHarvesterPlugin::SetRefreshNeeded(TBool aRefreshNeed)
       
   523     {
       
   524     TRACER( "CGlxContentHarvesterPlugin::SetRefreshNeeded" );  
       
   525     GLX_LOG_INFO1("CGlxContentHarvesterPlugin::SetRefreshNeeded(%d)", aRefreshNeed);
       
   526     iIsRefreshNeeded = aRefreshNeed;
       
   527     }
       
   528 
       
   529 // ---------------------------------------------------------------------------
       
   530 // CGlxContentHarvesterPlugin::SuiteInFocus
       
   531 // ---------------------------------------------------------------------------
       
   532 //
       
   533 TBool CGlxContentHarvesterPlugin::SuiteInFocus()
       
   534     {
       
   535     TRACER( "CGlxContentHarvesterPlugin::SuiteInFocus" );  
       
   536     TBool focus = EFalse;
       
   537     for(TInt pluginIndex=0; pluginIndex < KTotalCollection; pluginIndex++)
       
   538         {
       
   539         focus = iEntries[pluginIndex]->Focused();
       
   540         if (focus)
       
   541             {
       
   542             GLX_LOG_INFO1("GlxCH: SuiteInFocus pluginIndex(%d)", pluginIndex);
       
   543             break;
       
   544             }
       
   545         }
       
   546     GLX_LOG_INFO1("CGlxContentHarvesterPlugin::SuiteInFocus focus(%d)", focus);
       
   547     return focus;
       
   548     }
       
   549 
       
   550 //  End of File
       
   551