locationsystemui/locationsysui/locsuplsettingsui/inc/locsuplsettings.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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:  SUPL Settings UI implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CLOCSUPLSETTINGS_H_
       
    20 #define CLOCSUPLSETTINGS_H_
       
    21 
       
    22 // User Includes
       
    23 #include "locsettingsui.h"
       
    24 #include "locsuplsettingsuiengobserver.h"
       
    25 #include "locsuplsettingseventhandler.h"
       
    26 
       
    27 // System Includes
       
    28 #include <ConeResLoader.h>
       
    29 #include <data_caging_path_literals.hrh>
       
    30 
       
    31 
       
    32 // Forward Declarations
       
    33 class CAknQueryDialog;
       
    34 class MLocSettingsUiObserver;
       
    35 class CLocSUPLSettingsView;
       
    36 class CLocSUPLServerView;
       
    37 class CLocSUPLSessionView;
       
    38 class CLocSUPLSettingsUiEngine;
       
    39 
       
    40 // Global constants
       
    41 
       
    42 /**
       
    43  * SUPL Settings RSC file name
       
    44  */
       
    45 _LIT( KSUPLUiResFileName, "locsuplsettingsui.rsc" );
       
    46 
       
    47 class CLocSUPLAO : public CActive
       
    48     {               
       
    49     public:
       
    50         static CLocSUPLAO* NewL(
       
    51                 MLocSettingsUiObserver&     aSettingsUiObserver,
       
    52                 CLocSUPLSettingsUiEngine&   aSettingsEngine,
       
    53                 TInt                        aLaunchParams  );
       
    54         
       
    55         virtual ~CLocSUPLAO();
       
    56         
       
    57         void CompleteRequest();
       
    58 
       
    59     private:
       
    60         CLocSUPLAO( MLocSettingsUiObserver&     aSettingsUiObserver,
       
    61                     CLocSUPLSettingsUiEngine&   aSettingsEngine,
       
    62                     TInt                        aLaunchParams );
       
    63         
       
    64         void RunL();
       
    65         
       
    66         void DoCancel();
       
    67         
       
    68         
       
    69         
       
    70     private:
       
    71         MLocSettingsUiObserver&         iSettingsUiObserver;
       
    72         CLocSUPLSettingsUiEngine&       iSettingsEngine;
       
    73         TInt                            iLaunchParams;  
       
    74     };
       
    75 
       
    76 /**
       
    77  * CLocSUPLSettings
       
    78  *
       
    79  * ECom Plugin implementation for SUPL Settings UI. The Settings UI provides 
       
    80  * two major functionalities i.e., Launching a Settings UI plug-in and 
       
    81  * cancelling the existing launched UI.
       
    82  * The Launch request depending on the parameters is expected to pop up a 
       
    83  * query dialog to request the user whether he intends to configure SUPL
       
    84  * settings currently. The default behaviour should be to pop up the configuration
       
    85  * dialog for SUPL settings.
       
    86  */
       
    87 class CLocSUPLSettings : public CLocSettingsUi,
       
    88                          public MLocSUPLSettingsUiEngObserver,
       
    89                          public MLocSUPLSettingsEventHandler
       
    90     {
       
    91     
       
    92     public:
       
    93         
       
    94         /**
       
    95          * Symbian OS two-phased constructor
       
    96          * @return 
       
    97          */
       
    98         static CLocSUPLSettings* NewL( TAny* aParam );
       
    99     
       
   100         /**
       
   101          * Destructor.
       
   102          */
       
   103         ~CLocSUPLSettings();
       
   104 
       
   105     public: // Inherited from CLocSettingsUi
       
   106          
       
   107     	/**
       
   108     	 * Inherited from CLocSettingsUi
       
   109 		 * Launches the Settings UI
       
   110 		 *
       
   111 		 * @param aUiLaunchParams	Flags that define specific configuration of
       
   112          *                          if the Settings UI, that the user of the API
       
   113          *                          wants to launch. If more than one functionality
       
   114          *                          is requested then the various combinations
       
   115          *                          are to be ORed.
       
   116 		 */
       
   117 		 void LaunchL( TInt		aUiLaunchParams );
       
   118          
       
   119         /**
       
   120          * Inherited from CLocSettingsUi
       
   121          * Launches the Settings UI
       
   122          *
       
   123          * @param aUiLaunchParams   Flags that define specific configuration of
       
   124          *                          if the Settings UI, that the user of the API
       
   125          *                          wants to launch. If more than one functionality
       
   126          *                          is requested then the various combinations
       
   127          *                          are to be ORed.
       
   128          */
       
   129          void LaunchL( const TDesC&       aUiLaunchParams );
       
   130 
       
   131 		/**
       
   132 		 * Inherited from CLocSettingsUi
       
   133 		 * Closes the running Settings UI prematurely.
       
   134 		 */
       
   135 		 void Close();
       
   136 
       
   137 		/**
       
   138 		 * Inherited from CLocSettingsUi
       
   139          * Method for getting caption of this plugin. This should be the 
       
   140          * localized name of the settings view to be shown in parent view.
       
   141          *
       
   142          * @param aCaption pointer to Caption variable
       
   143          */
       
   144          void GetCaptionL( TDes& aCaption ) const;
       
   145 
       
   146 		/**
       
   147 		 * Inherited from CLocSettingsUi
       
   148          * Returns the priority of the UI module. 
       
   149          * 
       
   150          * @return Priority of the Settings UI
       
   151          */
       
   152          TInt GetPriority();
       
   153 
       
   154 		/**
       
   155 		 * Inherited from CLocSettingsUi
       
   156 		 * Accessor Function for determine whether the UI presence 
       
   157 		 * should be shown to the user or should be hidden
       
   158 		 *
       
   159 		 * @return ETrue  If the presence of the UI be shown to the usr
       
   160 				   EFalse If the UI should funtion as a non visible UI
       
   161 		 */
       
   162 		 TBool	IsVisible();
       
   163 	
       
   164 	public: // Inherited from MLocSUPLSettingsUiEngObserver
       
   165 		
       
   166 		/**
       
   167 		 * Inherited from MLocSUPLSettingsUiEngObserver
       
   168 		 */
       
   169 		void HandleSettingsEventL( TSettingsEventType    aEvent );
       
   170 	
       
   171 	public: // Inherited from MLocSUPLSettingsEventHandler
       
   172 		
       
   173 		/**
       
   174 		 * Inherited from MLocSUPLSettingsEventHandler
       
   175 		 */
       
   176 		void HandleScreenSizeChange();
       
   177 		 
       
   178 		/**
       
   179          * Inherited from MLocSUPLSettingsEventHandler
       
   180          * Handles commands from the views
       
   181          *
       
   182          * @param  aCommand Command ID
       
   183          */
       
   184         void HandleCommandL( TInt aCommand );
       
   185     
       
   186 	private:
       
   187 	    enum TLaunchParamType
       
   188 	        {
       
   189 	        ELaunchParamInt = 0,
       
   190 	        ELaunchParamString
       
   191 	        };
       
   192         
       
   193     private:
       
   194         /**
       
   195          * C++ default constructor.
       
   196          */
       
   197         CLocSUPLSettings( MLocSettingsUiObserver&		aSettingsUiObserver,
       
   198 					 	   CAknViewAppUi&				aAppUi );
       
   199 
       
   200         /**
       
   201          * Second phase constructor.
       
   202          */
       
   203         void ConstructL();
       
   204   
       
   205         /**
       
   206          * Launches the SUPL UI
       
   207          */
       
   208         void LaunchSUPLUiL();
       
   209         
       
   210         /**
       
   211          * Opens the nearest localized resourcefile using aResourceLoader. 
       
   212          * aResourceLoader should be opened only once before closing it. 
       
   213          * Otherwise it will raise a panic. Therefore it is better to have 
       
   214          * multiple resource loaders.
       
   215          * 
       
   216          * @param aResourceFileName Drive and name of resource file in format 
       
   217          *                          <path>:<rsc_file_name>
       
   218          * @param aResourceLoader Resource loader for the resource. The loader 
       
   219          *                        must not be opened allready or it will raise 
       
   220          *                        a panic. It is caller's responsibility to 
       
   221          *                        close the resource loader after using the 
       
   222          *                        resource.
       
   223          */
       
   224         void OpenLocalizedResourceFileL( const TDesC& 				aResourceFileName, 
       
   225         								       RConeResourceLoader& aResourceLoader );
       
   226           								       
       
   227     private:
       
   228 	    /**
       
   229 	     * Resource Loader handle for handling SUPL Settings UI specific resources
       
   230 	     */
       
   231     	RConeResourceLoader 			iResourceLoader;
       
   232               								       
       
   233     	/** 
       
   234     	 * Reference to the SUPL Settings View
       
   235     	 * Owns
       
   236     	 */
       
   237     	CLocSUPLSettingsView*			iSettingsView;
       
   238     	
       
   239     	/**
       
   240     	 * View Id for SUPL Settings UI View
       
   241     	 */
       
   242     	TUid							iSettingsViewId;              								       
       
   243 
       
   244     	/** 
       
   245     	 * Reference to the SUPL Server View
       
   246     	 * Owns
       
   247     	 */
       
   248     	CLocSUPLServerView*				iServerView;
       
   249     	
       
   250     	/**
       
   251     	 * View Id for SUPL Server UI View
       
   252     	 */
       
   253     	TUid							iServerViewId;              								       
       
   254 
       
   255         /**
       
   256          * Settings UI Engine
       
   257          * Owns
       
   258          */
       
   259          CLocSUPLSettingsUiEngine*      iSettingsEngine;
       
   260          
       
   261          /** 
       
   262     	 * Reference to the SUPL Session View
       
   263     	 * Owns
       
   264     	 */
       
   265          CLocSUPLSessionView*           iSessionView;
       
   266          
       
   267     	/**
       
   268     	 * View Id for SUPL Session UI View
       
   269     	 */
       
   270     	TUid							iSessionViewId;   
       
   271          								       
       
   272         /**
       
   273          * Denotes whether a Launch request is outstanding. 
       
   274          * Necessary to handle the closing of the configuration dialog ( if it
       
   275          * exists ) gracefully. If the dialog is currenlty being shown to
       
   276          * the user and we get a Cancel request, then we shouldnot complete
       
   277          * the request with KErrAbort. This is done to ensure that we complete
       
   278          * the request only if a Launch call is outstanding
       
   279          */
       
   280          TBool                          iLaunchOutStanding;
       
   281         
       
   282         /**
       
   283          * Launch Paramters
       
   284          */
       
   285          TInt                           iLaunchParams;    
       
   286          
       
   287         /**
       
   288          * Launch Param Type
       
   289          */
       
   290          TLaunchParamType               iLaunchParamType;
       
   291          
       
   292          CLocSUPLAO*                    iLaunchAO;
       
   293     };
       
   294 
       
   295 #endif // CLOCSUPLSETTINGS_H_
       
   296