photosgallery/contentharvesterplugin/inc/glxcontentharvesterplugin.h
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:    Publish the content in the photosuite
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef C_GLXCONTENTHARVESTERPLUGIN_H
       
    19 #define C_GLXCONTENTHARVESTERPLUGIN_H 
       
    20 
       
    21 // INCLUDES
       
    22 
       
    23 #include <liwcommon.h>
       
    24 
       
    25 #include <mglxmedialistobserver.h>  // for MGlxMediaListObserver
       
    26 #include <glxmediaid.h>             // for TGlxMediaId
       
    27 
       
    28 #include <contentharvesterplugin.h>
       
    29 #include <contentharvesterpluginuids.hrh>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 class MGlxMediaList;
       
    34 class CGlxAttributeContext;
       
    35 class TGlxSequentialIterator;
       
    36 class MGlxContentHarvesterPluginEntry;
       
    37 class CGlxDefaultAttributeContext;
       
    38 class CMPXCollectionPath;
       
    39 class CLiwGenericParamList;
       
    40 class CLiwServiceHandler;
       
    41 
       
    42 
       
    43 class MGlxContentHarvesterPlugin
       
    44     {
       
    45 public :
       
    46     virtual void UpdatePlugins(TBool aValue=ETrue)=0;
       
    47     virtual TBool IsRefreshNeeded()=0;
       
    48     virtual void SetRefreshNeeded(TBool aRefreshNeed) =0;
       
    49     virtual TBool SuiteInFocus()=0;
       
    50     };
       
    51 
       
    52 // CLASS DECLARATION
       
    53 /**
       
    54  *  CP  Content Harvester plugin
       
    55  *
       
    56  */
       
    57 
       
    58 class CGlxContentHarvesterPlugin : public CContentHarvesterPlugin, public MGlxMediaListObserver,
       
    59                                    public MGlxContentHarvesterPlugin 
       
    60     {
       
    61 public: // Constructors and destructor
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      */
       
    65     static CGlxContentHarvesterPlugin* NewL( MLiwInterface* aCPSInterface );
       
    66 
       
    67     /**
       
    68      * Destructor.
       
    69      */
       
    70     virtual ~CGlxContentHarvesterPlugin();
       
    71 
       
    72     // from base class 
       
    73 
       
    74     void UpdateL(); 
       
    75 
       
    76 private:
       
    77 
       
    78     /**
       
    79      * Perform the second phase construction 
       
    80      */		
       
    81     void ConstructL();
       
    82 
       
    83     /**
       
    84      * Default constructor.
       
    85      */
       
    86     CGlxContentHarvesterPlugin( MLiwInterface* aCPSInterface );
       
    87 
       
    88     void UpdateDataL();
       
    89 
       
    90     CMPXCollectionPath* CollectionPathLC ( const TGlxMediaId& aPluginId ) const;
       
    91 
       
    92     void UpdateDataInCPSL(TInt aCollection);
       
    93 
       
    94     void FillInputListWithDataL(
       
    95             CLiwGenericParamList* aInParamList,
       
    96             const TDesC& aPublisherId, const TDesC& aContentType, 
       
    97             TInt aCollection );
       
    98 
       
    99     void CreateContextsL();
       
   100 
       
   101     void CreateMedialistL();
       
   102        
       
   103     /*To update the plugins based on the matrix menu is on foreground or background
       
   104      * @parm: aUpdate :if it is true then update all the plugins
       
   105      * @parm: aUpdate :if it is false then remove all the observers.
       
   106      */
       
   107     void UpdatePlugins(TBool aUpdate);
       
   108     
       
   109     /*
       
   110      * Sets if the refresh of the collection is required or not
       
   111      * @parm: aUpdate :if it is true,then plugin has to be updated.
       
   112      * @parm: aUpdate :if it is false,then plugin need not be updated.
       
   113     */
       
   114     void SetRefreshNeeded(TBool aRefreshNeed);
       
   115     
       
   116     /*
       
   117      * check if refresh needed flag is set 
       
   118     */
       
   119     TBool IsRefreshNeeded();
       
   120     
       
   121     void DestroyMedialist();
       
   122     
       
   123     /*
       
   124      * Check if photossuite is in focus 
       
   125      */
       
   126     TBool SuiteInFocus();
       
   127     
       
   128     //Call back from the Media list for any error occured 
       
   129     void HandleError( TInt aError );
       
   130 
       
   131 private: // from MGlxMediaListObserver
       
   132 
       
   133     /**
       
   134      * @ref MGlxMediaListObserver::HandleItemAddedL
       
   135      */
       
   136     void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
       
   137     /**
       
   138      * @ref MGlxMediaListObserver::HandleMediaL
       
   139      */
       
   140     void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
       
   141     /**
       
   142      * @ref MGlxMediaListObserver::HandleItemRemoved
       
   143      */
       
   144     void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
       
   145     /**
       
   146      * @ref MGlxMediaListObserver::HandleItemModifiedL
       
   147      */
       
   148     void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
       
   149     /**
       
   150      * @ref MGlxMediaListObserver::HandleAttributesAvailableL
       
   151      */
       
   152     void HandleAttributesAvailableL(
       
   153             TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList );
       
   154     /**
       
   155      * @ref MGlxMediaListObserver::HandleFocusChangedL
       
   156      */
       
   157     void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, 
       
   158             TInt aOldIndex, MGlxMediaList* aList );
       
   159     /**
       
   160      * @ref MGlxMediaListObserver::HandleItemSelected
       
   161      */
       
   162     void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList );
       
   163     /**
       
   164      * @ref MGlxMediaListObserver::HandleMessageL
       
   165      */
       
   166     void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
       
   167 
       
   168 
       
   169 private: // data
       
   170 
       
   171     /**
       
   172      * Instance of CPS interface used for update with CPS.
       
   173      */
       
   174     MLiwInterface* iCPSInterface;
       
   175 
       
   176     /// Owned: Media list
       
   177     MGlxMediaList* iMediaList;
       
   178 
       
   179     /// Own: the attribute context
       
   180     CGlxDefaultAttributeContext* iSubtitleAttributeContext;
       
   181 
       
   182     // Owned: array of implementation objects
       
   183     RPointerArray<MGlxContentHarvesterPluginEntry> iEntries;
       
   184 
       
   185     // to check if refresh needed for plugins      
       
   186     TBool iIsRefreshNeeded;
       
   187 
       
   188     // Collection Indexes array to refresh the screen
       
   189     RArray<TInt> iCollectionIndexes;    
       
   190     };
       
   191 
       
   192 #endif // C_GLXCONTENTHARVESTERPLUGIN_H