williamr@2: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __CMSVATTACHMENT_H__ williamr@2: #define __CMSVATTACHMENT_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: Attachment Id for uniquely identifying attachments. williamr@2: williamr@2: This is unique on a per message entry basis. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: typedef TUint TMsvAttachmentId; williamr@2: williamr@2: /** williamr@2: DRM Mime type williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: _LIT8(KEpocMimeTypeDrm,"X-Epoc/DRM.Receipt"); williamr@2: williamr@2: class CMsvAttributeManager; williamr@2: williamr@2: /** williamr@2: Represents a single attachment and information about the attachment. williamr@2: williamr@2: This object is used to represent all types of attachments (file, linked file or message williamr@2: entry). Note that some APIs may not be valid for particular attachment types. This is williamr@2: described under each method. It is the responsibility of the client to ensure that the williamr@2: data about the attachment is set such as its mime-type or size. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CMsvAttachment : public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Enum to define the different types of attachments supported by messaging. williamr@2: */ williamr@2: enum TMsvAttachmentType williamr@2: { williamr@2: /** williamr@2: File attachment. This is a file attachment that is copied into the message store. williamr@2: */ williamr@2: EMsvFile = 0, williamr@2: /** williamr@2: Linked file attachment. This is an attachment that is linked to using its file path, williamr@2: this is not copied into the message store. williamr@2: */ williamr@2: EMsvLinkedFile, williamr@2: /** williamr@2: Message entry attachment. This is a message entry that is registered as an attachment. williamr@2: */ williamr@2: EMsvMessageEntry williamr@2: }; williamr@2: williamr@2: public: williamr@2: IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType); williamr@2: IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName); williamr@2: williamr@2: IMPORT_C static CMsvAttachment* NewL(const CMsvAttachment& aAttachment); williamr@2: williamr@2: IMPORT_C ~CMsvAttachment(); williamr@2: williamr@2: IMPORT_C TMsvAttachmentId Id() const; williamr@2: IMPORT_C void SetId(TMsvAttachmentId aId); williamr@2: williamr@2: IMPORT_C TMsvAttachmentType Type() const; williamr@2: williamr@2: IMPORT_C TMsvId EntryAttachmentId() const; williamr@2: void SetEntryAttachmentId(TMsvId aEntryId); williamr@2: williamr@2: IMPORT_C const TDesC& AttachmentName() const; williamr@2: IMPORT_C void SetAttachmentNameL(const TDesC& aAttachmentName); williamr@2: williamr@2: IMPORT_C const TDesC& FilePath() const; williamr@2: void SetFilePathL(const TDesC& aFilePath); williamr@2: williamr@2: IMPORT_C TInt Size() const; williamr@2: IMPORT_C void SetSize(TInt aSize); williamr@2: williamr@2: IMPORT_C const TDesC8& MimeType() const; williamr@2: IMPORT_C void SetMimeTypeL(const TDesC8& aMimeType); williamr@2: williamr@2: IMPORT_C TBool Complete() const; williamr@2: IMPORT_C void SetComplete(TBool aComplete); williamr@2: williamr@2: IMPORT_C void SetDesC8AttributeL(TUid aAttributeId, const TDesC8& aAttribute); williamr@2: IMPORT_C TInt GetDesC8Attribute(TUid aAttributeId, TPtrC8& aAttribute) const; williamr@2: IMPORT_C void RemoveDesC8Attribute(TUid aAttributeId); williamr@2: williamr@2: IMPORT_C void SetIntAttributeL(TUid aAttributeId, TInt aAttribute); williamr@2: IMPORT_C TInt GetIntAttribute(TUid aAttributeId, TInt& aAttribute) const; williamr@2: IMPORT_C void RemoveIntAttribute(TUid aAttributeId); williamr@2: williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: void ExternalizeL(RWriteStream& aStream) const; williamr@2: williamr@2: TBool IsPathRequired() const; williamr@2: williamr@2: private: williamr@2: CMsvAttachment(TMsvAttachmentType aType); williamr@2: CMsvAttachment(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName); williamr@2: void ConstructL(); williamr@2: void ConstructL(const CMsvAttachment& aAttachment); williamr@2: williamr@2: private: williamr@2: /** The unique attachment Id. This is unique per message entry and is auto-assigned. */ williamr@2: TMsvAttachmentId iId; williamr@2: williamr@2: /** The attachment type. */ williamr@2: TMsvAttachmentType iType; williamr@2: williamr@2: /** Size of the attachment in bytes. */ williamr@2: TInt iSize; williamr@2: williamr@2: /** Descriptor indicating the mime type of the attachment. */ williamr@2: HBufC8* iMimeType; williamr@2: williamr@2: /** The full file path and file name of attachment files and linked files. */ williamr@2: HBufC* iFilePath; williamr@2: williamr@2: /** The message entry Id of the entry attachment. */ williamr@2: TMsvId iEntryId; williamr@2: williamr@2: /** Name of the attachment to identify to the attachment. */ williamr@2: HBufC* iAttachmentName; williamr@2: williamr@2: /** Attachment entry completeness flag. */ williamr@2: TBool iComplete; williamr@2: williamr@2: /** Attribute manager for handling the attributes for this attachment. */ williamr@2: CMsvAttributeManager* iAttributeManager; williamr@2: williamr@2: /** Flag to indicate whether a path needs to be added. */ williamr@2: TBool iNeedsPath; williamr@2: }; williamr@2: williamr@2: #endif // __CMSVATTACHMENT_H__