widgets/widgetapp/src/WidgetUiAsyncExit.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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: 
       
    15 *  CWidgetUiAsyncExit class can exit the Browser in async mode. It calls the CWidgetAppUi`s
       
    16 *  Exit() method, when the object completes the request.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #include "WidgetUiAsyncExit.h"
       
    23 #include "ApiProvider.h"
       
    24 
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // static CWidgetUiAsyncExit* CWidgetUiAsyncExit::NewL( )
       
    28 // Create a CWidgetUiAsyncExit object. Leaves on failure.
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CWidgetUiAsyncExit* CWidgetUiAsyncExit::NewL( MApiProvider& aApiProvider )
       
    32     {
       
    33     CWidgetUiAsyncExit* self = new( ELeave ) CWidgetUiAsyncExit( aApiProvider );
       
    34     return self;
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 //	CWidgetUiAsyncExit::CWidgetUiAsyncExit( ):CActive(CActive::EPriorityStandard)
       
    39 //  Constructs this object
       
    40 // ---------------------------------------------------------------------------
       
    41 //    
       
    42 CWidgetUiAsyncExit::CWidgetUiAsyncExit( MApiProvider& aApiProvider ) :
       
    43     CActive(CActive::EPriorityStandard),
       
    44     iApiProvider( aApiProvider )
       
    45     {
       
    46     CActiveScheduler::Add( this );
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 //	CWidgetUiAsyncExit::~CWidgetUiAsyncExit()
       
    51 //  Destroy the object and release all memory objects
       
    52 // ---------------------------------------------------------------------------
       
    53 //    
       
    54 CWidgetUiAsyncExit::~CWidgetUiAsyncExit()
       
    55     {
       
    56     Cancel();
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 //	void CWidgetUiAsyncExit::Start()
       
    61 //  Complete an asynchronous request.
       
    62 // ---------------------------------------------------------------------------
       
    63 //    
       
    64 void CWidgetUiAsyncExit::Start()
       
    65     {
       
    66 	if ( !IsActive() )
       
    67 		{
       
    68 		TRequestStatus* status = &iStatus;
       
    69 		SetActive();    
       
    70 		User::RequestComplete( status, KErrNone );
       
    71 		}
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 //	void CWidgetUiAsyncExit::DoCancel()
       
    76 //  Cancel any outstanding requests.
       
    77 // ---------------------------------------------------------------------------
       
    78 //    
       
    79 void CWidgetUiAsyncExit::DoCancel()
       
    80     {
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 //	void CWidgetUiAsyncExit::RunL()
       
    85 //  Handles object`s request completion event.
       
    86 // ---------------------------------------------------------------------------
       
    87 //    
       
    88 void CWidgetUiAsyncExit::RunL()
       
    89     {
       
    90     iApiProvider.ExitWidget( ); // Exit the widget.
       
    91     }
       
    92 
       
    93 // End of file