emailservices/emailclientapi/inc/emailcontent.h
author hgs
Mon, 23 Aug 2010 23:32:31 +0300
changeset 62 a8c646b56683
parent 47 f83bd4ae1fe3
permissions -rw-r--r--
201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: mail content implementation definition
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifndef EMAILCONTENT_H
hgs
parents:
diff changeset
    19
#define EMAILCONTENT_H
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
#include <memailcontent.h>
hgs
parents:
diff changeset
    22
62
hgs
parents: 47
diff changeset
    23
#include "CFSMailClient.h"
47
hgs
parents:
diff changeset
    24
#include "emailapiutils.h"
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
using namespace EmailInterface;
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
class CFSMailPlugin;
hgs
parents:
diff changeset
    29
class CFSMailRequestObserver;
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
NONSHARABLE_CLASS( CEmailMessageContent ) : public CBase, 
hgs
parents:
diff changeset
    32
                                            public MEmailMessageContent
hgs
parents:
diff changeset
    33
{
hgs
parents:
diff changeset
    34
public:
hgs
parents:
diff changeset
    35
    static CEmailMessageContent* NewL( 
hgs
parents:
diff changeset
    36
            CPluginData& aPluginData,
hgs
parents:
diff changeset
    37
            const TMessageContentId& aMsgContentId,
hgs
parents:
diff changeset
    38
            CFSMailMessagePart* aPart);
hgs
parents:
diff changeset
    39
        
hgs
parents:
diff changeset
    40
    ~CEmailMessageContent();
hgs
parents:
diff changeset
    41
    
hgs
parents:
diff changeset
    42
public: // from MEmailInterface
hgs
parents:
diff changeset
    43
    TEmailTypeId InterfaceId() const;
hgs
parents:
diff changeset
    44
    
hgs
parents:
diff changeset
    45
    void Release();
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
public: // from MEmailMessageContent
hgs
parents:
diff changeset
    48
    TMessageContentId Id() const;
hgs
parents:
diff changeset
    49
hgs
parents:
diff changeset
    50
    TPtrC ContentType() const;
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
    void SetContentType( const TDesC& aContentType );
hgs
parents:
diff changeset
    53
hgs
parents:
diff changeset
    54
    TPtrC ContentId() const;
hgs
parents:
diff changeset
    55
hgs
parents:
diff changeset
    56
    void SetContentId( const TDesC& aContentId );
hgs
parents:
diff changeset
    57
hgs
parents:
diff changeset
    58
    TPtrC ContentDescription() const;
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
    void SetContentDescription( const TDesC& aContentDescription );
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
    TPtrC ContentDisposition() const;
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
    void SetContentDisposition( const TDesC& aContentDisposition );
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
    TPtrC ContentClass() const;
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
    void SetContentClass( const TDesC& aContentClass );
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
    TInt AvailableSize() const;
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
    TInt TotalSize() const;
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
    TPtrC ContentL() const;
hgs
parents:
diff changeset
    75
hgs
parents:
diff changeset
    76
    void SetContentL( const TDesC& aContent );
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
    void FetchL( MEmailFetchObserver& aObserver );
hgs
parents:
diff changeset
    79
hgs
parents:
diff changeset
    80
    void CancelFetch();
hgs
parents:
diff changeset
    81
hgs
parents:
diff changeset
    82
    void SaveToFileL( const TDesC& aPath );
hgs
parents:
diff changeset
    83
hgs
parents:
diff changeset
    84
    MEmailMultipart* AsMultipartOrNull() const;
hgs
parents:
diff changeset
    85
    
hgs
parents:
diff changeset
    86
    MEmailTextContent* AsTextContentOrNull() const;
hgs
parents:
diff changeset
    87
hgs
parents:
diff changeset
    88
    MEmailAttachment* AsAttachmentOrNull() const;
hgs
parents:
diff changeset
    89
    
hgs
parents:
diff changeset
    90
public:     
hgs
parents:
diff changeset
    91
    CFSMailMessagePart& Part();
hgs
parents:
diff changeset
    92
    void SetPart( CFSMailMessagePart *aPart );
hgs
parents:
diff changeset
    93
    
hgs
parents:
diff changeset
    94
    CPluginData& PluginData();
hgs
parents:
diff changeset
    95
        
hgs
parents:
diff changeset
    96
protected:
hgs
parents:
diff changeset
    97
    CEmailMessageContent( CPluginData& aPluginData, const TMessageContentId& aMsgContentId, CFSMailMessagePart* aPart );
hgs
parents:
diff changeset
    98
    
hgs
parents:
diff changeset
    99
private:
hgs
parents:
diff changeset
   100
    class CContentRequestObserver: public CBase, 
hgs
parents:
diff changeset
   101
                                   public MFSMailRequestObserver
hgs
parents:
diff changeset
   102
        {
hgs
parents:
diff changeset
   103
    public:
hgs
parents:
diff changeset
   104
        CContentRequestObserver( CEmailMessageContent &aParent);
hgs
parents:
diff changeset
   105
        
hgs
parents:
diff changeset
   106
        virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
hgs
parents:
diff changeset
   107
        void SetObserverL( MEmailFetchObserver* aObserver );
hgs
parents:
diff changeset
   108
    private:
hgs
parents:
diff changeset
   109
        MEmailFetchObserver* iObserver;
hgs
parents:
diff changeset
   110
        CEmailMessageContent& iParent;
hgs
parents:
diff changeset
   111
        };
hgs
parents:
diff changeset
   112
hgs
parents:
diff changeset
   113
private:
hgs
parents:
diff changeset
   114
    void ConstructL();
hgs
parents:
diff changeset
   115
hgs
parents:
diff changeset
   116
private:
hgs
parents:
diff changeset
   117
    CPluginData&            iPluginData;
hgs
parents:
diff changeset
   118
    CFSMailPlugin*          iPlugin;
hgs
parents:
diff changeset
   119
    CFSMailMessagePart*     iPart;
hgs
parents:
diff changeset
   120
    TMessageContentId       iMsgContentId;
hgs
parents:
diff changeset
   121
    mutable HBufC*          iBuf;
hgs
parents:
diff changeset
   122
    mutable TUint           iUsed;
hgs
parents:
diff changeset
   123
    CContentRequestObserver *iFetchObserver;
hgs
parents:
diff changeset
   124
    TInt                    iRequestId;
hgs
parents:
diff changeset
   125
};
hgs
parents:
diff changeset
   126
hgs
parents:
diff changeset
   127
#endif // EMAILCONTENT_H
hgs
parents:
diff changeset
   128
hgs
parents:
diff changeset
   129
// End of file