epoc32/include/mw/cmsvattachment.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/cmsvattachment.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __CMSVATTACHMENT_H__
williamr@2
    17
#define __CMSVATTACHMENT_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
#include <msvstd.h>
williamr@2
    21
williamr@2
    22
/**
williamr@2
    23
Attachment Id for uniquely identifying attachments. 
williamr@2
    24
williamr@2
    25
This is unique on a per message entry basis.
williamr@2
    26
williamr@2
    27
@publishedAll
williamr@2
    28
@released
williamr@2
    29
*/
williamr@2
    30
typedef TUint TMsvAttachmentId;
williamr@2
    31
williamr@2
    32
/**
williamr@2
    33
DRM Mime type
williamr@2
    34
williamr@2
    35
@publishedPartner
williamr@2
    36
@released
williamr@2
    37
*/
williamr@2
    38
_LIT8(KEpocMimeTypeDrm,"X-Epoc/DRM.Receipt");
williamr@2
    39
williamr@2
    40
class CMsvAttributeManager;
williamr@2
    41
williamr@2
    42
/**
williamr@2
    43
Represents a single attachment and information about the attachment.
williamr@2
    44
williamr@2
    45
This object is used to represent all types of attachments (file, linked file or message 
williamr@2
    46
entry). Note that some APIs may not be valid for particular attachment types. This is
williamr@2
    47
described under each method. It is the responsibility of the client to ensure that the
williamr@2
    48
data about the attachment is set such as its mime-type or size.
williamr@2
    49
williamr@2
    50
@publishedAll
williamr@2
    51
@released
williamr@2
    52
*/
williamr@2
    53
class CMsvAttachment : public CBase
williamr@2
    54
	{
williamr@2
    55
public:
williamr@2
    56
	/**
williamr@2
    57
	Enum to define the different types of attachments supported by messaging.
williamr@2
    58
	*/
williamr@2
    59
	enum TMsvAttachmentType
williamr@2
    60
		{
williamr@2
    61
		/**
williamr@2
    62
		File attachment. This is a file attachment that is copied into the message store.
williamr@2
    63
		*/
williamr@2
    64
		EMsvFile = 0,
williamr@2
    65
		/**
williamr@2
    66
		Linked file attachment. This is an attachment that is linked to using its file path,
williamr@2
    67
		this is not copied into the message store.
williamr@2
    68
		*/
williamr@2
    69
		EMsvLinkedFile,
williamr@2
    70
		/**
williamr@2
    71
		Message entry attachment. This is a message entry that is registered as an attachment.
williamr@2
    72
		*/
williamr@2
    73
		EMsvMessageEntry
williamr@2
    74
		};
williamr@2
    75
	
williamr@2
    76
public:
williamr@2
    77
	IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType);
williamr@2
    78
	IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
williamr@2
    79
	
williamr@2
    80
	IMPORT_C static CMsvAttachment* NewL(const CMsvAttachment& aAttachment);
williamr@2
    81
	
williamr@2
    82
	IMPORT_C ~CMsvAttachment();
williamr@2
    83
	
williamr@2
    84
	IMPORT_C TMsvAttachmentId Id() const;
williamr@2
    85
	IMPORT_C void SetId(TMsvAttachmentId aId);
williamr@2
    86
	
williamr@2
    87
	IMPORT_C TMsvAttachmentType Type() const;
williamr@2
    88
	
williamr@2
    89
	IMPORT_C TMsvId EntryAttachmentId() const;
williamr@2
    90
	void SetEntryAttachmentId(TMsvId aEntryId);
williamr@2
    91
	
williamr@2
    92
	IMPORT_C const TDesC& AttachmentName() const;
williamr@2
    93
	IMPORT_C void SetAttachmentNameL(const TDesC& aAttachmentName);
williamr@2
    94
	
williamr@2
    95
	IMPORT_C const TDesC& FilePath() const;
williamr@2
    96
	void SetFilePathL(const TDesC& aFilePath);
williamr@2
    97
	
williamr@2
    98
	IMPORT_C TInt Size() const;
williamr@2
    99
	IMPORT_C void SetSize(TInt aSize);
williamr@2
   100
	
williamr@2
   101
	IMPORT_C const TDesC8& MimeType() const;
williamr@2
   102
	IMPORT_C void SetMimeTypeL(const TDesC8& aMimeType);
williamr@2
   103
		
williamr@2
   104
	IMPORT_C TBool Complete() const;
williamr@2
   105
	IMPORT_C void SetComplete(TBool aComplete);
williamr@2
   106
	
williamr@2
   107
	IMPORT_C void SetDesC8AttributeL(TUid aAttributeId, const TDesC8& aAttribute);
williamr@2
   108
	IMPORT_C TInt GetDesC8Attribute(TUid aAttributeId, TPtrC8& aAttribute) const;
williamr@2
   109
	IMPORT_C void RemoveDesC8Attribute(TUid aAttributeId);
williamr@2
   110
	
williamr@2
   111
	IMPORT_C void SetIntAttributeL(TUid aAttributeId, TInt aAttribute);
williamr@2
   112
	IMPORT_C TInt GetIntAttribute(TUid aAttributeId, TInt& aAttribute) const;
williamr@2
   113
	IMPORT_C void RemoveIntAttribute(TUid aAttributeId);
williamr@2
   114
	
williamr@2
   115
	void InternalizeL(RReadStream& aStream);
williamr@2
   116
	void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   117
	
williamr@2
   118
	TBool IsPathRequired() const;
williamr@2
   119
	
williamr@2
   120
private:
williamr@2
   121
	CMsvAttachment(TMsvAttachmentType aType);
williamr@2
   122
	CMsvAttachment(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
williamr@2
   123
	void ConstructL();
williamr@2
   124
	void ConstructL(const CMsvAttachment& aAttachment);
williamr@2
   125
	
williamr@2
   126
private:
williamr@2
   127
	/** The unique attachment Id. This is unique per message entry and is auto-assigned. */
williamr@2
   128
	TMsvAttachmentId iId;
williamr@2
   129
	
williamr@2
   130
	/** The attachment type. */
williamr@2
   131
	TMsvAttachmentType iType;
williamr@2
   132
	
williamr@2
   133
	/** Size of the attachment in bytes. */
williamr@2
   134
	TInt iSize;
williamr@2
   135
	
williamr@2
   136
	/** Descriptor indicating the mime type of the attachment. */
williamr@2
   137
	HBufC8* iMimeType;
williamr@2
   138
			
williamr@2
   139
	/** The full file path and file name of attachment files and linked files. */
williamr@2
   140
	HBufC* iFilePath;
williamr@2
   141
		
williamr@2
   142
	/** The message entry Id of the entry attachment. */
williamr@2
   143
	TMsvId iEntryId;
williamr@2
   144
	
williamr@2
   145
	/** Name of the attachment to identify to the attachment. */
williamr@2
   146
	HBufC* iAttachmentName;
williamr@2
   147
	
williamr@2
   148
	/** Attachment entry completeness flag. */
williamr@2
   149
	TBool iComplete;
williamr@2
   150
	
williamr@2
   151
	/** Attribute manager for handling the attributes for this attachment. */
williamr@2
   152
	CMsvAttributeManager* iAttributeManager;
williamr@2
   153
	
williamr@2
   154
	/** Flag to indicate whether a path needs to be added. */
williamr@2
   155
	TBool iNeedsPath;
williamr@2
   156
	};
williamr@2
   157
williamr@2
   158
#endif // __CMSVATTACHMENT_H__