messagingfw/msgtestfw/TestActions/Base/Attachments/src/CMtfAsyncWaiter.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CMTFASYNCWAITER.H
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "CMtfAsyncWaiter.h"
       
    19 
       
    20 CMtfAsyncWaiter* CMtfAsyncWaiter::NewL()
       
    21 	{
       
    22 	CMtfAsyncWaiter* self = new(ELeave) CMtfAsyncWaiter();
       
    23 	return self;
       
    24 	}
       
    25 
       
    26 CMtfAsyncWaiter::CMtfAsyncWaiter()
       
    27 	: CActive(EPriorityStandard)
       
    28 	{
       
    29 	CActiveScheduler::Add(this);
       
    30 	}	
       
    31 
       
    32 CMtfAsyncWaiter::~CMtfAsyncWaiter()
       
    33 	{
       
    34 	Cancel();
       
    35 	}
       
    36 	
       
    37 void CMtfAsyncWaiter::StartAndWait()
       
    38 	{
       
    39 	SetActive();
       
    40 	CActiveScheduler::Start();
       
    41 	}
       
    42 	
       
    43 TInt CMtfAsyncWaiter::Result() const
       
    44 	{
       
    45 	return iError;
       
    46 	}
       
    47 	
       
    48 void CMtfAsyncWaiter::RunL()
       
    49 	{
       
    50 	iError = iStatus.Int();
       
    51 	CActiveScheduler::Stop();
       
    52 	}
       
    53 	
       
    54 void CMtfAsyncWaiter::DoCancel()
       
    55 	{
       
    56 	iError = KErrCancel;
       
    57 	CActiveScheduler::Stop();
       
    58 	}
       
    59