menucontentsrv/src/menucompletedoperation.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 #include "menucompletedoperation.h"
       
    21 #include "mcsmenu.h"
       
    22 
       
    23 // ================= MEMBER FUNCTIONS =======================
       
    24 
       
    25 // ---------------------------------------------------------
       
    26 // CMenuCompletedOperation::~CMenuCompletedOperation
       
    27 // ---------------------------------------------------------
       
    28 //
       
    29 EXPORT_C CMenuCompletedOperation::~CMenuCompletedOperation()
       
    30     {
       
    31     Cancel();
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // CMenuCompletedOperation::NewL
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 EXPORT_C CMenuCompletedOperation* CMenuCompletedOperation::NewL(
       
    39         RMenu &aMenu,
       
    40         TInt aPriority,
       
    41         TRequestStatus &aObserverStatus,
       
    42         TInt aError )
       
    43     {
       
    44     CMenuCompletedOperation* op = new (ELeave) CMenuCompletedOperation
       
    45         ( aMenu, aPriority, aObserverStatus );
       
    46     op->ReportCompletion( aError );
       
    47     return op;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CMenuCompletedOperation::CMenuCompletedOperation
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 CMenuCompletedOperation::CMenuCompletedOperation
       
    55 ( RMenu &aMenu, TInt aPriority, TRequestStatus &aObserverStatus )
       
    56 : CMenuOperation( aMenu, aPriority, aObserverStatus )
       
    57     {
       
    58     CActiveScheduler::Add( this );
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------
       
    62 // CMenuCompletedOperation::ReportCompletion
       
    63 // ---------------------------------------------------------
       
    64 //
       
    65 void CMenuCompletedOperation::ReportCompletion( TInt aError )
       
    66     {
       
    67     iObserverStatus = KRequestPending;
       
    68     TRequestStatus* ownStatus = &iStatus;
       
    69     *ownStatus = KRequestPending;
       
    70     SetActive();
       
    71     User::RequestComplete( ownStatus, aError );
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------
       
    75 // CMenuCompletedOperation::RunL
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 void CMenuCompletedOperation::RunL()
       
    79     {
       
    80     // Propagate completion to observer.
       
    81     TRequestStatus* status = &iObserverStatus;
       
    82     User::RequestComplete( status, iStatus.Int() );
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------
       
    86 // CMenuCompletedOperation::DoCancel
       
    87 // ---------------------------------------------------------
       
    88 //
       
    89 void CMenuCompletedOperation::DoCancel()
       
    90     {
       
    91     TRequestStatus* status = &iObserverStatus;
       
    92     User::RequestComplete( status, KErrCancel );
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------
       
    96 // CMenuCompletedOperation::RunError
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 TInt CMenuCompletedOperation::RunError( TInt aError )
       
   100     {
       
   101     TRequestStatus* status = &iObserverStatus;
       
   102     User::RequestComplete( status, aError );
       
   103 
       
   104     return KErrNone;
       
   105     }