meetingrequest/mricalviewer/inc/cmrattachmentinfofetcher.h
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     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:  MR attachment informatio fetcher definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMRATTACHMENTINFOFETCHER_H
       
    19 #define CMRATTACHMENTINFOFETCHER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "mfsmailrequestobserver.h"
       
    23 #include "mesmricalviewerobserver.h"
       
    24 #include "cesmricalviewerasynccommand.h"
       
    25 
       
    26 class CFSMailMessage;
       
    27 class CFSMailClient;
       
    28 class CCalEntry;
       
    29 
       
    30 /**
       
    31  * CMRAttachmentInfoFetcher is responsible for fetching attachment
       
    32  * information and storing URI attachment information to
       
    33  * calendar entry.
       
    34  */
       
    35 NONSHARABLE_CLASS( CMRAttachmentInfoFetcher ) :
       
    36         public CESMRIcalViewerAsyncCommand,
       
    37         public MFSMailRequestObserver
       
    38     {
       
    39 public:
       
    40 public: // Construction and destruction
       
    41     /**
       
    42      * Creates and initializes new CMRAttachmentInfoFetcher object. 
       
    43      * Ownership is transferred to caller.
       
    44      * 
       
    45      * @param aMailClient Reference to mail client
       
    46      * @param aCalSession Reference to calendar session
       
    47      * @return Pointer to CESMRImapMailFetcher object.
       
    48      */
       
    49     static CMRAttachmentInfoFetcher* NewL(
       
    50             CFSMailClient& aMailClient,
       
    51             CCalSession& aCalSession,
       
    52             CCalEntry& aCalEntry );
       
    53 
       
    54     /**
       
    55      * C++ destructor.
       
    56      */
       
    57     ~CMRAttachmentInfoFetcher();
       
    58 
       
    59 private: // From MFSMailRequestObserver
       
    60     void RequestResponseL(
       
    61             TFSProgress aEvent,
       
    62             TInt aRequestId );
       
    63 
       
    64 private: // From MESMRIcalViewerAsyncCommand
       
    65     void ExecuteAsyncCommandL();
       
    66     void CancelAsyncCommand();
       
    67 
       
    68 private: // Implementation
       
    69     CMRAttachmentInfoFetcher(
       
    70             CFSMailClient& aMailClient,
       
    71             CCalSession& aCalSession,
       
    72             CCalEntry& aCalEntry );
       
    73     void ConstructL();
       
    74     void FetchMessageStructureL();
       
    75     TBool ConstructAttachmentInformationL();
       
    76     void HandleRequestResponseL(
       
    77             TFSProgress aEvent,
       
    78             TInt aRequestId );
       
    79     void NotifyCompletion();
       
    80 
       
    81 private:
       
    82     /** Enumeration for object internal state */
       
    83     enum TMRAttachmentFetcherState
       
    84         {
       
    85         // Idle
       
    86         EIdle,
       
    87         // Fetching message structure
       
    88         EFetchingStructure,
       
    89         // Fetching message contents
       
    90         EFetchingContents
       
    91         };
       
    92 
       
    93 private: // Data
       
    94     /// Own: Fetch operation request id
       
    95     TInt iStructureRequestId;
       
    96     /// Own: Fetch operation request id
       
    97     TInt iMessagePartRequestId;
       
    98     // Own: Current state
       
    99     TMRAttachmentFetcherState iState;
       
   100     /// Ref: Reference to mail client object
       
   101     CFSMailClient& iMailClient;
       
   102     /// Ref: Reference to messageobject
       
   103     CFSMailMessage* iMailMessage;
       
   104     /// Own: Operation result
       
   105     MESMRIcalViewerObserver::TIcalViewerOperationResult iResult;
       
   106     /// Ref: Reference to calendar entry
       
   107     CCalEntry& iCalEntry;
       
   108     };
       
   109 
       
   110 #endif // CMRATTACHMENTINFOFETCHER_H
       
   111 
       
   112 // EOF