meetingrequest/mricalviewer/inc/cesmricalviewercmdhandler.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-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:  ESMR imap calendar entry retriever definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRICALVIEWERCMDHANDLER_H
       
    20 #define CESMRICALVIEWERCMDHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail>
       
    24 #include "mesmricalviewerobserver.h"
       
    25 #include "mesmricalviewercallback.h"
       
    26 //</cmail>
       
    27 
       
    28 class CCalSession;
       
    29 class CFSMailClient;
       
    30 class CFSMailMessage;
       
    31 class MESMRIcalViewerCommand;
       
    32 
       
    33 /**
       
    34  * CESMRIcalViewerCmdHandler is responsible for creating and
       
    35  * executing esmricalviewer commands for CFSMailMessages.
       
    36  */
       
    37 NONSHARABLE_CLASS( CESMRIcalViewerCmdHandler ) :
       
    38         public CBase,
       
    39         public MESMRIcalViewerObserver
       
    40     {
       
    41 public: // Construction and destruction
       
    42     /**
       
    43      * Creates and initialzes new CESMRIcalViewerCmdHandler object.
       
    44      * @param aCallback Reference to ESMRIcalviewer callback.
       
    45      * @return Pointer to CESMRIcalViewerCmdHandler object.
       
    46      */
       
    47     static CESMRIcalViewerCmdHandler* NewL(
       
    48             MESMRIcalViewerCallback& aCallback );
       
    49 
       
    50     /**
       
    51      * C++ destructor
       
    52      */
       
    53     ~CESMRIcalViewerCmdHandler();
       
    54 
       
    55 public: // Interface
       
    56     /**
       
    57      * Executes commands on based on CFSMailMessages based on  operation types
       
    58      * @param aOpType commands operation type
       
    59      * @param aObserver observer of the asynchronous command result
       
    60      * @param aMessage the command is executed on this CFSMailMessage
       
    61      */
       
    62     void ExecuteCommandL(
       
    63             TESMRIcalViewerOperationType aOpType,
       
    64             MESMRIcalViewerObserver* aObserver,
       
    65             CFSMailMessage& aMessage );
       
    66 
       
    67     /**
       
    68      * Executes commands on based on CFSMailMessages based on  operation types
       
    69      * @param aOpType commands operation type
       
    70      * @param aObserver observer of the asynchronous command result
       
    71      * @param aMessage the command is executed on this CFSMailMessage
       
    72      * @param aParam generic extension parameter type to extend ical commands
       
    73      */
       
    74     void ExecuteCommandL(
       
    75             TESMRIcalViewerOperationType aOpType,
       
    76             MESMRIcalViewerObserver* aObserver,
       
    77             CFSMailMessage& aMessage,
       
    78             TAny* aParam );
       
    79 
       
    80     /**
       
    81      * Cancel asynchronous operation execution
       
    82      */
       
    83     void CancelOperation();    
       
    84     
       
    85 public: // From MESMRIcalViewerObserver
       
    86     void OperationCompleted(
       
    87                     TIcalViewerOperationResult aResult );
       
    88     void OperationError(
       
    89                     TIcalViewerOperationResult aResult );
       
    90     
       
    91 private: // Implementation
       
    92     CESMRIcalViewerCmdHandler(
       
    93             MESMRIcalViewerCallback& aCallback );
       
    94     void ConstructL();
       
    95 
       
    96     void ExecuteCommandInternalL( 
       
    97             TESMRIcalViewerOperationType aOpType,
       
    98             MESMRIcalViewerObserver* aObserver,
       
    99             CFSMailMessage& aMessage,
       
   100             TAny* aParam );
       
   101     
       
   102     /**
       
   103      * Operation state of command execution
       
   104      */
       
   105     enum TState
       
   106         {
       
   107         EIdle,
       
   108         EExecuting
       
   109         };
       
   110 
       
   111 private: // Data
       
   112     TState iState;
       
   113     /// Own. Calendar database session
       
   114     CCalSession* iCalSession;
       
   115     /// Own. FS Email mail client object.
       
   116     CFSMailClient* iMailClient;
       
   117     /// Own: Copy of the message to be handled.
       
   118     CFSMailMessage* iMessage;
       
   119     /// Own: Command array
       
   120     MESMRIcalViewerCommand* iCommand;
       
   121     /// Ref: Reference to command observer
       
   122     MESMRIcalViewerObserver* iObserver;
       
   123     /// Ref: ESMRIcalViewer callback
       
   124     MESMRIcalViewerCallback& iCallback;
       
   125     /// Own: Result structure
       
   126     MESMRIcalViewerObserver::TIcalViewerOperationResult iResult;
       
   127     };
       
   128 
       
   129 #endif
       
   130 
       
   131 // EOF