author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 10 Sep 2009 12:58:20 +0300 | |
changeset 11 | 5c0037c72160 |
parent 5 | 989d2f495d90 |
child 23 | 50974a8b132e |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2007 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 the License "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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include <e32base.h> |
|
20 |
#include <senduiconsts.h> |
|
21 |
#include <mmsconst.h> |
|
22 |
#include <CMsvAttachment.h> |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
23 |
#include <aknenv.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
24 |
#include <MTCLREG.H> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
25 |
#include <UTF.H> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
26 |
#include <mturutils.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
27 |
#include <aknenv.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
28 |
#include <APGCLI.H> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
29 |
#include <smsclnt.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
30 |
#include <TXTRICH.H> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
31 |
#include <smuthdr.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
32 |
#include <smscmds.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
33 |
#include <mtmuibas.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
34 |
#include <mtuireg.h> |
5 | 35 |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
36 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
37 |
#include <s32mem.h> |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
38 |
|
5 | 39 |
|
40 |
#include "messageheader.h" |
|
41 |
#include "sendmessage.h" |
|
42 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
43 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
44 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
45 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
46 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
47 |
|
5 | 48 |
_LIT(KBodyTextFilePath,"C:\\"); |
49 |
// --------------------------------------------------------------------------- |
|
50 |
// Two-phased constructor. |
|
51 |
// --------------------------------------------------------------------------- |
|
52 |
// |
|
53 |
CSendMessage* CSendMessage::NewL( CMsvSession& aServerSession ) |
|
54 |
{ |
|
55 |
CSendMessage* self = new (ELeave) CSendMessage( aServerSession ); |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
56 |
|
5 | 57 |
return self; |
58 |
} |
|
59 |
||
60 |
// --------------------------------------------------------------------------- |
|
61 |
// Destructor. |
|
62 |
// --------------------------------------------------------------------------- |
|
63 |
// |
|
64 |
CSendMessage::~CSendMessage() |
|
65 |
{ |
|
66 |
if ( IsActive() ) |
|
67 |
{ |
|
68 |
iCallNotifyForCancelFlag = EFalse; |
|
69 |
Cancel(); |
|
70 |
} |
|
71 |
||
72 |
iMessage.Close(); |
|
73 |
iSendAs.Close(); |
|
74 |
delete iMessageParam; |
|
75 |
delete iNotifyCallback; |
|
76 |
delete iTemplateDetail; |
|
77 |
} |
|
78 |
||
79 |
// --------------------------------------------------------------------------- |
|
80 |
// Two-phased constructor. |
|
81 |
// --------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
CSendMessage::CSendMessage( CMsvSession& aServerSession ): |
|
84 |
CActive( EPriorityStandard ), |
|
85 |
iServerSession( aServerSession ), |
|
86 |
iCallNotifyForCancelFlag(ETrue), |
|
87 |
iBodyTextFileFlag(EFalse) |
|
88 |
{ |
|
89 |
} |
|
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// Sets message input parameters |
|
93 |
// aMessageParam/aTemplateDetail/aNotifyCallback ownership is passed to this |
|
94 |
// --------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
void CSendMessage::SetInputParamsL( CSendMessageParams* aMessageParam, |
|
97 |
CMessageDetailInfo* aTemplateDetail, |
|
98 |
CMsgCallbackBase* aNotifyCallback, |
|
99 |
MAsyncRequestObserver* aAsyncRequestObserver ) |
|
100 |
{ |
|
101 |
iMessageParam = CSendMessageParams::NewL(); |
|
102 |
*iMessageParam = *aMessageParam; |
|
103 |
iNotifyCallback = aNotifyCallback; |
|
104 |
iTemplateDetail = aTemplateDetail; |
|
105 |
iAsyncRequestObserver = aAsyncRequestObserver; |
|
106 |
} |
|
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// Sends the message |
|
110 |
// --------------------------------------------------------------------------- |
|
111 |
// |
|
112 |
void CSendMessage::SendMessageL() |
|
113 |
{ |
|
114 |
if ( iNotifyCallback ) // making call as asynchronous |
|
115 |
{ |
|
116 |
CActiveScheduler::Add( this ); |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
117 |
if ( iMessageParam->MessageType() == KSenduiMtmSmsUid ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
118 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
119 |
iMessageState = ESend; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
120 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
121 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
122 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
123 |
iMessageState = EInitialize; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
124 |
} |
5 | 125 |
ActivateRequest( KErrNone ); |
126 |
} |
|
127 |
else // making call as synchronous |
|
128 |
{ |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
129 |
if ( iMessageParam->MessageType() == KSenduiMtmMmsUid ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
130 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
131 |
InitializeL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
132 |
ValidateL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
133 |
} |
5 | 134 |
SendL(); |
135 |
} |
|
136 |
} |
|
137 |
||
138 |
// --------------------------------------------------------------------------- |
|
139 |
// Inherited from CActive class |
|
140 |
// --------------------------------------------------------------------------- |
|
141 |
// |
|
142 |
void CSendMessage::DoCancel() |
|
143 |
{ |
|
144 |
NotifyRequestResult( KErrCancel ); |
|
145 |
} |
|
146 |
||
147 |
// --------------------------------------------------------------------------- |
|
148 |
// Inherited from CActive class |
|
149 |
// --------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
void CSendMessage::RunL() |
|
152 |
{ |
|
153 |
TInt err = iStatus.Int(); |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
154 |
|
5 | 155 |
if ( err == KErrNone ) |
156 |
{ |
|
157 |
switch ( iMessageState ) |
|
158 |
{ |
|
159 |
case EInitialize: |
|
160 |
{ |
|
161 |
TRAP( err, InitializeL() ); |
|
162 |
iMessageState = EValidate; |
|
163 |
ActivateRequest( err ); |
|
164 |
} |
|
165 |
break; |
|
166 |
||
167 |
case EValidate: |
|
168 |
{ |
|
169 |
TRAP( err, ValidateL() ); |
|
170 |
iMessageState = ESend; |
|
171 |
ActivateRequest( err ); |
|
172 |
} |
|
173 |
break; |
|
174 |
||
175 |
case ESend: |
|
176 |
{ |
|
177 |
TRAP( err, SendL() ); |
|
178 |
iMessageState = EComplete; |
|
179 |
ActivateRequest( err ); |
|
180 |
} |
|
181 |
break; |
|
182 |
||
183 |
case EComplete: |
|
184 |
{ |
|
185 |
NotifyRequestResult( err ); |
|
186 |
} |
|
187 |
break; |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
188 |
|
5 | 189 |
default: |
190 |
NotifyRequestResult( KErrGeneral ); |
|
191 |
break; |
|
192 |
} |
|
193 |
} |
|
194 |
else |
|
195 |
{ |
|
196 |
NotifyRequestResult( err ); |
|
197 |
} |
|
198 |
} |
|
199 |
||
200 |
// --------------------------------------------------------------------------- |
|
201 |
// Initialises RSendAs Server object and RSendAsMessage Object |
|
202 |
// --------------------------------------------------------------------------- |
|
203 |
// |
|
204 |
void CSendMessage::InitializeL() |
|
205 |
{ |
|
206 |
TInt err; |
|
207 |
||
208 |
err = iSendAs.Connect(); |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
209 |
|
5 | 210 |
if ( err == KErrNone ) |
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
211 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
212 |
iMessage.CreateL( iSendAs, iMessageParam->MessageType() ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
213 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
214 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
215 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
216 |
User::Leave(err); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
217 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
218 |
|
5 | 219 |
if ( iTemplateDetail ) |
220 |
{ |
|
221 |
if ( iTemplateDetail->BodyText().Length() ) |
|
222 |
{ |
|
223 |
iMessageParam->AppendBodyTextL( iTemplateDetail->BodyText() ); |
|
224 |
} |
|
225 |
||
226 |
const CArrayPtr<CMessageAttachInfo>* attacharray = iTemplateDetail->AttachmentInfoArray(); |
|
227 |
||
228 |
if ( attacharray ) |
|
229 |
{ |
|
230 |
for ( TInt pos = 0; pos < attacharray->Count(); pos++ ) |
|
231 |
{ |
|
232 |
CMessageAttachInfo* element = (*attacharray)[pos]; |
|
233 |
||
234 |
TBuf8<KMaxFileName> tmpMime; |
|
235 |
tmpMime.Copy( element->MimeType() ); |
|
236 |
||
237 |
TRequestStatus stat; |
|
238 |
RFile fileHandle = element->FileHandle(); |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
239 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
240 |
if(tmpMime.CompareF(KMmsTextPlain)) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
241 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
242 |
iMessage.AddAttachment( fileHandle, tmpMime, 0, stat ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
243 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
244 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
245 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
246 |
iMessage.AddAttachment( fileHandle, tmpMime, stat ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
247 |
} |
5 | 248 |
User::WaitForRequest( stat ); |
249 |
||
250 |
} |
|
251 |
} |
|
252 |
||
253 |
delete iTemplateDetail; |
|
254 |
iTemplateDetail = NULL; |
|
255 |
} |
|
256 |
} |
|
257 |
||
258 |
// --------------------------------------------------------------------------- |
|
259 |
// Sets Subject, Recipient, BodyText, Attachments to RSendAsMessage object |
|
260 |
// --------------------------------------------------------------------------- |
|
261 |
// |
|
262 |
void CSendMessage::ValidateL() |
|
263 |
{ |
|
264 |
AddSubjectL(); |
|
265 |
AddRecipientL(); |
|
266 |
AddBodyTextL(); |
|
267 |
AddAttachmentL(); |
|
268 |
} |
|
269 |
||
270 |
// --------------------------------------------------------------------------- |
|
271 |
// Internal function |
|
272 |
// --------------------------------------------------------------------------- |
|
273 |
// |
|
274 |
void CSendMessage::SendL() |
|
275 |
{ |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
276 |
if ( iMessageParam->MessageType() == KSenduiMtmSmsUid ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
277 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
278 |
SendSMSMessageL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
279 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
280 |
else if ( iMessageParam->MessageType() == KSenduiMtmMmsUid ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
281 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
282 |
if( iMessageParam->LaunchEditor() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
283 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
284 |
iMessage.LaunchEditorAndCloseL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
285 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
286 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
287 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
288 |
iMessage.SendMessageAndCloseL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
289 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
290 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
291 |
|
5 | 292 |
if( iBodyTextFileFlag ) //If the bodytext attach file is created for mms, delete it |
293 |
{ |
|
294 |
RFs rFs; |
|
295 |
if( rFs.Connect() == KErrNone ) |
|
296 |
{ |
|
297 |
rFs.Delete( iBodyTextFileName ); //if found delete it b4 creating it |
|
298 |
rFs.Close(); |
|
299 |
} |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
300 |
} |
5 | 301 |
} |
302 |
||
303 |
// --------------------------------------------------------------------------- |
|
304 |
// Activates the asynchronous request |
|
305 |
// --------------------------------------------------------------------------- |
|
306 |
// |
|
307 |
void CSendMessage::ActivateRequest( TInt aReason ) |
|
308 |
{ |
|
309 |
iStatus = KRequestPending; |
|
310 |
SetActive(); |
|
311 |
TRequestStatus* temp = &iStatus; |
|
312 |
User::RequestComplete( temp, aReason ); |
|
313 |
} |
|
314 |
||
315 |
// --------------------------------------------------------------------------- |
|
316 |
// Notifies callback the result for asynchronous request. |
|
317 |
// --------------------------------------------------------------------------- |
|
318 |
// |
|
319 |
void CSendMessage::NotifyRequestResult( TInt aReason ) |
|
320 |
{ |
|
321 |
if ( iNotifyCallback ) |
|
322 |
{ |
|
323 |
iAsyncRequestObserver->RequestComplete( iNotifyCallback->iTransactionId ); |
|
324 |
||
325 |
if( iCallNotifyForCancelFlag ) |
|
326 |
{ |
|
327 |
TRAPD( err, iNotifyCallback->NotifyResultL( aReason, NULL )); |
|
328 |
} |
|
329 |
} |
|
330 |
// caller will delete the object in case of cancel |
|
331 |
if ( aReason != KErrCancel ) |
|
332 |
delete this; |
|
333 |
} |
|
334 |
||
335 |
// --------------------------------------------------------------------------- |
|
336 |
// Sets the subject for message |
|
337 |
// --------------------------------------------------------------------------- |
|
338 |
// |
|
339 |
void CSendMessage::AddSubjectL() |
|
340 |
{ |
|
341 |
TPtrC subject( iMessageParam->Subject()); |
|
342 |
if ( subject.Length() ) |
|
343 |
iMessage.SetSubjectL( iMessageParam->Subject() ); |
|
344 |
} |
|
345 |
||
346 |
// --------------------------------------------------------------------------- |
|
347 |
// Sets the recipient address. |
|
348 |
// --------------------------------------------------------------------------- |
|
349 |
// |
|
350 |
void CSendMessage::AddRecipientL() |
|
351 |
{ |
|
352 |
const CRecipientList* recipientArray = iMessageParam->RecipientArray(); |
|
353 |
if ( recipientArray ) |
|
354 |
{ |
|
355 |
TInt count = recipientArray->Count(); |
|
356 |
for( TInt pos = 0; pos < count; pos++ ) |
|
357 |
{ |
|
358 |
iMessage.AddRecipientL( (*recipientArray)[pos], |
|
359 |
RSendAsMessage::TSendAsRecipientType( recipientArray->Type(pos) ) ); |
|
360 |
} |
|
361 |
} |
|
362 |
else if ( !iMessageParam->LaunchEditor() ) |
|
363 |
{ |
|
364 |
User::Leave( KErrArgument ); |
|
365 |
} |
|
366 |
} |
|
367 |
||
368 |
||
369 |
// --------------------------------------------------------------------------- |
|
370 |
// Sets body text to message. |
|
371 |
// --------------------------------------------------------------------------- |
|
372 |
// |
|
373 |
void CSendMessage::AddBodyTextL() |
|
374 |
{ |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
375 |
|
5 | 376 |
TPtrC filePath( KBodyTextFilePath ); |
377 |
||
378 |
TPtrC bodyText = iMessageParam->BodyText(); |
|
379 |
||
380 |
if ( bodyText.Length() ) |
|
381 |
{ |
|
382 |
if ( iMessageParam->MessageType() == KSenduiMtmMmsUid ) |
|
383 |
{ |
|
384 |
RFs rFs; |
|
385 |
RFile tmpfile; |
|
386 |
User::LeaveIfError( rFs.Connect() ); |
|
387 |
||
388 |
tmpfile.Temp(rFs, filePath, iBodyTextFileName, EFileShareExclusive|EFileWrite); |
|
389 |
||
390 |
iBodyTextFileFlag = ETrue; |
|
391 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
392 |
HBufC8* buffer=HBufC8::NewL( bodyText.Length()* 4 ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
393 |
TPtr8 tmpBuffer = buffer->Des(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
394 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(tmpBuffer, bodyText); |
5 | 395 |
CleanupStack::PushL( buffer ); |
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
396 |
buffer->Des().Copy( tmpBuffer ); |
5 | 397 |
tmpfile.Write( *buffer ); |
398 |
tmpfile.Flush(); |
|
399 |
tmpfile.Close(); |
|
400 |
rFs.Close(); |
|
401 |
CleanupStack::PopAndDestroy( buffer ); |
|
402 |
TRequestStatus stat; |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
403 |
iMessage.AddAttachment( iBodyTextFileName, KMmsTextPlain, 0, stat ); |
5 | 404 |
User::WaitForRequest( stat ); |
405 |
} |
|
406 |
else |
|
407 |
{ |
|
408 |
iMessage.SetBodyTextL( bodyText ); |
|
409 |
} |
|
410 |
} |
|
411 |
} |
|
412 |
||
413 |
// --------------------------------------------------------------------------- |
|
414 |
// Adds attachments to message |
|
415 |
// --------------------------------------------------------------------------- |
|
416 |
// |
|
417 |
void CSendMessage::AddAttachmentL() |
|
418 |
{ |
|
419 |
const CArrayPtr<CMsvAttachment>* attachmentArray = iMessageParam->AttachmentArray(); |
|
420 |
if ( attachmentArray && attachmentArray->Count() > 0 ) |
|
421 |
{ |
|
422 |
TRequestStatus attachstatus; |
|
423 |
TInt error = KErrNone; |
|
424 |
TInt count; |
|
425 |
RApaLsSession rapaSesion; |
|
426 |
RFs rFs; |
|
427 |
RFile tmpfile; |
|
428 |
||
429 |
User::LeaveIfError( rapaSesion.Connect() ); |
|
430 |
||
431 |
CleanupClosePushL( rapaSesion ); |
|
432 |
||
433 |
User::LeaveIfError( rFs.Connect() ); |
|
434 |
||
435 |
CleanupClosePushL( rFs ); |
|
436 |
||
437 |
for ( count = 0; count < attachmentArray->Count(); count++ ) |
|
438 |
{ |
|
439 |
attachstatus = KRequestPending; |
|
440 |
||
441 |
error = tmpfile.Open(rFs, ((*attachmentArray)[count])->AttachmentName(), EFileRead); |
|
442 |
||
443 |
if( error == KErrNone ) |
|
444 |
{ |
|
445 |
TBuf8<256> tmpbuf; |
|
446 |
tmpfile.Read(tmpbuf, 255 ); |
|
447 |
||
448 |
tmpfile.Close(); |
|
449 |
||
450 |
TDataRecognitionResult aDataType; |
|
451 |
||
452 |
error = rapaSesion.RecognizeData(((*attachmentArray)[count])->AttachmentName(), tmpbuf, aDataType); |
|
453 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
454 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
455 |
|
5 | 456 |
if( error == KErrNone ) |
457 |
{ |
|
458 |
TBuf8< KMaxDataTypeLength > tmp; |
|
459 |
tmp.Copy( aDataType.iDataType.Des() ); |
|
460 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
461 |
if(!(tmp.CompareF(KMmsTextPlain))) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
462 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
463 |
iMessage.AddAttachment( ((*attachmentArray)[count])->AttachmentName(), |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
464 |
tmp, 0, |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
465 |
attachstatus ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
466 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
467 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
468 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
469 |
iMessage.AddAttachment( ((*attachmentArray)[count])->AttachmentName(), |
5 | 470 |
tmp, |
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
471 |
attachstatus ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
472 |
} |
5 | 473 |
} |
474 |
else |
|
475 |
{ |
|
476 |
if ( ((*attachmentArray)[count])->MimeType().Length() ) |
|
477 |
{ |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
478 |
|
5 | 479 |
iMessage.AddAttachment( ((*attachmentArray)[count])->AttachmentName(), |
480 |
((*attachmentArray)[count])->MimeType(), |
|
481 |
attachstatus ); |
|
482 |
} |
|
483 |
else |
|
484 |
{ |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
485 |
|
5 | 486 |
iMessage.AddAttachment( ((*attachmentArray)[count])->AttachmentName(), |
487 |
attachstatus ); |
|
488 |
} |
|
489 |
} |
|
490 |
||
491 |
User::WaitForRequest( attachstatus ); |
|
492 |
||
493 |
User::LeaveIfError( attachstatus.Int() ); |
|
494 |
} |
|
495 |
else |
|
496 |
{ |
|
497 |
User::Leave( error ); |
|
498 |
} |
|
499 |
} |
|
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
500 |
|
5 | 501 |
CleanupStack::PopAndDestroy( &rFs ); |
502 |
CleanupStack::PopAndDestroy( &rapaSesion ); |
|
503 |
} |
|
504 |
} |
|
505 |
||
11
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
506 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
507 |
// Two-phased constructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
508 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
509 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
510 |
CAsyncWaiter* CAsyncWaiter::NewL(TInt aPriority) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
511 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
512 |
CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
513 |
return self; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
514 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
515 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
516 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
517 |
// Two-phased constructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
518 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
519 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
520 |
CAsyncWaiter* CAsyncWaiter::NewLC(TInt aPriority) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
521 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
522 |
CAsyncWaiter* self = new(ELeave) CAsyncWaiter(aPriority); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
523 |
CleanupStack::PushL(self); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
524 |
return self; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
525 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
526 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
527 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
528 |
// Two-phased constructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
529 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
530 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
531 |
CAsyncWaiter::CAsyncWaiter(TInt aPriority) : CActive(aPriority) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
532 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
533 |
CActiveScheduler::Add(this); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
534 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
535 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
536 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
537 |
// Destructor. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
538 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
539 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
540 |
CAsyncWaiter::~CAsyncWaiter() |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
541 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
542 |
Cancel(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
543 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
544 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
545 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
546 |
// Starts the active scheduler. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
547 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
548 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
549 |
void CAsyncWaiter::StartAndWait() |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
550 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
551 |
iStatus = KRequestPending; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
552 |
SetActive(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
553 |
iWait.Start(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
554 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
555 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
556 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
557 |
// Returns the error |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
558 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
559 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
560 |
TInt CAsyncWaiter::Result() const |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
561 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
562 |
return iError; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
563 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
564 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
565 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
566 |
// Inherited from CActive class |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
567 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
568 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
569 |
void CAsyncWaiter::RunL() |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
570 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
571 |
iError = iStatus.Int(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
572 |
iWait.AsyncStop(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
573 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
574 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
575 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
576 |
// Inherited from CActive class |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
577 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
578 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
579 |
void CAsyncWaiter::DoCancel() |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
580 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
581 |
iError = KErrCancel; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
582 |
if( iStatus == KRequestPending ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
583 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
584 |
TRequestStatus* s=&iStatus; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
585 |
User::RequestComplete( s, KErrCancel ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
586 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
587 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
588 |
iWait.AsyncStop(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
589 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
590 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
591 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
592 |
// Sends the sms. |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
593 |
// --------------------------------------------------------------------------- |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
594 |
// |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
595 |
void CSendMessage::SendSMSMessageL() |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
596 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
597 |
if ( iTemplateDetail ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
598 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
599 |
if ( iTemplateDetail->BodyText().Length() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
600 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
601 |
iMessageParam->AppendBodyTextL( iTemplateDetail->BodyText() ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
602 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
603 |
delete iTemplateDetail; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
604 |
iTemplateDetail = NULL; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
605 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
606 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
607 |
CClientMtmRegistry* registry = CClientMtmRegistry::NewL(iServerSession); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
608 |
CleanupStack::PushL(registry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
609 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
610 |
// get the client mtm and return if it isn't supported in the system |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
611 |
CSmsClientMtm* clientMtm = NULL; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
612 |
TRAPD(err, clientMtm = static_cast<CSmsClientMtm*>(registry->NewMtmL(KUidMsgTypeSMS))); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
613 |
if (err || !clientMtm) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
614 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
615 |
User::Leave(KErrNotFound); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
616 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
617 |
CleanupStack::PushL(clientMtm); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
618 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
619 |
// create a new object to access an existing entry |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
620 |
CMsvEntry* msvEntry = CMsvEntry::NewL(iServerSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
621 |
CleanupStack::PushL(msvEntry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
622 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
623 |
// get default service |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
624 |
TMsvId defaultServiceId = 0; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
625 |
TRAP(err, defaultServiceId = clientMtm->DefaultServiceL()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
626 |
if (err) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
627 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
628 |
User::Leave(KErrNotFound); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
629 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
630 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
631 |
if( iMessageParam->LaunchEditor() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
632 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
633 |
msvEntry->SetEntryL(KMsvDraftEntryId); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
634 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
635 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
636 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
637 |
msvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
638 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
639 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
640 |
// mtm takes ownership of entry context |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
641 |
CleanupStack::Pop(msvEntry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
642 |
clientMtm->SetCurrentEntryL(msvEntry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
643 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
644 |
// create a new message |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
645 |
clientMtm->CreateMessageL(defaultServiceId); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
646 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
647 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
648 |
// set body |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
649 |
clientMtm->Body().Reset(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
650 |
clientMtm->Body().InsertL(0, iMessageParam->BodyText()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
651 |
TPtrC subject( iMessageParam->Subject()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
652 |
if ( subject.Length() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
653 |
clientMtm->SetSubjectL( iMessageParam->Subject() ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
654 |
// get the entry of the message |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
655 |
TMsvEntry messageEntry = clientMtm->Entry().Entry(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
656 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
657 |
const CRecipientList* recipientArray = iMessageParam->RecipientArray(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
658 |
if ( recipientArray ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
659 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
660 |
TInt count = recipientArray->Count(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
661 |
if(count) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
662 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
663 |
messageEntry.iDetails.Set((*recipientArray)[0]); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
664 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
665 |
for( TInt pos = 0; pos < count; pos++ ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
666 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
667 |
clientMtm->AddAddresseeL(( *recipientArray)[pos]); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
668 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
669 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
670 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
671 |
// set the description field same as the first part of the message body |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
672 |
messageEntry.iDescription.Set( iMessageParam->BodyText().Left(KSmsDescriptionLength) ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
673 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
674 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
675 |
CSmsHeader& smsHdr = clientMtm->SmsHeader(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
676 |
CSmsSettings* smsSetting = CSmsSettings::NewLC(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
677 |
smsSetting->CopyL(clientMtm->ServiceSettings()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
678 |
smsSetting->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabetUCS2); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
679 |
smsHdr.SetSmsSettingsL(*smsSetting); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
680 |
CleanupStack::PopAndDestroy(smsSetting); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
681 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
682 |
// save the changes done above |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
683 |
clientMtm->Entry().ChangeL(messageEntry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
684 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
685 |
// save the message |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
686 |
clientMtm->SaveMessageL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
687 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
688 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
689 |
// final fine tuning |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
690 |
messageEntry.SetAttachment(EFalse); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
691 |
messageEntry.iDate.DateTime().SetSecond( messageEntry.iDate.DateTime().Second()+1); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
692 |
messageEntry.SetVisible(ETrue); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
693 |
messageEntry.SetInPreparation(EFalse); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
694 |
messageEntry.SetComplete(ETrue); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
695 |
messageEntry.iServiceId = defaultServiceId; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
696 |
messageEntry.iRelatedId = 0; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
697 |
if( iMessageParam->LaunchEditor() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
698 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
699 |
messageEntry.SetSendingState( KMsvSendStateNotApplicable ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
700 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
701 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
702 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
703 |
messageEntry.SetSendingState( KMsvSendStateWaiting ); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
704 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
705 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
706 |
clientMtm->Entry().ChangeL(messageEntry); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
707 |
clientMtm->SaveMessageL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
708 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
709 |
if( iMessageParam->LaunchEditor() ) |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
710 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
711 |
MturUtils::LaunchEditorAndWaitL(messageEntry.Id()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
712 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
713 |
else |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
714 |
{ |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
715 |
CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
716 |
CleanupStack::PushL(sel); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
717 |
sel->AppendL(messageEntry.Id()); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
718 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
719 |
TBuf8<1> dummy; |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
720 |
CAsyncWaiter* waiter = CAsyncWaiter::NewL(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
721 |
CleanupStack::PushL(waiter); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
722 |
CMsvOperation* sndCall = clientMtm->InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy,*sel,dummy,waiter->iStatus); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
723 |
CleanupStack::PushL(sndCall); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
724 |
waiter->StartAndWait(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
725 |
CleanupStack::PopAndDestroy(2); //sndCall, waiter |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
726 |
sel->Reset(); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
727 |
CleanupStack::PopAndDestroy(sel); |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
728 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
729 |
CleanupStack::PopAndDestroy(2);//registry, clientMtm |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
730 |
} |
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
731 |
|
5c0037c72160
Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
732 |