|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Encapsulates the message data for MeetingRequestSender service. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32base.h> |
|
22 #include <e32std.h> |
|
23 #include <s32mem.h> |
|
24 |
|
25 #include <MeetingRequestData.h> |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CMeetingRequestData::NewL |
|
31 // Two-phased constructor. aDataType should be KSenduiMsgDataMeetingRequest |
|
32 // when message is sent using MeetingRequestSender. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CMeetingRequestData* CMeetingRequestData::NewL() |
|
36 { |
|
37 CMeetingRequestData* self = CMeetingRequestData::NewLC(); |
|
38 CleanupStack::Pop(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CMeetingRequestData::NewLC |
|
44 // Two-phased constructor. aDataType should be KSenduiMsgDataMeetingRequest |
|
45 // when message is sent using MeetingRequestSender. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C CMeetingRequestData* CMeetingRequestData::NewLC( ) |
|
49 { |
|
50 CMeetingRequestData* self = new( ELeave ) CMeetingRequestData(); |
|
51 CleanupStack::PushL( self ); |
|
52 self->ConstructL(); |
|
53 return self; |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CMeetingRequestData::~CMeetingRequestData |
|
58 // Destructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CMeetingRequestData::~CMeetingRequestData() |
|
62 { |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CMeetingRequestData::CMeetingRequestData |
|
67 // Constructor. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CMeetingRequestData::CMeetingRequestData() |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CMeetingRequestData::CMeetingRequestData |
|
76 // 2nd phase constructor. |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CMeetingRequestData::ConstructL() |
|
80 { |
|
81 // Nothing at the moment. |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CMeetingRequestData::UseMailbox |
|
86 // Define which mailbox should be used to send an email. aMailboxId is the |
|
87 // same as mail client service id. If not set, default mailbox is used. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C void CMeetingRequestData::UseMailbox( const TMsvId aMailboxId ) |
|
91 { |
|
92 iMailboxId = aMailboxId; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CMeetingRequestData::Mailbox |
|
97 // Get mailbox id. The same as mail client service id. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C TMsvId CMeetingRequestData::Mailbox( ) const |
|
101 { |
|
102 return iMailboxId; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CMeetingRequestData::SetDatabaseFileId |
|
107 // Set id of calendar database file. |
|
108 // (other items were commented in a header). |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C void CMeetingRequestData::SetDatabaseFileId( const TUint64 aFileId ) |
|
112 { |
|
113 iDatabaseFileId = aFileId; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CMeetingRequestData::DatabaseFileId |
|
118 // Returns id of calendar database file. |
|
119 // (other items were commented in a header). |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C TUint64 CMeetingRequestData::DatabaseFileId( ) const |
|
123 { |
|
124 return iDatabaseFileId; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CMeetingRequestData::AppendEntryLocalId |
|
129 // Append local id of calendar entry. |
|
130 // (other items were commented in a header). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C void CMeetingRequestData::AppendEntryLocalId( |
|
134 const TUint32 aEntryLocalId ) |
|
135 { |
|
136 iEntryLocalIdArray.Append( aEntryLocalId ); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CMeetingRequestData::DatabaseFileId |
|
141 // Returns array of local ids of calendar entries. |
|
142 // (other items were commented in a header). |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 EXPORT_C const RArray<TUint32>& CMeetingRequestData::EntryLocalIdArray( ) const |
|
146 { |
|
147 return iEntryLocalIdArray; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CMeetingRequestData::SetMailHeaderMethodL |
|
152 // Set method type for mail header. |
|
153 // (other items were commented in a header). |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CMeetingRequestData::SetMailHeaderMethodL( |
|
157 const TDesC8& aMethodType ) |
|
158 { |
|
159 iMethodType.Append( aMethodType ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CMeetingRequestData::MailHeaderMethod |
|
164 // Returns method type for mail header. |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TPtrC8 CMeetingRequestData::MailHeaderMethod( ) const |
|
169 { |
|
170 return iMethodType.Ptr(); |
|
171 } |
|
172 |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CMeetingRequestData::WriteToBufferLC |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C HBufC8* CMeetingRequestData::WriteToBufferLC() const |
|
179 { |
|
180 // Lenght for the buffer: |
|
181 // |
|
182 // 32-bit iMailboxId |
|
183 // 64-bit iDatabaseFileId |
|
184 // 50 x 8bit iMehtodType |
|
185 // 16-bit iEntryLocalIdArray.Count() |
|
186 // N x 32-bit N x iEntryLocalIdArray[i] |
|
187 // |
|
188 TInt bufLength = 0; |
|
189 bufLength += sizeof( iMailboxId ); |
|
190 bufLength += sizeof( iDatabaseFileId ); |
|
191 bufLength += KMethodTypeMaxLength; |
|
192 bufLength += sizeof( TInt ); |
|
193 bufLength += iEntryLocalIdArray.Count() * sizeof( TUint32 ); |
|
194 |
|
195 HBufC8* buf = HBufC8::NewLC( bufLength ); |
|
196 TDes8 des = buf->Des(); |
|
197 RDesWriteStream stream( des ); |
|
198 |
|
199 stream << iMailboxId; |
|
200 stream.WriteReal64L( iDatabaseFileId ); |
|
201 |
|
202 stream << iMethodType; |
|
203 |
|
204 TInt count = iEntryLocalIdArray.Count(); |
|
205 stream.WriteInt16L(count); |
|
206 |
|
207 for ( TInt i = 0; i < count; ++i ) |
|
208 { |
|
209 stream.WriteUint32L(iEntryLocalIdArray[i]); |
|
210 } |
|
211 stream.Close(); |
|
212 return buf; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CMeetingRequestData::ReadFromBufferL |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C void CMeetingRequestData::ReadFromBufferL( const TDesC8& aData ) |
|
220 { |
|
221 RDesReadStream stream( aData ); |
|
222 |
|
223 stream >> iMailboxId; |
|
224 iDatabaseFileId = stream.ReadReal64L( ); |
|
225 |
|
226 stream >> iMethodType; |
|
227 |
|
228 |
|
229 TInt count = stream.ReadInt16L(); |
|
230 |
|
231 for ( TInt i = 0; i < count; ++i ) |
|
232 { |
|
233 iEntryLocalIdArray[i] = stream.ReadUint32L(); |
|
234 } |
|
235 stream.Close(); |
|
236 } |
|
237 |
|
238 // END OF FILE |