cmmanager/cmmgr/Framework/Src/ccmdexec.cpp
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     1 /*
       
     2 * Copyright (c) 2008 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:  Execute command without blocking the process. Needed for
       
    15 *                touch UI implementation.
       
    16 *
       
    17 */
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mcmdexec.h>
       
    21 #include "ccmdexec.h"
       
    22 
       
    23 // ----------------------------------------------------------------------------
       
    24 // C++ default constructor can NOT contain any code, that might leave.
       
    25 // ----------------------------------------------------------------------------
       
    26 //
       
    27 CCmdExec::CCmdExec(MCmdExec& aOwner) :
       
    28     CActive( CActive::EPriorityStandard ),
       
    29     iOwner(aOwner)
       
    30     {
       
    31     CActiveScheduler::Add(this);
       
    32     }
       
    33 
       
    34 // ----------------------------------------------------------------------------
       
    35 // Destructor.
       
    36 // ----------------------------------------------------------------------------
       
    37 //
       
    38 CCmdExec::~CCmdExec()
       
    39     {
       
    40     Cancel();
       
    41     }
       
    42 
       
    43 void CCmdExec::Execute()
       
    44     {
       
    45     // Cancel possible previous request
       
    46     Cancel();
       
    47     
       
    48     // Do request
       
    49     TRequestStatus *requestStatus = &iStatus;
       
    50     User::RequestComplete(requestStatus, KErrNone);
       
    51     SetActive();
       
    52     }
       
    53             
       
    54 void CCmdExec::RunL()
       
    55     {
       
    56     iOwner.Execute();
       
    57     }
       
    58 
       
    59 TInt CCmdExec::RunError( TInt aError )
       
    60     {
       
    61     if (aError != 0)
       
    62         iOwner.HandleLeaveError( aError );
       
    63     return KErrNone;
       
    64     }
       
    65 
       
    66 void CCmdExec::DoCancel()
       
    67     {
       
    68     
       
    69     }