messagingappbase/msgavkon/muiu_domain/operationwait/src/MuiuOperationWait.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 "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 *     Allows a synchronous wait on a operation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <aknenv.h>
       
    24 #include "MuiuOperationWait.h"
       
    25 
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 
       
    31 // ---------------------------------------------------------
       
    32 // CMuiuOperationWait::NewLC
       
    33 //
       
    34 // ---------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CMuiuOperationWait* CMuiuOperationWait::NewLC( TInt aPriority )
       
    37     {
       
    38     CMuiuOperationWait* self = new ( ELeave ) CMuiuOperationWait( aPriority );
       
    39     CleanupStack::PushL( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------
       
    45 // CMuiuOperationWait::CMuiuOperationWait
       
    46 //
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 CMuiuOperationWait::CMuiuOperationWait( TInt aPriority )
       
    50 : CActive( aPriority )
       
    51     {
       
    52     CActiveScheduler::Add( this );
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------
       
    57 // CMuiuOperationWait::~CMuiuOperationWait
       
    58 //
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 EXPORT_C CMuiuOperationWait::~CMuiuOperationWait()
       
    62     {
       
    63     Cancel();
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------
       
    68 // CMuiuOperationWait::Start
       
    69 //
       
    70 // ---------------------------------------------------------
       
    71 //
       
    72 EXPORT_C void CMuiuOperationWait::Start()
       
    73     {
       
    74     SetActive();
       
    75     iWait.Start();
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------
       
    80 // CMuiuOperationWait::RunL
       
    81 //
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CMuiuOperationWait::RunL()
       
    85     {
       
    86     CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
       
    87     }
       
    88 
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // CMuiuOperationWait::DoCancel
       
    92 //
       
    93 // ---------------------------------------------------------
       
    94 //
       
    95 void CMuiuOperationWait::DoCancel()
       
    96     {
       
    97     if( iStatus == KRequestPending )
       
    98         {
       
    99         TRequestStatus* s=&iStatus;
       
   100         User::RequestComplete( s, KErrCancel );
       
   101         }
       
   102 
       
   103     CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
       
   104     }
       
   105 
       
   106 // End of file