internetradio2.0/uiinc/irhistorylistcontainer.h
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Header for CIRHistoryListContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /* ---------------------------------------------------------------------------
       
    20 *  Version history:
       
    21 *  Template version:
       
    22 *  <ccm_history>
       
    23 *
       
    24 *  Ref:
       
    25 *  Implemented SongHistory changes for channelwise songs
       
    26 *
       
    27 *  </ccm_history>
       
    28 * ============================================================================
       
    29 */
       
    30 
       
    31 #ifndef IRHISTORYLISTCONTAINER_H
       
    32 #define IRHISTORYLISTCONTAINER_H
       
    33 
       
    34 #include <akntreelistobserver.h>
       
    35 #include <akntreelist.h>
       
    36 
       
    37 class CIRHistoryListView;
       
    38 class CIRSongHistoryInfo;
       
    39 class CAknSingleStyleTreeList;
       
    40 
       
    41 /**
       
    42  * Container for History List View.
       
    43  */
       
    44 class CIRHistoryListContainer :public CCoeControl,public MAknTreeListObserver,
       
    45 					public MViewsResponseAndErrorObserver
       
    46     
       
    47     {
       
    48     
       
    49 public:  // Methods
       
    50 
       
    51 	/**
       
    52 	* NewL.
       
    53 	* Two-phased constructor.
       
    54 	* Create a CIRHistoryListContainer object, which will draw itself to aRect.
       
    55     * @return a pointer to the created instance of CIRHistoryListContainer.
       
    56 	*/
       
    57 	static CIRHistoryListContainer* NewL(const TRect& aRect ,CIRHistoryListView &aView ,
       
    58 					RPointerArray<CIRSongHistoryInfo>& aHistoryDataArr);
       
    59 
       
    60 	/**
       
    61 	* NewLC.
       
    62 	* Two-phased constructor.
       
    63 	* Create a CIRHistoryListContainer object, which will draw itself
       
    64 	* to aRect.
       
    65 	* @return A pointer to the created instance of CIRHistoryListContainer.
       
    66 	*/
       
    67 	static CIRHistoryListContainer* NewLC(const TRect& aRect,CIRHistoryListView &aView,
       
    68 					RPointerArray<CIRSongHistoryInfo>& aHistoryDataArr);
       
    69     /**
       
    70      * 2nd phase constructor.
       
    71      */
       
    72     
       
    73     void ConstructL( const TRect& aRect, RPointerArray<CIRSongHistoryInfo>& aHistoryDataArr );
       
    74     
       
    75 
       
    76 	/**
       
    77      * C++ default constructor.
       
    78      *
       
    79 	 * @param aView View of this container.
       
    80      */
       
    81     CIRHistoryListContainer( CIRHistoryListView& aHistoryListView );
       
    82     
       
    83     /**
       
    84      * Destructor.
       
    85      */
       
    86     ~CIRHistoryListContainer();
       
    87 
       
    88 	/**
       
    89 	* SizeChanged()
       
    90 	* 
       
    91 	*/
       
    92 	void SizeChanged();
       
    93 	 
       
    94 
       
    95 	/**
       
    96 	 * UpdateAllL()
       
    97 	 * Updates all items of the list by reading data from preset data base.
       
    98 	 */
       
    99 	 
       
   100  	void UpdateAllL(RPointerArray<CIRSongHistoryInfo>  & aHistoryDataArr);
       
   101 
       
   102     /**
       
   103      * InsertSongEntryL()
       
   104      * Adds the specified list item
       
   105      * 
       
   106      */
       
   107      
       
   108      void InsertSongEntry(const TDesC & aSongName, const TDesC & aArtistName,
       
   109      			 const TDesC & aChannelName, const TDesC & aChannelUrl);
       
   110      
       
   111      /**
       
   112      * RemoveListItemL()
       
   113      * Removes the specified list item
       
   114      * 
       
   115      */
       
   116        
       
   117      void RemoveListItem(const TDesC &aSongName , const TDesC & aArtistName,
       
   118      							 const TDesC & aChannelName);
       
   119 
       
   120   
       
   121      
       
   122    // from base class CCoeControl
       
   123 
       
   124     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   125 	
       
   126 	
       
   127     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   128 
       
   129 	/**
       
   130 	 * From CCoeControl
       
   131 	 *
       
   132 	 * @see CCoeControl::GetHelpContext( TCoeHelpContext& aContext ) const
       
   133 	 */
       
   134 	void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   135 	
       
   136 	/**
       
   137 	 * ClearHistoryList()	 
       
   138 	 * Clears the history list
       
   139 	 */
       
   140 	void ClearHistoryListL();
       
   141 
       
   142 	/**
       
   143 	 * ListenUrlL()
       
   144 	 * Connects to channel url and opens Now Playing view
       
   145 	 */
       
   146 	void ListenUrlL( TInt index );
       
   147 	
       
   148 	/**
       
   149 	* From MAknTreeListObserver.
       
   150 	* Handles tree list events.
       
   151 	*/
       
   152     TBool HandleTreeListEvent( CAknTreeList& aList, TAknTreeItemID aItem,
       
   153             TEvent aEvent );
       
   154             
       
   155 	/**
       
   156 	 * HandleResourceChange()
       
   157 	 * Handles Changes in the resources 
       
   158 	 */
       
   159     void HandleResourceChange( TInt aType ); 
       
   160     
       
   161 	/**
       
   162 	 * GetCurrentFocussedNode()
       
   163 	 * To get the focus of Node of the treeList
       
   164 	 */
       
   165     TInt GetCurrentFocussedNode();
       
   166     
       
   167 	/**
       
   168 	* GetCurrentFocussedLeaf()
       
   169 	* To get the focus of Leaf of the treeList
       
   170 	*/
       
   171     TInt GetCurrentFocussedLeaf();
       
   172     
       
   173 	/**
       
   174 	* AddStationToFavorites()
       
   175 	* For Adding the Station name to the favorites DB.
       
   176 	*/
       
   177     void AddStationToFavoritesL(TInt aCommand);
       
   178     
       
   179 	/**
       
   180 	* DisplayErroronDBL()
       
   181 	* To show error note whenever the Fovorites DB is full
       
   182 	*/
       
   183     void DisplayErroronDBL();
       
   184     
       
   185 	/**
       
   186 	* ShowFocus()
       
   187 	* To return whether a leaf or node is focused 
       
   188 	*/
       
   189     TInt ShowFocus();
       
   190     
       
   191     /**
       
   192 	* void ResponseL()
       
   193 	* Activates the Stations view after getting the IsdsResponse
       
   194 	*/
       
   195 	void ResponseL( CIRIsdsPreset* aPreset = NULL );
       
   196 	
       
   197 	/**
       
   198 	* void PresetResponseL()
       
   199 	* Activates the Stations view after getting the IsdsResponse
       
   200 	*/
       
   201 	void PresetResponseL(CIRIsdsPreset* aPreset);
       
   202 
       
   203     /**
       
   204 	* ErrorL()
       
   205 	* Handles error Conditions
       
   206 	*/
       
   207 	void ErrorL();
       
   208 	
       
   209     /**
       
   210 	* IsdsOrNot()
       
   211 	* Returns Whether ISDS channel or not.
       
   212 	*/
       
   213     TBool IsdsOrNot();
       
   214     
       
   215     /**
       
   216 	* GetButtonDimmed()
       
   217 	* Returns Whether Find in Shop Button is dimmed or not.
       
   218 	*/
       
   219     TBool GetButtonDimmed() ;
       
   220     
       
   221     /**
       
   222 	* RemovedIsdsChannel()
       
   223 	* Plays or AddtoFav the removed isds channel converting it to Userdefined.
       
   224 	*/
       
   225     void RemovedIsdsChannelL() ;
       
   226 
       
   227 
       
   228 private: //Methods
       
   229 
       
   230 	 
       
   231     // from base class CCoeControl
       
   232 	/**
       
   233      * From CCoeControl
       
   234      *
       
   235      * @see CCoeControl::Draw( const TRect& aRect ) const
       
   236 	 */
       
   237 	void Draw( const TRect& aRect ) const;
       
   238 	
       
   239 	
       
   240 	/**
       
   241 	* CountComponentControls() const
       
   242 	* returns the number of components in the view.
       
   243 	*/
       
   244 	TInt CountComponentControls() const;
       
   245 	
       
   246 	/**
       
   247 	* ComponentControl()
       
   248 	* returns the pointer to the control
       
   249 	*/
       
   250 	CCoeControl* ComponentControl(TInt aIndex) const ;
       
   251 	
       
   252 	/**
       
   253 	* Retrieves an object of the same type as that encapsulated in aId.
       
   254 	*
       
   255 	* @param aId An encapsulated object type ID.
       
   256 	*/
       
   257 	
       
   258 	TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   259 	
       
   260 	
       
   261 
       
   262 
       
   263 
       
   264 private:    // Data
       
   265 
       
   266 	CIRHistoryListView & iHistoryListView;
       
   267 	
       
   268     /** 
       
   269 	 * CAknSingleStyleTreeList object for hierarchical list
       
   270 	 */
       
   271 	CAknSingleStyleTreeList* iTreeListBox;
       
   272     /** 
       
   273 	 * CAknsBasicBackgroundControlContext object 
       
   274 	 */
       
   275 	CAknsBasicBackgroundControlContext* iBgContext;
       
   276     /** 
       
   277 	 * Array for storing the Node's TAknTreeItemID 
       
   278 	 */
       
   279     RArray<TInt> iNodeArray;
       
   280     /** 
       
   281 	 * Array for storing the Leaf's TAknTreeItemID
       
   282 	 */
       
   283     RArray<TInt> iLeafArray;
       
   284     /** 
       
   285 	 * Array for storing the URL Name for Listen scenario
       
   286 	 */
       
   287     CDesC16ArrayFlat * iUrlArray;
       
   288     /** 
       
   289 	 * Array for storing the Channel Name 
       
   290 	 */
       
   291     CDesC16ArrayFlat * iChannelArray;
       
   292     /** 
       
   293 	 * Array for storing the Channel Type
       
   294 	 */
       
   295     RArray<TInt>  iChannelTypeArray;
       
   296     
       
   297     /** 
       
   298 	 * Array for storing the Channel Description 
       
   299 	 */
       
   300     CDesC16ArrayFlat * iChannelDescriptionArray;
       
   301     
       
   302 
       
   303     TBool iLoadingCancelled;
       
   304     
       
   305     /** 
       
   306 	 * Array for storing the Channel Id
       
   307 	 */
       
   308     RArray<TInt>  iChannelIdArray;
       
   309     /** 
       
   310 	 * Array for storing the MusicStoreStatus of the channel
       
   311 	 */
       
   312     CDesC16ArrayFlat * iMusicStoreStatus;
       
   313     
       
   314     TBool iDimmed; 
       
   315     
       
   316     /** 
       
   317 	 * Used to store the value of the Id when removed from the isds.
       
   318 	 */
       
   319     TInt iChannelSyncId ;
       
   320     /** 
       
   321 	 * Boolean to store whether Listen request from history view.
       
   322 	 */
       
   323 	TBool iListenFrmHistory;
       
   324     /** 
       
   325 	 * Boolean to store whether AddToFav request from history view.
       
   326 	 */
       
   327     TBool iAddFrmHistory;
       
   328     /** 
       
   329 	 * Used to store the value of the current index of the view removed from the isds.
       
   330 	 */
       
   331     TInt iChangedIndex ;
       
   332     };
       
   333 
       
   334 #endif      // IRHISTORYLISTCONTAINER_H