epoc32/include/cmsvattachment.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/cmsvattachment.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/cmsvattachment.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,158 @@
     1.4 -cmsvattachment.h
     1.5 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __CMSVATTACHMENT_H__
    1.21 +#define __CMSVATTACHMENT_H__
    1.22 +
    1.23 +#include <e32base.h>
    1.24 +#include <msvstd.h>
    1.25 +
    1.26 +/**
    1.27 +Attachment Id for uniquely identifying attachments. 
    1.28 +
    1.29 +This is unique on a per message entry basis.
    1.30 +
    1.31 +@publishedAll
    1.32 +@released
    1.33 +*/
    1.34 +typedef TUint TMsvAttachmentId;
    1.35 +
    1.36 +/**
    1.37 +DRM Mime type
    1.38 +
    1.39 +@publishedPartner
    1.40 +@released
    1.41 +*/
    1.42 +_LIT8(KEpocMimeTypeDrm,"X-Epoc/DRM.Receipt");
    1.43 +
    1.44 +class CMsvAttributeManager;
    1.45 +
    1.46 +/**
    1.47 +Represents a single attachment and information about the attachment.
    1.48 +
    1.49 +This object is used to represent all types of attachments (file, linked file or message 
    1.50 +entry). Note that some APIs may not be valid for particular attachment types. This is
    1.51 +described under each method. It is the responsibility of the client to ensure that the
    1.52 +data about the attachment is set such as its mime-type or size.
    1.53 +
    1.54 +@publishedAll
    1.55 +@released
    1.56 +*/
    1.57 +class CMsvAttachment : public CBase
    1.58 +	{
    1.59 +public:
    1.60 +	/**
    1.61 +	Enum to define the different types of attachments supported by messaging.
    1.62 +	*/
    1.63 +	enum TMsvAttachmentType
    1.64 +		{
    1.65 +		/**
    1.66 +		File attachment. This is a file attachment that is copied into the message store.
    1.67 +		*/
    1.68 +		EMsvFile = 0,
    1.69 +		/**
    1.70 +		Linked file attachment. This is an attachment that is linked to using its file path,
    1.71 +		this is not copied into the message store.
    1.72 +		*/
    1.73 +		EMsvLinkedFile,
    1.74 +		/**
    1.75 +		Message entry attachment. This is a message entry that is registered as an attachment.
    1.76 +		*/
    1.77 +		EMsvMessageEntry
    1.78 +		};
    1.79 +	
    1.80 +public:
    1.81 +	IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType);
    1.82 +	IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
    1.83 +	
    1.84 +	IMPORT_C static CMsvAttachment* NewL(const CMsvAttachment& aAttachment);
    1.85 +	
    1.86 +	IMPORT_C ~CMsvAttachment();
    1.87 +	
    1.88 +	IMPORT_C TMsvAttachmentId Id() const;
    1.89 +	IMPORT_C void SetId(TMsvAttachmentId aId);
    1.90 +	
    1.91 +	IMPORT_C TMsvAttachmentType Type() const;
    1.92 +	
    1.93 +	IMPORT_C TMsvId EntryAttachmentId() const;
    1.94 +	void SetEntryAttachmentId(TMsvId aEntryId);
    1.95 +	
    1.96 +	IMPORT_C const TDesC& AttachmentName() const;
    1.97 +	IMPORT_C void SetAttachmentNameL(const TDesC& aAttachmentName);
    1.98 +	
    1.99 +	IMPORT_C const TDesC& FilePath() const;
   1.100 +	void SetFilePathL(const TDesC& aFilePath);
   1.101 +	
   1.102 +	IMPORT_C TInt Size() const;
   1.103 +	IMPORT_C void SetSize(TInt aSize);
   1.104 +	
   1.105 +	IMPORT_C const TDesC8& MimeType() const;
   1.106 +	IMPORT_C void SetMimeTypeL(const TDesC8& aMimeType);
   1.107 +		
   1.108 +	IMPORT_C TBool Complete() const;
   1.109 +	IMPORT_C void SetComplete(TBool aComplete);
   1.110 +	
   1.111 +	IMPORT_C void SetDesC8AttributeL(TUid aAttributeId, const TDesC8& aAttribute);
   1.112 +	IMPORT_C TInt GetDesC8Attribute(TUid aAttributeId, TPtrC8& aAttribute) const;
   1.113 +	IMPORT_C void RemoveDesC8Attribute(TUid aAttributeId);
   1.114 +	
   1.115 +	IMPORT_C void SetIntAttributeL(TUid aAttributeId, TInt aAttribute);
   1.116 +	IMPORT_C TInt GetIntAttribute(TUid aAttributeId, TInt& aAttribute) const;
   1.117 +	IMPORT_C void RemoveIntAttribute(TUid aAttributeId);
   1.118 +	
   1.119 +	void InternalizeL(RReadStream& aStream);
   1.120 +	void ExternalizeL(RWriteStream& aStream) const;
   1.121 +	
   1.122 +	TBool IsPathRequired() const;
   1.123 +	
   1.124 +private:
   1.125 +	CMsvAttachment(TMsvAttachmentType aType);
   1.126 +	CMsvAttachment(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
   1.127 +	void ConstructL();
   1.128 +	void ConstructL(const CMsvAttachment& aAttachment);
   1.129 +	
   1.130 +private:
   1.131 +	/** The unique attachment Id. This is unique per message entry and is auto-assigned. */
   1.132 +	TMsvAttachmentId iId;
   1.133 +	
   1.134 +	/** The attachment type. */
   1.135 +	TMsvAttachmentType iType;
   1.136 +	
   1.137 +	/** Size of the attachment in bytes. */
   1.138 +	TInt iSize;
   1.139 +	
   1.140 +	/** Descriptor indicating the mime type of the attachment. */
   1.141 +	HBufC8* iMimeType;
   1.142 +			
   1.143 +	/** The full file path and file name of attachment files and linked files. */
   1.144 +	HBufC* iFilePath;
   1.145 +		
   1.146 +	/** The message entry Id of the entry attachment. */
   1.147 +	TMsvId iEntryId;
   1.148 +	
   1.149 +	/** Name of the attachment to identify to the attachment. */
   1.150 +	HBufC* iAttachmentName;
   1.151 +	
   1.152 +	/** Attachment entry completeness flag. */
   1.153 +	TBool iComplete;
   1.154 +	
   1.155 +	/** Attribute manager for handling the attributes for this attachment. */
   1.156 +	CMsvAttributeManager* iAttributeManager;
   1.157 +	
   1.158 +	/** Flag to indicate whether a path needs to be added. */
   1.159 +	TBool iNeedsPath;
   1.160 +	};
   1.161 +
   1.162 +#endif // __CMSVATTACHMENT_H__