author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:32:06 +0100 | |
branch | GCC_SURGE |
changeset 47 | 5b14749788d7 |
parent 27 | e4592d119491 |
parent 43 | 35b64624a9e7 |
permissions | -rw-r--r-- |
31 | 1 |
/* |
2 |
* Copyright (c) 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
19 |
||
20 |
// Symbian: |
|
21 |
#include <e32base.h> |
|
22 |
#include <txtetext.h> |
|
23 |
#include <txtrich.h> |
|
24 |
#include <s32mem.h> |
|
25 |
||
26 |
#include <mmsvattachmentmanager.h> |
|
27 |
#include <mmsvattachmentmanagersync.h> |
|
28 |
#include <gsmerror.h> // KErrGsmOfflineOpNotAllowed |
|
29 |
#include <featmgr.h> |
|
30 |
||
31 |
#include <mtclreg.h> |
|
32 |
#include <smsclnt.h> |
|
33 |
#include <smscmds.h> |
|
34 |
#include <smuthdr.h> |
|
35 |
#include <csmsemailfields.h> |
|
36 |
#include <csmsaccount.h> |
|
37 |
#include <charconv.h> |
|
38 |
#include <smut.h> |
|
39 |
#include <cmsvmimeheaders.h> |
|
40 |
#include <badesca.h> |
|
41 |
#include <e32cmn.h> |
|
42 |
#include <gsmuset.h> |
|
43 |
||
44 |
// S60 |
|
45 |
#include <MsgMediaResolver.h> |
|
46 |
#include <MsgMediaInfo.h> |
|
47 |
#include <MsgTextInfo.h> |
|
48 |
||
49 |
#include <mmsgenutils.h> |
|
50 |
#include <vcard.h> |
|
51 |
#include <SenduiMtmUids.h> |
|
52 |
#include <MsgMimeTypes.h> |
|
53 |
#include "UniSendingSettings.h" |
|
54 |
#include "MessagingVariant.hrh" |
|
55 |
#include "msgbiouids.h" |
|
56 |
#include "unieditorsmsplugin_p.h" |
|
57 |
#include "convergedmessage.h" |
|
58 |
#include "convergedmessageid.h" |
|
59 |
#include "convergedmessageattachment.h" |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
60 |
|
31 | 61 |
#include "MuiuOperationWait.h" |
62 |
#include "UniEditorGenUtils.h" |
|
63 |
#include "unidatamodelloader.h" |
|
64 |
#include "unidatamodelplugininterface.h" |
|
65 |
#include <hbglobal.h> // for translation support |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
66 |
#include <xqconversions.h> |
31 | 67 |
// resources |
68 |
||
69 |
// CONSTANTS |
|
70 |
||
71 |
// Used to set msg in unparsed state |
|
72 |
const TInt KSmsPluginBioMsgUnparsed = 0; |
|
73 |
||
74 |
// Description length for sms messages |
|
75 |
const TInt KSmsMessageEntryDescriptionAmountOfChars = 60; |
|
76 |
||
77 |
//used for descriptor array containing recipients |
|
78 |
const TInt KRecipientsArrayGranularity = 8; |
|
79 |
||
80 |
// For address information separation (start) |
|
81 |
const TUint KMsgSmsAddressStartChar ('<'); |
|
82 |
||
83 |
// For address information separation (end) |
|
84 |
const TUint KMsgSmsAddressEndChar ('>'); |
|
85 |
||
86 |
const TUint KUniSmsStartParenthesis ('('); |
|
87 |
const TUint KUniSmsEndParenthesis (')'); |
|
88 |
||
89 |
// String length for Service centre name |
|
90 |
const TInt KUniSmsSCStringLength = 50; |
|
91 |
||
92 |
const TUid KUidMsvSMSHeaderStream_COPY_FROM_SMUTHDR_CPP = {0x10001834}; |
|
93 |
||
94 |
// Amount of to be converted chars during extracting description |
|
95 |
const TInt KSmsEdExtrDescReplaceCharacterCount = 3; |
|
96 |
||
97 |
// Unicode char for linefeed regocnised by basic phones |
|
98 |
const TUint KSmsEdUnicodeLFSupportedByBasicPhones = 0x000A; |
|
99 |
||
100 |
// Copy max this many chars to TMsvEntry iDetails |
|
101 |
const TInt KMaxDetailsLength = 64; |
|
102 |
||
103 |
// separators for iDetails field |
|
104 |
_LIT( KAddressSeparator, ";" ); |
|
105 |
||
106 |
// LOCALIZED CONSTANTS |
|
107 |
// String to be shown in Drafts view for VCard sms |
|
108 |
#define BUSINESS_CARD hbTrId("txt_messaging_list_business_card") |
|
109 |
||
110 |
// ============================ MEMBER FUNCTIONS =============================== |
|
111 |
||
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// Two-phased constructor. |
|
114 |
// ----------------------------------------------------------------------------- |
|
115 |
// |
|
116 |
UniEditorSmsPluginPrivate* UniEditorSmsPluginPrivate::NewL() |
|
117 |
{ |
|
118 |
UniEditorSmsPluginPrivate* self = new ( ELeave ) UniEditorSmsPluginPrivate(); |
|
119 |
CleanupStack::PushL( self ); |
|
120 |
self->ConstructL(); |
|
121 |
CleanupStack::Pop( self ); |
|
122 |
return self; |
|
123 |
} |
|
124 |
||
125 |
// ----------------------------------------------------------------------------- |
|
126 |
// Destructor |
|
127 |
// ----------------------------------------------------------------------------- |
|
128 |
// |
|
129 |
UniEditorSmsPluginPrivate::~UniEditorSmsPluginPrivate() |
|
130 |
{ |
|
131 |
if(iGenUtils) |
|
132 |
{ |
|
133 |
delete iGenUtils; |
|
134 |
iGenUtils = NULL; |
|
135 |
} |
|
136 |
||
137 |
if(iEmailOverSmsC) |
|
138 |
{ |
|
139 |
delete iEmailOverSmsC; |
|
140 |
iEmailOverSmsC = NULL; |
|
141 |
} |
|
142 |
||
143 |
if(iRecipients) |
|
144 |
{ |
|
145 |
delete iRecipients; |
|
146 |
iRecipients = NULL; |
|
147 |
} |
|
148 |
||
149 |
if(iRichText) |
|
150 |
{ |
|
151 |
delete iRichText; |
|
152 |
iRichText = NULL; |
|
153 |
} |
|
154 |
||
155 |
if(iCharFormatLayer) |
|
156 |
{ |
|
157 |
delete iCharFormatLayer; |
|
158 |
iCharFormatLayer = NULL; |
|
159 |
} |
|
160 |
||
161 |
if(iParaFormatLayer) |
|
162 |
{ |
|
163 |
delete iParaFormatLayer; |
|
164 |
iParaFormatLayer = NULL; |
|
165 |
} |
|
166 |
||
167 |
if(iSmsHeader) |
|
168 |
{ |
|
169 |
delete iSmsHeader; |
|
170 |
iSmsHeader = NULL; |
|
171 |
} |
|
172 |
||
173 |
if(iSmsMtm) |
|
174 |
{ |
|
175 |
delete iSmsMtm; |
|
176 |
iSmsMtm = NULL; |
|
177 |
} |
|
178 |
||
179 |
if(iMtmRegistry) |
|
180 |
{ |
|
181 |
delete iMtmRegistry; |
|
182 |
iMtmRegistry = NULL; |
|
183 |
} |
|
184 |
||
185 |
if(iSession) |
|
186 |
{ |
|
187 |
delete iSession; |
|
188 |
iSession = NULL; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
// ----------------------------------------------------------------------------- |
|
193 |
// C++ default constructor |
|
194 |
// ----------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
UniEditorSmsPluginPrivate::UniEditorSmsPluginPrivate() : |
|
197 |
iSession(0), |
|
198 |
iMtmRegistry(0), |
|
199 |
iSmsMtm(0), |
|
200 |
iSmsHeader(0), |
|
201 |
iParaFormatLayer(0), |
|
202 |
iCharFormatLayer(0), |
|
203 |
iRichText(0), |
|
204 |
iRecipients(0), |
|
205 |
iBioMsg( EFalse ), |
|
206 |
iEmailOverSmsC(0), |
|
207 |
iUnicodeMode( EFalse ), |
|
208 |
iOfflineSupported( EFalse ), |
|
209 |
iCharSupportType(TUniSendingSettings::EUniCharSupportReduced), |
|
210 |
iGenUtils(0) |
|
211 |
{ |
|
212 |
} |
|
213 |
||
214 |
// ----------------------------------------------------------------------------- |
|
215 |
// Symbian 2nd phase constructor |
|
216 |
// ----------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
void UniEditorSmsPluginPrivate::ConstructL() |
|
219 |
{ |
|
220 |
iSession = CMsvSession::OpenSyncL(*this); |
|
221 |
iParaFormatLayer = CParaFormatLayer::NewL(); |
|
222 |
iCharFormatLayer = CCharFormatLayer::NewL(); |
|
223 |
iRichText = CRichText::NewL( iParaFormatLayer, iCharFormatLayer ); |
|
224 |
iEmailOverSmsC = CSmsNumber::NewL(); |
|
225 |
||
226 |
CMsvEntry& entry = SmsMtmL()->Entry(); |
|
227 |
entry.SetEntryL( KMsvRootIndexEntryId ); |
|
228 |
||
229 |
TSmsUtilities::ServiceIdL( entry, iSmsServiceId ); |
|
230 |
||
231 |
FeatureManager::InitializeLibL(); |
|
232 |
if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) |
|
233 |
{ |
|
234 |
iOfflineSupported = ETrue; |
|
235 |
} |
|
236 |
else |
|
237 |
{ |
|
238 |
iOfflineSupported = EFalse; |
|
239 |
} |
|
240 |
||
241 |
//Turkish SMS-PREQ2265 Specific |
|
242 |
if ( FeatureManager::FeatureSupported( KFeatureIdNltSupport ) ) |
|
243 |
{ |
|
244 |
iNLTFeatureSupport = ETrue; |
|
245 |
} |
|
246 |
else |
|
247 |
{ |
|
248 |
iNLTFeatureSupport = EFalse; |
|
249 |
} |
|
250 |
||
251 |
FeatureManager::UnInitializeLib(); |
|
252 |
||
253 |
iGenUtils = new UniEditorGenUtils(); |
|
254 |
} |
|
255 |
||
256 |
// ----------------------------------------------------------------------------- |
|
257 |
// LoadHeadersL |
|
258 |
// @see header |
|
259 |
// ----------------------------------------------------------------------------- |
|
260 |
void UniEditorSmsPluginPrivate::LoadHeadersL( CMsvStore* aStore ) |
|
261 |
{ |
|
262 |
delete iSmsHeader; |
|
263 |
iSmsHeader = NULL; |
|
264 |
||
265 |
if ( aStore && aStore->HasBodyTextL() ) |
|
266 |
{ |
|
267 |
aStore->RestoreBodyTextL( *iRichText ); |
|
268 |
} |
|
269 |
||
270 |
iSmsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *iRichText ); |
|
271 |
||
272 |
if ( aStore && aStore->IsPresentL( KUidMsvSMSHeaderStream_COPY_FROM_SMUTHDR_CPP ) ) |
|
273 |
{ |
|
274 |
iSmsHeader->RestoreL( *aStore ); |
|
275 |
} |
|
276 |
else |
|
277 |
{ |
|
278 |
CSmsSettings* settings = CSmsSettings::NewLC(); |
|
279 |
CSmsAccount* account = CSmsAccount::NewLC(); |
|
280 |
account->LoadSettingsL( *settings ); |
|
281 |
CleanupStack::PopAndDestroy( account ); |
|
282 |
iSmsHeader->SetSmsSettingsL( *settings ); |
|
283 |
CleanupStack::PopAndDestroy( settings ); |
|
284 |
} |
|
285 |
} |
|
286 |
||
287 |
// ----------------------------------------------------------------------------- |
|
288 |
// ConvertFromL |
|
289 |
// @see header |
|
290 |
// ----------------------------------------------------------------------------- |
|
291 |
ConvergedMessage* UniEditorSmsPluginPrivate::ConvertFromL(TMsvId aId, |
|
292 |
UniEditorPluginInterface::EditorOperation aOperation) |
|
293 |
{ |
|
294 |
ConvergedMessageId id(aId); |
|
295 |
ConvergedMessage* msg = new ConvergedMessage(id); |
|
296 |
CleanupStack::PushL(msg); |
|
297 |
DoConvertFromL(aId, msg, aOperation); |
|
298 |
CleanupStack::Pop(msg); |
|
299 |
return msg; |
|
300 |
} |
|
301 |
||
302 |
// ----------------------------------------------------------------------------- |
|
303 |
// DoConvertFromL |
|
304 |
// @see header |
|
305 |
// ----------------------------------------------------------------------------- |
|
306 |
void UniEditorSmsPluginPrivate::DoConvertFromL( TMsvId aId, |
|
307 |
ConvergedMessage* aMessage, |
|
308 |
UniEditorPluginInterface::EditorOperation aOperation) |
|
309 |
{ |
|
310 |
// load message for processing |
|
311 |
SmsMtmL()->SwitchCurrentEntryL( aId ); |
|
312 |
SmsMtmL()->LoadMessageL(); |
|
313 |
||
314 |
aMessage->setMessageType(ConvergedMessage::Sms); |
|
315 |
||
316 |
// get parent entry |
|
317 |
TMsvEntry msvEntry( SmsMtmL()->Entry().Entry() ); |
|
318 |
TMsvId parent = msvEntry.Parent(); |
|
319 |
||
320 |
if( parent == KMsvDraftEntryIdValue ) |
|
321 |
{ |
|
322 |
aMessage->setLocation(ConvergedMessage::Draft); |
|
323 |
//TODO: need to give FORWARD etc info in convergedMessage |
|
324 |
aMessage->setDirection(ConvergedMessage::Outgoing); |
|
325 |
||
326 |
//Populate recipients |
|
327 |
populateRecipientsL(aMessage); |
|
328 |
||
329 |
//Populate message body |
|
330 |
populateMessageBodyL(aMessage,msvEntry); |
|
331 |
} |
|
332 |
else if(aOperation == UniEditorPluginInterface::Forward) |
|
333 |
{ |
|
334 |
//Populate message body |
|
335 |
populateMessageBodyL(aMessage,msvEntry); |
|
336 |
} |
|
337 |
||
338 |
//This is required as the switch entry doesnot reset sms headers |
|
339 |
//so if we fwd an inbox msg and then try to save that content to drafts |
|
340 |
//we see some issue |
|
341 |
delete iSmsMtm; |
|
342 |
iSmsMtm = NULL; |
|
343 |
||
344 |
return; |
|
345 |
} |
|
346 |
||
347 |
// ----------------------------------------------------------------------------- |
|
348 |
// ConvertToL |
|
349 |
// @see header |
|
350 |
// ----------------------------------------------------------------------------- |
|
351 |
TMsvId UniEditorSmsPluginPrivate::ConvertToL( ConvergedMessage* message ) |
|
352 |
{ |
|
353 |
// create message in draft folder |
|
354 |
TMsvId id = CreateNativeSmsL(); |
|
355 |
||
356 |
int err = KErrNone; |
|
357 |
TRAP(err, |
|
358 |
// set sms data |
|
359 |
SetSmsDataL( message ); |
|
360 |
// set sms settings |
|
361 |
SetSmsSettingsL(); |
|
362 |
// save all changes for the entry |
|
363 |
SmsMtmL()->SaveMessageL(); |
|
364 |
); |
|
365 |
||
366 |
// delete the created drafts entry because error |
|
367 |
// happened during save |
|
368 |
if (err != KErrNone) |
|
369 |
{ |
|
370 |
DeleteDraftsEntryL(id); |
|
371 |
id = -1; |
|
372 |
} |
|
373 |
||
374 |
return id; |
|
375 |
} |
|
376 |
||
377 |
// ----------------------------------------------------------------------------- |
|
378 |
// CreateNativeSmsL |
|
379 |
// @see header |
|
380 |
// ----------------------------------------------------------------------------- |
|
381 |
TMsvId UniEditorSmsPluginPrivate::CreateNativeSmsL() |
|
382 |
{ |
|
383 |
CMsvEntry* cEntry = SmsMtmL()->Session().GetEntryL(KMsvDraftEntryId); |
|
384 |
CleanupStack::PushL( cEntry ); |
|
385 |
SmsMtmL()->SwitchCurrentEntryL( cEntry->EntryId() ); |
|
386 |
||
387 |
TMsvEntry tEntry; |
|
388 |
tEntry.SetAttachment( EFalse ); |
|
389 |
tEntry.iMtm = KSenduiMtmSmsUid; |
|
390 |
tEntry.iType = KUidMsvMessageEntry; |
|
391 |
tEntry.iRelatedId = iSmsServiceId; |
|
392 |
tEntry.iServiceId = KMsvLocalServiceIndexEntryId; |
|
393 |
tEntry.iDate.UniversalTime(); |
|
394 |
tEntry.SetInPreparation( ETrue ); |
|
395 |
tEntry.SetVisible( EFalse ); |
|
396 |
||
397 |
cEntry->CreateL(tEntry); |
|
398 |
SmsMtmL()->SwitchCurrentEntryL(tEntry.Id()); |
|
399 |
CleanupStack::PopAndDestroy( cEntry ); |
|
400 |
return SmsMtmL()->Entry().Entry().Id(); |
|
401 |
} |
|
402 |
||
403 |
// ----------------------------------------------------------------------------- |
|
404 |
// SetSmsDataL |
|
405 |
// @see header |
|
406 |
// ----------------------------------------------------------------------------- |
|
407 |
void UniEditorSmsPluginPrivate::SetSmsDataL(ConvergedMessage* message) |
|
408 |
{ |
|
409 |
// populate recipients, subject and emailfields |
|
410 |
SetSmsHeaderL(message); |
|
411 |
||
412 |
// populate the attachments in msg entry |
|
413 |
SetSmsAttachmentsL(message); |
|
414 |
} |
|
415 |
||
416 |
// ----------------------------------------------------------------------------- |
|
417 |
// SetSmsHeaderL |
|
418 |
// @see header |
|
419 |
// ----------------------------------------------------------------------------- |
|
420 |
void UniEditorSmsPluginPrivate::SetSmsHeaderL(ConvergedMessage* message) |
|
421 |
{ |
|
422 |
TBuf<KMaxDetailsLength> idetailsBuf; |
|
423 |
idetailsBuf.Zero(); |
|
424 |
//Save for email over sms |
|
425 |
if ( iRecipients ) |
|
426 |
{ |
|
427 |
delete iRecipients; |
|
428 |
iRecipients = NULL; |
|
429 |
} |
|
430 |
iRecipients = new ( ELeave ) CDesCArrayFlat( KRecipientsArrayGranularity ); |
|
431 |
||
432 |
CSmsEmailFields *emailFields = CSmsEmailFields::NewL(); |
|
433 |
CleanupStack::PushL( emailFields ); |
|
434 |
||
435 |
ConvergedMessageAddressList addrList = message->toAddressList(); |
|
436 |
int addrCount = addrList.count(); |
|
437 |
for(int i=0; i<addrCount; i++) |
|
438 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
439 |
HBufC* addr = XQConversions::qStringToS60Desc( addrList.at(i)->address() ); |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
440 |
HBufC* alt_alias = XQConversions::qStringToS60Desc( addrList.at(i)->alias() ); |
31 | 441 |
if(addr->Length() > 0) |
442 |
{ |
|
443 |
CleanupStack::PushL(addr); |
|
444 |
if(alt_alias->Length() > 0) |
|
445 |
CleanupStack::PushL(alt_alias); |
|
446 |
HBufC* pureAddr = TMmsGenUtils::PureAddress( *addr ).AllocLC(); |
|
447 |
HBufC* aliasAddr = TMmsGenUtils::Alias( *addr ).AllocLC(); |
|
448 |
TInt appendLen = KMaxDetailsLength-idetailsBuf.Length(); |
|
449 |
TPtrC appendbuf; |
|
450 |
if ( IsEmailAddress( *pureAddr ) ) |
|
451 |
{ |
|
452 |
emailFields->AddAddressL( *pureAddr ); |
|
453 |
appendbuf.Set(pureAddr->Des().Left(appendLen)); |
|
454 |
} |
|
455 |
else |
|
456 |
{ |
|
457 |
if(aliasAddr->Length() > 0) |
|
458 |
{ |
|
459 |
SmsMtmL()->AddAddresseeL( *pureAddr, *aliasAddr ); |
|
460 |
appendbuf.Set(aliasAddr->Des().Left(appendLen)); |
|
461 |
} |
|
462 |
else |
|
463 |
{ |
|
464 |
if(alt_alias->Length() > 0) |
|
465 |
{ |
|
466 |
SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias ); |
|
467 |
appendbuf.Set(alt_alias->Des().Left(appendLen)); |
|
468 |
} |
|
469 |
else |
|
470 |
{ |
|
471 |
SmsMtmL()->AddAddresseeL( *pureAddr ); |
|
472 |
appendbuf.Set(pureAddr->Des().Left(appendLen)); |
|
473 |
} |
|
474 |
} |
|
475 |
} |
|
476 |
// copy the append-buffer to form idetails |
|
477 |
if(appendLen > 0) |
|
478 |
{ |
|
479 |
idetailsBuf.Append( appendbuf ); |
|
480 |
} |
|
481 |
iRecipients->AppendL( *addr ); |
|
482 |
||
483 |
// cleanup |
|
484 |
CleanupStack::PopAndDestroy(2, pureAddr ); |
|
485 |
if(alt_alias->Length() > 0) |
|
486 |
{ |
|
487 |
CleanupStack::PopAndDestroy( alt_alias ); |
|
488 |
} |
|
489 |
CleanupStack::PopAndDestroy( addr ); |
|
490 |
||
491 |
// append separator |
|
492 |
if(i != addrCount-1) |
|
493 |
{ |
|
494 |
if(KMaxDetailsLength-idetailsBuf.Length() > 0) |
|
495 |
{ |
|
496 |
idetailsBuf.Append( KAddressSeparator() ); |
|
497 |
} |
|
498 |
} |
|
499 |
} |
|
500 |
} |
|
501 |
||
502 |
if(idetailsBuf.Length() > 0) |
|
503 |
{ |
|
504 |
// set iDetails |
|
505 |
CMsvEntry& entry = SmsMtmL()->Entry(); |
|
506 |
TMsvEntry msvEntry( entry.Entry() ); |
|
507 |
msvEntry.iDetails.Set( idetailsBuf ); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
508 |
entry.ChangeL( msvEntry ); |
31 | 509 |
SmsMtmL()->SaveMessageL(); |
510 |
} |
|
511 |
||
512 |
// set subject |
|
513 |
if ( !message->subject().isEmpty() ) |
|
514 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
515 |
HBufC* subj = XQConversions::qStringToS60Desc( message->subject() ); |
31 | 516 |
if( subj ) |
517 |
{ |
|
518 |
CleanupStack::PushL( subj ); |
|
519 |
emailFields->SetSubjectL( *subj ); |
|
520 |
CleanupStack::PopAndDestroy( subj ); |
|
521 |
} |
|
522 |
} |
|
523 |
||
524 |
SmsMtmL()->SmsHeader().SetEmailFieldsL( *emailFields ); |
|
525 |
CleanupStack::PopAndDestroy( emailFields ); |
|
526 |
} |
|
527 |
||
528 |
// ----------------------------------------------------------------------------- |
|
529 |
// SetSmsBodyL |
|
530 |
// @see header |
|
531 |
// ----------------------------------------------------------------------------- |
|
532 |
void UniEditorSmsPluginPrivate::SetSmsBodyL(ConvergedMessage* message) |
|
533 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
534 |
HBufC8* bodytext = XQConversions::qStringToS60Desc8( message->bodyText() ); |
31 | 535 |
if( bodytext->Length() > 0) |
536 |
{ |
|
537 |
CleanupStack::PushL( bodytext ); |
|
538 |
RDesReadStream stream(*bodytext); |
|
539 |
CleanupClosePushL( stream ); |
|
540 |
||
541 |
CPlainText::TImportExportParam param; |
|
542 |
param.iForeignEncoding = KCharacterSetIdentifierUtf8; |
|
543 |
param.iOrganisation = CPlainText::EOrganiseByParagraph; |
|
544 |
CPlainText::TImportExportResult result; |
|
545 |
||
546 |
SmsMtmL()->Body().Reset(); |
|
547 |
SmsMtmL()->Body().ImportTextL( 0, stream, param, result ); |
|
548 |
||
549 |
CleanupStack::PopAndDestroy(&stream); |
|
550 |
CleanupStack::PopAndDestroy( bodytext ); |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
// ----------------------------------------------------------------------------- |
|
555 |
// SetSmsAttachmentsL |
|
556 |
// @see header |
|
557 |
// ----------------------------------------------------------------------------- |
|
558 |
void UniEditorSmsPluginPrivate::SetSmsAttachmentsL(ConvergedMessage* message) |
|
559 |
{ |
|
560 |
// set body text |
|
561 |
SetSmsBodyL( message ); |
|
562 |
||
563 |
// look for attachments |
|
564 |
ConvergedMessageAttachmentList attachmentList = message->attachments(); |
|
565 |
int attachmentCount = attachmentList.count(); |
|
566 |
||
567 |
ConvergedMessageAttachment* attachment = NULL; |
|
568 |
if( attachmentCount > 1) |
|
569 |
{ |
|
570 |
//Programming error in caller code |
|
571 |
// sms can have at-max 1 attachment e.g. vcard, vcal etc |
|
572 |
User::Leave( KErrArgument ); |
|
573 |
} |
|
574 |
else if( attachmentCount == 1) |
|
575 |
{ |
|
576 |
attachment = attachmentList.at(0); |
|
577 |
} |
|
578 |
// set entry info for drafts viewing |
|
579 |
TMsvEntry tEntry = SmsMtmL()->Entry().Entry(); |
|
580 |
CMsvStore* store = SmsMtmL()->Entry().EditStoreL(); |
|
581 |
CleanupStack::PushL( store ); |
|
582 |
// fill localized strings for smart-msgs e.g. 'Business Card' for vcards |
|
583 |
QString descr; |
|
584 |
if ( attachment ) |
|
585 |
{ |
|
586 |
// create msv attachment in store |
|
587 |
CreateAttachmentL(store, |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
588 |
*XQConversions::qStringToS60Desc(attachment->filePath())); |
31 | 589 |
|
590 |
// check for mimetype of the attachment |
|
591 |
TPtrC8 mimetype; |
|
592 |
int attSize; |
|
593 |
QString attMimeType; |
|
594 |
TMsgMediaType attMediaType = EMsgMediaUnknown; |
|
595 |
iGenUtils->getFileInfoL(attachment->filePath(), |
|
596 |
attSize, attMimeType, attMediaType); |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
597 |
mimetype.Set( *XQConversions::qStringToS60Desc8(attMimeType) ); |
31 | 598 |
|
599 |
if ( mimetype.CompareF( KMsgMimeTextPlain ) == 0 ) |
|
600 |
{ |
|
601 |
iBioMsg=EFalse; |
|
602 |
} |
|
603 |
else if ( mimetype.CompareF(KMsgMimeVCard) == 0 ) |
|
604 |
{ |
|
605 |
iBioMsg=ETrue; |
|
606 |
tEntry.iBioType = KMsgBioUidVCard.iUid; |
|
607 |
SmsMtmL()->BioTypeChangedL( KMsgBioUidVCard ); |
|
608 |
descr = BUSINESS_CARD; |
|
609 |
} |
|
610 |
else if ( mimetype.CompareF(KMsgMimeVCal ) == 0 || |
|
611 |
mimetype.CompareF(KMsgMimeICal ) == 0 ) |
|
612 |
{ |
|
613 |
iBioMsg=ETrue; |
|
614 |
tEntry.iBioType = KMsgBioUidVCalendar.iUid; |
|
615 |
SmsMtmL()->BioTypeChangedL( KMsgBioUidVCalendar ); |
|
616 |
} |
|
617 |
else |
|
618 |
{ |
|
619 |
// do not expect any other mimetype |
|
620 |
User::Leave( KErrArgument ); |
|
621 |
} |
|
622 |
} |
|
623 |
||
624 |
// populate description for this msg (from subject/body content) |
|
625 |
CSmsHeader& header = SmsMtmL()->SmsHeader(); |
|
626 |
TBuf<KSmsMessageEntryDescriptionAmountOfChars> buf; |
|
627 |
buf.Zero(); |
|
628 |
if(!iBioMsg) |
|
629 |
{ |
|
630 |
ExtractDescriptionFromMessageL( |
|
631 |
header.Message(), |
|
632 |
buf, |
|
633 |
KSmsMessageEntryDescriptionAmountOfChars ); |
|
634 |
} |
|
635 |
else if(!descr.isNull()) |
|
636 |
{ |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
637 |
buf.Copy( *XQConversions::qStringToS60Desc(descr) ); |
31 | 638 |
} |
639 |
tEntry.iDescription.Set( buf ); |
|
640 |
||
641 |
// save/commit all changes |
|
642 |
SmsMtmL()->SaveMessageL( *store, tEntry ); |
|
643 |
SmsMtmL()->Entry().ChangeL( tEntry ); |
|
644 |
store->Commit(); |
|
645 |
CleanupStack::PopAndDestroy( store ); |
|
646 |
} |
|
647 |
||
648 |
// ----------------------------------------------------------------------------- |
|
649 |
// CreateAttachmentL |
|
650 |
// @see header |
|
651 |
// ----------------------------------------------------------------------------- |
|
652 |
void UniEditorSmsPluginPrivate::CreateAttachmentL(CMsvStore* aStore, const TDesC& aFilePath) |
|
653 |
{ |
|
654 |
MMsvAttachmentManager* attachmentManager = &( aStore->AttachmentManagerL() ); |
|
655 |
CMsvAttachment* attachment = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
|
656 |
CleanupStack::PushL( attachment ); |
|
657 |
||
658 |
int attSize; |
|
659 |
QString mimeType; |
|
660 |
TMsgMediaType mediaType = EMsgMediaUnknown; |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
661 |
QString filepath = XQConversions::s60DescToQString( aFilePath ); |
31 | 662 |
iGenUtils->getFileInfoL(filepath, attSize, mimeType, mediaType); |
663 |
||
664 |
attachment->SetSize( attSize ); |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
665 |
attachment->SetMimeTypeL( *XQConversions::qStringToS60Desc8(mimeType) ); |
31 | 666 |
|
667 |
CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
668 |
attachmentManager->AddAttachmentL( aFilePath, attachment, wait->iStatus ); |
|
669 |
wait->Start(); |
|
670 |
CleanupStack::PopAndDestroy( wait ); |
|
671 |
CleanupStack::Pop( attachment ); |
|
672 |
||
673 |
aStore->CommitL(); |
|
674 |
} |
|
675 |
||
676 |
// ----------------------------------------------------------------------------- |
|
677 |
// SetSmsSettingsL |
|
678 |
// @see header |
|
679 |
// ----------------------------------------------------------------------------- |
|
680 |
void UniEditorSmsPluginPrivate::SetSmsSettingsL() |
|
681 |
{ |
|
682 |
CSmsSettings* sendOptions = CSmsSettings::NewL(); |
|
683 |
CleanupStack::PushL( sendOptions ); |
|
684 |
||
685 |
// "ConvertToL" might be called right after constructor. |
|
686 |
// In this case iSmsHeader is still NULL. Need to initialise. |
|
687 |
if ( !iSmsHeader ) |
|
688 |
{ |
|
689 |
CMsvStore* store = SmsMtmL()->Entry().EditStoreL(); |
|
690 |
CleanupStack::PushL( store ); |
|
691 |
LoadHeadersL( store ); |
|
692 |
CleanupStack::PopAndDestroy( store ); |
|
693 |
} |
|
694 |
iSmsHeader->GetSmsSettingsL( *sendOptions ); |
|
695 |
||
696 |
sendOptions->CopyL( *sendOptions ); |
|
697 |
||
698 |
if ( iBioMsg ) |
|
699 |
{ |
|
700 |
// make sure bio messages have no conversion |
|
701 |
sendOptions->SetMessageConversion( ESmsConvPIDNone ); |
|
702 |
} |
|
703 |
||
704 |
// Update some global SMS settings affecting all messages. |
|
705 |
// These might have changed from the ones retrieved when |
|
706 |
// the message was created and so needs to be updated. |
|
707 |
CSmsSettings* defaultSettings = CSmsSettings::NewLC(); |
|
708 |
||
709 |
CSmsAccount* account = CSmsAccount::NewLC(); |
|
710 |
account->LoadSettingsL( *defaultSettings ); |
|
711 |
CleanupStack::PopAndDestroy( account ); |
|
712 |
||
713 |
sendOptions->SetDeliveryReport( defaultSettings->DeliveryReport() ); |
|
714 |
sendOptions->SetSmsBearer( defaultSettings->SmsBearer() ); |
|
715 |
sendOptions->SetValidityPeriod( defaultSettings->ValidityPeriod() ); |
|
716 |
sendOptions->SetReplyPath( defaultSettings->ReplyPath() ); |
|
717 |
||
718 |
if (defaultSettings->CharacterSet() |
|
719 |
== TSmsDataCodingScheme::ESmsAlphabetUCS2) |
|
720 |
{ |
|
721 |
iCharSupportType = TUniSendingSettings::EUniCharSupportFull; |
|
722 |
} |
|
723 |
else |
|
724 |
{ |
|
725 |
iCharSupportType = TUniSendingSettings::EUniCharSupportReduced; |
|
726 |
} |
|
727 |
||
728 |
iSmsHeader->SetSmsSettingsL( *sendOptions ); |
|
729 |
||
730 |
// Move all the stuff from iSmsHeader::SmsSettings to SmsMtm::SmsHeader::SmsSettings |
|
731 |
SmsMtmL()->SmsHeader( ).SetSmsSettingsL( *sendOptions ); |
|
732 |
//If sc is existant then only set the default service center |
|
733 |
if(ValidateSCNumberL()) |
|
734 |
{ |
|
735 |
SmsMtmL()->SmsHeader( ).Message( ). |
|
736 |
SetServiceCenterAddressL( defaultSettings->GetServiceCenter(defaultSettings->DefaultServiceCenter()).Address() ); |
|
737 |
} |
|
738 |
CleanupStack::PopAndDestroy(defaultSettings); |
|
739 |
CleanupStack::PopAndDestroy( sendOptions ); |
|
740 |
||
741 |
||
742 |
//Initialize the settings |
|
743 |
SetEncodingSettingsL( iUnicodeMode, ESmsEncodingNone, |
|
744 |
iCharSupportType); |
|
745 |
||
746 |
//get bodytext |
|
747 |
TInt smslength = SmsMtmL()->Body().LdDocumentLength(); |
|
748 |
HBufC* body = HBufC::NewLC(smslength); |
|
749 |
TPtrC ptr; |
|
750 |
ptr.Set(SmsMtmL()->Body().Read(0,smslength)); |
|
751 |
||
752 |
TInt numOfRemainingChars; |
|
753 |
TInt numOfPDUs; |
|
754 |
TBool unicodeMode; |
|
755 |
TSmsEncoding alternativeEncodingType; |
|
756 |
||
757 |
//This is to reset the charset type |
|
758 |
GetNumPDUsL(ptr,numOfRemainingChars,numOfPDUs, |
|
759 |
unicodeMode,alternativeEncodingType); |
|
760 |
||
761 |
if (iNLTFeatureSupport) |
|
762 |
{ |
|
763 |
//Turkish SMS-PREQ2265 Specific |
|
764 |
TSmsEncoding currAlternateEncoding = |
|
765 |
iSmsHeader->Message().Alternative7bitEncoding(); |
|
766 |
SmsMtmL()->SmsHeader().Message().SetAlternative7bitEncoding( |
|
767 |
currAlternateEncoding); |
|
768 |
} |
|
769 |
||
770 |
//Write the settings into message header |
|
771 |
TSmsUserDataSettings smsSettings; |
|
772 |
CSmsMessage& smsMsg = SmsMtmL()->SmsHeader().Message(); |
|
773 |
||
774 |
if (iUnicodeMode) |
|
775 |
{ |
|
776 |
smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabetUCS2); |
|
777 |
} |
|
778 |
else |
|
779 |
{ |
|
780 |
smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet7Bit); |
|
781 |
} |
|
782 |
||
783 |
smsSettings.SetTextCompressed(EFalse); |
|
784 |
||
785 |
smsMsg.SetUserDataSettingsL( smsSettings ); |
|
786 |
||
787 |
CleanupStack::PopAndDestroy(body); |
|
788 |
} |
|
789 |
||
790 |
// ----------------------------------------------------------------------------- |
|
791 |
// SendL |
|
792 |
// @see header |
|
793 |
// ----------------------------------------------------------------------------- |
|
794 |
void UniEditorSmsPluginPrivate::SendL( TMsvId aId ) |
|
795 |
{ |
|
796 |
SmsMtmL()->SwitchCurrentEntryL( aId ); |
|
797 |
SmsMtmL()->LoadMessageL(); |
|
798 |
MoveMessagesToOutboxL(); |
|
799 |
} |
|
800 |
||
801 |
// ----------------------------------------------------------------------------- |
|
802 |
// ValidateServiceL |
|
803 |
// @see header |
|
804 |
// ----------------------------------------------------------------------------- |
|
805 |
TBool UniEditorSmsPluginPrivate::ValidateServiceL( TBool aEmailOverSms ) |
|
806 |
{ |
|
807 |
TBool valid = ValidateSCNumberL(); |
|
808 |
||
809 |
if ( aEmailOverSms ) |
|
810 |
{ |
|
811 |
valid = ValidateSCNumberForEmailOverSmsL(); |
|
812 |
} |
|
813 |
||
814 |
return valid; |
|
815 |
} |
|
816 |
||
817 |
// ----------------------------------------------------------------------------- |
|
818 |
// IsServiceValidL |
|
819 |
// @see header |
|
820 |
// ----------------------------------------------------------------------------- |
|
821 |
TBool UniEditorSmsPluginPrivate::IsServiceValidL() |
|
822 |
{ |
|
823 |
// Not implemented. |
|
824 |
return ETrue; |
|
825 |
} |
|
826 |
||
827 |
// ----------------------------------------------------------------------------- |
|
828 |
// SmsMtmL |
|
829 |
// @see header |
|
830 |
// ----------------------------------------------------------------------------- |
|
831 |
CSmsClientMtm* UniEditorSmsPluginPrivate::SmsMtmL() |
|
832 |
{ |
|
833 |
if ( !iSmsMtm ) |
|
834 |
{ |
|
835 |
if ( !iMtmRegistry ) |
|
836 |
{ |
|
837 |
iMtmRegistry = CClientMtmRegistry::NewL( *iSession ); |
|
838 |
} |
|
839 |
iSmsMtm = static_cast<CSmsClientMtm*>( iMtmRegistry->NewMtmL( KSenduiMtmSmsUid ) ); |
|
840 |
} |
|
841 |
return iSmsMtm; |
|
842 |
} |
|
843 |
||
844 |
// ---------------------------------------------------------------------------- |
|
845 |
// MoveMessagesToOutboxL |
|
846 |
// @see header |
|
847 |
// ---------------------------------------------------------------------------- |
|
848 |
void UniEditorSmsPluginPrivate::MoveMessagesToOutboxL() |
|
849 |
{ |
|
850 |
if ( !iRecipients || !iRecipients->Count() ) |
|
851 |
{ |
|
852 |
User::Leave( KErrGeneral ); |
|
853 |
} |
|
854 |
||
855 |
// manage attachment and body content for sms |
|
856 |
// e.g. in case of smartmsgs, we will need to populate attachment's |
|
857 |
// content into msg body and discard the attachment |
|
858 |
CMsvStore* store = SmsMtmL()->Entry().EditStoreL(); |
|
859 |
CleanupStack::PushL(store); |
|
860 |
MMsvAttachmentManager* attachmentManager = &(store->AttachmentManagerL()); |
|
861 |
MMsvAttachmentManagerSync& managerSync = |
|
862 |
store->AttachmentManagerExtensionsL(); |
|
863 |
TInt attCount = attachmentManager->AttachmentCount(); |
|
864 |
if (attCount > 1) |
|
865 |
{ |
|
866 |
//Programming error in caller code |
|
867 |
User::Leave(KErrArgument); |
|
868 |
} |
|
869 |
else if (attCount == 1) |
|
870 |
{ |
|
871 |
// get mimetype |
|
872 |
CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL(); |
|
873 |
CleanupStack::PushL(mediaResolver); |
|
874 |
mediaResolver->SetCharacterSetRecognition(EFalse); |
|
875 |
RFile filehandle = mediaResolver->FileHandleL( |
|
876 |
attachmentManager->GetAttachmentInfoL(0)->FilePath()); |
|
877 |
CleanupClosePushL(filehandle); |
|
878 |
TPtrC8 mimetype; |
|
879 |
TDataType datatype; |
|
880 |
mediaResolver->RecognizeL(filehandle, datatype); |
|
881 |
mimetype.Set(datatype.Des8()); |
|
882 |
if (mimetype.CompareF(KMsgMimeTextPlain) == 0) |
|
883 |
{ |
|
884 |
CreatePlainTextSMSL(filehandle); |
|
885 |
CleanupStack::Pop(&filehandle); |
|
886 |
filehandle.Close(); |
|
887 |
managerSync.RemoveAttachmentL(0); |
|
888 |
} |
|
889 |
else if (mimetype.CompareF(KMsgMimeVCard) == 0) |
|
890 |
{ |
|
891 |
CreateVCardSMSL(filehandle); |
|
892 |
CleanupStack::Pop(&filehandle); |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
893 |
filehandle.Close(); |
31 | 894 |
} |
895 |
else if (mimetype.CompareF(KMsgMimeVCal) == 0 || |
|
896 |
mimetype.CompareF(KMsgMimeICal) == 0) |
|
897 |
{ |
|
898 |
CreateVCalSMSL(filehandle); |
|
899 |
CleanupStack::Pop(&filehandle); |
|
900 |
filehandle.Close(); |
|
901 |
managerSync.RemoveAttachmentL(0); |
|
902 |
} |
|
903 |
else |
|
904 |
{ |
|
905 |
User::Leave(KErrArgument); |
|
906 |
} |
|
907 |
CleanupStack::PopAndDestroy(mediaResolver); |
|
908 |
} |
|
909 |
// commit changes |
|
910 |
store->CommitL(); |
|
911 |
CleanupStack::PopAndDestroy(store); |
|
912 |
||
913 |
//we must create an entry selection for message copies |
|
914 |
CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
915 |
CleanupStack::PushL( selection ); |
|
916 |
||
917 |
CMsvEntry& entry = SmsMtmL()->Entry(); |
|
918 |
TMsvEntry msvEntry( entry.Entry() ); |
|
919 |
||
920 |
if ( iOfflineSupported && iGenUtils->IsPhoneOfflineL() ) |
|
921 |
{ |
|
922 |
msvEntry.SetSendingState( KMsvSendStateSuspended ); |
|
923 |
msvEntry.iError = KErrGsmOfflineOpNotAllowed; |
|
924 |
} |
|
925 |
else |
|
926 |
{ |
|
927 |
msvEntry.SetSendingState( KMsvSendStateWaiting ); |
|
928 |
} |
|
929 |
||
930 |
CSmsHeader& header = SmsMtmL()->SmsHeader(); |
|
931 |
TBuf<KSmsMessageEntryDescriptionAmountOfChars> buf; |
|
932 |
||
933 |
if (!iBioMsg ) |
|
934 |
{ |
|
935 |
ExtractDescriptionFromMessageL( |
|
936 |
header.Message(), |
|
937 |
buf, |
|
938 |
KSmsMessageEntryDescriptionAmountOfChars ); |
|
939 |
msvEntry.iDescription.Set( buf ); |
|
940 |
} |
|
941 |
||
942 |
CSmsNumber* rcpt = CSmsNumber::NewL(); |
|
943 |
CleanupStack::PushL( rcpt ); |
|
944 |
||
945 |
TPtrC name; |
|
946 |
TPtrC address; |
|
947 |
TBool cantExit = ETrue; |
|
948 |
while ( cantExit ) |
|
949 |
{ |
|
950 |
HBufC* addressBuf = NULL; |
|
951 |
TPtr addressPtr( 0, 0); |
|
952 |
||
953 |
NameAndAddress( iRecipients->MdcaPoint(0) , name, address ); |
|
954 |
||
955 |
// set To-field stuff into the Details of the entry |
|
956 |
if ( name.Length() ) |
|
957 |
{ |
|
958 |
msvEntry.iDetails.Set( name ); |
|
959 |
} |
|
960 |
else |
|
961 |
{ |
|
962 |
// Internal data structures always holds the address data in western format. |
|
963 |
// UI is responsible of doing language specific conversions. |
|
964 |
addressBuf = HBufC::NewLC( address.Length() ); |
|
965 |
addressPtr.Set( addressBuf->Des() ); |
|
966 |
addressPtr.Copy( address ); |
|
967 |
||
968 |
iGenUtils->ConvertDigitsTo( addressPtr, EDigitTypeWestern ); |
|
969 |
msvEntry.iDetails.Set( addressPtr ); |
|
970 |
} |
|
971 |
TMsvId copyId; |
|
972 |
||
973 |
if ( iRecipients->Count() == 1 ) |
|
974 |
{ |
|
975 |
//Note that we came here also in case of many recipients. ...eventually. |
|
976 |
||
977 |
if ( IsEmailAddress( address ) ) |
|
978 |
{ |
|
979 |
FillEmailInformationDataL( header, address ); |
|
980 |
//Let's remove the recipient and replace it with Email over SMS gateway address |
|
981 |
//But let's first cehck if it exists |
|
982 |
if( SmsMtmL( )->AddresseeList().Count() ) |
|
983 |
{ |
|
984 |
SmsMtmL( )->RemoveAddressee( 0 ); |
|
985 |
} |
|
986 |
SmsMtmL()->AddAddresseeL( |
|
987 |
iEmailOverSmsC->Address( ) , |
|
988 |
KNullDesC( ) ); |
|
989 |
} |
|
990 |
else |
|
991 |
{ |
|
992 |
InsertSubjectL( header, SmsMtmL()->Body() ); |
|
993 |
} |
|
994 |
||
995 |
entry.ChangeL( msvEntry ); |
|
996 |
SmsMtmL()->SaveMessageL(); |
|
997 |
// Move it |
|
998 |
copyId = MoveMessageEntryL( KMsvGlobalOutBoxIndexEntryId ); |
|
999 |
cantExit = EFalse; |
|
1000 |
} |
|
1001 |
else |
|
1002 |
{// Many recipients in array |
|
1003 |
||
1004 |
// Own copy function for Emails |
|
1005 |
// This is because EmailOverSms messages can |
|
1006 |
// contain adresses longer than 21 digits |
|
1007 |
if ( IsEmailAddress( address ) ) |
|
1008 |
{ |
|
1009 |
copyId = CreateMessageInOutboxL( |
|
1010 |
msvEntry, address ); |
|
1011 |
||
1012 |
} |
|
1013 |
else // For MSISDN's |
|
1014 |
{ |
|
1015 |
rcpt->SetAddressL( address ); |
|
1016 |
if ( name.Length() ) |
|
1017 |
{ // add name only if we have alias |
|
1018 |
rcpt->SetNameL( name ); |
|
1019 |
} |
|
1020 |
||
1021 |
copyId = CreateMessageInOutboxL( |
|
1022 |
msvEntry, *rcpt, SmsMtmL()->Body()); |
|
1023 |
||
1024 |
SmsMtmL()->RemoveAddressee( 0 ); |
|
1025 |
} |
|
1026 |
//If hundreds of recipient, make sure viewserver |
|
1027 |
//timers are reseted |
|
1028 |
if ( iRecipients->Count() > 100 && ( iRecipients->Count() ) % 30 == 0 ) |
|
1029 |
{ |
|
1030 |
User::ResetInactivityTime(); |
|
1031 |
} |
|
1032 |
||
1033 |
iRecipients->Delete(0); |
|
1034 |
} |
|
1035 |
if ( addressBuf ) |
|
1036 |
{ |
|
1037 |
CleanupStack::PopAndDestroy( addressBuf ); |
|
1038 |
} |
|
1039 |
||
1040 |
// let's add the entry id into the cmsventryselection |
|
1041 |
selection->AppendL( copyId ); |
|
1042 |
} |
|
1043 |
CleanupStack::PopAndDestroy( rcpt ); |
|
1044 |
||
1045 |
//Let's free some memory |
|
1046 |
if ( iRecipients ) |
|
1047 |
{ |
|
1048 |
delete iRecipients; |
|
1049 |
iRecipients = NULL; |
|
1050 |
} |
|
1051 |
||
1052 |
SetScheduledSendingStateL( selection ); |
|
1053 |
CleanupStack::PopAndDestroy( selection ); |
|
1054 |
} |
|
1055 |
||
1056 |
||
1057 |
// ---------------------------------------------------------------------------- |
|
1058 |
// MoveMessageEntryL |
|
1059 |
// @see header |
|
1060 |
// ---------------------------------------------------------------------------- |
|
1061 |
TMsvId UniEditorSmsPluginPrivate::MoveMessageEntryL( TMsvId aTarget ) |
|
1062 |
{ |
|
1063 |
TMsvEntry msvEntry( SmsMtmL()->Entry().Entry() ); |
|
1064 |
TMsvId id = msvEntry.Id(); |
|
1065 |
||
1066 |
if ( msvEntry.Parent() != aTarget ) |
|
1067 |
{ |
|
1068 |
TMsvSelectionOrdering sort; |
|
1069 |
sort.SetShowInvisibleEntries( ETrue ); |
|
1070 |
CMsvEntry* parentEntry= CMsvEntry::NewL( *iSession, msvEntry.Parent(), sort ); |
|
1071 |
CleanupStack::PushL( parentEntry ); |
|
1072 |
||
1073 |
// Copy original from the parent to the new location |
|
1074 |
CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
1075 |
||
1076 |
CMsvOperation* op = parentEntry->MoveL( |
|
1077 |
msvEntry.Id(), |
|
1078 |
aTarget, |
|
1079 |
wait->iStatus ); |
|
1080 |
||
1081 |
CleanupStack::PushL( op ); |
|
1082 |
wait->Start(); |
|
1083 |
TMsvLocalOperationProgress prog = McliUtils::GetLocalProgressL( *op ); |
|
1084 |
User::LeaveIfError( prog.iError ); |
|
1085 |
||
1086 |
id = prog.iId; |
|
1087 |
||
1088 |
CleanupStack::PopAndDestroy( op ); |
|
1089 |
CleanupStack::PopAndDestroy( wait ); |
|
1090 |
CleanupStack::PopAndDestroy( parentEntry ); |
|
1091 |
} |
|
1092 |
||
1093 |
return id; |
|
1094 |
} |
|
1095 |
||
1096 |
// ---------------------------------------------------------------------------- |
|
1097 |
// CreateMessageInOutboxL |
|
1098 |
// Use this function for non-email messages |
|
1099 |
// @see header |
|
1100 |
// ---------------------------------------------------------------------------- |
|
1101 |
TMsvId UniEditorSmsPluginPrivate::CreateMessageInOutboxL( |
|
1102 |
const TMsvEntry& aEntry, |
|
1103 |
const CSmsNumber& aRecipient, |
|
1104 |
const CRichText& aBody ) |
|
1105 |
{ |
|
1106 |
// Initialize the richtext object |
|
1107 |
CRichText* richText = CRichText::NewL( iParaFormatLayer, iCharFormatLayer ); |
|
1108 |
CleanupStack::PushL( richText ); |
|
1109 |
||
1110 |
// Initialise header and store |
|
1111 |
CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *richText ); |
|
1112 |
CleanupStack::PushL( header ); |
|
1113 |
CMsvStore* sourceStore = SmsMtmL()->Entry().ReadStoreL(); |
|
1114 |
CleanupStack::PushL( sourceStore ); |
|
1115 |
||
1116 |
// Read store |
|
1117 |
header->RestoreL( *sourceStore ); |
|
1118 |
||
1119 |
// Initialise number with parameters |
|
1120 |
CSmsNumber* rcpt = CSmsNumber::NewL( aRecipient ); |
|
1121 |
CleanupStack::PushL( rcpt ); |
|
1122 |
header->Recipients().ResetAndDestroy(); |
|
1123 |
header->Recipients().AppendL( rcpt ); |
|
1124 |
CleanupStack::Pop( rcpt ); |
|
1125 |
||
1126 |
// Create entry to Outbox |
|
1127 |
TMsvEntry entry( aEntry ); |
|
1128 |
entry.iMtmData3 = KSmsPluginBioMsgUnparsed; |
|
1129 |
CMsvEntry* outbox = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryId ); |
|
1130 |
CleanupStack::PushL( outbox ); |
|
1131 |
outbox->CreateL( entry ); |
|
1132 |
iSession->CleanupEntryPushL( entry.Id() ); |
|
1133 |
outbox->SetEntryL( entry.Id()); |
|
1134 |
||
1135 |
//Initialize target store |
|
1136 |
CMsvStore* targetStore; |
|
1137 |
targetStore = outbox->EditStoreL(); |
|
1138 |
CleanupStack::PushL( targetStore ); |
|
1139 |
||
1140 |
//Add attachment |
|
1141 |
MMsvAttachmentManager& attaManager = sourceStore->AttachmentManagerL(); |
|
1142 |
RFile tmpFile; |
|
1143 |
||
1144 |
//Check if attachment exists and add it |
|
1145 |
if( sourceStore->AttachmentManagerL().AttachmentCount() ) |
|
1146 |
{ |
|
1147 |
tmpFile = attaManager.GetAttachmentFileL( 0 ); |
|
1148 |
CleanupClosePushL( tmpFile ); |
|
1149 |
||
1150 |
MMsvAttachmentManager& targetAttaMan = targetStore->AttachmentManagerL(); |
|
1151 |
CMsvAttachment* targetAtta = CMsvAttachment::NewL( CMsvAttachment::EMsvFile ); |
|
1152 |
CleanupStack::PushL( targetAtta ); |
|
1153 |
||
1154 |
CMuiuOperationWait* waiter = CMuiuOperationWait::NewLC(); |
|
1155 |
targetAttaMan.AddAttachmentL( tmpFile, targetAtta, waiter->iStatus ); |
|
1156 |
waiter->Start(); |
|
1157 |
||
1158 |
CleanupStack::PopAndDestroy( waiter ); //waiter |
|
1159 |
CleanupStack::Pop(targetAtta );// targetAtta |
|
1160 |
CleanupStack::Pop( &tmpFile );//tmpFile |
|
1161 |
} |
|
1162 |
||
1163 |
TInt totalLength( aBody.DocumentLength() ); |
|
1164 |
HBufC* bodyText = HBufC::NewLC ( totalLength ); |
|
1165 |
TPtr bodyTextPtr ( bodyText->Des() ); |
|
1166 |
||
1167 |
aBody.Extract( bodyTextPtr, 0, totalLength ); |
|
1168 |
richText->InsertL( 0, bodyTextPtr ); |
|
1169 |
CleanupStack::PopAndDestroy( bodyText ); |
|
1170 |
||
1171 |
InsertSubjectL( *header, *richText ); |
|
1172 |
||
1173 |
targetStore->StoreBodyTextL( *richText ); |
|
1174 |
||
1175 |
header->StoreL( *targetStore ); |
|
1176 |
targetStore->CommitL(); |
|
1177 |
||
1178 |
// Usually SMCM takes care of updating iSize, but now when msg is |
|
1179 |
// created to Outbox for several recipients this has to be done manually. |
|
1180 |
entry.iSize = targetStore->SizeL(); |
|
1181 |
entry.iRelatedId = iSmsServiceId; |
|
1182 |
entry.iServiceId = KMsvLocalServiceIndexEntryId; |
|
1183 |
outbox->ChangeL( entry ); |
|
1184 |
CleanupStack::PopAndDestroy( targetStore ); |
|
1185 |
||
1186 |
iSession->CleanupEntryPop(); |
|
1187 |
CleanupStack::PopAndDestroy( outbox ); |
|
1188 |
CleanupStack::PopAndDestroy( sourceStore ); |
|
1189 |
CleanupStack::PopAndDestroy( header ); |
|
1190 |
CleanupStack::PopAndDestroy( richText ); |
|
1191 |
return entry.Id(); |
|
1192 |
} |
|
1193 |
||
1194 |
// --------------------------------------------------------- |
|
1195 |
// CMsgSmsEditorAppUi::CreateMessageInOutboxL |
|
1196 |
// Creates message in outbox in case of multiple recipients |
|
1197 |
// with some e-mail over SMS addresses |
|
1198 |
// --------------------------------------------------------- |
|
1199 |
TMsvId UniEditorSmsPluginPrivate::CreateMessageInOutboxL( |
|
1200 |
const TMsvEntry& aEntry, |
|
1201 |
const TDesC& aAddress ) |
|
1202 |
{ |
|
1203 |
CRichText* richText = CRichText::NewL( iParaFormatLayer, iCharFormatLayer ); |
|
1204 |
CleanupStack::PushL( richText ); |
|
1205 |
// Initialise header and store |
|
1206 |
CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *richText ); |
|
1207 |
CleanupStack::PushL( header ); |
|
1208 |
CMsvStore* store = SmsMtmL()->Entry().ReadStoreL(); |
|
1209 |
||
1210 |
CleanupStack::PushL( store ); |
|
1211 |
// Read store |
|
1212 |
header->RestoreL( *store ); |
|
1213 |
CleanupStack::PopAndDestroy( store ); |
|
1214 |
// Initialise number |
|
1215 |
CSmsNumber* rcpt = CSmsNumber::NewL(); |
|
1216 |
CleanupStack::PushL( rcpt ); |
|
1217 |
header->Recipients().ResetAndDestroy(); |
|
1218 |
// Save Email specific information in header |
|
1219 |
FillEmailInformationDataL( *header, aAddress ); |
|
1220 |
// Fill the recipient data for Email |
|
1221 |
// Address = Email gateway |
|
1222 |
// Alias = The real address |
|
1223 |
rcpt->SetAddressL( iEmailOverSmsC->Address() ); |
|
1224 |
rcpt->SetNameL( aAddress ); // This takes only 21 chars |
|
1225 |
||
1226 |
header->Recipients().AppendL( rcpt ); |
|
1227 |
CleanupStack::Pop( rcpt ); |
|
1228 |
// Create entry to Outbox |
|
1229 |
TMsvEntry entry( aEntry ); |
|
1230 |
entry.iMtmData3 = KSmsPluginBioMsgUnparsed; |
|
1231 |
||
1232 |
CMsvEntry* outbox = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryId ); |
|
1233 |
CleanupStack::PushL( outbox ); |
|
1234 |
outbox->CreateL( entry ); |
|
1235 |
iSession->CleanupEntryPushL( entry.Id()); |
|
1236 |
outbox->SetEntryL( entry.Id()); |
|
1237 |
// Save |
|
1238 |
store = outbox->EditStoreL(); |
|
1239 |
CleanupStack::PushL( store ); |
|
1240 |
header->StoreL( *store ); |
|
1241 |
||
1242 |
richText->Reset(); |
|
1243 |
richText->InsertL( 0 , SmsMtmL()->Body().Read( 0 ) ); |
|
1244 |
||
1245 |
store->StoreBodyTextL( *richText ); |
|
1246 |
store->CommitL(); |
|
1247 |
// Usually SMCM takes care of updating iSize, but now when msg is |
|
1248 |
// created to Outbox for several recipients this has to be done manually. |
|
1249 |
entry.iSize = store->SizeL(); |
|
1250 |
entry.iRelatedId = iSmsServiceId; |
|
1251 |
entry.iServiceId = KMsvLocalServiceIndexEntryId; |
|
1252 |
outbox->ChangeL( entry ); |
|
1253 |
||
1254 |
CleanupStack::PopAndDestroy( store ); |
|
1255 |
iSession->CleanupEntryPop(); |
|
1256 |
CleanupStack::PopAndDestroy( outbox ); |
|
1257 |
CleanupStack::PopAndDestroy( header ); |
|
1258 |
CleanupStack::PopAndDestroy( richText ); |
|
1259 |
return entry.Id(); |
|
1260 |
} |
|
1261 |
||
1262 |
// ---------------------------------------------------------------------------- |
|
1263 |
// SetScheduledSendingStateL |
|
1264 |
// @see header |
|
1265 |
// ---------------------------------------------------------------------------- |
|
1266 |
void UniEditorSmsPluginPrivate::SetScheduledSendingStateL( CMsvEntrySelection* aSelection ) |
|
1267 |
{ |
|
1268 |
const TMsvEntry msvEntry = SmsMtmL()->Entry().Entry(); |
|
1269 |
if ( msvEntry.SendingState() == KMsvSendStateWaiting ) |
|
1270 |
{ |
|
1271 |
// Add entry to task scheduler |
|
1272 |
TBuf8<1> dummyParams; |
|
1273 |
||
1274 |
CMuiuOperationWait* waiter = CMuiuOperationWait::NewLC(); |
|
1275 |
waiter->iStatus = KRequestPending; |
|
1276 |
||
1277 |
CMsvOperation* op= SmsMtmL()->InvokeAsyncFunctionL( |
|
1278 |
ESmsMtmCommandScheduleCopy, |
|
1279 |
*aSelection, |
|
1280 |
dummyParams, |
|
1281 |
waiter->iStatus ); |
|
1282 |
CleanupStack::PushL( op ); |
|
1283 |
waiter->Start(); |
|
1284 |
||
1285 |
CleanupStack::PopAndDestroy( op ); |
|
1286 |
CleanupStack::PopAndDestroy( waiter ); |
|
1287 |
} |
|
1288 |
} |
|
1289 |
||
1290 |
// ---------------------------------------------------------------------------- |
|
1291 |
// NameAndAddress |
|
1292 |
// @see header |
|
1293 |
// ---------------------------------------------------------------------------- |
|
1294 |
void UniEditorSmsPluginPrivate::NameAndAddress( const TDesC& aMsvAddress, TPtrC& aName, TPtrC& aAddress ) |
|
1295 |
{ |
|
1296 |
TInt addressStart = aMsvAddress.LocateReverse( KMsgSmsAddressStartChar ); |
|
1297 |
TInt addressEnd = aMsvAddress.LocateReverse( KMsgSmsAddressEndChar ); |
|
1298 |
||
1299 |
if ( addressStart != KErrNotFound && addressEnd != KErrNotFound |
|
1300 |
&& addressEnd > addressStart ) |
|
1301 |
{ |
|
1302 |
// verified address, will be used as selected from contacts manager |
|
1303 |
aName.Set( aMsvAddress.Ptr(), addressStart ); |
|
1304 |
aAddress.Set( |
|
1305 |
aMsvAddress.Mid( addressStart + 1 ).Ptr(), |
|
1306 |
( addressEnd - addressStart ) -1 ); |
|
1307 |
if ( !aAddress.Length()) |
|
1308 |
{ |
|
1309 |
aAddress.Set( aName ); |
|
1310 |
aName.Set( KNullDesC ); // empty string |
|
1311 |
} |
|
1312 |
} |
|
1313 |
else |
|
1314 |
{ |
|
1315 |
// unverified string, will be used as entered in the header field |
|
1316 |
aName.Set( KNullDesC ); // empty string |
|
1317 |
aAddress.Set( aMsvAddress.Ptr(), aMsvAddress.Length() ); // a whole string to address |
|
1318 |
} |
|
1319 |
||
1320 |
if ( aName.CompareF( aAddress ) == 0 ) |
|
1321 |
{ |
|
1322 |
aName.Set( KNullDesC ); // empty string |
|
1323 |
} |
|
1324 |
} |
|
1325 |
||
1326 |
// ---------------------------------------------------------------------------- |
|
1327 |
// UniEditorSmsPluginPrivate::ExtractDescriptionFromMessageL |
|
1328 |
// @see header |
|
1329 |
// ---------------------------------------------------------------------------- |
|
1330 |
void UniEditorSmsPluginPrivate::ExtractDescriptionFromMessageL( |
|
1331 |
const CSmsMessage& aMessage, |
|
1332 |
TDes& aDescription, |
|
1333 |
TInt aMaxLength) |
|
1334 |
{ |
|
1335 |
// subject was already put in emailfields |
|
1336 |
HBufC* subject = SmsMtmL()->SmsHeader().EmailFields().Subject().AllocL(); |
|
1337 |
if ( subject->Length() > 0 ) |
|
1338 |
{ |
|
1339 |
aDescription = subject->Des().Left(aMaxLength); |
|
1340 |
} |
|
1341 |
else |
|
1342 |
{// Extract from message body |
|
1343 |
aMessage.Buffer().Extract( |
|
1344 |
aDescription, |
|
1345 |
0, |
|
1346 |
Min( |
|
1347 |
aMaxLength, |
|
1348 |
aMessage.Buffer().Length())); |
|
1349 |
} |
|
1350 |
||
1351 |
//replace paragraphs with spaces. |
|
1352 |
TBuf<KSmsEdExtrDescReplaceCharacterCount> replaceChars; |
|
1353 |
replaceChars.Zero(); |
|
1354 |
replaceChars.Append( CEditableText::EParagraphDelimiter ); |
|
1355 |
replaceChars.Append( KSmsEdUnicodeLFSupportedByBasicPhones ); |
|
1356 |
replaceChars.Append( CEditableText::ELineBreak ); |
|
1357 |
iGenUtils->ReplaceCharacters( aDescription, replaceChars, CEditableText::ESpace ); |
|
1358 |
aDescription.Trim(); |
|
1359 |
} |
|
1360 |
||
1361 |
// ---------------------------------------------------------------------------- |
|
1362 |
// CreatePlainTextSMSL |
|
1363 |
// @see header |
|
1364 |
// ---------------------------------------------------------------------------- |
|
1365 |
void UniEditorSmsPluginPrivate::CreatePlainTextSMSL( RFile& aFile) |
|
1366 |
{ |
|
1367 |
RFileReadStream stream( aFile ); |
|
1368 |
CleanupClosePushL( stream ); |
|
1369 |
||
1370 |
CPlainText::TImportExportParam param; |
|
1371 |
param.iForeignEncoding = KCharacterSetIdentifierUtf8; |
|
1372 |
param.iOrganisation = CPlainText::EOrganiseByParagraph; |
|
1373 |
||
1374 |
CPlainText::TImportExportResult result; |
|
1375 |
||
1376 |
SmsMtmL()->Body().ImportTextL( 0, stream, param, result ); |
|
1377 |
||
1378 |
CleanupStack::PopAndDestroy( &stream ); |
|
1379 |
} |
|
1380 |
||
1381 |
// ---------------------------------------------------------------------------- |
|
1382 |
// InsertSubjectL |
|
1383 |
// Insert subject for non email addresses into the body |
|
1384 |
// ---------------------------------------------------------------------------- |
|
1385 |
void UniEditorSmsPluginPrivate::InsertSubjectL( CSmsHeader& aHeader, CRichText& aText ) |
|
1386 |
{ |
|
1387 |
// subject was already put in emailfields |
|
1388 |
HBufC* subject = SmsMtmL()->SmsHeader().EmailFields().Subject().AllocL(); |
|
1389 |
if ( ( subject->Length() > 0 ) && !iBioMsg ) |
|
1390 |
{ |
|
1391 |
CleanupStack::PushL(subject); |
|
1392 |
TInt writePosition = subject->Length()+2;//+2 for the parentesis |
|
1393 |
||
1394 |
if ( subject->Locate( KUniSmsStartParenthesis )!= KErrNotFound || |
|
1395 |
subject->Locate( KUniSmsEndParenthesis ) != KErrNotFound) |
|
1396 |
{ |
|
1397 |
HBufC* modifiableSubject = subject->Alloc(); |
|
1398 |
CleanupStack::PushL(modifiableSubject); |
|
1399 |
TPtr ptr = modifiableSubject->Des(); |
|
1400 |
||
1401 |
TBuf<1> replaceChars; |
|
1402 |
replaceChars.Zero(); |
|
1403 |
replaceChars.Append( KUniSmsStartParenthesis ); |
|
1404 |
// Replace '(' chars with '<' |
|
1405 |
iGenUtils->ReplaceCharacters( ptr, replaceChars, TChar('<') ); |
|
1406 |
||
1407 |
replaceChars.Zero(); |
|
1408 |
replaceChars.Append( KUniSmsEndParenthesis ); |
|
1409 |
// Replace ')' chars with '>' |
|
1410 |
iGenUtils->ReplaceCharacters( ptr, replaceChars, TChar('>') ); |
|
1411 |
||
1412 |
aText.InsertL( 0, KUniSmsStartParenthesis ); |
|
1413 |
aText.InsertL( 1, ptr ); |
|
1414 |
aText.InsertL( writePosition-1, KUniSmsEndParenthesis ); |
|
1415 |
CleanupStack::PopAndDestroy( modifiableSubject ); |
|
1416 |
} |
|
1417 |
else |
|
1418 |
{ |
|
1419 |
aText.InsertL( 0, KUniSmsStartParenthesis ); |
|
1420 |
aText.InsertL( 1, *subject ); |
|
1421 |
aText.InsertL( writePosition-1, KUniSmsEndParenthesis ); |
|
1422 |
} |
|
1423 |
} |
|
1424 |
||
1425 |
// Clears the CSmsHeaders EmailFields for non Email addresses |
|
1426 |
CSmsEmailFields* emailFields = CSmsEmailFields::NewL(); |
|
1427 |
CleanupStack::PushL( emailFields ); |
|
1428 |
aHeader.SetEmailFieldsL( *emailFields ); |
|
1429 |
CleanupStack::PopAndDestroy( emailFields ); |
|
1430 |
} |
|
1431 |
||
1432 |
// ---------------------------------------------------------------------------- |
|
1433 |
// CreateVCardSMS |
|
1434 |
// @see header |
|
1435 |
// ---------------------------------------------------------------------------- |
|
1436 |
void UniEditorSmsPluginPrivate::CreateVCardSMSL( RFile& aFile ) |
|
1437 |
{ |
|
1438 |
TInt fileSize; |
|
1439 |
TInt err ( aFile.Size( fileSize ) ); |
|
1440 |
User::LeaveIfError(err); |
|
1441 |
||
1442 |
// Create two buffers: 8-bit for reading from file and 16-bit for |
|
1443 |
// converting to 16-bit format |
|
1444 |
HBufC8* buf8 = HBufC8::NewLC( fileSize ); |
|
1445 |
TPtr8 ptr8 = buf8->Des(); |
|
1446 |
HBufC16* buf16 = HBufC16::NewLC( fileSize ); |
|
1447 |
TPtr16 ptr16 = buf16->Des(); |
|
1448 |
||
1449 |
for (TInt err = aFile.Read(ptr8); |
|
1450 |
ptr8.Length() > 0; |
|
1451 |
err = aFile.Read(ptr8)) |
|
1452 |
{ |
|
1453 |
User::LeaveIfError(err); |
|
1454 |
ptr16.Copy(ptr8); |
|
1455 |
SmsMtmL()->Body().InsertL(SmsMtmL()->Body().DocumentLength(), ptr16); |
|
1456 |
} |
|
1457 |
||
1458 |
// Cleanup and return |
|
1459 |
CleanupStack::PopAndDestroy( buf16 ); |
|
1460 |
CleanupStack::PopAndDestroy( buf8 ); |
|
1461 |
} |
|
1462 |
||
1463 |
// ---------------------------------------------------------------------------- |
|
1464 |
// CreateVCalSMS |
|
1465 |
// @see header |
|
1466 |
// ---------------------------------------------------------------------------- |
|
1467 |
void UniEditorSmsPluginPrivate::CreateVCalSMSL( RFile& aFile ) |
|
1468 |
{ |
|
1469 |
TInt err (KErrNone); |
|
1470 |
TInt fileSize; |
|
1471 |
err = aFile.Size( fileSize ); |
|
1472 |
User::LeaveIfError(err); |
|
1473 |
||
1474 |
HBufC8* buf8 = HBufC8::NewLC( fileSize ); |
|
1475 |
TPtr8 ptr8 = buf8->Des(); |
|
1476 |
||
1477 |
err = aFile.Read( ptr8 ); |
|
1478 |
User::LeaveIfError(err); |
|
1479 |
||
1480 |
HBufC16* buf16 = HBufC16::NewLC( fileSize ); |
|
1481 |
TPtr16 ptr16 = buf16->Des(); |
|
1482 |
||
1483 |
ptr16.Copy(ptr8); |
|
1484 |
SmsMtmL()->Body().InsertL(0, ptr16); |
|
1485 |
||
1486 |
CleanupStack::PopAndDestroy( buf16 ); |
|
1487 |
CleanupStack::PopAndDestroy( buf8 ); |
|
1488 |
} |
|
1489 |
||
1490 |
// ---------------------------------------------------------------------------- |
|
1491 |
// UniEditorSmsPluginPrivate::ValidateSCNumberL |
|
1492 |
// @see header |
|
1493 |
// ---------------------------------------------------------------------------- |
|
1494 |
TBool UniEditorSmsPluginPrivate::ValidateSCNumberL() |
|
1495 |
{ |
|
1496 |
TBool valid( EFalse ); |
|
1497 |
CSmsAccount* smsAccount = CSmsAccount::NewLC(); |
|
1498 |
CSmsSettings* settings = CSmsSettings::NewLC(); |
|
1499 |
||
1500 |
smsAccount->LoadSettingsL(*settings); |
|
1501 |
||
1502 |
int serviceCenterCount = settings->ServiceCenterCount(); |
|
1503 |
||
1504 |
if( serviceCenterCount > 0 ) |
|
1505 |
{ |
|
1506 |
TInt defaultIndex = settings->DefaultServiceCenter(); |
|
1507 |
if( settings->GetServiceCenter(defaultIndex).Address().Length() > 0 ) |
|
1508 |
{ |
|
1509 |
valid = ETrue; |
|
1510 |
} |
|
1511 |
} |
|
1512 |
else if(settings->ReplyPath()) |
|
1513 |
{ |
|
1514 |
valid = ETrue; |
|
1515 |
} |
|
1516 |
||
1517 |
CleanupStack::PopAndDestroy(2); |
|
1518 |
return valid; |
|
1519 |
} |
|
1520 |
||
1521 |
// --------------------------------------------------------- |
|
1522 |
// UniEditorSmsPluginPrivate::ValidateSCNumberForEmailOverSmsL |
|
1523 |
// @see header |
|
1524 |
// --------------------------------------------------------- |
|
1525 |
TBool UniEditorSmsPluginPrivate::ValidateSCNumberForEmailOverSmsL() |
|
1526 |
{ |
|
1527 |
TBool confNeeded( EFalse ); |
|
1528 |
// Read the email settings |
|
1529 |
TBuf<KUniSmsSCStringLength> emailSmscNumber; |
|
1530 |
TBuf<KUniSmsSCStringLength> emailGateWayNumber; |
|
1531 |
TBool notUsed( EFalse ); |
|
1532 |
// The file may not exist |
|
1533 |
TInt readResult = iGenUtils->ReadEmailOverSmsSettingsL( |
|
1534 |
emailSmscNumber, |
|
1535 |
emailGateWayNumber, |
|
1536 |
notUsed ); |
|
1537 |
if ( KErrNone == readResult ) |
|
1538 |
{ |
|
1539 |
// Check that both have valid values |
|
1540 |
// In any otther case we need to show the conf pop-up window |
|
1541 |
if ( emailSmscNumber != KNullDesC && emailGateWayNumber != KNullDesC) |
|
1542 |
{ |
|
1543 |
confNeeded = ETrue; |
|
1544 |
} |
|
1545 |
} |
|
1546 |
||
1547 |
return confNeeded; |
|
1548 |
} |
|
1549 |
||
1550 |
// --------------------------------------------------------- |
|
1551 |
// UniEditorSmsPluginPrivate::FillEmailInformationDataL |
|
1552 |
// @see header |
|
1553 |
// --------------------------------------------------------- |
|
1554 |
void UniEditorSmsPluginPrivate::FillEmailInformationDataL( |
|
1555 |
CSmsHeader& aHeader, |
|
1556 |
const TPtrC& aAddress ) |
|
1557 |
{ |
|
1558 |
CSmsEmailFields* emailFields = CSmsEmailFields::NewL(); |
|
1559 |
CleanupStack::PushL( emailFields ); |
|
1560 |
||
1561 |
// The Email SMSC may differ from sms SMSC |
|
1562 |
aHeader.Message().SetServiceCenterAddressL( iEmailOverSmsC->Name() ); |
|
1563 |
||
1564 |
// Check if there is need to save as EmailFieds with header |
|
1565 |
if ( aAddress.Length() ) |
|
1566 |
{ |
|
1567 |
// Set the address |
|
1568 |
emailFields->AddAddressL( aAddress ); |
|
1569 |
} |
|
1570 |
||
1571 |
// subject was already put in emailfields |
|
1572 |
HBufC* subject = SmsMtmL()->SmsHeader().EmailFields().Subject().AllocL(); |
|
1573 |
if ( subject->Length() > 0 ) |
|
1574 |
{ // Handle the subject |
|
1575 |
CleanupStack::PushL( subject ); |
|
1576 |
TPtr text = subject->Des(); |
|
1577 |
||
1578 |
TBuf<1> replaceChars; |
|
1579 |
replaceChars.Zero(); |
|
1580 |
replaceChars.Append( KUniSmsStartParenthesis ); |
|
1581 |
// Replace '(' chars with '<' |
|
1582 |
iGenUtils->ReplaceCharacters( text, replaceChars, TChar('<') ); |
|
1583 |
||
1584 |
replaceChars.Zero(); |
|
1585 |
replaceChars.Append( KUniSmsEndParenthesis ); |
|
1586 |
// Replace ')' chars with '>' |
|
1587 |
iGenUtils->ReplaceCharacters( text, replaceChars, TChar('>') ); |
|
1588 |
||
1589 |
// For Emails save it to CSmsEmailFields |
|
1590 |
emailFields->SetSubjectL( text ); |
|
1591 |
CleanupStack::PopAndDestroy( subject ); |
|
1592 |
} |
|
1593 |
||
1594 |
aHeader.SetEmailFieldsL( *emailFields ); |
|
1595 |
CleanupStack::PopAndDestroy( emailFields ); |
|
1596 |
} |
|
1597 |
||
1598 |
||
1599 |
||
1600 |
// ---------------------------------------------------- |
|
1601 |
// UniEditorSmsPluginPrivate::IsEmailAddress() |
|
1602 |
// @see header |
|
1603 |
// ---------------------------------------------------- |
|
1604 |
TBool UniEditorSmsPluginPrivate::IsEmailAddress( const TPtrC& aAddress ) const |
|
1605 |
{ |
|
1606 |
TBool isEmailAddress( EFalse ); |
|
1607 |
if ( aAddress.Locate('@') != KErrNotFound) |
|
1608 |
{ |
|
1609 |
isEmailAddress = ETrue; |
|
1610 |
} |
|
1611 |
return isEmailAddress; |
|
1612 |
} |
|
1613 |
||
1614 |
//------------------------------------------------------------------------------ |
|
1615 |
// UniEditorSmsPluginPrivate::SetEncodingSetings |
|
1616 |
// Turkish SMS-PREQ2265 Specific |
|
1617 |
// To Set encoding settings like encoding type, character support |
|
1618 |
// and alternative encoding if any |
|
1619 |
// |
|
1620 |
// IMPORTANT NOTE: |
|
1621 |
// This function is usually called from CV and UE to reset/set alternative |
|
1622 |
// encoding or char support |
|
1623 |
// when corresponding feilds change. Hence aUnicodeMode is always set to false |
|
1624 |
//------------------------------------------------------------------------------ |
|
1625 |
void UniEditorSmsPluginPrivate::SetEncodingSettingsL( TBool aUnicodeMode, |
|
1626 |
TSmsEncoding aAlternativeEncodingType, |
|
1627 |
TInt aCharSupportType) |
|
1628 |
{ |
|
1629 |
||
1630 |
if ( !iSmsHeader ) |
|
1631 |
{ |
|
1632 |
iSmsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *iRichText ); |
|
1633 |
||
1634 |
CSmsSettings* settings = CSmsSettings::NewLC(); |
|
1635 |
CSmsAccount* account = CSmsAccount::NewLC(); |
|
1636 |
account->LoadSettingsL( *settings ); |
|
1637 |
CleanupStack::PopAndDestroy( account ); |
|
1638 |
iSmsHeader->SetSmsSettingsL( *settings ); |
|
1639 |
CleanupStack::PopAndDestroy( settings ); |
|
1640 |
} |
|
1641 |
||
1642 |
TSmsUserDataSettings smsSettings; |
|
1643 |
CSmsMessage& smsMsg = iSmsHeader->Message(); |
|
1644 |
||
1645 |
iUnicodeMode = aUnicodeMode; |
|
1646 |
iCharSupportType = aCharSupportType; |
|
1647 |
iAlternativeEncodingType = aAlternativeEncodingType; |
|
1648 |
||
1649 |
if (iUnicodeMode) |
|
1650 |
{ |
|
1651 |
smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabetUCS2); |
|
1652 |
} |
|
1653 |
else |
|
1654 |
{ |
|
1655 |
smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet7Bit); |
|
1656 |
} |
|
1657 |
||
1658 |
smsSettings.SetTextCompressed(EFalse); |
|
1659 |
||
1660 |
smsMsg.SetUserDataSettingsL( smsSettings ); |
|
1661 |
//First try without any alternate encoding |
|
1662 |
smsMsg.SetAlternative7bitEncoding( aAlternativeEncodingType ); |
|
1663 |
} |
|
1664 |
||
1665 |
//------------------------------------------------------------------------------ |
|
1666 |
// UniEditorSmsPluginPrivate::GetNumPDUs |
|
1667 |
// Turkish SMS-PREQ2265 Specific |
|
1668 |
// To get PDU Info: extracts details of number of PDUs, number of remaining |
|
1669 |
// chars in last PDU |
|
1670 |
// and encoding types used. |
|
1671 |
//------------------------------------------------------------------------------ |
|
1672 |
void UniEditorSmsPluginPrivate::GetNumPDUsL( |
|
1673 |
TDesC& aBuf, |
|
1674 |
TInt& aNumOfRemainingChars, |
|
1675 |
TInt& aNumOfPDUs, |
|
1676 |
TBool& aUnicodeMode, |
|
1677 |
TSmsEncoding & aAlternativeEncodingType ) |
|
1678 |
{ |
|
1679 |
TInt numOfUnconvChars, numOfDowngradedChars, isAltEncSupported; |
|
1680 |
TSmsEncoding currentAlternativeEncodingType; |
|
1681 |
||
1682 |
CSmsMessage& smsMsg = iSmsHeader->Message(); |
|
1683 |
||
1684 |
// need to set the input buffer to SMS buffer through iRichText(which is reference to SMS Buffer object) |
|
1685 |
iRichText->Reset(); |
|
1686 |
iRichText->InsertL(0, aBuf); |
|
1687 |
||
1688 |
//call SMS stack API to get PDU info |
|
1689 |
smsMsg.GetEncodingInfoL( aNumOfPDUs, numOfUnconvChars, numOfDowngradedChars, aNumOfRemainingChars ); |
|
1690 |
||
1691 |
//Algo to switch to Unicode if required |
|
1692 |
while( (numOfUnconvChars || numOfDowngradedChars) && !iUnicodeMode ) |
|
1693 |
{ |
|
1694 |
currentAlternativeEncodingType = smsMsg.Alternative7bitEncoding(); |
|
1695 |
if( currentAlternativeEncodingType != iAlternativeEncodingType ) |
|
1696 |
{ |
|
1697 |
//try with this new alternative encoding type |
|
1698 |
isAltEncSupported = smsMsg.SetAlternative7bitEncoding( iAlternativeEncodingType ); |
|
1699 |
if( isAltEncSupported == KErrNotSupported ) |
|
1700 |
{ |
|
1701 |
// if required alternative encoding plugin is not supported, retain the existing encoding mechanism. |
|
1702 |
iAlternativeEncodingType = currentAlternativeEncodingType; |
|
1703 |
continue; |
|
1704 |
} |
|
1705 |
} |
|
1706 |
else if( numOfUnconvChars || iCharSupportType == TUniSendingSettings::EUniCharSupportFull) |
|
1707 |
{ |
|
1708 |
//switch to Unicode |
|
1709 |
//iUnicodeMode = ETrue; |
|
1710 |
SetEncodingSettingsL( ETrue, iAlternativeEncodingType, TUniSendingSettings::EUniCharSupportFull); |
|
1711 |
} |
|
1712 |
else |
|
1713 |
{ |
|
1714 |
//Get out of while loop and return the results |
|
1715 |
break; |
|
1716 |
} |
|
1717 |
//get the PDU info with new settings |
|
1718 |
iRichText->Reset(); |
|
1719 |
iRichText->InsertL(0, aBuf); |
|
1720 |
smsMsg.GetEncodingInfoL( aNumOfPDUs, numOfUnconvChars, numOfDowngradedChars, aNumOfRemainingChars ); |
|
1721 |
} |
|
1722 |
||
1723 |
/* |
|
1724 |
* Enable the below code to debug if something wrong with characters sent even in unicode mode |
|
1725 |
*/ |
|
1726 |
||
1727 |
aUnicodeMode = iUnicodeMode; |
|
1728 |
aAlternativeEncodingType = iAlternativeEncodingType; |
|
1729 |
if(iUnicodeMode) |
|
1730 |
{ |
|
1731 |
//In case of Unicode mode, SMS Stack returns number of available free User Data units. |
|
1732 |
//Need to convert them w.r.t characters(each char takse 2 UD units). |
|
1733 |
aNumOfRemainingChars = aNumOfRemainingChars/2; |
|
1734 |
} |
|
1735 |
} |
|
1736 |
||
1737 |
// ---------------------------------------------------- |
|
1738 |
// UniEditorSmsPluginPrivate::DeleteDraftsEntryL() |
|
1739 |
// @see header |
|
1740 |
// ---------------------------------------------------- |
|
1741 |
void UniEditorSmsPluginPrivate::DeleteDraftsEntryL( TMsvId aId ) |
|
1742 |
{ |
|
1743 |
CMsvEntry* pEntry = iSession->GetEntryL(KMsvDraftEntryIdValue); |
|
1744 |
CleanupStack::PushL(pEntry); |
|
1745 |
pEntry->DeleteL( aId ); |
|
1746 |
CleanupStack::PopAndDestroy(pEntry); |
|
1747 |
} |
|
1748 |
||
1749 |
// ---------------------------------------------------- |
|
1750 |
// UniEditorSmsPluginPrivate::populateRecipientsL() |
|
1751 |
// @see header |
|
1752 |
// ---------------------------------------------------- |
|
1753 |
void UniEditorSmsPluginPrivate::populateRecipientsL( |
|
1754 |
ConvergedMessage *aMessage) |
|
1755 |
{ |
|
1756 |
TPtrC name; |
|
1757 |
TPtrC address; |
|
1758 |
||
1759 |
const CSmsEmailFields& emailFields = SmsMtmL( )->SmsHeader( ).EmailFields(); |
|
1760 |
if( emailFields.HasAddress( )) |
|
1761 |
{ // If email address set -> copy them here |
|
1762 |
const MDesCArray& emailRecipients = emailFields.Addresses(); |
|
1763 |
for( TInt id = 0; id < emailRecipients.MdcaCount( ); id++ ) |
|
1764 |
{ |
|
1765 |
HBufC* pureAddr = TMmsGenUtils::PureAddress( emailRecipients.MdcaPoint( id ) ).AllocLC(); |
|
1766 |
HBufC* aliasAddr = TMmsGenUtils::Alias( emailRecipients.MdcaPoint( id ) ).AllocLC(); |
|
1767 |
ConvergedMessageAddress messageAddress( |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1768 |
XQConversions::s60DescToQString(*pureAddr), |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1769 |
XQConversions::s60DescToQString(*aliasAddr)); |
31 | 1770 |
CleanupStack::PopAndDestroy(2, pureAddr ); |
1771 |
aMessage->addToRecipient(messageAddress); |
|
1772 |
} |
|
1773 |
} |
|
1774 |
||
1775 |
// Copy non-email over sms addresses if needed |
|
1776 |
const CMsvRecipientList& smsRecipients = SmsMtmL()->AddresseeList(); |
|
1777 |
int smsRecCount = smsRecipients.Count(); |
|
1778 |
for (int i = 0; i < smsRecCount; i++) |
|
1779 |
{ // Go thru all the recipients |
|
1780 |
if( !emailFields.HasAddress( ) ) |
|
1781 |
{ // and copy them only if email addresses did not exist |
|
1782 |
HBufC* pureAddr = |
|
1783 |
TMmsGenUtils::PureAddress(smsRecipients[i]).AllocLC(); |
|
1784 |
HBufC* aliasAddr = |
|
1785 |
TMmsGenUtils::Alias(smsRecipients[i]).AllocLC(); |
|
1786 |
ConvergedMessageAddress messageAddress( |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1787 |
XQConversions::s60DescToQString(*pureAddr), |
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1788 |
XQConversions::s60DescToQString(*aliasAddr)); |
31 | 1789 |
CleanupStack::PopAndDestroy(2, pureAddr ); |
1790 |
aMessage->addToRecipient(messageAddress); |
|
1791 |
} |
|
1792 |
} |
|
1793 |
||
1794 |
if( emailFields.Subject( ).Length( ) ) |
|
1795 |
{ // If email subject exists -> copy it |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1796 |
aMessage->setSubject(XQConversions::s60DescToQString( |
31 | 1797 |
emailFields.Subject())); |
1798 |
} |
|
1799 |
||
1800 |
} |
|
1801 |
||
1802 |
// ---------------------------------------------------- |
|
1803 |
// UniEditorSmsPluginPrivate::populateMessageBodyL() |
|
1804 |
// @see header |
|
1805 |
// ---------------------------------------------------- |
|
1806 |
void UniEditorSmsPluginPrivate::populateMessageBodyL( |
|
1807 |
ConvergedMessage* aMessage, |
|
1808 |
TMsvEntry &aEntry) |
|
1809 |
{ |
|
1810 |
if ( aEntry.iBioType == KMsgBioUidVCard.iUid |
|
1811 |
|| aEntry.iBioType == KMsgBioUidVCalendar.iUid ) |
|
1812 |
{ |
|
1813 |
//In case of drafts the vcal is present inside msg store and |
|
1814 |
//can be read directly |
|
1815 |
if(aEntry.Parent() == KMsvDraftEntryIdValue) |
|
1816 |
{ |
|
1817 |
//In case of drafts the vcf/vcs file is stored inside store |
|
1818 |
//so we can directly extract it |
|
1819 |
CMsvStore* store = SmsMtmL()->Entry().EditStoreL(); |
|
1820 |
CleanupStack::PushL( store ); |
|
1821 |
MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
1822 |
CMsvAttachment *attachment = manager.GetAttachmentInfoL(0); |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1823 |
QString filepath = XQConversions::s60DescToQString(attachment->FilePath()); |
31 | 1824 |
ConvergedMessageAttachment* conv_attachment = |
1825 |
new ConvergedMessageAttachment(filepath, ConvergedMessageAttachment::EAttachment); |
|
1826 |
ConvergedMessageAttachmentList conv_attList; |
|
1827 |
conv_attList << conv_attachment; |
|
1828 |
aMessage->addAttachments(conv_attList); |
|
1829 |
CleanupStack::PopAndDestroy( store ); |
|
1830 |
} |
|
1831 |
else |
|
1832 |
{ |
|
1833 |
//For non drafts cases extract the vcf/vcs using datamodel interface |
|
1834 |
UniDataModelLoader* pluginLoader = new UniDataModelLoader(); |
|
1835 |
UniDataModelPluginInterface* pluginInterface = |
|
1836 |
pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg); |
|
1837 |
pluginInterface->setMessageId(aEntry.Id()); |
|
1838 |
UniMessageInfoList attachments = pluginInterface->attachmentList(); |
|
1839 |
||
1840 |
QString attachmentPath = attachments[0]->path(); |
|
1841 |
||
1842 |
ConvergedMessageAttachment* conv_attachment = |
|
1843 |
new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment); |
|
1844 |
ConvergedMessageAttachmentList conv_attList; |
|
1845 |
conv_attList << conv_attachment; |
|
1846 |
aMessage->addAttachments(conv_attList); |
|
1847 |
||
1848 |
foreach(UniMessageInfo* attachment,attachments) |
|
1849 |
{ |
|
1850 |
delete attachment; |
|
1851 |
} |
|
1852 |
||
1853 |
delete pluginLoader; |
|
1854 |
} |
|
1855 |
} |
|
1856 |
else //plain text |
|
1857 |
{ |
|
1858 |
TInt totalLength( SmsMtmL()->Body().DocumentLength() ); |
|
1859 |
if ( totalLength > 0 ) |
|
1860 |
{ |
|
1861 |
HBufC* bodyText = HBufC::NewLC ( totalLength ); |
|
1862 |
TPtr bodyTextPtr ( bodyText->Des() ); |
|
1863 |
SmsMtmL()->Body().Extract( bodyTextPtr, 0, totalLength ); |
|
43
35b64624a9e7
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
34
diff
changeset
|
1864 |
aMessage->setBodyText(XQConversions::s60DescToQString( |
31 | 1865 |
bodyTextPtr)); |
1866 |
CleanupStack::PopAndDestroy( bodyText ); |
|
1867 |
} |
|
1868 |
} |
|
1869 |
} |
|
1870 |
||
1871 |
// ---------------------------------------------------- |
|
1872 |
// UniEditorSmsPluginPrivate::HandleSessionEventL() |
|
1873 |
// @see header |
|
1874 |
// ---------------------------------------------------- |
|
1875 |
void UniEditorSmsPluginPrivate::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, |
|
1876 |
TAny* /*aArg1*/, |
|
1877 |
TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
1878 |
{ |
|
1879 |
// do nothing |
|
1880 |
} |
|
1881 |
||
1882 |
// End of File |