1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef __CMSVATTACHMENT_H__
23 #define __CMSVATTACHMENT_H__
29 Attachment Id for uniquely identifying attachments.
31 This is unique on a per message entry basis.
36 typedef TUint TMsvAttachmentId;
38 class CMsvAttributeManager;
41 Represents a single attachment and information about the attachment.
43 This object is used to represent all types of attachments (file, linked file or message
44 entry). Note that some APIs may not be valid for particular attachment types. This is
45 described under each method. It is the responsibility of the client to ensure that the
46 data about the attachment is set such as its mime-type or size.
51 class CMsvAttachment : public CBase
55 Enum to define the different types of attachments supported by messaging.
57 enum TMsvAttachmentType
60 File attachment. This is a file attachment that is copied into the message store.
64 Linked file attachment. This is an attachment that is linked to using its file path,
65 this is not copied into the message store.
69 Message entry attachment. This is a message entry that is registered as an attachment.
75 IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType);
76 IMPORT_C static CMsvAttachment* NewL(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
78 IMPORT_C static CMsvAttachment* NewL(const CMsvAttachment& aAttachment);
80 IMPORT_C ~CMsvAttachment();
82 IMPORT_C TMsvAttachmentId Id() const;
83 IMPORT_C void SetId(TMsvAttachmentId aId);
85 IMPORT_C TMsvAttachmentType Type() const;
87 IMPORT_C TMsvId EntryAttachmentId() const;
88 void SetEntryAttachmentId(TMsvId aEntryId);
90 IMPORT_C const TDesC& AttachmentName() const;
91 IMPORT_C void SetAttachmentNameL(const TDesC& aAttachmentName);
93 IMPORT_C const TDesC& FilePath() const;
94 void SetFilePathL(const TDesC& aFilePath);
96 IMPORT_C TInt Size() const;
97 IMPORT_C void SetSize(TInt aSize);
99 IMPORT_C const TDesC8& MimeType() const;
100 IMPORT_C void SetMimeTypeL(const TDesC8& aMimeType);
102 IMPORT_C TBool Complete() const;
103 IMPORT_C void SetComplete(TBool aComplete);
105 IMPORT_C void SetDesC8AttributeL(TUid aAttributeId, const TDesC8& aAttribute);
106 IMPORT_C TInt GetDesC8Attribute(TUid aAttributeId, TPtrC8& aAttribute) const;
107 IMPORT_C void RemoveDesC8Attribute(TUid aAttributeId);
109 IMPORT_C void SetIntAttributeL(TUid aAttributeId, TInt aAttribute);
110 IMPORT_C TInt GetIntAttribute(TUid aAttributeId, TInt& aAttribute) const;
111 IMPORT_C void RemoveIntAttribute(TUid aAttributeId);
113 void InternalizeL(RReadStream& aStream);
114 void ExternalizeL(RWriteStream& aStream) const;
116 TBool IsPathRequired() const;
119 CMsvAttachment(TMsvAttachmentType aType);
120 CMsvAttachment(TMsvAttachmentType aType, TInt aSize, HBufC8* aMimeType, HBufC* aAttachmentName);
122 void ConstructL(const CMsvAttachment& aAttachment);
125 /** The unique attachment Id. This is unique per message entry and is auto-assigned. */
126 TMsvAttachmentId iId;
128 /** The attachment type. */
129 TMsvAttachmentType iType;
131 /** Size of the attachment in bytes. */
134 /** Descriptor indicating the mime type of the attachment. */
137 /** The full file path and file name of attachment files and linked files. */
140 /** The message entry Id of the entry attachment. */
143 /** Name of the attachment to identify to the attachment. */
144 HBufC* iAttachmentName;
146 /** Attachment entry completeness flag. */
149 /** Attribute manager for handling the attributes for this attachment. */
150 CMsvAttributeManager* iAttributeManager;
152 /** Flag to indicate whether a path needs to be added. */
156 #endif // __CMSVATTACHMENT_H__