locationsystemui/locationsysui/locsettingsuiservice/locsettingsuiserver/src/locsettingsuiappserver.cpp
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 implementation for AppServer class of Location Settings 
       
    15 *                UI Server
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <apaserverapp.h>
       
    21 #include <eikappui.h>
       
    22 #include <aknViewAppUi.h>
       
    23 #include <eikenv.h>
       
    24 #include <aknappui.h>
       
    25 #include <apgwgnam.h>
       
    26 
       
    27 #include "locsettingsuiappserver.h"
       
    28 #include "locsettingsuiserverinterface.h"
       
    29 #include "locsettingsuilaunchmgr.h"
       
    30 #include "locsettingsuiservice.h"
       
    31 #include "locsettingsuisrvshutdowntimer.h"
       
    32 #include "locsettingsuisrvappui.h"
       
    33 
       
    34 // ======== MEMBER FUNCTIONS ========
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CLocSettingsUIAppServer::CLocSettingsUIAppServer()
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CLocSettingsUIAppServer::CLocSettingsUIAppServer()
       
    41     {
       
    42     }
       
    43 
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CLocSettingsUIAppServer::ConstructL()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CLocSettingsUIAppServer::ConstructL(const TDesC& aFixedServerName)
       
    50     {
       
    51     iShutdownTimer = CLocSettingsUISrvShutdown::NewL();
       
    52     // Base Call and pass the Server Name to be used.
       
    53     // Will be called by Framework. Not needed here.
       
    54     CAknAppServer::ConstructL(aFixedServerName);
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CLocSettingsUIAppServer::CLocSettingsUIAppServer()
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CLocSettingsUIAppServer::~CLocSettingsUIAppServer()
       
    63     {
       
    64     delete iShutdownTimer;
       
    65     }
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CLocSettingsUIAppServer::CancelShutdownTimer()
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 void CLocSettingsUIAppServer::CancelShutdownTimer()
       
    73     {
       
    74     iShutdownTimer->Cancel();
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CLocSettingsUIAppServer::CreateServiceL
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CApaAppServiceBase* CLocSettingsUIAppServer::CreateServiceL(
       
    83     TUid aServiceType) const
       
    84     {
       
    85     if (KLocSettingsUiServiceId == aServiceType.iUid)
       
    86         {
       
    87         return new(ELeave) CLocSettingsUIService;
       
    88         }
       
    89         
       
    90     return CAknAppServer::CreateServiceL(aServiceType);
       
    91     }
       
    92 
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // CLocSettingsUIAppServer::HandleAllClientsClosed()
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void CLocSettingsUIAppServer::HandleAllClientsClosed()
       
    99     {
       
   100     // The default behaviour is to close server immediately.
       
   101     // This is what we want when the server is running as Embedded Application.
       
   102     // But when the server is processing Framework request, we need to run
       
   103     // a shutdown timer. When the Timer expires, the server is closed.
       
   104     // In case a new request comes in before the timer expires, the timer is
       
   105     // cancelled.
       
   106     if ( CEikonEnv::Static()->StartedAsServerApp() )
       
   107         {
       
   108         // If running as embedded application server then stop immediately.
       
   109         CActiveScheduler::Stop();
       
   110         }
       
   111     else
       
   112         {
       
   113         iShutdownTimer->Start();
       
   114         }
       
   115     }
       
   116 
       
   117 
       
   118 // End of file