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