|
1 /* |
|
2 * Copyright (c) 2002 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 * Provides MMS MTM UI methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <apgcli.h> |
|
24 #include <msvuids.h> |
|
25 #include <mtmuidef.hrh> |
|
26 #include <mtmdef.h> |
|
27 |
|
28 #include <msvstore.h> |
|
29 #include <mmsvattachmentmanager.h> |
|
30 |
|
31 #include <e32keys.h> |
|
32 #include <coemain.h> |
|
33 #include <eikenv.h> |
|
34 #include <eikdef.h> |
|
35 #include <eikmfne.h> |
|
36 #include <eikedwin.h> |
|
37 #include <eikcapc.h> |
|
38 #include <gulicon.h> |
|
39 #include <ErrorUI.h> //CErrorUI |
|
40 |
|
41 #include <aknPopup.h> |
|
42 #include <aknlists.h> |
|
43 #include <aknconsts.h> |
|
44 #include <akncontext.h> |
|
45 #include <akntabgrp.h> |
|
46 #include <AknQueryDialog.h> |
|
47 #include <aknnotewrappers.h> |
|
48 |
|
49 #include <centralrepository.h> // link against centralrepository.lib |
|
50 #include <messaginginternalcrkeys.h> // for Central Repository keys |
|
51 #include <cmsvrecipientlist.h> |
|
52 #include <messagingvariant.hrh> // additional headers variation flags |
|
53 |
|
54 #include <StringLoader.h> |
|
55 |
|
56 #include <Muiumsginfo.h> |
|
57 #include <MuiuMsvUiServiceUtilities.h> |
|
58 #include <MuiuOperationWait.h> |
|
59 #include <muiumsguploadparam.h> |
|
60 |
|
61 #include <MtmExtendedCapabilities.hrh> |
|
62 #include <ApUtils.h> //CApUtils, CCommsDatabase, EDatabaseTypeIAP |
|
63 #include <MmsUi.rsg> |
|
64 #include <mmsconst.h> |
|
65 #include <mmscmds.h> // EMmsDeleteSchedule |
|
66 #include <mmsmsventry.h> |
|
67 #include <mmsclient.h> |
|
68 #include <mmsgenutils.h> |
|
69 #include <mmssettings.h> // MMS Engine settings |
|
70 |
|
71 // Features |
|
72 #include <featmgr.h> |
|
73 #include <bldvariant.hrh> |
|
74 |
|
75 // DRM |
|
76 #include <fileprotectionresolver.h> |
|
77 |
|
78 #include "MmsMtmUiPanic.h" |
|
79 #include "MmsSettingsDialog.h" |
|
80 #include "MmsMtmConst.h" |
|
81 #include "MmsMtmUi.h" |
|
82 // For Delivery Status |
|
83 #include "CMmsMtmDeliveryDialogLauncher.h" |
|
84 // CONSTANTS |
|
85 |
|
86 _LIT( KCharLeftAddressIterator, "<" ); |
|
87 _LIT( KCharRightAddressIterator, ">" ); |
|
88 _LIT( KMmsCharCommaAndSpace, ", " ); |
|
89 _LIT( KMmsCharSpace, " " ); |
|
90 |
|
91 const TInt KMessageSize = 20; |
|
92 const TInt KMmsAdditionalCharsStringLength = 7; |
|
93 const TUint KMmsLRMarker = 0x200E; |
|
94 |
|
95 const TUint KMmsPostcardAppId = 0x10207247; |
|
96 |
|
97 const TUint KAmsAppId = 0x1020745A; |
|
98 |
|
99 |
|
100 // MACROS |
|
101 #define iMmsClient ( static_cast<CMmsClientMtm&>( iBaseMtm ) ) |
|
102 |
|
103 // LOCAL CONSTANTS AND MACROS |
|
104 |
|
105 // MODULE DATA STRUCTURES |
|
106 |
|
107 // LOCAL FUNCTION PROTOTYPES |
|
108 |
|
109 // ==================== LOCAL FUNCTIONS ==================== |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // NewMmsMtmUiL |
|
113 // Factory function |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 EXPORT_C CBaseMtmUi* NewMmsMtmUiL( CBaseMtm& aMtm, CRegisteredMtmDll& aRegisteredDll ) |
|
117 { |
|
118 return CMmsMtmUi::NewL( aMtm, aRegisteredDll ); |
|
119 } |
|
120 |
|
121 |
|
122 // ================= MEMBER FUNCTIONS ======================= |
|
123 |
|
124 // --------------------------------------------------------- |
|
125 // CMmsMtmUi::CMmsMtmUi |
|
126 // C++ default constructor can NOT contain any code, that |
|
127 // might leave. |
|
128 // --------------------------------------------------------- |
|
129 // |
|
130 CMmsMtmUi::CMmsMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) |
|
131 : CBaseMtmUi( aBaseMtm, aRegisteredMtmDll ) |
|
132 { |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------- |
|
136 // CMmsMtmUi::ConstructL |
|
137 // Symbian OS default constructor can leave. |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 void CMmsMtmUi::ConstructL() |
|
141 { |
|
142 LOGTEXT( _L8( "MmsMtmUi::ConstructL, base construct" ) ); |
|
143 CBaseMtmUi::ConstructL(); |
|
144 LOGTEXT( _L8( "MmsMtmUi::ConstructL, settings handler" ) ); |
|
145 iSettingsHandler = CMmsSettingsHandler::NewL( iMmsClient ); |
|
146 |
|
147 // Changes for the cr # 401-1806 |
|
148 // Get supported features from feature manager. |
|
149 // Since mmsui mtm is loaded by mce firsttime it is launched and it is reloaded after an mms operation is performed , |
|
150 // the usage of the flags iSupportAudioMessaging & iSupportPostcard may not be correct because the feature status might be affected |
|
151 // since the feature status can be modified before starting new mms operation |
|
152 FeatureManager::InitializeLibL(); |
|
153 LOGTEXT( _L8( "MmsMtmUi::ConstructL, end" ) ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // CMmsMtmUi::NewL |
|
158 // Two-phased constructor. |
|
159 // --------------------------------------------------------- |
|
160 // |
|
161 CMmsMtmUi* CMmsMtmUi::NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) |
|
162 { |
|
163 LOGTEXT( _L8( "MmsMtmUi::NewL, start" ) ); |
|
164 CMmsMtmUi* self = new ( ELeave ) CMmsMtmUi( aBaseMtm, aRegisteredMtmDll ); |
|
165 |
|
166 CleanupStack::PushL( self ); |
|
167 self->ConstructL(); |
|
168 CleanupStack::Pop(); |
|
169 |
|
170 LOGTEXT( _L8( "MmsMtmUi::NewL, end" ) ); |
|
171 return self; |
|
172 } |
|
173 |
|
174 |
|
175 // --------------------------------------------------------- |
|
176 // CMmsMtmUi::~CMmsMtmUi |
|
177 // Destructor |
|
178 // --------------------------------------------------------- |
|
179 // |
|
180 CMmsMtmUi::~CMmsMtmUi() |
|
181 { |
|
182 delete iSettingsHandler; |
|
183 |
|
184 if (iLauncher) |
|
185 { |
|
186 delete iLauncher; |
|
187 } |
|
188 // Changes for the cr # 401-1806 |
|
189 FeatureManager::UnInitializeLib(); |
|
190 } |
|
191 |
|
192 |
|
193 // --------------------------------------------------------- |
|
194 // CMmsMtmUi::QueryCapability |
|
195 // Capability check for UI mtm specific functionality. These should |
|
196 // be minimal, as the default capability checking places are UI data MTM |
|
197 // (UI) and client MTM (engine). |
|
198 // --------------------------------------------------------- |
|
199 TInt CMmsMtmUi::QueryCapability( TUid aCapability, TInt& aResponse ) |
|
200 { |
|
201 switch ( aCapability.iUid ) |
|
202 { |
|
203 case KUidMsvMtmUiQueryMessagingInitialisation: // flow through |
|
204 case KUidMsvMtmQueryFactorySettings: |
|
205 case KUidMsvMtmQuerySupportValidateService: |
|
206 |
|
207 aResponse = ETrue; |
|
208 return KErrNone; |
|
209 default: |
|
210 // Actually this routes to client MTM capability check. |
|
211 return CBaseMtmUi::QueryCapability( aCapability, aResponse ); |
|
212 } |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------- |
|
216 // CMmsMtmUi::CreateL |
|
217 // Launches MMS editor for creating a new message. |
|
218 // --------------------------------------------------------- |
|
219 // |
|
220 CMsvOperation* CMmsMtmUi::CreateL( const TMsvEntry& /*aEntry*/, |
|
221 CMsvEntry& /*aParent*/, |
|
222 TRequestStatus& /*aStatus*/ ) |
|
223 { |
|
224 LOGTEXT( _L8( "MmsMtmUi::CreateL - launching editor" ) ); |
|
225 User::Leave( KErrNotSupported ); |
|
226 return NULL; |
|
227 } |
|
228 |
|
229 // --------------------------------------------------------- |
|
230 // CMmsMtmUi::CheckSettingsL() const |
|
231 // Check MMS service settings |
|
232 // --------------------------------------------------------- |
|
233 // |
|
234 TBool CMmsMtmUi::CheckSettingsL( CMmsSettingsDialog::TMmsExitCode& aExitCode ) const |
|
235 { |
|
236 iSettingsHandler->RefreshSettingsL( ); |
|
237 return iSettingsHandler->CheckSettingsL( aExitCode ); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------- |
|
241 // CMmsMtmUi::DeleteServiceL |
|
242 // --------------------------------------------------------- |
|
243 // |
|
244 CMsvOperation* CMmsMtmUi::DeleteServiceL( const TMsvEntry& /*aService*/, |
|
245 TRequestStatus& /*aStatus*/ ) |
|
246 { |
|
247 User::Leave( KErrNotSupported ); |
|
248 return NULL; |
|
249 } |
|
250 |
|
251 // --------------------------------------------------------- |
|
252 // CMmsMtmUi::DeleteFromL |
|
253 // --------------------------------------------------------- |
|
254 // |
|
255 CMsvOperation* CMmsMtmUi::DeleteFromL( const CMsvEntrySelection& /*aSelection*/, |
|
256 TRequestStatus& /*aStatus*/ ) |
|
257 { |
|
258 User::Leave( KErrNotSupported ); |
|
259 return NULL; |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------- |
|
263 // CMmsMtmUi::CopyToL |
|
264 // Copy local outbox entry to remote server = called when sending the entry from MCE outbox |
|
265 // --------------------------------------------------------- |
|
266 // |
|
267 CMsvOperation* CMmsMtmUi::CopyToL( const CMsvEntrySelection& aSelection, |
|
268 TRequestStatus& aStatus ) |
|
269 { |
|
270 return CopyMoveToL( aSelection, aStatus, ETrue ); |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------- |
|
274 // CMmsMtmUi::MoveToL |
|
275 // Move local outbox entry to remote server. |
|
276 // --------------------------------------------------------- |
|
277 // |
|
278 CMsvOperation* CMmsMtmUi::MoveToL( const CMsvEntrySelection& aSelection, |
|
279 TRequestStatus& aStatus ) |
|
280 { |
|
281 return CopyMoveToL( aSelection, aStatus, EFalse ); |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------- |
|
285 // CMmsMtmUi::CopyMoveToL |
|
286 // Performs either CopyToL or MoveToL operation. |
|
287 // --------------------------------------------------------- |
|
288 // |
|
289 CMsvOperation* CMmsMtmUi::CopyMoveToL( const CMsvEntrySelection& aSelection, |
|
290 TRequestStatus& aStatus, TBool aCopyOnly ) |
|
291 { |
|
292 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
293 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iType==KUidMsvServiceEntry, Panic( EMmsNotAService ) ); |
|
294 |
|
295 // --- Carry out the operation --- |
|
296 TMsvEntry mmsService ( BaseMtm().Entry().Entry() ); |
|
297 // Get CMsvEntry of parent of messages to be sent |
|
298 CMsvEntry* parentEntry = Session().GetEntryL( aSelection[0] ); |
|
299 |
|
300 CleanupStack::PushL( parentEntry ); |
|
301 parentEntry->SetEntryL( parentEntry->Entry().Parent() ); |
|
302 |
|
303 // Do the copy/move |
|
304 CMsvOperation* op = aCopyOnly ? |
|
305 parentEntry->CopyL( aSelection, mmsService.Id(), aStatus ) : |
|
306 parentEntry->MoveL( aSelection, mmsService.Id(), aStatus ); |
|
307 |
|
308 CleanupStack::PopAndDestroy(); //parentEntry |
|
309 return op; |
|
310 } |
|
311 |
|
312 // --------------------------------------------------------- |
|
313 // CMmsMtmUi::CopyFromL |
|
314 // Could be used in fetching messages manually, but client MTM API has simple FetchL() |
|
315 // --------------------------------------------------------- |
|
316 // |
|
317 CMsvOperation* CMmsMtmUi::CopyFromL(const CMsvEntrySelection& /*aSelection*/, |
|
318 TMsvId /*aTargetId*/, |
|
319 TRequestStatus& /*aStatus*/) |
|
320 { |
|
321 User::Leave( KErrNotSupported ); |
|
322 return NULL; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------- |
|
326 // CMmsMtmUi::MoveFromL |
|
327 // Could be used in fetching messages manually, but client MTM API has simple FetchL() |
|
328 // --------------------------------------------------------- |
|
329 // |
|
330 CMsvOperation* CMmsMtmUi::MoveFromL(const CMsvEntrySelection& /*aSelection*/, |
|
331 TMsvId /*aTargetId*/, |
|
332 TRequestStatus& /*aStatus*/) |
|
333 { |
|
334 User::Leave( KErrNotSupported ); |
|
335 return NULL; |
|
336 } |
|
337 |
|
338 // --------------------------------------------------------- |
|
339 // CMmsMtmUi::OpenL |
|
340 // Handles request to open existing message server entry (message/service) |
|
341 // --------------------------------------------------------- |
|
342 // |
|
343 CMsvOperation* CMmsMtmUi::OpenL( TRequestStatus& aStatus ) |
|
344 { |
|
345 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
346 |
|
347 const TMsvEntry& entry = BaseMtm().Entry().Entry(); |
|
348 if ( entry.ReadOnly() ) |
|
349 { |
|
350 return ViewL( aStatus ); |
|
351 } |
|
352 else |
|
353 { |
|
354 return EditL( aStatus ); |
|
355 } |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------- |
|
359 // CMmsMtmUi::OpenL |
|
360 // Opens the first entry in a selection |
|
361 // --------------------------------------------------------- |
|
362 // |
|
363 CMsvOperation* CMmsMtmUi::OpenL( TRequestStatus& aStatus, |
|
364 const CMsvEntrySelection& aSelection ) |
|
365 { |
|
366 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
367 |
|
368 BaseMtm().SwitchCurrentEntryL( aSelection[0] ); |
|
369 return OpenL( aStatus ); |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------- |
|
373 // CMmsMtmUi::CloseL |
|
374 // --------------------------------------------------------- |
|
375 // |
|
376 CMsvOperation* CMmsMtmUi::CloseL( TRequestStatus& /*aStatus*/ ) |
|
377 { |
|
378 User::Leave( KErrNotSupported ); |
|
379 return NULL; |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------- |
|
383 // CMmsMtmUi::CloseL |
|
384 // --------------------------------------------------------- |
|
385 // |
|
386 CMsvOperation* CMmsMtmUi::CloseL( TRequestStatus& /*aStatus*/, |
|
387 const CMsvEntrySelection& /*aSelection*/ ) |
|
388 { |
|
389 User::Leave( KErrNotSupported ); |
|
390 return NULL; |
|
391 } |
|
392 |
|
393 // --------------------------------------------------------- |
|
394 // CMmsMtmUi::EditL |
|
395 // Opens a message (editor) or service (settings dialog) for editing. |
|
396 // --------------------------------------------------------- |
|
397 // |
|
398 CMsvOperation* CMmsMtmUi::EditL( TRequestStatus& aStatus ) |
|
399 { |
|
400 LOGTEXT(_L8("MmsMtmUi::EditL")); |
|
401 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
402 |
|
403 CMsvOperation* msvoperation = NULL; |
|
404 |
|
405 switch ( iBaseMtm.Entry().Entry().iType.iUid ) |
|
406 { |
|
407 case KUidMsvMessageEntryValue: |
|
408 { |
|
409 CMmsSettingsDialog::TMmsExitCode exitCode = |
|
410 CMmsSettingsDialog::EMmsExternalInterrupt; |
|
411 |
|
412 if ( !CheckSettingsL( exitCode ) ) |
|
413 { |
|
414 TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 ); |
|
415 //settings saved with valid access point |
|
416 if( !( exitCode==CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) ) ) |
|
417 { |
|
418 return CompleteSettingsOperationL( aStatus, exitCode ); |
|
419 } |
|
420 } |
|
421 |
|
422 if ( iBaseMtm.Entry().Entry().Connected() ) |
|
423 { |
|
424 User::Leave( KErrLocked ); |
|
425 } |
|
426 LOGTEXT( _L8( "MmsMtmUi::EditL launching editor" ) ); |
|
427 msvoperation = LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); |
|
428 } |
|
429 break; |
|
430 |
|
431 case KUidMsvServiceEntryValue: |
|
432 LOGTEXT( _L8( "MmsMtmUi::EditL - launching settings" ) ); |
|
433 msvoperation = OpenServiceSettingsDialogL( aStatus ); |
|
434 break; |
|
435 |
|
436 case KUidMsvAttachmentEntryValue: // flow through |
|
437 case KUidMsvFolderEntryValue: // flow through |
|
438 default: |
|
439 User::Leave( KErrNotSupported ); |
|
440 break; |
|
441 } |
|
442 |
|
443 return msvoperation; |
|
444 } |
|
445 |
|
446 // --------------------------------------------------------- |
|
447 // CMmsMtmUi::EditL |
|
448 // --------------------------------------------------------- |
|
449 // |
|
450 CMsvOperation* CMmsMtmUi::EditL( TRequestStatus& aStatus, |
|
451 const CMsvEntrySelection& aSelection ) |
|
452 { |
|
453 BaseMtm().SwitchCurrentEntryL( aSelection[0] ); |
|
454 return EditL( aStatus ); |
|
455 } |
|
456 |
|
457 // --------------------------------------------------------- |
|
458 // CMmsMtmUi::ViewL |
|
459 // Opens the message for reading in Viewer. |
|
460 // --------------------------------------------------------- |
|
461 // |
|
462 CMsvOperation* CMmsMtmUi::ViewL( TRequestStatus& aStatus ) |
|
463 { |
|
464 LOGTEXT( _L8( "MmsMtmUi::ViewL" ) ); |
|
465 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm == Type(), Panic( EMmsWrongMtm ) ); |
|
466 |
|
467 CMsvOperation* msvoperation = NULL; |
|
468 |
|
469 switch ( iBaseMtm.Entry().Entry().iType.iUid ) |
|
470 { |
|
471 case KUidMsvMessageEntryValue: |
|
472 // It's a multimedia message |
|
473 if ( iBaseMtm.Entry().Entry().Connected() ) |
|
474 { |
|
475 User::Leave( KErrLocked ); |
|
476 } |
|
477 // Open Viewer |
|
478 LOGTEXT( _L8( "MmsMtmUi::ViewL - launching Viewer" ) ); |
|
479 msvoperation = LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session(), EReadOnly ); |
|
480 break; |
|
481 case KUidMsvServiceEntryValue: |
|
482 case KUidMsvAttachmentEntryValue: |
|
483 case KUidMsvFolderEntryValue: |
|
484 default: |
|
485 User::Leave( KErrNotSupported ); |
|
486 break; |
|
487 } |
|
488 return msvoperation; |
|
489 } |
|
490 |
|
491 // --------------------------------------------------------- |
|
492 // CMmsMtmUi::ViewL |
|
493 // --------------------------------------------------------- |
|
494 // |
|
495 CMsvOperation* CMmsMtmUi::ViewL( TRequestStatus& aStatus, |
|
496 const CMsvEntrySelection& aSelection ) |
|
497 { |
|
498 __ASSERT_DEBUG( iBaseMtm.Entry().Entry().iMtm == Type(), Panic( EMmsWrongMtm ) ); |
|
499 BaseMtm().SwitchCurrentEntryL( aSelection[0] ); |
|
500 return ViewL( aStatus ); |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CMmsMtmUi::LaunchEditorApplicationL() |
|
505 // Does the actual opening. |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 CMsvOperation* CMmsMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, |
|
509 CMsvSession& aSession, |
|
510 TEditorType aEditorType ) |
|
511 { |
|
512 |
|
513 TEditorParameters temp; |
|
514 |
|
515 if ( iBaseMtm.HasContext() ) |
|
516 { |
|
517 temp.iId = iBaseMtm.Entry().EntryId(); |
|
518 // Changes for the cr # 401-1806 |
|
519 if( FeatureManager::FeatureSupported( KFeatureIdMmsPostcard ) && IsPostcard( iBaseMtm.Entry().Entry() ) ) |
|
520 { |
|
521 aEditorType = ESpecialEditor; |
|
522 } |
|
523 |
|
524 else if( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) && IsAudioMessage( iBaseMtm.Entry().Entry() ) ) |
|
525 { |
|
526 if( aEditorType == EReadOnly ) |
|
527 { |
|
528 aEditorType = EReadOnlyAudioMessage; |
|
529 } |
|
530 else |
|
531 { |
|
532 aEditorType = ECreateNewAudioMessage; |
|
533 } |
|
534 } |
|
535 } |
|
536 |
|
537 switch( aEditorType ) |
|
538 { |
|
539 case EReadOnly: |
|
540 temp.iFlags|=EMsgReadOnly; |
|
541 break; |
|
542 case ECreateNewMessage: |
|
543 temp.iFlags|=EMsgCreateNewMessage ; |
|
544 temp.iId=KMsvDraftEntryIdValue; |
|
545 //appName already correct |
|
546 break; |
|
547 |
|
548 case ESpecialEditor: |
|
549 { |
|
550 temp.iSpecialAppId = TUid::Uid(KMmsPostcardAppId); |
|
551 } |
|
552 break; |
|
553 case ECreateNewAudioMessage: |
|
554 { |
|
555 temp.iSpecialAppId = TUid::Uid( KAmsAppId ); |
|
556 } |
|
557 break; |
|
558 case EReadOnlyAudioMessage: |
|
559 { |
|
560 temp.iSpecialAppId = TUid::Uid( KAmsAppId ); |
|
561 temp.iFlags|=EMsgReadOnly; |
|
562 break; |
|
563 } |
|
564 case EEditExisting: //fall through |
|
565 //appName already correct |
|
566 default: |
|
567 break; |
|
568 }; |
|
569 |
|
570 temp.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded|EMtmUiFlagEditorNoWaitForExit ); |
|
571 |
|
572 temp.iFlags |= ( Preferences() & EMtmUiFlagEditorPreferEmbedded?EMsgLaunchEditorEmbedded:0 ); |
|
573 |
|
574 TPckgC<TEditorParameters> paramPack( temp ); |
|
575 |
|
576 LOGTEXT( _L8( "Just before calling MsgEditorLauncher" ) ); |
|
577 return MsgEditorLauncher::LaunchEditorApplicationL( aSession, Type(), aStatus, temp, KNullDesC( ), paramPack ); |
|
578 } |
|
579 |
|
580 // --------------------------------------------------------- |
|
581 // CMmsMtmUi::ForwardL |
|
582 // --------------------------------------------------------- |
|
583 // |
|
584 CMsvOperation* CMmsMtmUi::ForwardL( TMsvId aDestination, |
|
585 TMsvPartList aPartList, |
|
586 TRequestStatus& aCompletionStatus ) |
|
587 { |
|
588 TEditorParameters editorParams; |
|
589 editorParams.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded | EMtmUiFlagEditorNoWaitForExit ); |
|
590 |
|
591 editorParams.iFlags |= ( ( Preferences() & EMtmUiFlagEditorPreferEmbedded ) ? EMsgLaunchEditorEmbedded : 0 ); |
|
592 editorParams.iDestinationFolderId = aDestination; |
|
593 editorParams.iPartList = aPartList; |
|
594 |
|
595 editorParams.iFlags |= EMsgForwardMessage; |
|
596 editorParams.iId=BaseMtm().Entry().EntryId(); |
|
597 // Changes for the cr # 401-1806 |
|
598 if( FeatureManager::FeatureSupported( KFeatureIdMmsPostcard ) && IsPostcard( iBaseMtm.Entry().Entry() ) ) |
|
599 { |
|
600 editorParams.iSpecialAppId = TUid::Uid(KMmsPostcardAppId); |
|
601 } |
|
602 |
|
603 //we need to check access points here |
|
604 CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt; |
|
605 if ( !CheckSettingsL( exitCode ) ) |
|
606 { |
|
607 TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 ); |
|
608 if( exitCode == CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) ) |
|
609 { |
|
610 LOGTEXT( _L8( "MmsMtmUi::ForwardL launching editor" ) ); |
|
611 return MsgEditorLauncher::LaunchEditorApplicationL( Session(), |
|
612 Type(), |
|
613 aCompletionStatus, |
|
614 editorParams, |
|
615 KNullDesC( ) ); |
|
616 } |
|
617 else//user selects exit and settings not saved |
|
618 { |
|
619 return CompleteSettingsOperationL( aCompletionStatus, exitCode ); |
|
620 } |
|
621 }//if |
|
622 |
|
623 LOGTEXT( _L8( "MmsMtmUi::ForwardL launching editor" ) ); |
|
624 return MsgEditorLauncher::LaunchEditorApplicationL( Session(), |
|
625 Type(), |
|
626 aCompletionStatus, |
|
627 editorParams, |
|
628 KNullDesC( ) ); |
|
629 } |
|
630 |
|
631 |
|
632 // --------------------------------------------------------- |
|
633 // CMmsMtmUi::UploadL |
|
634 // --------------------------------------------------------- |
|
635 // |
|
636 CMsvOperation* CMmsMtmUi::UploadL( |
|
637 const CMsvEntrySelection& aSelection, |
|
638 TRequestStatus& aCompletionStatus, |
|
639 TDes8& aParameter ) |
|
640 { |
|
641 // Unpack parameters: |
|
642 TPckgBuf<TMsgUploadParameters> inputParamPack; |
|
643 inputParamPack.Copy( aParameter.Ptr(), sizeof( TMsgUploadParameters ) ); |
|
644 TMsgUploadParameters& uploadParam = inputParamPack(); |
|
645 |
|
646 // Create the message by utilizing ClientMTM's Forward operation: |
|
647 TMsvPartList parts = |
|
648 KMsvMessagePartBody | |
|
649 KMsvMessagePartDescription | |
|
650 KMsvMessagePartAttachments; |
|
651 |
|
652 if ( aSelection.Count() ) |
|
653 { |
|
654 iMmsClient.SwitchCurrentEntryL( aSelection.At( 0 ) ); |
|
655 iMmsClient.LoadMessageL(); |
|
656 } |
|
657 |
|
658 TMsvId currentEntryId = iMmsClient.Entry().EntryId(); |
|
659 |
|
660 if ( !UploadDRMChecksL() ) |
|
661 { |
|
662 return CMsvCompletedOperation::NewL( Session(), |
|
663 KUidMsvLocalServiceMtm, |
|
664 KNullDesC8, |
|
665 KMsvLocalServiceIndexEntryId, |
|
666 aCompletionStatus ); |
|
667 } |
|
668 |
|
669 CMuiuOperationWait* wait = |
|
670 CMuiuOperationWait::NewLC( EActivePriorityWsEvents + 10 ); |
|
671 CMsvOperation* oper = iMmsClient.ForwardL( KMsvDraftEntryIdValue, parts, wait->iStatus ); |
|
672 CleanupStack::PushL( oper ); |
|
673 wait->Start(); |
|
674 TMsvId temp; |
|
675 TPckgC<TMsvId> paramPack( temp ); |
|
676 const TDesC8& progress = oper->FinalProgress(); |
|
677 paramPack.Set( progress ); |
|
678 TMsvId id = paramPack(); |
|
679 CleanupStack::PopAndDestroy( 2 ); // wait, oper |
|
680 |
|
681 // Set the recipient |
|
682 CMsvEntry* cEntry = Session().GetEntryL( id ); |
|
683 CleanupStack::PushL( cEntry ); |
|
684 iMmsClient.SetCurrentEntryL( cEntry ); |
|
685 CleanupStack::Pop( cEntry ); // ownership transferred |
|
686 iMmsClient.AddAddresseeL( uploadParam.iRealAddress, uploadParam.iAlias ); |
|
687 iMmsClient.SaveMessageL(); |
|
688 |
|
689 TMmsMsvEntry tEntry = static_cast<TMmsMsvEntry>( cEntry->Entry() ); |
|
690 tEntry.iBioType = KUidMsgSubTypeMmsUpload.iUid; |
|
691 tEntry.iDetails.Set( uploadParam.iAlias ); |
|
692 tEntry.SetInPreparation( !uploadParam.iDirect ); |
|
693 tEntry.SetForwardedMessage( ETrue ); |
|
694 cEntry->ChangeL( tEntry ); |
|
695 |
|
696 CMsvOperation* result = uploadParam.iDirect |
|
697 ? iMmsClient.SendL( aCompletionStatus ) |
|
698 : EditL( aCompletionStatus ); |
|
699 |
|
700 iMmsClient.SwitchCurrentEntryL( currentEntryId ); |
|
701 |
|
702 return result; |
|
703 } |
|
704 |
|
705 // --------------------------------------------------------- |
|
706 // CMmsMtmUi::UploadDRMChecksL |
|
707 // --------------------------------------------------------- |
|
708 // |
|
709 TBool CMmsMtmUi::UploadDRMChecksL() |
|
710 { |
|
711 CFileProtectionResolver* resolver = CFileProtectionResolver::NewLC( Session().FileSession() ); |
|
712 |
|
713 CMsvStore* store = iMmsClient.Entry().ReadStoreL(); |
|
714 CleanupStack::PushL( store ); |
|
715 MMsvAttachmentManager& attaManager = store->AttachmentManagerL(); |
|
716 |
|
717 TInt attaCount = attaManager.AttachmentCount(); |
|
718 TInt flCount = 0; |
|
719 TInt sdCount = 0; |
|
720 |
|
721 for ( TInt i = 0; i < attaCount; i++ ) |
|
722 { |
|
723 CMsvAttachment* info = attaManager.GetAttachmentInfoL( i ); |
|
724 CleanupStack::PushL( info ); |
|
725 TDataType dataType( info->MimeType() ); |
|
726 |
|
727 RFile file = attaManager.GetAttachmentFileL( info->Id() ); |
|
728 CleanupClosePushL( file ); |
|
729 |
|
730 TInt status = resolver->ProtectionStatusL( file, dataType ); |
|
731 if ( status & EFileProtForwardLocked || |
|
732 status & EFileProtClosedContent ) |
|
733 { |
|
734 flCount++; |
|
735 } |
|
736 else if ( status & EFileProtSuperDistributable ) |
|
737 { |
|
738 sdCount++; |
|
739 } |
|
740 |
|
741 CleanupStack::PopAndDestroy( 2, info ); // file, info |
|
742 } |
|
743 |
|
744 CleanupStack::PopAndDestroy( 2, resolver ); //store, resolver |
|
745 |
|
746 if ( flCount ) |
|
747 { |
|
748 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
749 HBufC* string = StringLoader::LoadLC( R_MMS_CANNOT_FW_DRM ); |
|
750 note->ExecuteLD( *string ); |
|
751 CleanupStack::PopAndDestroy( string ); |
|
752 return EFalse; |
|
753 } |
|
754 if ( sdCount ) |
|
755 { |
|
756 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
757 HBufC* string = StringLoader::LoadLC( sdCount == attaCount |
|
758 ? R_MMS_SEND_WO_RIGHTS |
|
759 : R_MMS_SEND_WO_RIGHTS_MIX ); |
|
760 TInt retVal = dlg->ExecuteLD( R_MMS_CONFIRMATION_QUERY, *string ); |
|
761 CleanupStack::PopAndDestroy( string ); |
|
762 return retVal; |
|
763 } |
|
764 return ETrue; |
|
765 } |
|
766 |
|
767 |
|
768 // --------------------------------------------------------- |
|
769 // CMmsMtmUi::ReplyL |
|
770 // --------------------------------------------------------- |
|
771 // |
|
772 CMsvOperation* CMmsMtmUi::ReplyL( TMsvId aDestination, |
|
773 TMsvPartList aPartList, |
|
774 TRequestStatus& aCompletionStatus ) |
|
775 { |
|
776 TEditorParameters editorParams; |
|
777 editorParams.iFlags |= EMsgReplyToMessageSender; |
|
778 editorParams.iId = BaseMtm().Entry().EntryId(); |
|
779 editorParams.iDestinationFolderId = aDestination; |
|
780 editorParams.iPartList = aPartList; |
|
781 editorParams.iFlags &= ~( EMtmUiFlagEditorPreferEmbedded | EMtmUiFlagEditorNoWaitForExit ); |
|
782 |
|
783 editorParams.iFlags |= ( ( Preferences() & EMtmUiFlagEditorPreferEmbedded ) ? EMsgLaunchEditorEmbedded : 0 ); |
|
784 |
|
785 // Changes for the cr # 401-1806 |
|
786 if ( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) ) |
|
787 { |
|
788 if( IsAudioMessage( iBaseMtm.Entry().Entry() ) ) |
|
789 { |
|
790 editorParams.iSpecialAppId = TUid::Uid( KAmsAppId ); |
|
791 } |
|
792 } |
|
793 |
|
794 //we need to check access points here |
|
795 CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt; |
|
796 if ( !CheckSettingsL( exitCode ) ) |
|
797 { |
|
798 TInt32 ap = iSettingsHandler->MmsSettings()->AccessPoint( 0 ); |
|
799 if( exitCode == CMmsSettingsDialog::EMmsBack && ApExistsL( ap ) ) |
|
800 { |
|
801 LOGTEXT( _L8( "MmsMtmUi::ReplyL launching editor" ) ); |
|
802 return MsgEditorLauncher::LaunchEditorApplicationL( Session(), |
|
803 Type(), |
|
804 aCompletionStatus, |
|
805 editorParams, |
|
806 KNullDesC( ) ); |
|
807 } |
|
808 else//user selects exit and settings not saved |
|
809 { |
|
810 return CompleteSettingsOperationL( aCompletionStatus, exitCode ); |
|
811 } |
|
812 } |
|
813 |
|
814 //Setting the entry always to read as done for sms |
|
815 if ( BaseMtm().Entry().Entry().Unread() ) |
|
816 { |
|
817 CMsvEntry* cEntry; |
|
818 cEntry = &(BaseMtm().Entry()); |
|
819 TMsvEntry entry = cEntry->Entry(); |
|
820 entry.SetUnread( EFalse ); |
|
821 cEntry->ChangeL( entry ); |
|
822 } |
|
823 |
|
824 LOGTEXT( _L8( "MmsMtmUi::ReplyL launching editor" ) ); |
|
825 return MsgEditorLauncher::LaunchEditorApplicationL( Session(), |
|
826 Type(), |
|
827 aCompletionStatus, |
|
828 editorParams, |
|
829 KNullDesC( ) ); |
|
830 } |
|
831 |
|
832 // --------------------------------------------------------- |
|
833 // CMmsMtmUi::CancelL |
|
834 // Suspends sending of the selected messages (if possible) |
|
835 // --------------------------------------------------------- |
|
836 // |
|
837 CMsvOperation* CMmsMtmUi::CancelL( TRequestStatus& aStatus, |
|
838 const CMsvEntrySelection& aSelection ) |
|
839 { |
|
840 TInt count = aSelection.Count(); |
|
841 __ASSERT_DEBUG( count, Panic( EMmsWrongParameters ) ); |
|
842 |
|
843 CMsvEntry* entry = Session().GetEntryL( aSelection[0] ); |
|
844 CleanupStack::PushL( entry ); |
|
845 |
|
846 while ( count-- ) |
|
847 { |
|
848 entry->SetEntryL( aSelection[count] ); |
|
849 TMsvEntry tempEntry = entry->Entry(); |
|
850 tempEntry.SetSendingState( KMsvSendStateSuspended ); |
|
851 |
|
852 tempEntry.iDate.UniversalTime(); |
|
853 |
|
854 entry->ChangeL( tempEntry ); |
|
855 } |
|
856 |
|
857 CleanupStack::PopAndDestroy(); // entry |
|
858 |
|
859 TBuf8<1> dummyParams; |
|
860 dummyParams.Zero(); |
|
861 return CBaseMtmUi::InvokeAsyncFunctionL( EMmsDeleteSchedule, aSelection, aStatus, dummyParams ); |
|
862 } |
|
863 |
|
864 // --------------------------------------------------------- |
|
865 // CMmsMtmUi::InvokeSyncFunctionL |
|
866 // --------------------------------------------------------- |
|
867 // |
|
868 void CMmsMtmUi::InvokeSyncFunctionL( TInt aFunctionId, |
|
869 const CMsvEntrySelection& aSelection, |
|
870 TDes8& aParameter ) |
|
871 { |
|
872 switch ( aFunctionId ) |
|
873 { |
|
874 case KMtmUiMessagingInitialisation: |
|
875 CreateDefaultSettingsL(); |
|
876 break; |
|
877 case KMtmUiFunctionRestoreFactorySettings: |
|
878 HandleFactorySettingsL( aParameter ); |
|
879 break; |
|
880 case KMtmUiFunctionValidateService: |
|
881 { |
|
882 //TMsvId serviceId = iMmsClient.DefaultSettingsL(); |
|
883 //TInt error = iMmsClient.ValidateService( serviceId ); |
|
884 iSettingsHandler->RefreshSettingsL( ); |
|
885 TInt error = iSettingsHandler->MmsSettings()->ValidateSettings(); |
|
886 // return the result via aParameter as a TInt packaged into a TDes8 |
|
887 TPckgBuf<TInt> resultPackage( error ); |
|
888 aParameter.Copy( resultPackage ); |
|
889 } |
|
890 break; |
|
891 default: |
|
892 CBaseMtmUi::InvokeSyncFunctionL( aFunctionId, aSelection, aParameter ); |
|
893 break; |
|
894 } |
|
895 |
|
896 } |
|
897 |
|
898 // --------------------------------------------------------- |
|
899 // CMmsMtmUi::InvokeAsyncFunctionL |
|
900 // --------------------------------------------------------- |
|
901 // |
|
902 CMsvOperation* CMmsMtmUi::InvokeAsyncFunctionL( TInt aFunctionId, |
|
903 const CMsvEntrySelection& aSelection, |
|
904 TRequestStatus& aCompletionStatus, |
|
905 TDes8& aParameter ) |
|
906 { |
|
907 CMsvOperation* msvoperation = NULL; |
|
908 |
|
909 switch ( aFunctionId ) |
|
910 { |
|
911 case KMtmUiFunctionDeliveryStatus: |
|
912 msvoperation = OpenDeliveryPopupL( aCompletionStatus, aParameter ); |
|
913 break; |
|
914 case KMtmUiFunctionMessageInfo: |
|
915 msvoperation = OpenMessageInfoL( aCompletionStatus ); |
|
916 break; |
|
917 case KMtmUiFunctionUpload: |
|
918 msvoperation = UploadL( aSelection, aCompletionStatus, aParameter ); |
|
919 break; |
|
920 default: |
|
921 msvoperation = CBaseMtmUi::InvokeAsyncFunctionL( aFunctionId, |
|
922 aSelection, |
|
923 aCompletionStatus, |
|
924 aParameter); |
|
925 break; |
|
926 } |
|
927 return msvoperation; |
|
928 } |
|
929 |
|
930 // --------------------------------------------------------- |
|
931 // CMmsMtmUi::DisplayProgressSummary |
|
932 // --------------------------------------------------------- |
|
933 // |
|
934 TInt CMmsMtmUi::DisplayProgressSummary( const TDesC8& /* aProgress */ ) const |
|
935 { |
|
936 // This does nothing, because MsgErrorWatcher shows all MMS error messages. |
|
937 // Furthermore currently MMS engine does not return any sensible progress to report. |
|
938 return KErrNone; |
|
939 } |
|
940 |
|
941 // --------------------------------------------------------- |
|
942 // CMmsMtmUi::GetResourceFileName |
|
943 // --------------------------------------------------------- |
|
944 // |
|
945 void CMmsMtmUi::GetResourceFileName( TFileName& aFileName ) const |
|
946 { |
|
947 aFileName = KMmsMtmResourceFile; |
|
948 } |
|
949 |
|
950 // --------------------------------------------------------- |
|
951 // CMmsMtmUi::CreateDefaultSettingsL |
|
952 // --------------------------------------------------------- |
|
953 // |
|
954 void CMmsMtmUi::CreateDefaultSettingsL() |
|
955 { |
|
956 // done in engine by FactorySettings |
|
957 } |
|
958 |
|
959 // --------------------------------------------------------- |
|
960 // CMmsMtmUi::HandleFactorySettingsL |
|
961 // Reset Factory Settings support |
|
962 // --------------------------------------------------------- |
|
963 void CMmsMtmUi::HandleFactorySettingsL( TDes8& aLevel ) |
|
964 { |
|
965 iSettingsHandler->HandleFactorySettingsL( aLevel ); |
|
966 } |
|
967 |
|
968 |
|
969 // --------------------------------------------------------- |
|
970 // CMsvOperation* CMmsMtmUi::OpenServiceSettingsDialogL(TRequestStatus& aCompletionStatus) |
|
971 // Handles MMS service settings |
|
972 // --------------------------------------------------------- |
|
973 // |
|
974 CMsvOperation* CMmsMtmUi::OpenServiceSettingsDialogL( TRequestStatus& aCompletionStatus ) |
|
975 { |
|
976 iSettingsHandler->RefreshSettingsL( ); |
|
977 return iSettingsHandler->OpenServiceSettingsDialogL( aCompletionStatus ); |
|
978 } |
|
979 |
|
980 // --------------------------------------------------------- |
|
981 // CMsvOperation* CMmsMtmUi::CompleteSettingsOperationL( |
|
982 // TRequestStatus& aCompletionStatus, const CMmsSettingsDialog::TMmsExitCode& aExitCode) |
|
983 // Creates completed operation after settings dialog closing with appropriate parameters. |
|
984 // --------------------------------------------------------- |
|
985 // |
|
986 CMsvOperation* CMmsMtmUi::CompleteSettingsOperationL( |
|
987 TRequestStatus& aCompletionStatus, |
|
988 const CMmsSettingsDialog::TMmsExitCode& aExitCode /* = CMmsSettingsDialog::EMmsExternalInterrupt */ ) |
|
989 { |
|
990 return iSettingsHandler->CompleteSettingsOperationL( |
|
991 aCompletionStatus, |
|
992 aExitCode ); |
|
993 } |
|
994 |
|
995 // --------------------------------------------------------- |
|
996 // TInt CMmsMtmUi::LaunchSettingsDialogL( |
|
997 // CMmsSettingsDialog::TMmsExitCode& aExitCode ) |
|
998 // Opens either MMS Service Settings or MMS Sending Settings dialog. |
|
999 // --------------------------------------------------------- |
|
1000 // |
|
1001 void CMmsMtmUi::LaunchSettingsDialogL( |
|
1002 CMmsSettingsDialog::TMmsExitCode& aExitCode ) const |
|
1003 { |
|
1004 iSettingsHandler->LaunchSettingsDialogL( aExitCode ); |
|
1005 } |
|
1006 |
|
1007 // --------------------------------------------------------- |
|
1008 // CMmsMtmUi::OpenMessageInfoL(TRequestStatus& aCompletionStatus, TDes8& aParameter) |
|
1009 // Opens the Message Info popup. |
|
1010 // --------------------------------------------------------- |
|
1011 // |
|
1012 CMsvOperation* CMmsMtmUi::OpenMessageInfoL( TRequestStatus& aCompletionStatus ) |
|
1013 { |
|
1014 LOGTEXT( _L8( "MmsMtmUi OpenMessageInfo start" ) ); |
|
1015 // Changes for the cr # 401-1806 |
|
1016 if( FeatureManager::FeatureSupported( KFeatureIdMmsPostcard ) && IsPostcard( BaseMtm( ).Entry( ).Entry( ) ) ) |
|
1017 { |
|
1018 return OpenPostcardInfoL( aCompletionStatus ); |
|
1019 } |
|
1020 TInt popCount( 0 ); |
|
1021 |
|
1022 // get additional headers variation info |
|
1023 TInt addHeadersBitmask = 0; |
|
1024 |
|
1025 CRepository* repository = CRepository::NewL( KCRUidMuiuVariation ); |
|
1026 repository->Get( KMuiuMmsFeatures, addHeadersBitmask ); |
|
1027 delete repository; |
|
1028 |
|
1029 // MMS Priority feature is enabled |
|
1030 if ( addHeadersBitmask & KMmsFeatureIdPrioritySupport ) |
|
1031 { |
|
1032 iPriorityFeatureSupported = ETrue; |
|
1033 } |
|
1034 |
|
1035 // reminder of bit flags: |
|
1036 // addHeadersBitmask & KMmsFeatureIdEditorSubjectField |
|
1037 // addHeadersBitmask & KMmsFeatureIdEditorCcField |
|
1038 // addHeadersBitmask & KMmsFeatureIdEditorBccField |
|
1039 |
|
1040 |
|
1041 // The items for Info are read from the message entry. |
|
1042 // Note: Most of the stuff is in TMsvEntry, but not all -> MMS entry used all the way. |
|
1043 TMmsMsvEntry entry = static_cast<TMmsMsvEntry>( BaseMtm().Entry().Entry() ); |
|
1044 __ASSERT_DEBUG( entry.iType==KUidMsvMessageEntry, Panic( EMmsNotAMessage ) ); |
|
1045 __ASSERT_DEBUG( entry.iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
1046 |
|
1047 iMmsClient.LoadMessageL(); |
|
1048 |
|
1049 TMsgInfoMessageInfoData infoData; |
|
1050 |
|
1051 // From - show only for received messages |
|
1052 if ( entry.IsMobileTerminated() ) |
|
1053 { |
|
1054 HBufC* senderNumber = iMmsClient.Sender().AllocLC(); |
|
1055 popCount++; |
|
1056 // Additional space for chars: '<' '>' ',' + 2 x KMmsLRMarker |
|
1057 HBufC* fromText = HBufC::NewLC( entry.iDetails.Length() + senderNumber->Length() + KMmsAdditionalCharsStringLength ); |
|
1058 popCount++; |
|
1059 |
|
1060 // Do we have alias? |
|
1061 if ( senderNumber->Compare( entry.iDetails ) ) |
|
1062 { // yes |
|
1063 TPtr fromTextPtr = fromText->Des(); |
|
1064 fromTextPtr.Append( entry.iDetails ); |
|
1065 fromTextPtr.Append( KMmsCharSpace ); |
|
1066 fromTextPtr.Append( KMmsLRMarker ); |
|
1067 fromTextPtr.Append( KCharLeftAddressIterator ); |
|
1068 fromTextPtr.Append( TMmsGenUtils::PureAddress( senderNumber->Des( ) ) ); |
|
1069 fromTextPtr.Append( KCharRightAddressIterator ); |
|
1070 fromTextPtr.Append( KMmsLRMarker ); |
|
1071 infoData.iFrom.Set( *fromText ); |
|
1072 } |
|
1073 else |
|
1074 { // no |
|
1075 infoData.iFrom.Set( *senderNumber ); |
|
1076 } |
|
1077 } |
|
1078 |
|
1079 // always shown for MT messages, for MO messages only if variated On |
|
1080 if ( entry.IsMobileTerminated() |
|
1081 || addHeadersBitmask & KMmsFeatureIdEditorSubjectField ) |
|
1082 { |
|
1083 infoData.iSubject.Set( iMmsClient.SubjectL() ); |
|
1084 } |
|
1085 |
|
1086 // Supply UTC date-time to message info |
|
1087 infoData.iDateTime = entry.iDate; |
|
1088 // Changes for the cr # 401-1806 |
|
1089 if( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) && IsAudioMessage( BaseMtm( ).Entry( ).Entry( ) ) ) |
|
1090 { |
|
1091 HBufC* msgType = StringLoader::LoadLC( R_AUDIOMESSAGE_TYPE_TEXT, iCoeEnv ); |
|
1092 popCount++; |
|
1093 infoData.iType.Set( msgType->Des() ); |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 // Type of message -taken directly from resources as this must be a multimedia message |
|
1098 HBufC* msgType = StringLoader::LoadLC( R_MMS_TYPE_TEXT, iCoeEnv ); |
|
1099 popCount++; |
|
1100 infoData.iType.Set( msgType->Des() ); |
|
1101 } |
|
1102 |
|
1103 ////// Priority of message ///////////////////////////////////// |
|
1104 // Editor view and Priority feature supported |
|
1105 if ( !(entry.IsMobileTerminated()) && iPriorityFeatureSupported ) |
|
1106 { |
|
1107 HBufC* priority = NULL; |
|
1108 switch ( iMmsClient.MessagePriority() ) |
|
1109 { |
|
1110 case EMmsPriorityHigh: |
|
1111 { |
|
1112 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_HIGH, iCoeEnv ); |
|
1113 popCount++; |
|
1114 break; |
|
1115 } |
|
1116 case EMmsPriorityLow: |
|
1117 { |
|
1118 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_LOW, iCoeEnv ); |
|
1119 popCount++; |
|
1120 break; |
|
1121 } |
|
1122 case EMmsPriorityNormal: |
|
1123 default: |
|
1124 { |
|
1125 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_NORMAL, iCoeEnv ); |
|
1126 popCount++; |
|
1127 break; |
|
1128 } |
|
1129 } |
|
1130 infoData.iPriority.Set( *priority ); |
|
1131 } |
|
1132 else if ( entry.IsMobileTerminated() ) // Viewer View |
|
1133 { |
|
1134 HBufC* priority = NULL; |
|
1135 switch ( iMmsClient.MessagePriority() ) |
|
1136 { |
|
1137 case EMmsPriorityHigh: |
|
1138 { |
|
1139 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_HIGH, iCoeEnv ); |
|
1140 popCount++; |
|
1141 break; |
|
1142 } |
|
1143 case EMmsPriorityLow: |
|
1144 { |
|
1145 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_LOW, iCoeEnv ); |
|
1146 popCount++; |
|
1147 break; |
|
1148 } |
|
1149 case EMmsPriorityNormal: |
|
1150 default: |
|
1151 { |
|
1152 priority = StringLoader::LoadLC( R_MMS_MESSAGE_PRIORITY_NORMAL, iCoeEnv ); |
|
1153 popCount++; |
|
1154 break; |
|
1155 } |
|
1156 } |
|
1157 infoData.iPriority.Set( *priority ); |
|
1158 } |
|
1159 |
|
1160 // Size of message. |
|
1161 TInt sizeOfMessage = MessageSizeL(); |
|
1162 |
|
1163 // Finally make the UI string |
|
1164 TBuf<KMessageSize> sizeString; |
|
1165 MessageSizeToStringL( sizeString, sizeOfMessage ); |
|
1166 infoData.iSize.Set( sizeString ); |
|
1167 |
|
1168 // To |
|
1169 const CMsvRecipientList& recipients = iMmsClient.AddresseeList(); |
|
1170 HBufC* toList( NULL ); |
|
1171 HBufC* ccList( NULL ); |
|
1172 HBufC* bccList( NULL ); |
|
1173 TurnRecipientsArrayIntoStringsLC( |
|
1174 recipients, |
|
1175 toList, |
|
1176 ccList, |
|
1177 bccList, |
|
1178 addHeadersBitmask, |
|
1179 entry.IsMobileTerminated() ); |
|
1180 if ( toList ) |
|
1181 { |
|
1182 infoData.iTo.Set( *toList ); |
|
1183 popCount++; |
|
1184 } |
|
1185 if ( ccList ) |
|
1186 { |
|
1187 infoData.iCC.Set( *ccList ); |
|
1188 popCount++; |
|
1189 } |
|
1190 if ( bccList ) |
|
1191 { |
|
1192 infoData.iBCC.Set( *bccList ); |
|
1193 popCount++; |
|
1194 } |
|
1195 |
|
1196 CMsgInfoMessageInfoDialog* infoDialog = CMsgInfoMessageInfoDialog::NewL(); |
|
1197 if ( entry.IsMobileTerminated() ) |
|
1198 { |
|
1199 infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsViewer ); |
|
1200 } |
|
1201 else |
|
1202 { |
|
1203 infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsEditor ); |
|
1204 } |
|
1205 |
|
1206 CleanupStack::PopAndDestroy( popCount ); |
|
1207 |
|
1208 return CMsvCompletedOperation::NewL( Session(), |
|
1209 KUidMsvLocalServiceMtm, |
|
1210 KNullDesC8, |
|
1211 KMsvLocalServiceIndexEntryId, |
|
1212 aCompletionStatus ); |
|
1213 } |
|
1214 |
|
1215 // --------------------------------------------------------- |
|
1216 // CMmsMtmUi::TurnRecipientsArrayIntoStringsLC |
|
1217 // |
|
1218 // --------------------------------------------------------- |
|
1219 // every created recipient buffer object increases pushed object count by one |
|
1220 void CMmsMtmUi::TurnRecipientsArrayIntoStringsLC( |
|
1221 const CMsvRecipientList& aRecip, |
|
1222 HBufC*& aTo, |
|
1223 HBufC*& aCc, |
|
1224 HBufC*& aBcc, |
|
1225 TInt aAddHeadersVariation, |
|
1226 TBool aMobileTerminated ) const |
|
1227 { |
|
1228 TInt count = aRecip.Count(); |
|
1229 if ( count == 0 ) |
|
1230 { |
|
1231 return; |
|
1232 } |
|
1233 |
|
1234 TMmsMsvEntry entry = static_cast<TMmsMsvEntry>( BaseMtm().Entry().Entry() ); |
|
1235 TBool showNumber = CMmsMtmUi::IsUpload( entry ) |
|
1236 ? EFalse |
|
1237 : ETrue; |
|
1238 |
|
1239 // indeces refers To, Cc, Bcc |
|
1240 TInt recipTypesIndex( 0 ); |
|
1241 const TInt KRecipTypesCount( 3 ); |
|
1242 |
|
1243 TMsvRecipientTypeValues recipType ( EMsvRecipientTo ); |
|
1244 |
|
1245 // needs first round to check what is there |
|
1246 TInt index; |
|
1247 TInt stringLengthTo = 0; |
|
1248 TInt stringLengthCc = 0; |
|
1249 TInt stringLengthBcc = 0; |
|
1250 TInt* stringLength = &stringLengthTo; |
|
1251 for ( recipTypesIndex = 0; recipTypesIndex < KRecipTypesCount; recipTypesIndex++ ) |
|
1252 { |
|
1253 if ( recipTypesIndex == 1 ) |
|
1254 { |
|
1255 stringLength = &stringLengthCc; |
|
1256 recipType = EMsvRecipientCc; |
|
1257 } |
|
1258 else if ( recipTypesIndex == 2 ) |
|
1259 { |
|
1260 stringLength = &stringLengthBcc; |
|
1261 recipType = EMsvRecipientBcc; |
|
1262 } |
|
1263 |
|
1264 for ( index = 0; index < count; index++ ) |
|
1265 { |
|
1266 if ( aRecip.Type( index ) == recipType ) |
|
1267 { |
|
1268 ( *stringLength ) += TMmsGenUtils::Alias( aRecip[index] ).Length(); |
|
1269 ( *stringLength ) += TMmsGenUtils::PureAddress( aRecip[index] ).Length(); |
|
1270 // Additional space for chars: '<' '>' ',' + 2 x KMmsLRMarker |
|
1271 ( *stringLength ) += KMmsAdditionalCharsStringLength; |
|
1272 } |
|
1273 } |
|
1274 } |
|
1275 |
|
1276 if ( stringLengthTo |
|
1277 || stringLengthCc |
|
1278 || stringLengthBcc ) |
|
1279 { |
|
1280 // needs second round to copy strigs: |
|
1281 // if CC not variated On, append CC recipients to To: field |
|
1282 // if BCC not variated On but CC variated On, append BCC recipients to Cc: field |
|
1283 // if BCC not variated On and also CC variated Off, append BCC recipients to To: field |
|
1284 HBufC** recipients = NULL; |
|
1285 recipType = EMsvRecipientTo; |
|
1286 TInt bufLength( stringLengthTo ); |
|
1287 for ( recipTypesIndex = 0; recipTypesIndex < KRecipTypesCount; recipTypesIndex++ ) |
|
1288 { |
|
1289 recipients = NULL; |
|
1290 if ( recipTypesIndex == 0 ) |
|
1291 { |
|
1292 if ( ! ( aAddHeadersVariation & KMmsFeatureIdEditorCcField ) ) |
|
1293 { |
|
1294 // CC not supported on the UI |
|
1295 bufLength += stringLengthCc; |
|
1296 if ( ! ( aAddHeadersVariation & KMmsFeatureIdEditorBccField ) ) |
|
1297 { |
|
1298 // BCC not supported on the UI |
|
1299 bufLength += stringLengthBcc; |
|
1300 } |
|
1301 } |
|
1302 if ( bufLength ) |
|
1303 { |
|
1304 aTo = HBufC::NewLC( bufLength ); |
|
1305 recipients = &aTo; |
|
1306 } |
|
1307 else |
|
1308 { |
|
1309 continue; |
|
1310 } |
|
1311 } |
|
1312 else if ( recipTypesIndex == 1 ) |
|
1313 { |
|
1314 recipType = EMsvRecipientCc; |
|
1315 if ( aAddHeadersVariation & KMmsFeatureIdEditorCcField ) |
|
1316 { |
|
1317 // Cc supported on the UI |
|
1318 bufLength = stringLengthCc; |
|
1319 if ( ! ( aAddHeadersVariation & KMmsFeatureIdEditorBccField ) ) |
|
1320 { |
|
1321 // BCC not supported on the UI |
|
1322 bufLength += stringLengthBcc; |
|
1323 } |
|
1324 if ( bufLength ) |
|
1325 { |
|
1326 aCc = HBufC::NewLC( bufLength ); |
|
1327 recipients = &aCc; |
|
1328 } |
|
1329 else |
|
1330 { |
|
1331 continue; |
|
1332 } |
|
1333 } |
|
1334 else |
|
1335 { |
|
1336 // Cc not supported on the UI |
|
1337 recipients = &aTo; |
|
1338 } |
|
1339 } |
|
1340 else if ( recipTypesIndex == 2 ) |
|
1341 { |
|
1342 if ( aMobileTerminated ) |
|
1343 { |
|
1344 // never create bcc list |
|
1345 continue; |
|
1346 } |
|
1347 recipType = EMsvRecipientBcc; |
|
1348 if ( aAddHeadersVariation & KMmsFeatureIdEditorBccField ) |
|
1349 { |
|
1350 // BCC supported on the UI |
|
1351 bufLength = stringLengthBcc; |
|
1352 if ( bufLength ) |
|
1353 { |
|
1354 aBcc = HBufC::NewLC( bufLength ); |
|
1355 recipients = &aBcc; |
|
1356 } |
|
1357 else |
|
1358 { |
|
1359 continue; |
|
1360 } |
|
1361 } |
|
1362 else if ( aAddHeadersVariation & KMmsFeatureIdEditorCcField ) |
|
1363 { |
|
1364 // CC supported on the UI |
|
1365 recipients = &aCc; |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 // BCC not supported on the UI |
|
1370 recipients = &aTo; |
|
1371 } |
|
1372 |
|
1373 } |
|
1374 |
|
1375 if ( recipients |
|
1376 && *recipients ) |
|
1377 { |
|
1378 TPtr listPtr = (*recipients)->Des(); |
|
1379 for ( index=0; index < count; index++ ) |
|
1380 { |
|
1381 if ( aRecip.Type( index ) == recipType ) |
|
1382 { |
|
1383 TPtrC name = TMmsGenUtils::Alias( aRecip[index] ); |
|
1384 TPtrC number = TMmsGenUtils::PureAddress( aRecip[index] ); |
|
1385 if ( name.Length() ) |
|
1386 { |
|
1387 listPtr.Append( name ); |
|
1388 if ( showNumber ) |
|
1389 { |
|
1390 listPtr.Append( KMmsCharSpace ); |
|
1391 listPtr.Append( KMmsLRMarker ); |
|
1392 listPtr.Append( KCharLeftAddressIterator ); |
|
1393 listPtr.Append( number ); |
|
1394 listPtr.Append( KCharRightAddressIterator ); |
|
1395 listPtr.Append( KMmsLRMarker ); |
|
1396 } |
|
1397 } |
|
1398 else |
|
1399 { |
|
1400 listPtr.Append( number ); |
|
1401 } |
|
1402 |
|
1403 //append always and remove last one in the very end |
|
1404 listPtr.Append( KMmsCharCommaAndSpace ); |
|
1405 } |
|
1406 } |
|
1407 } |
|
1408 } |
|
1409 |
|
1410 // third round to strip the ", " off |
|
1411 for ( recipTypesIndex = 0; recipTypesIndex < KRecipTypesCount; recipTypesIndex++ ) |
|
1412 { |
|
1413 recipients = NULL; |
|
1414 if ( recipTypesIndex == 0 |
|
1415 && aTo ) |
|
1416 { |
|
1417 recipients = &aTo; |
|
1418 } |
|
1419 else if ( recipTypesIndex == 1 |
|
1420 && aCc ) |
|
1421 { |
|
1422 recipients = &aCc; |
|
1423 } |
|
1424 else if ( recipTypesIndex == 2 |
|
1425 && aBcc ) |
|
1426 { |
|
1427 recipients = &aBcc; |
|
1428 } |
|
1429 if ( recipients |
|
1430 && *recipients ) |
|
1431 { |
|
1432 TPtr listPtr = (*recipients)->Des(); |
|
1433 if ( listPtr.Length() > KMmsCharCommaAndSpace().Length() ) |
|
1434 { |
|
1435 listPtr.SetLength( listPtr.Length() - KMmsCharCommaAndSpace().Length() ); |
|
1436 } |
|
1437 } |
|
1438 } |
|
1439 } |
|
1440 } |
|
1441 |
|
1442 |
|
1443 |
|
1444 // --------------------------------------------------------- |
|
1445 // CMmsMtmUi::MessageSizeToStringL(TDes& aTarget, TInt aFileSize) |
|
1446 // Converts message size in bytes to a kilobyte string. Rounds the bytes up to the |
|
1447 // next full kilo. I.e: |
|
1448 // 0 -> 0KB |
|
1449 // 1 -> 1KB |
|
1450 // 1024 -> 1KB |
|
1451 // 1025 -> 2KB |
|
1452 // --------------------------------------------------------- |
|
1453 // |
|
1454 void CMmsMtmUi::MessageSizeToStringL( TDes& aTarget, TInt aFileSize ) const |
|
1455 { |
|
1456 TInt fileSize = aFileSize / KKiloByte; |
|
1457 if ( aFileSize % KKiloByte ) |
|
1458 { |
|
1459 fileSize++; |
|
1460 } |
|
1461 |
|
1462 HBufC* buf = StringLoader::LoadLC( R_MMS_MESSAGE_SIZE_KB, fileSize, iEikonEnv ); |
|
1463 TPtr ptr = buf->Des(); |
|
1464 ptr.Trim(); // remove possible white space from beginning |
|
1465 aTarget.Append( ptr ); |
|
1466 |
|
1467 CleanupStack::PopAndDestroy(); // buf |
|
1468 } |
|
1469 |
|
1470 // --------------------------------------------------------- |
|
1471 // CMmsMtmUi::IsMessageEmptyL() |
|
1472 // Checks if the message is effectively empty or not |
|
1473 // --------------------------------------------------------- |
|
1474 // |
|
1475 TBool CMmsMtmUi::IsMessageEmptyL() const |
|
1476 { |
|
1477 TBool empty = EFalse; |
|
1478 //CMsvEntrySelection* ids = iMmsClient.GetAttachmentsL(); |
|
1479 //CleanupStack::PushL( ids ); |
|
1480 |
|
1481 CMsvStore* store = iMmsClient.Entry().ReadStoreL(); |
|
1482 CleanupStack::PushL( store ); |
|
1483 MMsvAttachmentManager& attaManager = store->AttachmentManagerL(); |
|
1484 TInt attaCount = attaManager.AttachmentCount(); |
|
1485 CleanupStack::PopAndDestroy( store ); |
|
1486 |
|
1487 // Only attachments and subject are calculated |
|
1488 // in message size. |
|
1489 //if ( ids->Count() == 0 && |
|
1490 if ( attaCount == 0 && |
|
1491 iMmsClient.SubjectL().Length() == 0 ) |
|
1492 { |
|
1493 // No attachments nor subject |
|
1494 empty = ETrue; |
|
1495 } |
|
1496 //CleanupStack::PopAndDestroy(); // ids |
|
1497 |
|
1498 return empty; |
|
1499 } |
|
1500 |
|
1501 // --------------------------------------------------------- |
|
1502 // CMmsMtmUi::MessageSizeL() |
|
1503 // Returns size of message |
|
1504 // --------------------------------------------------------- |
|
1505 // |
|
1506 TInt CMmsMtmUi::MessageSizeL() const |
|
1507 { |
|
1508 // Only attachments and subject are calculated |
|
1509 // in message size. |
|
1510 TInt size( 0 ); |
|
1511 |
|
1512 // get size of attachments without headers |
|
1513 CMsvStore* store = iMmsClient.Entry().ReadStoreL(); |
|
1514 CleanupStack::PushL( store ); |
|
1515 MMsvAttachmentManager& attaManager = store->AttachmentManagerL(); |
|
1516 TInt attaCount = attaManager.AttachmentCount(); |
|
1517 |
|
1518 for ( TInt i = 0; i < attaCount; i++ ) |
|
1519 { |
|
1520 RFile attaFile = attaManager.GetAttachmentFileL( i ); |
|
1521 CleanupClosePushL( attaFile ); |
|
1522 TInt fileSize( 0 ); |
|
1523 |
|
1524 attaFile.Size( fileSize ); |
|
1525 size += fileSize; |
|
1526 |
|
1527 CleanupStack::PopAndDestroy( &attaFile ); // attachmentInfo, mimeHeaders, attaFile |
|
1528 } |
|
1529 CleanupStack::PopAndDestroy( store ); |
|
1530 |
|
1531 size += iMmsClient.SubjectL().Length(); |
|
1532 return size; |
|
1533 } |
|
1534 |
|
1535 // --------------------------------------------------------- |
|
1536 // CMmsMtmUi::ApExistsL |
|
1537 // Checks the existence of given access point |
|
1538 // according to id. |
|
1539 // --------------------------------------------------------- |
|
1540 // |
|
1541 TBool CMmsMtmUi::ApExistsL( TInt32 aAp ) |
|
1542 { |
|
1543 return iSettingsHandler->ApExistsL( aAp ); |
|
1544 } |
|
1545 |
|
1546 // --------------------------------------------------------- |
|
1547 // CMmsMtmUi::ConfirmSendL |
|
1548 // Gets user confirmation for message sending ni case where application |
|
1549 // does not have required capabilities |
|
1550 // |
|
1551 // --------------------------------------------------------- |
|
1552 // |
|
1553 CMsvOperation* CMmsMtmUi::ConfirmSendL( |
|
1554 TRequestStatus& aStatus, |
|
1555 const CMsvEntrySelection& /*aSelection*/, |
|
1556 const TSecurityInfo& /*aClientInfo*/ ) |
|
1557 |
|
1558 { |
|
1559 return CMsvCompletedOperation::NewL( |
|
1560 Session(), |
|
1561 Type(), |
|
1562 KNullDesC8, |
|
1563 BaseMtm().Entry().OwningService(), |
|
1564 aStatus, |
|
1565 KErrNone ); |
|
1566 } |
|
1567 |
|
1568 // --------------------------------------------------------- |
|
1569 // CMmsMtmUi::OpenPostcardInfoL(TRequestStatus& aCompletionStatus ) |
|
1570 // Opens the Postcard Info popup. |
|
1571 // --------------------------------------------------------- |
|
1572 // |
|
1573 CMsvOperation* CMmsMtmUi::OpenPostcardInfoL( TRequestStatus& aCompletionStatus ) |
|
1574 { |
|
1575 LOGTEXT( _L8( "MmsMtmUi OpenPostcardInfo start" ) ); |
|
1576 TInt popCount( 0 ); |
|
1577 |
|
1578 // The items for Info are read from the message entry. |
|
1579 // Note: Most of the stuff is in TMsvEntry, but not all -> MMS entry used all the way. |
|
1580 TMmsMsvEntry entry = static_cast<TMmsMsvEntry>( BaseMtm().Entry().Entry() ); |
|
1581 __ASSERT_DEBUG( entry.iType==KUidMsvMessageEntry, Panic( EMmsNotAMessage ) ); |
|
1582 __ASSERT_DEBUG( entry.iMtm==Type(), Panic( EMmsWrongMtm ) ); |
|
1583 |
|
1584 iMmsClient.LoadMessageL(); |
|
1585 |
|
1586 TMsgInfoMessageInfoData infoData; |
|
1587 |
|
1588 // Supply UTC date-time to message info |
|
1589 infoData.iDateTime = entry.iDate; |
|
1590 |
|
1591 // Type of message -taken directly from resources as this must be a multimedia message |
|
1592 HBufC* msgType = StringLoader::LoadLC( R_POSTCARD_TYPE_TEXT, iCoeEnv ); |
|
1593 popCount++; |
|
1594 infoData.iType.Set( msgType->Des() ); |
|
1595 |
|
1596 // Size of message. |
|
1597 // The size of recipient/greeting text is always less than 1024 so lets |
|
1598 // spare that for them |
|
1599 TInt sizeOfMessage = 1024; |
|
1600 if ( !IsMessageEmptyL() ) |
|
1601 { |
|
1602 sizeOfMessage = iMmsClient.MessageSize(); |
|
1603 } |
|
1604 // Finally make the UI string |
|
1605 TBuf<KMessageSize> sizeString; |
|
1606 MessageSizeToStringL( sizeString, sizeOfMessage ); |
|
1607 infoData.iSize.Set( sizeString ); |
|
1608 |
|
1609 infoData.iTo.Set( entry.iDetails ); |
|
1610 CMsgInfoMessageInfoDialog* infoDialog = CMsgInfoMessageInfoDialog::NewL(); |
|
1611 if ( entry.IsMobileTerminated() ) |
|
1612 { |
|
1613 infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsViewer ); |
|
1614 } |
|
1615 else |
|
1616 { |
|
1617 infoDialog->ExecuteLD( infoData, CMsgInfoMessageInfoDialog::EMmsEditor ); |
|
1618 } |
|
1619 |
|
1620 CleanupStack::PopAndDestroy( popCount ); |
|
1621 |
|
1622 return CMsvCompletedOperation::NewL( Session(), |
|
1623 KUidMsvLocalServiceMtm, |
|
1624 KNullDesC8, |
|
1625 KMsvLocalServiceIndexEntryId, |
|
1626 aCompletionStatus ); |
|
1627 } |
|
1628 |
|
1629 // --------------------------------------------------------- |
|
1630 // CMmsMtmUi::OpenDeliveryPopupL |
|
1631 // Uses CMmsMtmDeliveryDialogLauncher to fetch the delivery data for the current message |
|
1632 // and finally to display it in message query dialog. |
|
1633 // |
|
1634 // --------------------------------------------------------- |
|
1635 // |
|
1636 CMsvOperation* CMmsMtmUi::OpenDeliveryPopupL( TRequestStatus& aCompletionStatus, |
|
1637 TDes8& /*aParameter */) |
|
1638 { |
|
1639 // get the current message |
|
1640 TMmsMsvEntry entry = static_cast<TMmsMsvEntry>( BaseMtm().Entry().Entry() ); |
|
1641 iMmsClient.LoadMessageL(); |
|
1642 |
|
1643 // reset for reuse, otherwise causes memoryleak |
|
1644 if (iLauncher) |
|
1645 { |
|
1646 delete iLauncher; |
|
1647 iLauncher = NULL; |
|
1648 } |
|
1649 // give the iMmsClient as parameter, it's data is being used when filtering data from Logs DB |
|
1650 iLauncher = CMmsMtmDeliveryDialogLauncher::NewL(entry, &iMmsClient); |
|
1651 TBool success = iLauncher->StartDialogL(); |
|
1652 if (!success) |
|
1653 { |
|
1654 delete iLauncher; |
|
1655 iLauncher = NULL; |
|
1656 } |
|
1657 // if succesfull, deleted in destructor |
|
1658 |
|
1659 return CMsvCompletedOperation::NewL( Session(), |
|
1660 KUidMsvLocalServiceMtm, |
|
1661 KNullDesC8, |
|
1662 KMsvLocalServiceIndexEntryId, |
|
1663 aCompletionStatus ); |
|
1664 |
|
1665 } |
|
1666 |
|
1667 |
|
1668 // --------------------------------------------------------- |
|
1669 // CMmsMtmUi::ConvertUtcToLocalTime |
|
1670 // |
|
1671 // --------------------------------------------------------- |
|
1672 // |
|
1673 void CMmsMtmUi::ConvertUtcToLocalTime( TTime& aTime ) |
|
1674 { |
|
1675 TLocale locale; |
|
1676 // Add time difference |
|
1677 aTime += locale.UniversalTimeOffset(); |
|
1678 if (locale.QueryHomeHasDaylightSavingOn()) |
|
1679 { // and possible daylight saving time |
|
1680 TTimeIntervalHours daylightSaving(1); |
|
1681 aTime += daylightSaving; |
|
1682 } |
|
1683 } |
|
1684 // End of File |