uiservicetab/vimpstui/inc/cvimpstuisearchviewcontrol.h
branchRCL_3
changeset 29 9a48e301e94b
parent 0 5e5d6b214f4f
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Search view control.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef     __CVIMPSTUISEARCHVIEWCONTROL_H
       
    20 #define     __CVIMPSTUISEARCHVIEWCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <bldvariant.hrh>
       
    24 #include <eiklbo.h>
       
    25 #include <coecntrl.h>
       
    26 #include <eikbtgpc.h>
       
    27 #include "tvimpstenums.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CAknDoubleStyleListBox;
       
    31 class MPbk2KeyEventHandler;
       
    32 class MVIMPSTEngine;
       
    33 class MVIMPSTEngineSearchExtentionEventObserver;
       
    34 class MVIMPSTCmdHandler;
       
    35 class CVIMPSTUiSearchView;
       
    36 
       
    37 
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42  * Search view control. Shows search results
       
    43  *  @lib vimpstui.lib
       
    44  *  @since S60 v5.0 
       
    45  */
       
    46 class CVIMPSTUiSearchViewControl :  public CCoeControl,
       
    47                                 	public MEikListBoxObserver,
       
    48 									public MCoeControlObserver
       
    49     {
       
    50            
       
    51     public: // Constructor and destructor
       
    52         /**
       
    53          * Creates a new CVIMPSTUiSearchViewControl.
       
    54          * @param aKeyEventHandler Key event handler to be used
       
    55          * @param aServiceId service id
       
    56          * @param aEngine reference to engine.
       
    57          * @param aCommandHandler reference to commandhandler
       
    58          * @param aSearchView reference to search view.
       
    59          */
       
    60         static CVIMPSTUiSearchViewControl* NewL(MPbk2KeyEventHandler* aKeyEventHandler, 
       
    61         										TUint32 aServiceId,
       
    62         										MVIMPSTEngine& aEngine,
       
    63         										MVIMPSTCmdHandler& aCommandHandler,
       
    64         										CVIMPSTUiSearchView& aSearchView );
       
    65         
       
    66         /**
       
    67          * Creates a new CVIMPSTUiSearchViewControl and leaves it to
       
    68          * cleanup stack.
       
    69          * @see NewL
       
    70          */
       
    71         static CVIMPSTUiSearchViewControl* NewLC( MPbk2KeyEventHandler* aKeyEventHandler,
       
    72         											TUint32 aServiceId,
       
    73         											MVIMPSTEngine& aEngine,
       
    74         											MVIMPSTCmdHandler& aCommandHandler,
       
    75         											CVIMPSTUiSearchView& aSearchView );
       
    76         
       
    77         /**
       
    78          * Destructor.
       
    79          */
       
    80         ~CVIMPSTUiSearchViewControl();
       
    81 
       
    82 	
       
    83     private: 
       
    84     
       
    85         /**
       
    86          * Standard C++ constructor
       
    87          * @param aKeyEventHandler Key event handler to be used
       
    88          * @param aServiceId service id
       
    89          * @param aEngine reference to engine
       
    90          * @param aCommandHandler reference to commandhandler
       
    91          * @param aSearchView reference to search view.
       
    92          * 
       
    93          */    
       
    94         CVIMPSTUiSearchViewControl(	MPbk2KeyEventHandler* aKeyEventHandler,
       
    95         							TUint32 aServiceId,
       
    96         							MVIMPSTEngine& aEngine,
       
    97         							MVIMPSTCmdHandler& aCommandHandler,
       
    98         							CVIMPSTUiSearchView& aSearchView );
       
    99         
       
   100         /**
       
   101          * Performs the 2nd phase of construction.
       
   102          *
       
   103          */        
       
   104         void ConstructL();
       
   105 
       
   106     public: // New functions
       
   107     
       
   108 	   /**
       
   109         * sets the primary and secondary text of this view
       
   110         */
       
   111        void SetEmptyTextsToListboxL();
       
   112        
       
   113        /**
       
   114         * sets the searching text text of this view
       
   115         */
       
   116        void SetSearchingTextToListboxL();
       
   117        
       
   118       /**
       
   119        * Updates the list box with search data
       
   120        * @param aSerachData - search data for listbox to be updated with
       
   121        */
       
   122        void UpdateListBoxL(RArray<TVIMPSTSearchData> aSerachData);
       
   123       
       
   124       
       
   125        /**
       
   126         * returns the list box
       
   127         */
       
   128 		CEikListBox* ListBox() const;
       
   129 
       
   130        /**
       
   131         * extracts the contactId ,allocates memory for contactId and returns
       
   132         * Owership of the contactId is transfered to caller 
       
   133         * 
       
   134         * @return contactId  : Owenership to caller
       
   135         */    
       
   136         HBufC* GetFocusedContactLC() const;
       
   137 
       
   138 		/**
       
   139         * Clears list box contents. I.e. item array.
       
   140         */
       
   141         void ClearListBoxContents();
       
   142         
       
   143        	/**
       
   144         * Starts the conversation with the selected contact
       
   145         * @param aContact : id of the contact 
       
   146         */
       
   147         void OpenConversationL(const TDesC& aContactId );	    
       
   148     
       
   149 
       
   150 	    /**
       
   151         * SearchResultL
       
   152         * @param aSerachData, search data 
       
   153         */
       
   154 		void SearchResultL(RArray<TVIMPSTSearchData> aSerachData) ;
       
   155 		
       
   156 	   /**
       
   157         * SearchFinishedL
       
   158         * @param aError, error any
       
   159         */
       
   160 		void SearchFinishedL(TInt aError);
       
   161 		
       
   162 	    /**
       
   163          * Updates Softkeys according to current focus
       
   164          * @param aUseDefaultCba Flag to force the default sofkeys for view.
       
   165          * Default value is false.
       
   166          */                     
       
   167         void UpdateCbaL( TBool aUseDefaultCba = EFalse );
       
   168                
       
   169    
       
   170     private: // Functions MCoeControlObserver
       
   171     
       
   172     	/**
       
   173 	    * Handles events from findpane and forwards them to listbox filter.
       
   174 	    * @see MCoeControlObserver
       
   175 	    */
       
   176 	    void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );  
       
   177 
       
   178         /**
       
   179         * From MEikListBoxObserver, Handles event's generated by listbox
       
   180         * @param aListBox Pointer to listbox from where this event originated
       
   181         * @param aEventType Type of event received.
       
   182         */
       
   183 		void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   184 
       
   185         
       
   186         /**
       
   187         * From CoeControl, Returns the number of control contained by this class.
       
   188         * @return Number of controls contained
       
   189         */
       
   190         TInt CountComponentControls() const;
       
   191 
       
   192         /**
       
   193         * From CCoeControl, Returns handle to control pointed by aIndex
       
   194         * @param aIndex Wanted control's index [0..n]
       
   195         * @return Handle to wanted control
       
   196         */
       
   197         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   198 
       
   199         /**
       
   200         * From CCoeControl, Handles key-events
       
   201         * @param aEvent Event that occured
       
   202 		* @param aType Type of key-event (EEventKey, EEventKeyUp or EEventKeyDown)
       
   203         * @return Containers response to event (EKeyWasNotConsumed/ EKeyWasConsumed)
       
   204         */
       
   205 		TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aType );
       
   206 		
       
   207 		/**
       
   208         * From CCoeControl,respond to size chnaged
       
   209         */
       
   210 		void SizeChanged();
       
   211 		
       
   212      	
       
   213 	   	
       
   214     private:    // Data
       
   215     
       
   216     	// Not owned: key event handler
       
   217     	MPbk2KeyEventHandler* iKeyEventHandler;
       
   218     	
       
   219         //Service Id 
       
   220 		TUint32 iServiceId ;
       
   221 		
       
   222 	    //Owns
       
   223 		CAknDoubleStyleListBox* iListBox;
       
   224 
       
   225       	//Owns
       
   226 		CDesCArray* iItemArray;
       
   227      	
       
   228         //Doesnt own - reference to engine for this service
       
   229         MVIMPSTEngine& iEngine;
       
   230         
       
   231         //Doesnt own - reference to Command handler for this service
       
   232         MVIMPSTCmdHandler& iCommandHandler;
       
   233         
       
   234         //doesn't own - reference to Searh View
       
   235         CVIMPSTUiSearchView& iSearchView;
       
   236         
       
   237         // CBA. not owned
       
   238         CEikButtonGroupContainer* iCba;     
       
   239 
       
   240         // Storage for previous focus
       
   241         TVIMPSTEnums::TItem iLastFocusedItemType;
       
   242 		
       
   243 		//indicate command to be executed on enter key event.	
       
   244 		TInt iCurrentCmdToExe;
       
   245              
       
   246 	};
       
   247 
       
   248 #endif      // __CVIMPSTUISEARCHVIEWCONTROL_H
       
   249 
       
   250 // End of File