|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Message store multipart message support. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __MSG_STORE_MESSAGE_PART_H__ |
|
21 #define __MSG_STORE_MESSAGE_PART_H__ |
|
22 |
|
23 //<cmail> |
|
24 #include "MsgStoreTypes.h" |
|
25 #include "MsgStorePropertyContainerWithContent.h" |
|
26 //</cmail> |
|
27 |
|
28 class CMsgStoreMessage; |
|
29 |
|
30 /** This class represents a part of a message */ |
|
31 class CMsgStoreMessagePart : public CMsgStorePropertyContainerWithContent |
|
32 { |
|
33 public: |
|
34 |
|
35 /** check if this part contains any child parts */ |
|
36 //IMPORT_C TBool IsMultiPart(); |
|
37 |
|
38 /** Adds a child part to this part |
|
39 |
|
40 /param aProperties the headers of the newly added part |
|
41 /param aContentFilenams optional parameter that contains the name of the content/attachment file. |
|
42 |
|
43 /note This method leaves with KErrNotSupported if it is NOT multi-part, i.e. this part |
|
44 already has content. |
|
45 */ |
|
46 IMPORT_C CMsgStoreMessagePart* AddChildPartL( const CMsgStorePropertyContainer& aProperties, |
|
47 const TDesC& aContentFilename = KNullDesC ); |
|
48 //cmail |
|
49 |
|
50 /** Adds a child part to this part and set the content to the same content stored in the input file handle |
|
51 |
|
52 /param aProperties the headers of the newly added part |
|
53 /param aFile file handle that contains the content. |
|
54 //cmail |
|
55 NOTE 1: RFs.ShareProtected() must have been called before calling this method. |
|
56 NOTE 2: Ownersip of the file handle is transferred to this method. |
|
57 //~cmail |
|
58 |
|
59 /note This method leaves with KErrNotSupported if it is NOT multi-part, i.e. this part |
|
60 already has content. |
|
61 */ |
|
62 IMPORT_C CMsgStoreMessagePart* AddChildPartL( const CMsgStorePropertyContainer& aProperties, |
|
63 RFile& aFile ); |
|
64 |
|
65 //~cmail |
|
66 |
|
67 /** Adds an embedded message to this part |
|
68 * |
|
69 /param aProperties the headers of the newly added part |
|
70 /note This method leaves with KErrNotSupported if it is NOT multi-part, i.e. this part |
|
71 already has content. |
|
72 */ |
|
73 IMPORT_C CMsgStoreMessage* AddChildMessageL( CMsgStorePropertyContainer& aProperties ); |
|
74 |
|
75 /** Copies an attachment from one message to another message. |
|
76 |
|
77 This function copies an an attachment, including the properties and content, from one |
|
78 message to another message. This function will leave with KErrNotFound if the specified |
|
79 message is not found in the source folder or if the destination message is not found in |
|
80 the destination folder. |
|
81 |
|
82 KMsgStoreInvalidId may be passed for the destination folder ID if there is no desire to |
|
83 check the source folder. |
|
84 |
|
85 ECapabilityWriteUserData is required to use this function. |
|
86 |
|
87 \param aNewParentId the destination parent, either a message or a part |
|
88 |
|
89 \retval Returns the ID of the new message. |
|
90 |
|
91 \note Only works if the store is in an authenticated state, otherwise this function leaves |
|
92 with KErrNotReady. |
|
93 */ |
|
94 IMPORT_C TMsgStoreId CopyChildPartL( TMsgStoreId aPartId, |
|
95 TMsgStoreId aNewParentId ); |
|
96 |
|
97 /** Removes a child part from this part |
|
98 \param aRecursive if true, recursively search into the tree |
|
99 */ |
|
100 IMPORT_C void RemoveChildPartL( TMsgStoreId aPartId, TBool aRecursive = EFalse ); |
|
101 |
|
102 /** gets a child part fo this part |
|
103 \param aRecursive if true, recursively search into the tree |
|
104 */ |
|
105 IMPORT_C CMsgStoreMessagePart* ChildPartL( TMsgStoreId aPartId, TBool aRecursive = EFalse ); |
|
106 |
|
107 /** list all the child part to this part |
|
108 /note This method leaves with KErrNotSupported if it is NOT multi-part. |
|
109 */ |
|
110 IMPORT_C void ChildPartsL( RPointerArray<CMsgStoreMessagePart>& aParts ); |
|
111 |
|
112 /** flag that indicates whether this part is actually a message. |
|
113 /note This method can be used to check if a child part is actually |
|
114 an embedded message, if it is, than it is safe to cast |
|
115 this part to CMsgStoreMessage. This can avoid run-time |
|
116 type checking. |
|
117 */ |
|
118 IMPORT_C TBool IsEmbeddedMessageL(); |
|
119 |
|
120 // --------------------------- |
|
121 // INTERNAL USE (NOT EXPORTED) |
|
122 // --------------------------- |
|
123 |
|
124 static CMsgStoreMessagePart* NewL( CMsgStoreSessionContext& aSessionContext, |
|
125 TMsgStoreId aId, |
|
126 TMsgStoreId aParentId, |
|
127 TMsgStoreId aMailBoxId, |
|
128 const TDesC8& aPropertiesBuf ); |
|
129 |
|
130 protected: |
|
131 |
|
132 CMsgStoreMessagePart( CMsgStoreSessionContext& aSessionContext, TMsgStoreId aId, TMsgStoreId aParentId, TMsgStoreId aMailBoxId ); |
|
133 |
|
134 void ConstructL( const TDesC8& aPropertiesBuf ); |
|
135 |
|
136 }; // end CMsgStoreMessagePart |
|
137 |
|
138 #endif // __MESSAGE_STORE_CLIENT_H__ |