browserutilities/browserdialogsprovider/Src/PhotoOperationWait.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 *     
       
    16 *     
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "PhotoOperationWait.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CPhotoOperationWait::NewL
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CPhotoOperationWait* CPhotoOperationWait::NewL( TInt aPriority )
       
    32 	{
       
    33 	CPhotoOperationWait* self = new( ELeave )CPhotoOperationWait( aPriority );	
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 	
       
    38 // -----------------------------------------------------------------------------
       
    39 // CPhotoOperationWait::~COperationWait
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CPhotoOperationWait::~CPhotoOperationWait()
       
    43 	{
       
    44     Cancel();
       
    45 	}
       
    46 	
       
    47 // -----------------------------------------------------------------------------
       
    48 // CPhotoOperationWait::Wait
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 void CPhotoOperationWait::Wait()
       
    52 	{
       
    53 	iStatus = KRequestPending;
       
    54 	SetActive();
       
    55 	iSafeWait.Start();
       
    56 	}
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CPhotoOperationWait::RunL
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void CPhotoOperationWait::RunL()
       
    63 	{
       
    64 	if ( iSafeWait.IsStarted() )
       
    65        {
       
    66        iSafeWait.AsyncStop();
       
    67        }
       
    68 	}
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CPhotoOperationWait::SetViewActivate
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CPhotoOperationWait::SetViewActivate( TBool aViewActivate )
       
    75 	{
       
    76 	iViewActivate = aViewActivate;
       
    77 	}
       
    78 
       
    79 	
       
    80 // -----------------------------------------------------------------------------
       
    81 // CPhotoOperationWait::IsStarted
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 TBool CPhotoOperationWait::IsStarted()
       
    85 	{
       
    86 	return iViewActivate;
       
    87 	}
       
    88 
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CPhotoOperationWait::COperationWait
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 CPhotoOperationWait::CPhotoOperationWait( TInt aPriority ): CActive( aPriority )
       
    95 	{
       
    96 	iViewActivate = EFalse;
       
    97 	CActiveScheduler::Add( this );
       
    98 	}
       
    99 	
       
   100 
       
   101 // ---------------------------------------------------------
       
   102 // CPhotoOperationWait::HandleServerAppExit()
       
   103 // ---------------------------------------------------------
       
   104 //
       
   105 void CPhotoOperationWait::HandleServerAppExit( TInt /*aReason*/ )
       
   106 	{
       
   107 	TRequestStatus* s = &iStatus;
       
   108 	User::RequestComplete( s, KErrNone );	
       
   109 	}
       
   110 	
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CPhotoOperationWait::DoCancel
       
   114 // -----------------------------------------------------------------------------
       
   115 //
       
   116 void CPhotoOperationWait::DoCancel()
       
   117 	{
       
   118 	if ( iSafeWait.IsStarted()  )
       
   119        {
       
   120        iSafeWait.AsyncStop();
       
   121        iStatus = KErrNone;
       
   122        }
       
   123 
       
   124 	//For fast swap window closing, we don't receive HandleServerAppExit call
       
   125 	//so we need to call it. Otherwise, the thread for this active object is not
       
   126 	//released
       
   127 	TRequestStatus* s = &iStatus;
       
   128 	User::RequestComplete( s, KErrNone );	
       
   129 	}
       
   130