locationsystemui/locationsysui/locsysuiengine/src/locsysuiengine.cpp
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     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:  Location System UI Server's engine component. This class serves
       
    15 *                as a factory implementation for Location UI components
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // System Include
       
    21 #include <aknViewAppUi.h>
       
    22 
       
    23 // User Include
       
    24 #include "locsysuiengine.h"
       
    25 #include "locsettingsuiengine.h"
       
    26 #include "locationsettings.h"
       
    27 #include "locpossettings.h"
       
    28 
       
    29 // ========================= MEMBER FUNCTIONS ================================
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // CLocSysUiEngine::CLocSysUiEngine
       
    33 // Overloaded Constructor
       
    34 //
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 CLocSysUiEngine::CLocSysUiEngine( CAknViewAppUi&    aAppUi )
       
    38 	:iAppUi( aAppUi )
       
    39 	{	
       
    40 	}
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CLocationSystemUiView::~CLocSysUiEngine
       
    44 // Destructor
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CLocSysUiEngine::~CLocSysUiEngine()
       
    49 	{
       
    50 	// Incase a Location sub-settings request was made then the Settings
       
    51 	// UI engine has been created, In that case, the object and the 
       
    52 	// associated resources would be freed.
       
    53 	delete iSettingsEngine;
       
    54 	
       
    55 	// Incase Positioning settings request was made then the Settings UI
       
    56 	// and the associated resources would be freed.
       
    57 	delete iPosSettings;
       
    58 	}	
       
    59 					 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CLocSysUiEngine* CLocSysUiEngine::NewL
       
    62 // Two Phase Constructor for creating the Location Settings UI engine.  
       
    63 //
       
    64 // @param    aAppUi			    Reference to the Application UI class.
       
    65 // @return	CLocSysUiEngine*    Reference to the created object.
       
    66 // ---------------------------------------------------------------------------  
       
    67 //
       
    68 EXPORT_C CLocSysUiEngine* CLocSysUiEngine::NewL( CAknViewAppUi&	 aAppUi )
       
    69 	{
       
    70     CLocSysUiEngine* self = CLocSysUiEngine::NewLC( aAppUi );
       
    71 	CleanupStack::Pop( self );
       
    72 	return self;
       
    73 	}
       
    74 	
       
    75 // ---------------------------------------------------------------------------
       
    76 // CLocSysUiEngine* CLocSysUiEngine::NewL
       
    77 // Two Phase Constructor for creating the Location Settings UI engine.
       
    78 // Leaves the object on the cleanupstack.
       
    79 //
       
    80 // @param    aAppUi			    Reference to the Application UI class.
       
    81 // @return	CLocSysUiEngine*    Reference to the created object.
       
    82 // ---------------------------------------------------------------------------  
       
    83 //
       
    84 EXPORT_C CLocSysUiEngine* CLocSysUiEngine::NewLC( CAknViewAppUi&	aAppUi )
       
    85 	{
       
    86     CLocSysUiEngine* self = new(ELeave) CLocSysUiEngine( aAppUi );
       
    87 	CleanupStack::PushL( self );
       
    88     // No second phase construction required
       
    89 	return self;
       
    90 	}
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // MLocationUI* CLocSysUiEngine::CreateSettingsUi
       
    94 // Creates the sub-Settings UI and  appends it to the existing list. The ownership
       
    95 // of the created object is not returned to the callee function. The object would
       
    96 // be destroyed only on the destruction of the plug-in.
       
    97 // Incase the object alreacdy exists then the function would return a reference to
       
    98 // to the existing object.
       
    99 //
       
   100 // @param  aImplementationUid The Implementation UID of the sub-settings plug-in that
       
   101 //                            has to be created.
       
   102 // @return MLocationUI*       Reference to the sub-settings UI that has been created.
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 EXPORT_C MLocationUI* CLocSysUiEngine::CreateLocationSubSettingsUIL( 
       
   106                                                 TUid    aImplementationUid )
       
   107     {
       
   108     // If the Settings engine has already been created then use the same
       
   109     // instance. If not, create a new instance
       
   110     if( !iSettingsEngine )
       
   111         {
       
   112         iSettingsEngine = CLocSettingsUiEngine::NewL( iAppUi );
       
   113         }   
       
   114     return iSettingsEngine->CreateSettingsUiL( aImplementationUid );        
       
   115     }
       
   116     
       
   117 // ---------------------------------------------------------------------------
       
   118 // MLocationUI* CLocSysUiEngine::CreatePositioningSettingsUIL
       
   119 // Creates an instance of Postioning Settings UI. The ownership
       
   120 // of the created object is not returned to the callee function. The object would
       
   121 // be destroyed only on the destruction of the plug-in.
       
   122 // Incase the object alreacdy exists then the function would return a reference to
       
   123 // to the existing object.
       
   124 //
       
   125 // @return MLocationUI*       Reference to the Positioning UI that has been created.         
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C MLocationUI* CLocSysUiEngine::CreatePositioningSettingsUIL()
       
   129     {
       
   130     // If the Postioning Settings UI instance already exists then use the same
       
   131     // If not, create a new instance
       
   132     if( !iPosSettings )
       
   133         {
       
   134         iPosSettings = CLocPosSettings::NewL();
       
   135         }
       
   136     return iPosSettings;
       
   137     }
       
   138 
       
   139 
       
   140