photosgallery/viewframework/views/metadatadialog/inc/glxmetadatacontainer.h
changeset 0 4e91876724a2
child 13 71da52165949
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:    Metadata dialog implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_GLXMETADATACONTAINER_H__
       
    20 #define C_GLXMETADATACONTAINER_H__ 
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <glxmedialist.h>				    //media list
       
    25 #include <alf/alfenv.h>
       
    26 #include <aknsettingitemlist.h>     // for CAknSettingItem
       
    27 #include "mglxmedialistobserver.h"
       
    28 #include <glxattributecontext.h>  
       
    29 
       
    30 /*
       
    31  * whenever some operation in details view happens,we need to refresh the toolbar area.
       
    32  * Through this observer, we shall notify the main class to refresh the toolbar area.   
       
    33  */
       
    34 class MToolbarResetObserver
       
    35     {
       
    36 public:
       
    37     virtual void HandleToolbarResetting(TBool aVisible)= 0;
       
    38     };
       
    39 
       
    40 //FORWARD DECLARATION
       
    41 class MGlxMediaList;
       
    42 class CGlxDetailsMulModelProvider;
       
    43 class MGlxMetadataDialogObserver;
       
    44 class CGlxCommandHandlerAddToContainer;
       
    45 class CGlxMetadataAsyncUpdate;
       
    46 
       
    47 #include "glxmedia.h"
       
    48 
       
    49 // CLASS DECLARATION
       
    50 /**
       
    51  * CGlxMetadataContainer
       
    52  * 
       
    53  * Metadata Container implementation
       
    54  */
       
    55 NONSHARABLE_CLASS( CGlxMetadataContainer ) : public CAknSettingItemList,
       
    56 public MGlxMediaListObserver
       
    57 
       
    58     {
       
    59 public:  // Constructors and destructor
       
    60     void ViewDynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
       
    61 	/**
       
    62 	* Symbian standard tow phase construction.Construct object of CGlxMetadataContainer object.
       
    63 	* 
       
    64 	* @param aRect rect for control
       
    65 	* @param aMediaList media list
       
    66 	* @return Metadata container object
       
    67 	*/
       
    68     static CGlxMetadataContainer* NewL( const TRect& aRect,
       
    69                                         MGlxMetadataDialogObserver& aDialogObserver,
       
    70                                         const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs );
       
    71     
       
    72     /**
       
    73 	* Symbian standard tow phase construction.Construct object of CGlxMetadataContainer object.
       
    74 	* 
       
    75 	* @param aRect rect for control
       
    76  	* @param aMediaList media list
       
    77 	* @return Metadata container object
       
    78 	*/  
       
    79     static CGlxMetadataContainer* NewLC( const TRect& aRect,
       
    80                                          MGlxMetadataDialogObserver& aDialogObserver,
       
    81                                          const TDesC& aUri,MToolbarResetObserver& aResetToolbarObs);
       
    82 	
       
    83     /**
       
    84     * Destructor
       
    85     */       
       
    86     ~CGlxMetadataContainer();
       
    87 
       
    88 public: 
       
    89  		
       
    90    // @ref CAknSettingItemList::CreateSettingItemL
       
    91    CAknSettingItem* CreateSettingItemL(TInt aIdentifier);
       
    92    
       
    93    // @ref CAknSettingItemList::HandleListBoxEventL
       
    94    void HandleListBoxEventL(CEikListBox* aListBox,
       
    95                                  TListBoxEvent aEventType);
       
    96    void HandleListboxChangesL();
       
    97    
       
    98    //Enable disble the options based on the current selected item
       
    99    TBool IsItemModifiable();
       
   100    TBool IsLicenseItem();
       
   101    TBool IsLocationItem();
       
   102    
       
   103    //Delete the location information
       
   104    void RemoveLocationL();
       
   105    //Change MSK
       
   106 	void ChangeMskL();
       
   107 	//Enable marquee support
       
   108 	void EnableMarqueingL();
       
   109 private:
       
   110 
       
   111 		/**
       
   112 		* C++ constructor.
       
   113 		* 
       
   114 		* @param aMediaList media list
       
   115 		*/
       
   116 		CGlxMetadataContainer(MGlxMetadataDialogObserver& aDialogObserver,const TDesC& aUri
       
   117 		        ,MToolbarResetObserver& aResetToolbarObs);
       
   118 		
       
   119 		/**
       
   120 		* Symbian 2nd phase constructor
       
   121 		* @param aRect rect for this control
       
   122 		*/		
       
   123 		void ConstructL( const TRect& aRect);
       
   124 		
       
   125 		/** 
       
   126 		*  Create media list with URI filter
       
   127 		*  This function creates the collection path filter and finally the MediaList 
       
   128 		*
       
   129 		*  @param aIsRename If ETrue,then MediaList is created with iModifiedUri 
       
   130 		*  ,if EFalse,then created with iUri
       
   131 		*/
       
   132 		void CreateMediaListForSelectedItemL(TBool aIsRename = EFalse);
       
   133 		/** 
       
   134 		*  Create media list to get the tags list for the particular Item.
       
   135 		*  This function creates the collection path filter and finally the MediaList 
       
   136 		*  
       
   137 		*/
       
   138 		void CreateTagsMediaListL();
       
   139 		/** 
       
   140 		*  Create media list to get the Albums list for the particular Item.
       
   141 		*  This function creates the collection path filter and finally the MediaList 
       
   142 		*
       
   143 		*  @param aItemURI uri or file name of item
       
   144 		*/
       
   145 		void CreateAlbumsMediaListL();	    
       
   146 		//Set attributes to the settings list once fetched from medialist.
       
   147 		void SetAttributesL(TMPXAttribute attribute);
       
   148 		//Set the modifed name or description to the list and MDS
       
   149 		void SetNameDescriptionL(TInt aItem);
       
   150 		//Sets the duration and license items based on the selected item
       
   151 		void SetDurationLIicenseItemVisibilityL();
       
   152 		//updates the tags item on callback.
       
   153 		void UpdateTagsL();
       
   154 		//updates the Albums item on callback.
       
   155 		void UpdateAlbumsL();
       
   156 		//Update the details field.
       
   157 		void EditItemL(TInt aIndex, TBool /*aCalledFromMenu*/);
       
   158 		/** 
       
   159 		*  Parse the drive, path & extension from the old uri,
       
   160 		*  And return the modified uri by appending the new title
       
   161 		*
       
   162 		*  @param aTitleText new title entered by user.
       
   163 		*  @return TFileName as modified uri
       
   164 		*/
       
   165 		TFileName ParseFileName(const TDesC& aTitleText);	
       
   166 public:
       
   167 		//MedialistObserver APIS
       
   168 		void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
       
   169 		void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */);
       
   170 		void HandleAttributesAvailableL( TInt aItemIndex, 
       
   171 		const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList );    
       
   172 		void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, 
       
   173 		TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList );
       
   174 		void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList );
       
   175 		void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
       
   176 		void HandleError( TInt aError );
       
   177 		void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, 
       
   178 		MGlxMediaList* aList );
       
   179 		void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
       
   180 		void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
       
   181 		void HandleErrorL();
       
   182 		MGlxMediaList& MediaList();
       
   183 		void HandleCommandCompleteL(TAny* aSessionId, 
       
   184 		        CMPXCommand* /*aCommandResult*/, TInt aError, MGlxMediaList* aList);
       
   185 		/** 
       
   186 		*  Create new mediaList with modified filename.
       
   187 		*/
       
   188 		void RefreshMediaListL();
       
   189 	
       
   190 private: 	//data
       
   191     
       
   192 		MGlxMetadataDialogObserver& iDialogObesrver;
       
   193 		//Flag to check if the item is a video.
       
   194 		TBool iVideo;
       
   195 		//To check if marquee is enabled.
       
   196 		TBool iMarquee;
       
   197 		//to set visible duration and license items based on the Item.
       
   198 		TBool iSetVisible;
       
   199 		TBool iLocationinfo;
       
   200 		RBuf iTextSetter;
       
   201 		RBuf iTagSetter;
       
   202 		RBuf iAlbumSetter;
       
   203 		const TDesC& iUri ;
       
   204 		MGlxMediaList* iItemMediaList;
       
   205 		MGlxMediaList* iTagMediaList;
       
   206 		MGlxMediaList* iAlbumMediaList;
       
   207 		CGlxDefaultAttributeContext* iAlbumContext;
       
   208 		CGlxDefaultAttributeContext* iTagContext;
       
   209 		TGlxSelectionIterator iSelectionIterator;
       
   210 		CGlxAttributeContext* iMainListAttributecontext;   
       
   211 		MToolbarResetObserver& iResetToolbarObs; // observer
       
   212 		//New variable introduce to hold the modified uri name 
       
   213 		//since iUri is const type.     
       
   214     	HBufC* iModifiedUri;
       
   215 		CGlxMetadataAsyncUpdate* iAsyncRequest;
       
   216     };
       
   217     
       
   218 /**
       
   219  * CGlxMetadataAsyncUpdate
       
   220  * 
       
   221  * Metadata asynchronous update implementation
       
   222  * Asynchronously refreshing the MediaList because it can't be done in any MediaList callback.
       
   223  */
       
   224 class CGlxMetadataAsyncUpdate: public CActive
       
   225 	{
       
   226 	
       
   227 	public:
       
   228 		/**
       
   229 		* Symbian standard two phase construction.Construct object of CGlxMetadataAsyncUpdate class.
       
   230 		* 
       
   231 		* @param aObserver CGlxMetadataContainer
       
   232 		* @return MetadataAsynchronous object
       
   233 		*/
       
   234 		static CGlxMetadataAsyncUpdate* NewL(CGlxMetadataContainer& aObserver);
       
   235 		/**
       
   236 		* Symbian standard two phase construction.Construct object of CGlxMetadataAsyncUpdate class.
       
   237 		* 
       
   238 		* @param aObserver CGlxMetadataContainer
       
   239 		* @return MetadataAsynchronous object
       
   240 		*/
       
   241 		static CGlxMetadataAsyncUpdate* NewLC(CGlxMetadataContainer& aObserver);
       
   242 		/**
       
   243 	    * Destructor
       
   244 	    */       
       
   245 	    ~CGlxMetadataAsyncUpdate();
       
   246 	    /**
       
   247 	     * Completes the active object causing a call from the 
       
   248 	     * active scheduler to RunL()
       
   249 	     * (test in RunL using iStatus.Int())
       
   250 	     */
       
   251     	void CompleteSelf();
       
   252 	private:
       
   253 		/**
       
   254 		* C++ constructor.
       
   255 		* 
       
   256 		* @param aObserver CGlxMetadataContainer
       
   257 		*/
       
   258 		CGlxMetadataAsyncUpdate(CGlxMetadataContainer& aObserver);
       
   259 		// from CActive
       
   260 	    void RunL();
       
   261 	    void DoCancel();
       
   262 	    
       
   263     private:
       
   264     	CGlxMetadataContainer& iObserver;
       
   265 	};
       
   266 #endif //C_GLXMETADATACONTAINER_H__
       
   267 
       
   268 //End of file
       
   269