email/imum/Mtms/Inc/EmailMsgSizerOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 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 *       Class declaration file
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __EMAILMSGSIZEROPERATION_H__
       
    20 #define __EMAILMSGSIZEROPERATION_H__
       
    21 
       
    22 #include <eikdialg.h>
       
    23 
       
    24 #include <msvapi.h> // CMsvOperation
       
    25 #include <miutmsg.h> // CImEmailMessage
       
    26 #include <ImumInternalApi.h>        // CImumInternalApi
       
    27 
       
    28 #include "PROGTYPE.H"
       
    29 
       
    30 class CEikonEnv;
       
    31 class CImEmailMessage;
       
    32 class CImBaseEmailSettings;
       
    33 class CContactItemFieldSet;
       
    34 class CImIAPPreferences;
       
    35 
       
    36 const TInt KSizerOpPriority = CActive::EPriorityStandard;
       
    37 
       
    38 /**
       
    39 * TMsvAttachmentNamesArray
       
    40 *
       
    41 */
       
    42 class TMsvAttachmentNamesArray : public MDesC16Array
       
    43     {
       
    44     public:
       
    45         /**
       
    46         * C++ constructor
       
    47         * TMsvAttachmentNamesArray
       
    48         * @param const CArrayFixFlat<CMsvAttachment>&, attachment list
       
    49         */
       
    50         TMsvAttachmentNamesArray(
       
    51             const CArrayFixFlat<CMsvAttachment>& aAttachmentList );
       
    52 
       
    53         /**
       
    54         * MdcaCount
       
    55         * From MDesC16Array
       
    56         * @return TInt, item count
       
    57         */
       
    58         virtual TInt MdcaCount() const;
       
    59 
       
    60         /**
       
    61         * MdcaPoint
       
    62         * From MDesC16Array'
       
    63         * @return TPtrC16, item text
       
    64         */
       
    65         virtual TPtrC16 MdcaPoint(TInt aIndex) const;
       
    66 
       
    67     public:
       
    68         const CArrayFixFlat<CMsvAttachment>& iAttachments;
       
    69     };
       
    70 
       
    71 
       
    72 /**
       
    73 * Progress for email message sizer op.
       
    74 *
       
    75 */
       
    76 class TEmailMsgSizerProgress
       
    77     {
       
    78     public:
       
    79         /**
       
    80         * TEmailMsgSizerProgress
       
    81         * C++ constructor
       
    82         */
       
    83         TEmailMsgSizerProgress()
       
    84             : iProgTypeId(EUiProgTypeSizingMsg), iErrorCode(KErrNone) {}        // progtype.h
       
    85     public:
       
    86         TInt iProgTypeId;
       
    87         TInt iErrorCode;
       
    88     };
       
    89 
       
    90 /**
       
    91 * Email Message Sizer Operation.
       
    92 * Walks a message tree asynchronously and provides accessors for
       
    93 * message part sizes after completion.
       
    94 */
       
    95 class CEmailMsgSizerOperation : public CMsvOperation
       
    96     {
       
    97     public:
       
    98         /**
       
    99         * NewL
       
   100         * @param CMsvSession&, session reference
       
   101         * @param TRequestStatus&, request status
       
   102         * @param TMsvId, entry id
       
   103         * @param TUid, Mtm id
       
   104         * @return CEmailMsgSizerOperation*, self pointer
       
   105         */
       
   106         static CEmailMsgSizerOperation* NewL(
       
   107             CImumInternalApi& aMailboxApi,
       
   108             TRequestStatus& aObserverRequestStatus,
       
   109             TMsvId aMsgId,
       
   110             TUid aMtm);
       
   111 
       
   112         /**
       
   113         * ~CEmailMsgSizerOperation
       
   114         * Destructor
       
   115         */
       
   116         virtual ~CEmailMsgSizerOperation();
       
   117 
       
   118         /**
       
   119         * ProgressL
       
   120         * @return TDesC8&, progress
       
   121         */
       
   122         virtual const TDesC8& ProgressL();
       
   123 
       
   124         /**
       
   125         * TotalMessageSize
       
   126         * Valid after op completes.
       
   127         * @return TInt32, message size
       
   128         */
       
   129         TInt32 TotalMessageSize() const;
       
   130 
       
   131         /**
       
   132         * BodyTextSizeL
       
   133         * Valid after op completes.
       
   134         * @return TInt32, body size
       
   135         */
       
   136         TInt32 BodyTextSizeL() const;
       
   137 
       
   138         /**
       
   139         * SizeOfAllAttachmentsL
       
   140         * Valid after op completes.
       
   141         * @return TInt32, attachments size
       
   142         */
       
   143         TInt32 SizeOfAllAttachmentsL() const;
       
   144 
       
   145         /**
       
   146         * AttachmentSizeL
       
   147         * Valid after op completes.
       
   148         * @param TMsvId, attachment id
       
   149         * @return TInt32, attachment size
       
   150         */
       
   151         TInt32 AttachmentSizeL(TMsvId aAttachmentId) const;
       
   152 
       
   153         /**
       
   154         * HasAttachmentLargerThanL
       
   155         * Returns ETrue if there is bigger attachement than aSize found
       
   156         * by this operation.
       
   157         * @param TInt32, size
       
   158         * @return TBool, ETrue if has attachments larger than given size
       
   159         */
       
   160         TBool HasAttachmentLargerThanL( TInt32 aSize ) const;
       
   161 
       
   162     protected:
       
   163 
       
   164         /**
       
   165         * DoCancel
       
   166         * From CActive
       
   167         */
       
   168         virtual void DoCancel();
       
   169 
       
   170         /**
       
   171         * RunL
       
   172         * From CActive
       
   173         */
       
   174         virtual void RunL();
       
   175     private:
       
   176 
       
   177         /**
       
   178         * CEmailMsgSizerOperation
       
   179         * C++ constructor
       
   180         * @param CMsvSession&, session reference
       
   181         * @param TRequestStatus&, request status
       
   182         * @param TUid, Mtm id
       
   183         */
       
   184         CEmailMsgSizerOperation(
       
   185             CImumInternalApi& aMailboxApi,
       
   186             TRequestStatus& aObserverRequestStatus,
       
   187             TUid aMtm);
       
   188 
       
   189         /**
       
   190         * ConstructL
       
   191         * Symbian constructor
       
   192         * @param TMsvId, message id
       
   193         */
       
   194         void ConstructL( TMsvId aMsgId );
       
   195 
       
   196     private:
       
   197 
       
   198         /**
       
   199         *
       
   200         * @since S60 3.0
       
   201         */
       
   202         TInt GetSizeL(
       
   203              const TInt aIndex,
       
   204              MMsvAttachmentManager& aList ) const;
       
   205 
       
   206     private:
       
   207         CMsvEntry* iMsgEntry;
       
   208         CImEmailMessage* iEmailMsg;
       
   209         TPckgBuf<TEmailMsgSizerProgress> iProgress;
       
   210     };
       
   211 
       
   212 
       
   213 #endif // __EMAILMSGSIZEROPERATION_H__
       
   214