locationsystemui/locationsysui/locsettingsuiservice/locsettingsuiserver/inc/locsettingsuilaunchao.h
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2005 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:  The declaration for Settings Launch AO class of Location
       
    15 *                Settings UI Server
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_LOCSETTINGSUILAUNCHAO_H
       
    21 #define C_LOCSETTINGSUILAUNCHAO_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32std.h> //For TSglQue
       
    25 
       
    26 #include "locsettingsuiinfo.h"
       
    27 #include "locationui.h"
       
    28 
       
    29 //Forward Declaration
       
    30 class CLocSysUiEngine;
       
    31 class CEikonEnv;
       
    32 class CActiveSchedulerWait;
       
    33 /**
       
    34  *  The Settings UI Launch class.
       
    35  *
       
    36  *  This class interacts with the LocationSysUi engine interface
       
    37  *  to execute the requested settings UI.
       
    38  *  It maintains a queue of all the requests and schedules them
       
    39  *  to execute in a serialized manner.
       
    40  *
       
    41  *  @lib
       
    42  *  @since S60 v3.1
       
    43  */
       
    44 class CLocSettingsUISrvLaunchAO : public CActive,
       
    45                                   public MLocationUIObserver
       
    46     {
       
    47 public:
       
    48     /**
       
    49      * Symbian 2 Phase Constructor
       
    50      *
       
    51      * @since S60 v3.1
       
    52      * @return A pointer to the created CLocSettingsUISrvLaunchAO object
       
    53      */
       
    54     static CLocSettingsUISrvLaunchAO* NewL();
       
    55 
       
    56     /**
       
    57      * Symbian 2 Phase Constructor
       
    58      *
       
    59      * @since S60 v3.1
       
    60      * @return A pointer to the created CLocSettingsUISrvLaunchAO object
       
    61      */
       
    62     static CLocSettingsUISrvLaunchAO* NewLC();
       
    63 
       
    64     /**
       
    65      * Destructor
       
    66      */
       
    67     virtual ~CLocSettingsUISrvLaunchAO();
       
    68 
       
    69 public:
       
    70     /**
       
    71      * Enqueue the Settings UI launch request.
       
    72      *
       
    73      * @since S60 v3.1
       
    74      * @param aReqInfo Pointer to the Settings UI Request Info class which
       
    75      * contains all the information needed to launch the settings UI.
       
    76      * @return None
       
    77      */
       
    78     void EnqueueRequest( CLocSettingsUIInfo* aReqInfo );
       
    79 
       
    80     /**
       
    81      * Cancel the launched Settings UI.
       
    82      * Checks if the UI to be cancelled is in the queue. If so the item
       
    83      * is removed from the queue. Otherwise if the setitngs UI is currently
       
    84      * running then it is cancelled and then removed.
       
    85      *
       
    86      * @since S60 v3.1
       
    87      * @param aSession The pointer to the session from which the settings UI
       
    88      * launch was requested.
       
    89      * @return None
       
    90      */
       
    91     void CancelRequest( const CSession2* aSession );
       
    92 
       
    93     /**
       
    94      * Returns whether the server is running in embedded application server
       
    95      * mode or not.
       
    96      *
       
    97      * @since S60 v3.1
       
    98      * @return ETrue if running in embedded application server mode. EFalse
       
    99      * otherwise.
       
   100      */
       
   101     TBool IsSrvRunningAsEmbeddedApp() const;
       
   102 
       
   103     /**
       
   104      * From Base class MLocationUIObserver
       
   105      * Notifies the termination of the Settings UI
       
   106      *
       
   107      * @param aErrorCode The termination reason. KErrNone for normal 
       
   108      *					 terminations. In case of error or pre-mature
       
   109      *					 aborting System wide Error codes.
       
   110      */
       
   111     virtual void LocationUIDismissed( TInt aErrorCode );
       
   112 
       
   113 protected: // Functions from base classes
       
   114     /**
       
   115      * From Base class CActive 
       
   116      * Handles asynchronous request completion.
       
   117      */
       
   118     virtual void RunL();
       
   119 
       
   120     /**
       
   121      * From Base class CActive 
       
   122      * Cancels any outstanding request.
       
   123      */
       
   124     virtual void DoCancel();
       
   125 
       
   126     /**
       
   127      * From Base class CActive 
       
   128      * Handles a leave in RunL.
       
   129      *
       
   130      * @param aError The RunL leave code.
       
   131      * @return Always KErrNone, because all errors are handled
       
   132      */
       
   133     virtual TInt RunError(TInt aError);
       
   134 
       
   135 private:
       
   136     /**
       
   137      * Constructor
       
   138      */
       
   139     CLocSettingsUISrvLaunchAO();
       
   140 
       
   141     /**
       
   142      * Symbian 2nd Phase Constructor
       
   143      * Leaves in case of Error.
       
   144      *
       
   145      * @since S60 v3.1
       
   146      * @return None
       
   147      */
       
   148     void ConstructL();
       
   149 
       
   150 private: // Helper methods
       
   151     /**
       
   152      * Complete the specified request.
       
   153      * Deques the request from the queue and also updates the request count.
       
   154      *
       
   155      * @since S60 v3.1
       
   156      * @param aReq pointer to the request to be completed and dequeued.
       
   157      * @param aErrorCode the error code to be returned to the client that
       
   158      * originated the request.
       
   159      * @return None
       
   160      */
       
   161     void CompleteRequest( CLocSettingsUIInfo* aReq, TInt aErrorCode );
       
   162     
       
   163     /**
       
   164      * Sends the Applicaiton Server UI to Background and hides it from
       
   165      * the FSW as well.
       
   166      *
       
   167      * @since S60 v3.1
       
   168      * @return None
       
   169      */
       
   170     void SendAppToBackground();
       
   171 
       
   172     /**
       
   173      * Brings the Application Server UI to Foreground and enables it in
       
   174      * the FSW as well.
       
   175      *
       
   176      * @since S60 v3.1
       
   177      * @return None
       
   178      */
       
   179     void BringAppToForeground();
       
   180     
       
   181     /**
       
   182      * Since this Active Object is a dummy object we have to reschedule
       
   183      * it to run when ever needed. This method does that functionality.
       
   184      * mode or not.
       
   185      *
       
   186      * @since S60 v3.1
       
   187      * @return None
       
   188      */
       
   189     void ScheduleAORun();
       
   190 
       
   191 private: // data
       
   192 
       
   193     /**
       
   194      * This data member maintains a list of all the Launch Requests.
       
   195      */
       
   196     TSglQue<CLocSettingsUIInfo> iRequestQue;
       
   197 
       
   198     /**
       
   199      * The Engine Interface for launching Settings UI.
       
   200      * Does not own. Just for reference.
       
   201      * Will be created in this class and then ownership will be transferred
       
   202      * to the Document class.
       
   203      */
       
   204     CLocSysUiEngine* iEngine;
       
   205 
       
   206     /**
       
   207      * Reference to the Eikon Environment.
       
   208      * It is accessed multiple times. Hence Stored here to prevent
       
   209      * unnecessary access each time to the TLS.
       
   210      */
       
   211     CEikonEnv* iEikEnv;
       
   212     
       
   213     /**
       
   214      * Determines whether this server is running as an embedded application
       
   215      * server.
       
   216      */
       
   217     TBool iIsSrvRunningAsEmbeddedApp;
       
   218     
       
   219     /**
       
   220      * Reference to the Location UI that is currently outstanding.
       
   221      * At any instant of time there can be only one request outstanding.
       
   222      * Incase, there are no requests outstanding then the value is set to
       
   223      * NULL.
       
   224      */
       
   225     MLocationUI*        iLocationUI;
       
   226     };
       
   227 
       
   228 #endif // C_LOCSETTINGSUILAUNCHAO_H