locationsystemui/locationsysui/locsettingsuiservice/locsettingsuiclient/src/loclaunchuiao.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:  Active Object to monitor the UI Server launch requests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User Include
       
    20 #include "loclaunchuiao.h"
       
    21 #include "loclaunchuiobserver.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // C++ Default Constructor
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CLocLaunchUiAO::CLocLaunchUiAO( MLocLaunchUiObserver&    aObserver )
       
    30     : CActive( EPriorityStandard ),
       
    31     iObserver( aObserver )
       
    32     {
       
    33     // Add the Active object to the Active scheduler queue
       
    34     CActiveScheduler::Add( this );    
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // Two Phase constructor 
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CLocLaunchUiAO* CLocLaunchUiAO::NewL( MLocLaunchUiObserver&    aObserver )
       
    42     {
       
    43     CLocLaunchUiAO* self = CLocLaunchUiAO::NewLC( aObserver );
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Two Phase constructor. Leaves the allocated object on the Clean-up stack 
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CLocLaunchUiAO* CLocLaunchUiAO::NewLC( MLocLaunchUiObserver&    aObserver )
       
    54     {
       
    55     CLocLaunchUiAO* self = new( ELeave ) CLocLaunchUiAO( aObserver );
       
    56     CleanupStack::PushL( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // C++ Destructor
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CLocLaunchUiAO::~CLocLaunchUiAO()
       
    66     {
       
    67     // Cancel any outstanding request
       
    68     Cancel();
       
    69     }
       
    70     
       
    71 // ---------------------------------------------------------------------------
       
    72 // Informs the active object that there is an outstanding request.
       
    73 // ---------------------------------------------------------------------------
       
    74 //    
       
    75 void    CLocLaunchUiAO::SetRequestOutStandingL()
       
    76     {
       
    77     // Check if there is any request outstanding for there can be only one 
       
    78     // request outstanding on the active object at any instant of time
       
    79     if( IsActive())
       
    80         {
       
    81         User::Leave( KErrInUse );
       
    82         }
       
    83     iStatus = KRequestPending;
       
    84     SetActive();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // Returns a reference to the active objects Status variable
       
    89 // ---------------------------------------------------------------------------
       
    90 // 
       
    91 TRequestStatus&     CLocLaunchUiAO::GetStatusVariable()
       
    92     {
       
    93     return iStatus;
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CActive RunL
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CLocLaunchUiAO::RunL()
       
   101     {
       
   102     // Issue a callback only when the active object has not been cancelled
       
   103     if( KErrCancel != iStatus.Int())
       
   104         {
       
   105         iObserver.LaunchUiComplete( iStatus.Int());
       
   106         }
       
   107     }
       
   108     
       
   109 // ---------------------------------------------------------------------------
       
   110 // CActive DoCancel
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CLocLaunchUiAO::DoCancel()
       
   114     {
       
   115     }