|
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 message client implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 //<cmail> |
|
21 #include "MsgStoreMessage.h" |
|
22 //</cmail> |
|
23 #include "MsgStoreSessionContext.h" |
|
24 |
|
25 /** Commits a newly created message to the message store. |
|
26 |
|
27 This function commits a newly created message to the message store. If this function is not |
|
28 called, then the message will be automatically cleaned up when the message store is |
|
29 restarted. |
|
30 |
|
31 ECapabilityWriteUserData is required to use this function. |
|
32 */ |
|
33 EXPORT_C void CMsgStoreMessage::CommitL() |
|
34 { |
|
35 //leave if this message is embedded in an attachment |
|
36 if ( IsEmbeddedMessageL() ) |
|
37 { |
|
38 //can not commit embedded messages |
|
39 User::Leave( KErrNotSupported ); |
|
40 } |
|
41 |
|
42 iContext.iSession.CommitContainerL( iId, iFolderId, iMailBoxId ); |
|
43 |
|
44 iParentId = iFolderId; |
|
45 } |
|
46 |
|
47 /** Abandons an uncommitted message. |
|
48 |
|
49 This function abandons an uncommitted message, and all children of the uncommitted message. |
|
50 The message object should no longer be used after this call. |
|
51 |
|
52 ECapabilityWriteUserData is required to use this function. |
|
53 */ |
|
54 EXPORT_C void CMsgStoreMessage::AbandonL() |
|
55 { |
|
56 //leave if this message is embedded in an attachment |
|
57 if ( IsEmbeddedMessageL() ) |
|
58 { |
|
59 //can not abandon embedded messages |
|
60 User::Leave( KErrNotSupported ); |
|
61 } |
|
62 |
|
63 iContext.iSession.AbandonContainerL( iId ); |
|
64 |
|
65 } // end AbandonL |
|
66 |
|
67 |
|
68 CMsgStoreMessage::~CMsgStoreMessage() |
|
69 { |
|
70 } |
|
71 |
|
72 CMsgStoreMessage* CMsgStoreMessage::NewL( CMsgStoreSessionContext& aSessionContext, |
|
73 TMsgStoreId aId, |
|
74 TMsgStoreId aCurrentParentId, |
|
75 TMsgStoreId aFolderId, |
|
76 TMsgStoreId aMailBoxId, |
|
77 const TDesC8& aPropertiesBuf ) |
|
78 { |
|
79 CMsgStoreMessage* self = new( ELeave ) CMsgStoreMessage( aSessionContext, aId, aCurrentParentId, aFolderId, aMailBoxId ); |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL( aPropertiesBuf ); |
|
82 CleanupStack::Pop( self ); |
|
83 return self; |
|
84 } // end NewL |
|
85 |
|
86 |
|
87 CMsgStoreMessage::CMsgStoreMessage( CMsgStoreSessionContext& aSessionContext, |
|
88 TMsgStoreId aId, |
|
89 TMsgStoreId aCurrentParentId, |
|
90 TMsgStoreId aFolderId, |
|
91 TMsgStoreId aMailBoxId) |
|
92 : CMsgStoreMessagePart( aSessionContext, aId, aCurrentParentId, aMailBoxId ), |
|
93 iFolderId( aFolderId ) |
|
94 { |
|
95 } |
|
96 |
|
97 |
|
98 void CMsgStoreMessage::ConstructL( const TDesC8& aPropertiesBuf ) |
|
99 { |
|
100 CMsgStoreMessagePart::ConstructL( aPropertiesBuf ); |
|
101 } // end ConstructL |