searchui/searchapp/inc/srchuimanager.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:      Manager communicates with the client and srchuigenui
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef C_SEARCH_UI_MANAGER_H
       
    25 #define C_SEARCH_UI_MANAGER_H
       
    26  
       
    27 #include <e32base.h>
       
    28 #include "searchrequirement.h"
       
    29 #include <searchclientsession.h>
       
    30 #include <srchuicustomservice.h>
       
    31 
       
    32 #include "srchuiresulthandler.h"
       
    33 #include "srchuiserviceplugin.h"
       
    34 #include "srchuiresultviewerplugin.h"
       
    35 
       
    36 class CFbsBitmap;
       
    37 class CAknView;
       
    38 class CSrchUiResFolder;
       
    39 class MSrchUiFolder;
       
    40 class CSrchUiResultViewerPlugin;
       
    41 
       
    42 
       
    43 /**
       
    44 * This structure contains the information that is needed by the 
       
    45 * SearchMainView to be displayed.
       
    46 */
       
    47 struct TServiceInfo
       
    48    {
       
    49 
       
    50 public:
       
    51 
       
    52 	/**
       
    53 	 * Service Id
       
    54 	 */	
       
    55 	TUid iServiceId;
       
    56 	
       
    57 	/**
       
    58 	 * Caption for service
       
    59 	 */
       
    60 	HBufC* iPrimaryCaption;
       
    61 	
       
    62 	/**
       
    63 	 * Secondary Caption for service
       
    64 	 */
       
    65 	HBufC* iSecondaryCaption;
       
    66 	
       
    67 	/**
       
    68 	 * Icon
       
    69 	 */
       
    70 	CFbsBitmap* iServiceIcon;
       
    71 	
       
    72 	/**
       
    73 	 * Icon mask
       
    74 	 */
       
    75 	CFbsBitmap* iServiceIconMask;
       
    76 	
       
    77 	/**
       
    78 	 * Visiblity
       
    79 	 */
       
    80 	TBool iVisible;	
       
    81     };
       
    82 
       
    83 
       
    84 /**
       
    85  * Class is an interface for communication between srchgenui and 
       
    86  * search client. 
       
    87  *
       
    88  * And also constructs the result folder.
       
    89  */
       
    90 NONSHARABLE_CLASS( CSrchUiManager ) : public CBase
       
    91   	{
       
    92   		
       
    93 public:	
       
    94          /**
       
    95          * Symbian OS 2 phased constructor.
       
    96          *
       
    97          * @return	A pointer to the created instance of CSrchUiManager.
       
    98          */
       
    99          static CSrchUiManager* NewL();
       
   100 
       
   101          /**
       
   102          * Symbian OS 2 phased constructor.
       
   103          *
       
   104          * @return	A pointer to the created instance of CSrchUiManager.
       
   105          */
       
   106          static CSrchUiManager* NewLC();
       
   107 
       
   108          /**
       
   109          * Destructor
       
   110          */
       
   111          virtual ~CSrchUiManager();
       
   112 	
       
   113 	
       
   114          /**
       
   115 	 * Loads the services that are implemented as the SearchUiCustomPlugIns
       
   116          *
       
   117          * @param aServiceInfoArray Service info array
       
   118          */
       
   119          void LoadUiServicesL( RPointerArray<TServiceInfo>& aServiceInfoArray );	
       
   120 
       
   121          /**
       
   122          * Handles the selection of the a particular service id from the Search 
       
   123          * Main View.If the Service plug in uses light customization, then InDevice
       
   124          * /ServiceMainView is constructed and launched using GeneralSearch Ui
       
   125          * Else, if the Service plug in uses heavy customization, then  
       
   126          * of the plug in is called... If the query string is not NULL, 
       
   127          * then the search is launched for the selected service, without launching
       
   128          * the Service/InDeviceMainView
       
   129          *
       
   130          * Called when the service has been selected by the user.
       
   131          *
       
   132          * @param aQueryString The query string entered by the user.
       
   133          * @param aServiceId The ServiceId of the service.
       
   134          * @param  aSelectedContentTypes All the selected content types
       
   135          *@param aObserver Observer
       
   136          */   
       
   137          void HandleSelectionL ( TDesC8& aQueryString,  TUid aServiceId, 
       
   138                                  RArray <TBool> aSelectedContentTypes, MSearchQueryObserver* aObserver );
       
   139 
       
   140          /**
       
   141          * Gets the supported content classes by the SearchFW
       
   142          * Used by the Service Main view of General Search Ui to display 
       
   143          * the content classes
       
   144          *
       
   145          * @param aSupportedContentClasses supported content classes will be 
       
   146          				placed in this variable
       
   147          * @param aServiceId Service Id of which to be 
       
   148          */
       
   149          void GetSupportedContentClassesL ( RPointerArray<CSearchContent>& 
       
   150 	 		aSupportedContentClasses, const TUid& aServiceId );
       
   151 	
       
   152          /**
       
   153          *
       
   154          * Sets the threshold
       
   155          * @param aThreshold
       
   156          */
       
   157          void SetThreshold( TSearchThreshold aThreshold );
       
   158    	
       
   159       
       
   160          /**
       
   161          * Gets the results
       
   162          *
       
   163          * @param aObserver Obsrever through which results are retrieved
       
   164          */
       
   165          void GetResultL( RPointerArray<CSearchDocumentId>& aResultIdArray,
       
   166      		 MSearchResultRetrieveObserver* aObserver );
       
   167     
       
   168  	
       
   169          /**
       
   170   	 * Getter for iAllContentClassesSelected flag
       
   171          */
       
   172          TBool AllContentClassesSelected() const;
       
   173 	
       
   174          /**
       
   175          * Setter for iAllContentClassesSelected flag
       
   176          */
       
   177          void SetAllContentClassesSelected( TBool aSelected );
       
   178 	
       
   179          /**
       
   180          * Get the selected content types
       
   181          *
       
   182          * @return Boolean values if the selected in same order as the content 
       
   183          * 			types
       
   184          */
       
   185          RArray<TBool>& SelectedContentTypes();
       
   186     
       
   187          /**
       
   188          * Set the selected content types
       
   189          *
       
   190          * @param aSelected
       
   191          */
       
   192          void SetSelectedContentTypesL( RArray<TBool>& aSelected );
       
   193     
       
   194          /**
       
   195          * Updates the supported content classes to the passed parameter
       
   196          *
       
   197          * @param aContentClass content classes to be updated
       
   198          */
       
   199          void UpdateContentClassesL( RPointerArray< CSearchContent> aContentClass );
       
   200 	
       
   201          /**
       
   202          * returns max results allowed
       
   203          *
       
   204          */
       
   205          TInt MaxResults();
       
   206 	
       
   207          /**
       
   208          * Getter for light result count
       
   209          *
       
   210          * @return The number of light result count
       
   211          */
       
   212          TInt LightResultCount();
       
   213 	
       
   214          /**
       
   215          * Sets the last visited view id
       
   216          *
       
   217          * @param aViewId : the view id of the previous view
       
   218          */
       
   219          void SetLastLaunchViewId(const TUid aViewId);
       
   220 	 
       
   221 	 
       
   222          /**
       
   223          * Get the Query string
       
   224          *
       
   225          * @since S60 v3.2
       
   226          * @return : reference to the query string
       
   227          */
       
   228          TDesC8& GetQueryString();
       
   229 
       
   230          /**
       
   231          * From MSrchUiResultHandler
       
   232          *
       
   233          * Launches the application for given document id
       
   234          *
       
   235          * @param aResultId Document Id for which is to be launched
       
   236          */
       
   237          void LaunchApplicationL( const CSearchDocumentId& aResultId );
       
   238     
       
   239          /**
       
   240          * Cancels the search operation
       
   241          */
       
   242          TInt CancelSearch();
       
   243          /**
       
   244 		 * Get the launch infor 
       
   245 		 */         
       
   246          HBufC8* GetLaunchInfoL( const CSearchDocumentId& aDocumentID );
       
   247     					
       
   248 private:
       
   249          // C++ constructor - not exported;
       
   250          // implicitly called from NewLC()
       
   251          /**
       
   252          * Constructor
       
   253          *
       
   254          */
       
   255          CSrchUiManager( );
       
   256 	
       
   257          /**
       
   258          * second-phase constructor
       
   259          *
       
   260          */
       
   261          void ConstructL( ); 
       
   262 	
       
   263          /**
       
   264          * Initializes the Ui Plugins
       
   265          *
       
   266          * @param aImpUid Implementation Uid
       
   267          */	
       
   268          CSrchUiServicePlugin* InitializeUiPlugInsL(TUid aImpUid );
       
   269     	
       
   270          /**
       
   271          * Loads the Plugin information
       
   272          *
       
   273          * @param aServiceInfoArray service info array
       
   274          */
       
   275          void LoadPluginInfoL( RPointerArray<TServiceInfo>& aServiceInfoArray );
       
   276     
       
   277          /**
       
   278          * fires a search
       
   279          *
       
   280          * @param aQueryString query string to be searched
       
   281          * @param aServiceId service id
       
   282          * @param aObserver observer
       
   283          */
       
   284          void FireSeacrhL( TDesC8& aQueryString,TUid aServiceId, 
       
   285                            MSearchQueryObserver* aObserver );
       
   286  
       
   287 private: //data
       
   288 	
       
   289          /**
       
   290          * Service Id
       
   291          */
       
   292          TUid iServiceId;
       
   293      
       
   294          /**
       
   295          * search requirement 
       
   296          * includes query string, where to search, what to search etc.,
       
   297          *
       
   298          * Own
       
   299          */
       
   300          CSearchRequirement* iSearchRequirement;
       
   301      
       
   302          /**
       
   303          * Array of Services available
       
   304          */
       
   305          RPointerArray<CSrchUiServicePlugin> iServices;
       
   306     
       
   307          /**
       
   308          * session with the search client
       
   309          *
       
   310          * Own
       
   311          */
       
   312          CSearchClientSession* iClientSession;
       
   313     
       
   314          /**
       
   315          * Supported content classes
       
   316          */
       
   317          RPointerArray<CSearchContent> iSupportedContentClasses;
       
   318         
       
   319          /**
       
   320          * Number of requests made for e.g, 3rd search request to client
       
   321          */
       
   322          TInt iRequest;
       
   323     
       
   324          /**
       
   325          * Array of selected content type
       
   326          */
       
   327          RArray <TBool> iSelectedContentTypes;
       
   328     
       
   329          /**
       
   330          * Boolean if all classes are selected
       
   331          */
       
   332          TBool iAllContentClassesSelected;
       
   333      
       
   334      
       
   335          /**
       
   336          * Threshold for the search : Max results, max time etc.,
       
   337          */
       
   338          TSearchThreshold iThreshold;
       
   339          };
       
   340 
       
   341 #endif //C_SEARCH_UI_MANAGER_H