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