mapnavproviderrefapp/src/mnrpappserver.cpp
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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:  CMnrpAppServer class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mnappserviceuids.hrh>
       
    20 #include "debug.h"
       
    21 
       
    22 #include <lbsposition.h>
       
    23 #include <EPos_CPosLandmark.h>
       
    24 
       
    25 #include "mnrpnavigationservice.h"
       
    26 #include "mnrpmapviewservice.h"
       
    27 
       
    28 #include <mnrefprovider.rsg>
       
    29 #include "mnrpappui.h"
       
    30 #include "mnrpengine.h"
       
    31 #include "mnrpappserver.h"
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CMnrpAppServer::~CMnrpAppServer()
       
    39     {
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C CApaAppServiceBase* CMnrpAppServer::CreateServiceL(TUid aServiceType) const
       
    46     {  
       
    47     LOG1("MnRefProvider::CreateServiceL, svcUid = %X", aServiceType.iUid);
       
    48     switch ( aServiceType.iUid )
       
    49         {
       
    50         case KMnAppMapViewService:
       
    51             return CreateMapViewServiceL();
       
    52 
       
    53         case KMnAppNavigationService:
       
    54             return CreateNavigationServiceL();
       
    55             
       
    56         default:
       
    57             return CAknAppServer::CreateServiceL( aServiceType );
       
    58         }
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C void CMnrpAppServer::HandleAllClientsClosed()
       
    65     {
       
    66     LOG( "MnRefProvider: HandleAllClientsClosed" );
       
    67     CMnrpAppUi* appUi = AppUi();
       
    68     if ( appUi )
       
    69     	{
       
    70     	if ( appUi->IsChainedMode() ) 
       
    71     		{
       
    72     		// close
       
    73     		CAknAppServer::HandleAllClientsClosed();
       
    74     		}
       
    75     	else // standalone mode
       
    76     		{
       
    77     		if ( !appUi->IsAnyUserViewActive() )
       
    78     			{
       
    79 	    		// close
       
    80 	    		CAknAppServer::HandleAllClientsClosed();
       
    81     			}
       
    82     		else
       
    83     			{	
       
    84     			// "remain active until user closes me"
       
    85     			}
       
    86     		}	
       
    87     	}
       
    88 	else
       
    89         {
       
    90         CAknAppServer::HandleAllClientsClosed();
       
    91         }
       
    92     }
       
    93     
       
    94 // -----------------------------------------------------------------------------
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CMnrpNavigationService* CMnrpAppServer::CreateNavigationServiceL() const
       
    98     {
       
    99     LOG( "MnRefProvider: CreateNavigationServiceL" );
       
   100     CMnrpNavigationService* svc = CMnrpNavigationService::NewL();
       
   101     return svc;
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 CMnrpMapViewService* CMnrpAppServer::CreateMapViewServiceL() const
       
   108     {
       
   109     LOG( "MnRefProvider: CreateMapViewServiceL" );
       
   110     CMnrpMapViewService* svc = CMnrpMapViewService::NewL();
       
   111     return svc;
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 CMnrpAppUi* CMnrpAppServer::AppUi()
       
   118     {
       
   119     CMnrpAppUi* ui = (CMnrpAppUi*) CEikonEnv::Static()->AppUi();
       
   120     if ( !ui )
       
   121         {
       
   122         LOG("MnRefProvider: UI not found!");
       
   123         }
       
   124     return ui;
       
   125     }