photosgallery/contentharvesterplugin/src/glxcontentharvesterpluginbase.cpp
changeset 0 4e91876724a2
child 1 9ba538e329bd
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 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <featmgr.h>
       
    22 #include <apgtask.h>
       
    23 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    24 #include <liwservicehandler.h>
       
    25 #include <glxuistd.h>     // KGlxFetchontextPriorityNormal and KGlxIconsFilename  
       
    26 #include <AknIconUtils.h> 
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 #include <glxattributecontext.h>
       
    30 #include <glxtracer.h>
       
    31 #include <glxlog.h>
       
    32 #include <mglxmedialist.h>       // for MGlxMediaList
       
    33 #include <glxcollectiongeneraldefs.h>
       
    34 #include <glxgallery.hrh>               // for KGlxGalleryApplicationUid
       
    35 #include <glxfilterfactory.h>
       
    36 #include <glxuistd.h>
       
    37 #include <glxthumbnailcontext.h>
       
    38 #include <glxmedialistiterator.h>
       
    39 #include <mglxcache.h>
       
    40 
       
    41 #include "glxcontentharvesterplugin.h"
       
    42 #include "glxcontentharvesterpluginbase.h"
       
    43 #include "glxcontentharvesterplugin.hrh"
       
    44 #include "glxmapconstants.h"
       
    45 #include "glxcontentharvesterpluginalbums.h"
       
    46 
       
    47 // Matrixmenu uid - needed to check if photo suite is in foreground
       
    48 const TInt KMatrixMenuUid = 0x101F4CD2;
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS ==============================
       
    51 
       
    52 // ----------------------------------------------------------------------------
       
    53 // Constructor
       
    54 // ----------------------------------------------------------------------------
       
    55 //
       
    56 CGlxContentHarvesterPluginBase::CGlxContentHarvesterPluginBase( )
       
    57     {
       
    58     TRACER( "CGlxContentHarvesterPluginBase::CGlxContentHarvesterPluginBase" );
       
    59     // No Implementation
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // Symbian 2nd phase constructor.
       
    64 // ----------------------------------------------------------------------------
       
    65 //
       
    66 void CGlxContentHarvesterPluginBase::ConstructL(TInt aDefaultIconId )
       
    67     {
       
    68     SetGridIconSizeL();
       
    69     TSize gridIconSize = GetGridIconSize();
       
    70     TFileName resFile(KDC_APP_BITMAP_DIR);
       
    71     resFile.Append(KGlxIconsFilename);
       
    72     iBitmap = AknIconUtils::CreateIconL(resFile,aDefaultIconId);
       
    73     AknIconUtils::SetSize(iBitmap, gridIconSize);
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // Destructor
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 CGlxContentHarvesterPluginBase::~CGlxContentHarvesterPluginBase()
       
    81     {
       
    82     TRACER( "CGlxContentHarvesterPluginBase::~CGlxContentHarvesterPluginBase" );
       
    83     if ( iCPSNotificationInterface )
       
    84         {
       
    85         iCPSNotificationInterface->Close();
       
    86         }
       
    87   
       
    88     delete iServiceHandler;
       
    89     
       
    90     if(iBitmap)
       
    91         {
       
    92          delete iBitmap;
       
    93          iBitmap=NULL;
       
    94         }
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // SetGridIconSizeL
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CGlxContentHarvesterPluginBase::SetGridIconSizeL()
       
   102     {
       
   103     TRACER("CGlxContentHarvesterPluginBase::SetGridIconSizeL()");
       
   104     // Sets up TLS, must be done before FeatureManager is used.
       
   105     FeatureManager::InitializeLibL();
       
   106 
       
   107     if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch ))
       
   108         {
       
   109         iGridIconSize = TSize(111,83);
       
   110         }
       
   111     else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || 
       
   112             FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640))
       
   113         {
       
   114         iGridIconSize = TSize(146,110);
       
   115         }
       
   116     else
       
   117         {
       
   118         iGridIconSize = TSize(146,110);
       
   119         }
       
   120     // Frees the TLS. Must be done after FeatureManager is used.
       
   121     FeatureManager::UnInitializeLib(); 
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // GetGridIconSize
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 TSize CGlxContentHarvesterPluginBase::GetGridIconSize()
       
   129     {
       
   130     TRACER("CGlxContentHarvesterPluginBase::GetGridIconSize()");
       
   131     return iGridIconSize;
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // GetBitmapHandle
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 TInt CGlxContentHarvesterPluginBase::GetBitmapHandle() const
       
   139     {
       
   140     TRACER("CGlxContentHarvesterPluginBase::GetBitmapHandle");
       
   141     return iBitmap->Handle();
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // GetInterfaceForNotificationL
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 void CGlxContentHarvesterPluginBase::GetInterfaceForNotificationL()
       
   149     {
       
   150     TRACER( "CGlxContentHarvesterPluginBase::GetInterfaceForNotificationL" );
       
   151     // create Service Handler and keep as long as access to Service needed
       
   152     iServiceHandler = CLiwServiceHandler::NewL();
       
   153     //keep for convenience, not owned
       
   154     iInParamList = &iServiceHandler->InParamListL();
       
   155     iOutParamList = &iServiceHandler->OutParamListL();
       
   156 
       
   157     RCriteriaArray criteriaArray;
       
   158     CleanupResetAndDestroyPushL( criteriaArray );
       
   159 
       
   160     // create Liw criteria
       
   161     CLiwCriteriaItem* criterion = 
       
   162     CLiwCriteriaItem::NewLC( KLiwCmdAsStr, KCPInterface, KCPService ); 
       
   163     criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) );
       
   164 
       
   165     criteriaArray.AppendL( criterion );
       
   166     CleanupStack::Pop( criterion );
       
   167 
       
   168     // attach Liw criteria
       
   169     iServiceHandler->AttachL( criteriaArray );
       
   170     // get Service interface
       
   171     iServiceHandler->ExecuteServiceCmdL( *criterion, 
       
   172             *iInParamList, 
       
   173             *iOutParamList );
       
   174 
       
   175     CleanupStack::PopAndDestroy( &criteriaArray );
       
   176 
       
   177     // extract interface from output params
       
   178     TInt pos( 0 );
       
   179     iOutParamList->FindFirst( pos, KCPInterface );
       
   180     if( pos != KErrNotFound )
       
   181         {
       
   182         iCPSNotificationInterface = 
       
   183         (*iOutParamList)[pos].Value().AsInterface();    
       
   184         }
       
   185 
       
   186     iInParamList->Reset();
       
   187     iOutParamList->Reset();
       
   188 
       
   189     if ( !iCPSNotificationInterface )
       
   190         {
       
   191         // handle no Service
       
   192         User::Leave( KErrNotFound );
       
   193         }
       
   194     }
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // RequestCpsNotificationL
       
   198 // ---------------------------------------------------------------------------
       
   199 //
       
   200 void CGlxContentHarvesterPluginBase::RequestCpsNotificationL(TInt aSuiteItem)
       
   201     {
       
   202     TRACER( "CGlxContentHarvesterPluginBase::RequestCpsNotificationL" );
       
   203 
       
   204     TLiwGenericParam cptype( KType, TLiwVariant( KPublisherId ));
       
   205     iInParamList->AppendL( cptype );
       
   206 
       
   207     //create filter
       
   208     CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC();
       
   209     filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher ));
       
   210 
       
   211     switch (aSuiteItem)
       
   212         {
       
   213         case KItemIndexMonths:
       
   214             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) );
       
   215             break;
       
   216         case KItemIndexAlbums:
       
   217             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) );
       
   218             break;
       
   219         case KItemIndexTags:
       
   220             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) );
       
   221             break;
       
   222         case KItemIndexAll:
       
   223             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) );
       
   224             break;
       
   225         }
       
   226 
       
   227     filterMap->InsertL( KContentId, TLiwVariant( KContentDefault ) );
       
   228 
       
   229     //we are only interested in update events
       
   230     filterMap->InsertL( KOperation, TLiwVariant( KOperationUpdate ) );
       
   231 
       
   232     TLiwGenericParam filter( KFilter, TLiwVariant( filterMap ));          
       
   233     iInParamList->AppendL( filter );
       
   234 
       
   235     iCPSNotificationInterface->ExecuteCmdL( KRequestNotification, 
       
   236             *iInParamList, 
       
   237             *iOutParamList,
       
   238             KLiwOptASyncronous,
       
   239             this );
       
   240 
       
   241     CleanupStack::PopAndDestroy( filterMap );
       
   242     filter.Reset();
       
   243     cptype.Reset();
       
   244 
       
   245     iInParamList->Reset();
       
   246     iOutParamList->Reset();
       
   247     }
       
   248 
       
   249 // ---------------------------------------------------------------------------
       
   250 // SetupPublisherL
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 void CGlxContentHarvesterPluginBase::SetupPublisherL(TInt aSuiteItem)
       
   254     {
       
   255     TRACER( "CGlxContentHarvesterPluginBase::SetupPublisherL" );
       
   256 
       
   257     //add mandatory type param
       
   258     TLiwGenericParam cptype( KType, TLiwVariant( KPublisherId ));
       
   259     iInParamList->AppendL( cptype );
       
   260 
       
   261     //create publisher definition
       
   262     CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC();
       
   263     filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher ));
       
   264     switch (aSuiteItem)
       
   265         {
       
   266         case KItemIndexMonths:
       
   267             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) );
       
   268             break;
       
   269         case KItemIndexAlbums:
       
   270             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) );
       
   271             break;
       
   272         case KItemIndexTags:
       
   273             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) );
       
   274             break;
       
   275         case KItemIndexAll:
       
   276             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) );
       
   277             break;
       
   278         }
       
   279     filterMap->InsertL( KContentId, TLiwVariant( KContentDefault ) );
       
   280     // initial value for activation flag
       
   281     filterMap->InsertL( KFlag, TLiwVariant( TUint(0) ) );
       
   282 
       
   283 
       
   284     // prepare Access Control List for the publisher
       
   285     CLiwDefaultMap* cpsAclMap = CLiwDefaultMap::NewLC();
       
   286     CLiwDefaultMap* cpsAclWriteMap = CLiwDefaultMap::NewLC();
       
   287     CLiwDefaultMap* cpsAclReadMap = CLiwDefaultMap::NewLC();
       
   288 
       
   289     // write policy - allow only MatrixMenu,
       
   290     // Matrix has 2 UIDs:
       
   291     //     - 0x20012474 is used if it is compiled as a standalone application
       
   292     //     - 0x101F4CD2 is used if it should replace AppShell
       
   293     // add both for convenience
       
   294     cpsAclWriteMap->InsertL( KUIDs, TLiwVariant( _L("0x101F4CD2:0x20012474") ) );
       
   295 
       
   296     // read policy - allow only the Content Harvester plug-in,
       
   297     // this plug-in runs inside Content Harvester server - UID 0x10282E5A
       
   298     cpsAclReadMap->InsertL( KUIDs, TLiwVariant( _L("0x10282E5A") ) );
       
   299 
       
   300     cpsAclMap->InsertL( KACLWrite, TLiwVariant( cpsAclWriteMap ) );
       
   301     cpsAclMap->InsertL( KACLRead, TLiwVariant( cpsAclReadMap ) );
       
   302 
       
   303     filterMap->InsertL( KAccessList, TLiwVariant( cpsAclMap ) );
       
   304 
       
   305     // create a dummy data map,
       
   306     // mandatory for adding publisher data - can be left empty
       
   307     CLiwDefaultMap* cpsDummyDataMap = CLiwDefaultMap::NewLC();
       
   308     filterMap->InsertL( KDataMap, TLiwVariant( cpsDummyDataMap ) );
       
   309 
       
   310     TLiwGenericParam cpsItemParam( KItem, TLiwVariant( filterMap ) );       
       
   311     iInParamList->AppendL( cpsItemParam );
       
   312 
       
   313 
       
   314     iCPSNotificationInterface->ExecuteCmdL( KAdd, 
       
   315             *iInParamList, 
       
   316             *iOutParamList,
       
   317             0,
       
   318             NULL );
       
   319     CleanupStack::PopAndDestroy( cpsDummyDataMap );
       
   320     CleanupStack::PopAndDestroy( cpsAclReadMap );
       
   321     CleanupStack::PopAndDestroy( cpsAclWriteMap );
       
   322     CleanupStack::PopAndDestroy( cpsAclMap );
       
   323     CleanupStack::PopAndDestroy( filterMap );
       
   324     cpsItemParam.Reset();
       
   325     // filter.Reset();
       
   326     cptype.Reset();
       
   327 
       
   328     iInParamList->Reset();
       
   329     iOutParamList->Reset();
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // HandleStateChangeL
       
   334 // ---------------------------------------------------------------------------
       
   335 //
       
   336 void CGlxContentHarvesterPluginBase::HandleStateChangeL(TInt aSuiteItem)
       
   337     {
       
   338     TRACER( "CGlxContentHarvesterPluginBase::HandleStateChangeL" );
       
   339 
       
   340     TLiwGenericParam cptype( KType, TLiwVariant( KPublisher ));
       
   341     iInParamList->AppendL( cptype );
       
   342 
       
   343     CLiwDefaultMap* filterMap = CLiwDefaultMap::NewLC();
       
   344     filterMap->InsertL( KPublisherId, TLiwVariant( KSuitePublisher ));
       
   345     switch (aSuiteItem)
       
   346         {
       
   347         case KItemIndexMonths:
       
   348             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationMonths ) );
       
   349             break;
       
   350 
       
   351         case KItemIndexAlbums:
       
   352             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAlbums ) );
       
   353             break;
       
   354 
       
   355         case KItemIndexTags:
       
   356             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationTags ) );
       
   357             break;
       
   358 
       
   359         case KItemIndexAll:
       
   360             filterMap->InsertL( KContentType, TLiwVariant( KContentActivationAll ) );
       
   361             break;
       
   362         }
       
   363 
       
   364     TLiwGenericParam filter( KFilter, TLiwVariant( filterMap ));      
       
   365     iInParamList->AppendL( filter );
       
   366 
       
   367 
       
   368     iCPSNotificationInterface->ExecuteCmdL( KGetList, 
       
   369             *iInParamList, 
       
   370             *iOutParamList,
       
   371             0,
       
   372             NULL );
       
   373 
       
   374     CleanupStack::PopAndDestroy( filterMap );
       
   375 
       
   376     filter.Reset();
       
   377     cptype.Reset();
       
   378 
       
   379     TInt posStat( 0 );
       
   380     iOutParamList->FindFirst( posStat, KResults );
       
   381     if( posStat != KErrNotFound )
       
   382         {
       
   383         // status info present - extract and return
       
   384         CLiwIterable* results = (*iOutParamList)[posStat].Value().AsIterable();
       
   385         TLiwVariant cpdata;
       
   386         if ( results->NextL( cpdata ) )
       
   387             {
       
   388             const CLiwMap* map = cpdata.AsMap();
       
   389             TLiwVariant dataMapVar;
       
   390             if ( map->FindL( _L8("flag"), dataMapVar ) )
       
   391                 {
       
   392                 ActivateL(dataMapVar.AsTInt32());
       
   393                 }
       
   394             dataMapVar.Reset();
       
   395             }
       
   396         cpdata.Reset();
       
   397         }
       
   398     else
       
   399         {
       
   400         // no return value
       
   401         // this will happen if suite was never activated/deactivated before
       
   402         // handle gracefuly - ignore and wait for action ;]
       
   403         }
       
   404 
       
   405     iInParamList->Reset();
       
   406     iOutParamList->Reset();
       
   407 
       
   408     }
       
   409 
       
   410 
       
   411 // ----------------------------------------------------------------------------
       
   412 // CGlxContentHarvesterPluginBase::FillInputListWithDataL()
       
   413 // ----------------------------------------------------------------------------
       
   414 //
       
   415 void CGlxContentHarvesterPluginBase::FillInputListWithDataL( 
       
   416         CLiwGenericParamList* aInParamList,
       
   417         const TDesC& aPublisherId, const TDesC& aContentType, 
       
   418         const TDesC& aContentId, TInt aHandle)
       
   419     {
       
   420     TRACER( "CGlxContentHarvesterPluginBase::FillInputListWithDataL" );
       
   421 
       
   422     aInParamList->Reset();
       
   423 
       
   424     TLiwGenericParam cptype( KType, TLiwVariant( KCpData ));
       
   425     aInParamList->AppendL( cptype );
       
   426 
       
   427     CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
       
   428     CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
       
   429 
       
   430     if(aHandle)
       
   431         {
       
   432         map->InsertL( KFirstIcon, TLiwVariant( (TInt32)aHandle) );
       
   433         }
       
   434 
       
   435     cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
       
   436     cpdatamap->InsertL( KContentType, TLiwVariant( aContentType )); 
       
   437     cpdatamap->InsertL( KContentId, TLiwVariant( aContentId ));
       
   438     cpdatamap->InsertL( KDataMap, TLiwVariant(map) );
       
   439 
       
   440     TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ));        
       
   441     aInParamList->AppendL( item );
       
   442     CleanupStack::PopAndDestroy( map );
       
   443     CleanupStack::PopAndDestroy( cpdatamap );
       
   444     item.Reset();
       
   445     cptype.Reset(); 
       
   446 
       
   447     }
       
   448 
       
   449 // ---------------------------------------------------------------------------
       
   450 // CreateMedialistAndThumbnailContextL
       
   451 // ---------------------------------------------------------------------------
       
   452 //
       
   453 MGlxMediaList* CGlxContentHarvesterPluginBase::CreateMedialistAndThumbnailContextL(const TGlxMediaId& 
       
   454         aPluginId,CGlxThumbnailContext* aThumbnailContext) const
       
   455         {
       
   456         TRACER( "CGlxContentHarvesterPluginBase::CreateMedialistAndThumbnailContextL" );        
       
   457 
       
   458         CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
   459         CleanupStack::PushL( path );
       
   460         path->AppendL( aPluginId.Value() );               
       
   461 
       
   462         CMPXFilter* filter = NULL;
       
   463         filter = TGlxFilterFactory::CreatePreviewFilterL(); 
       
   464         CleanupStack::PushL( filter );
       
   465 
       
   466         MGlxMediaList* mediaList = MGlxMediaList::InstanceL( *path, KGlxIdNone , filter);
       
   467         CleanupStack::PopAndDestroy( filter );
       
   468         CleanupStack::PopAndDestroy( path );
       
   469         aThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth,iGridIconSize.iHeight); 
       
   470         return mediaList;
       
   471         }
       
   472 
       
   473 // ---------------------------------------------------------------------------
       
   474 // CGlxContentHarvesterPluginBase::IsFocused
       
   475 // ---------------------------------------------------------------------------
       
   476 //
       
   477 TBool CGlxContentHarvesterPluginBase::IsFocused() const
       
   478     {
       
   479     TRACER( "CGlxContentHarvesterPluginBase::IsFocused" );
       
   480     GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::IsFocused,isFocused=%d",iIsFocused);
       
   481     return iIsFocused;
       
   482     }
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 // CGlxContentHarvesterPluginBase::Focused
       
   486 // ---------------------------------------------------------------------------
       
   487 //
       
   488 TBool CGlxContentHarvesterPluginBase::Focused()
       
   489     {
       
   490     TRACER( "CGlxContentHarvesterPluginBase::Focused" );
       
   491     GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::Focused(%d)", iIsFocused);
       
   492     return iIsFocused;
       
   493     }
       
   494 
       
   495 // ---------------------------------------------------------------------------
       
   496 // CGlxContentHarvesterPluginBase::SetFocus
       
   497 // ---------------------------------------------------------------------------
       
   498 //
       
   499 void CGlxContentHarvesterPluginBase::SetFocus(TBool aFocus )
       
   500     {
       
   501     TRACER( "CGlxContentHarvesterPluginBase::SetFocus" );
       
   502     iIsFocused=aFocus;
       
   503     }
       
   504 
       
   505 // ---------------------------------------------------------------------------
       
   506 // ContainerCacheCleanupL
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 void CGlxContentHarvesterPluginBase::ContainerCacheCleanupL(MGlxMediaList* aMediaList)
       
   510     {
       
   511     TRACER( "CGlxContentHarvesterPluginBase::ContainerCacheCleanupL" ); 
       
   512       
       
   513     if ( IsMatrixMenuInForegroundL() )
       
   514         {
       
   515         MGlxCache* cacheManager = MGlxCache::InstanceL();   
       
   516         for(TInt i=0 ; i< aMediaList->Count();i++)
       
   517             {  
       
   518             GLX_LOG_INFO1("CGlxContentHarvesterPluginBase::ForceCleanupMedia(%d)", i);
       
   519             cacheManager->ForceCleanupMedia(aMediaList->IdSpaceId(i),
       
   520                                             aMediaList->Item(i).Id());
       
   521             }
       
   522         cacheManager->Close();  
       
   523         }    
       
   524     }
       
   525 
       
   526 // ---------------------------------------------------------------------------
       
   527 // IsMatrixMenuInForegroundL
       
   528 // ---------------------------------------------------------------------------
       
   529 //
       
   530 TBool CGlxContentHarvesterPluginBase::IsMatrixMenuInForegroundL()
       
   531     {
       
   532     TRACER( "CGlxContentHarvesterPluginBase::IsMatrixMenuInForegroundL" );
       
   533     
       
   534     RWsSession wssession;
       
   535     User::LeaveIfError(wssession.Connect());
       
   536     CleanupClosePushL(wssession);
       
   537         
       
   538     TApaTaskList taskList( wssession );       
       
   539     TApaTask task = taskList.FindApp( TUid::Uid( KMatrixMenuUid ) );
       
   540     // get fopreground app
       
   541     TApaTask taskForeGround = taskList.FindByPos(0); 
       
   542    
       
   543     if ( task.Exists() && task.ThreadId() == taskForeGround.ThreadId() )
       
   544         {
       
   545         CleanupStack::PopAndDestroy( &wssession ); 
       
   546         return ETrue;
       
   547         } 
       
   548     CleanupStack::PopAndDestroy( &wssession ); 
       
   549     return EFalse;
       
   550     }
       
   551 
       
   552 // ---------------------------------------------------------------------------
       
   553 // SetCHPlugin
       
   554 // ---------------------------------------------------------------------------
       
   555 //
       
   556 void CGlxContentHarvesterPluginBase::SetCHPlugin(MGlxContentHarvesterPlugin* aCHplugin)
       
   557 	{
       
   558 	iCHplugin = aCHplugin;
       
   559 	}
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // GetCHPlugin
       
   563 // ---------------------------------------------------------------------------
       
   564 //
       
   565 MGlxContentHarvesterPlugin* CGlxContentHarvesterPluginBase::GetCHPlugin()
       
   566 	{
       
   567 	return iCHplugin;
       
   568 	}
       
   569 
       
   570 // EOF