menucontentsrv/inc/menucompletedoperation.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Definition of completed menu operation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MENUCOMPLETEDOPERATION_H__
       
    20 #define __MENUCOMPLETEDOPERATION_H__
       
    21 
       
    22 #include "mcsmenuoperation.h"
       
    23 #include <e32base.h>
       
    24 
       
    25 class RMenu;
       
    26 
       
    27 /**
       
    28  *  Completed CMenuOperation.
       
    29  *  Utility class to wrap synchronous functionality as asynchronous menu
       
    30  *  operation. Used in CMenuHandlers and other menu operations where the
       
    31  *  API requires an asynchronous operation but the concrete functionality
       
    32  *  is synchronous and the result is already available.
       
    33  *  @lib mcsmenu.lib
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 NONSHARABLE_CLASS( CMenuCompletedOperation ): public CMenuOperation
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41     /**
       
    42     * Destructor.
       
    43     */
       
    44     IMPORT_C virtual ~CMenuCompletedOperation();
       
    45 
       
    46     /**
       
    47     * Two-phased constructor. Constructs an operation that is already complete.
       
    48     * @param aMenu Menu.
       
    49     * @param aPriority Active Object priority.
       
    50     * @param aStatus Observer request status. Completes with aError.
       
    51     * @param aError Completion code (result of the operation).
       
    52     * @return Asynchronous operation. Owned by the caller.
       
    53     */
       
    54     IMPORT_C static CMenuCompletedOperation* NewL(
       
    55         RMenu &aMenu,
       
    56         TInt aPriority,
       
    57         TRequestStatus &aObserverStatus,
       
    58         TInt aError );
       
    59 
       
    60 private:
       
    61 
       
    62     /**
       
    63     * Constructor
       
    64     * @param aMenu Menu.
       
    65     * @param aPriority Active Object priority.
       
    66     * @param aStatus Observer request status.
       
    67     */
       
    68     CMenuCompletedOperation(
       
    69         RMenu &aMenu,
       
    70         TInt aPriority,
       
    71         TRequestStatus &aObserverStatus );
       
    72 
       
    73     /**
       
    74     * Report completion.
       
    75     * @param aError Completion code (result of the operation).
       
    76     */
       
    77     void ReportCompletion( TInt aError );
       
    78 
       
    79 // from base class CActive
       
    80 
       
    81     /**
       
    82     * Report completion to observer.
       
    83     */
       
    84     void RunL();
       
    85 
       
    86     /**
       
    87     * Cancel object (never called).
       
    88     */
       
    89     void DoCancel();
       
    90 
       
    91     /**
       
    92     * Handle error.
       
    93     * @param aError Error code.
       
    94     * @return KErrNone.
       
    95     */
       
    96     TInt RunError( TInt aError );
       
    97 
       
    98     };
       
    99 
       
   100 #endif // __MENUCOMPLETEDOPERATION_H__