1 /* |
|
2 * Copyright (c) 2007-2009 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: MRUI attachmentinfo definition |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 #include "cesmrattachmentinfo.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // CESMRAttachmentInfo::CESMRAttachmentInfo |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 inline CESMRAttachmentInfo::CESMRAttachmentInfo() |
|
28 { |
|
29 FUNC_LOG; |
|
30 } |
|
31 // --------------------------------------------------------------------------- |
|
32 // CESMRAttachmentInfo::~CESMRAttachmentInfo |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CESMRAttachmentInfo::~CESMRAttachmentInfo() |
|
36 { |
|
37 FUNC_LOG; |
|
38 iAttachments.ResetAndDestroy(); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CESMRAttachmentInfo::NewL |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C CESMRAttachmentInfo* CESMRAttachmentInfo::NewL() |
|
46 { |
|
47 FUNC_LOG; |
|
48 CESMRAttachmentInfo* self = new (ELeave) CESMRAttachmentInfo; |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CESMRAttachmentInfo::ConstructL |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void CESMRAttachmentInfo::ConstructL() |
|
57 { |
|
58 FUNC_LOG; |
|
59 // Do nothing |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CESMRAttachmentInfo::AddAttachmentInfoL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C void CESMRAttachmentInfo::AddAttachmentInfoL( |
|
67 const TDesC& aAttachmentName, |
|
68 TInt aAttachntSizeInBytes, |
|
69 CESMRAttachment::TESMRAttachmentState aState ) |
|
70 { |
|
71 FUNC_LOG; |
|
72 CESMRAttachment* attachment = |
|
73 CESMRAttachment::NewL( |
|
74 aAttachmentName, |
|
75 aAttachntSizeInBytes, |
|
76 aState ); |
|
77 |
|
78 // Ownership of 'attachment' is transferred |
|
79 AddAttachmentInfoL( attachment ); |
|
80 attachment = NULL; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CESMRAttachmentInfo::AddAttachmentInfoL |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C void CESMRAttachmentInfo::AddAttachmentInfoL( |
|
88 CESMRAttachment* aAttachment ) |
|
89 { |
|
90 FUNC_LOG; |
|
91 // Ownership of 'aAttachment' is transferred to pointer array on the stack |
|
92 User::LeaveIfError( iAttachments.Append(aAttachment) ); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CESMRAttachmentInfo::AttachmentCount |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C TInt CESMRAttachmentInfo::AttachmentCount() const |
|
100 { |
|
101 FUNC_LOG; |
|
102 return iAttachments.Count(); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CESMRAttachmentInfo::Attachment |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 EXPORT_C const CESMRAttachment& CESMRAttachmentInfo::AttachmentL( |
|
110 TInt aIndex ) const |
|
111 { |
|
112 FUNC_LOG; |
|
113 if ( aIndex < 0 || aIndex >= iAttachments.Count() ) |
|
114 { |
|
115 User::Leave( KErrArgument ); |
|
116 } |
|
117 |
|
118 return *(iAttachments[ aIndex ]); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CESMRAttachmentInfo::RemoveAttachmentAtL |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C void CESMRAttachmentInfo::RemoveAttachmentAtL( |
|
126 TInt aIndex ) |
|
127 { |
|
128 FUNC_LOG; |
|
129 CESMRAttachment* attachment = iAttachments[ aIndex ]; |
|
130 iAttachments.Remove( aIndex ); |
|
131 delete attachment; |
|
132 } |
|
133 |
|
134 // EOF |
|
135 |
|