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