|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Provides CNotViewerAppUi class methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <featmgr.h> // FeatureManager |
|
22 #include <bldvariant.hrh> |
|
23 #include <messagingvariant.hrh> |
|
24 #include <txtrich.h> // CRichText |
|
25 #include <eikrted.h> // CEikRichTextEditor |
|
26 #include <StringLoader.h> // StringLoader (load and format strings from resources) |
|
27 |
|
28 #include <centralrepository.h> // link against centralrepository.lib |
|
29 #include <CommonUiInternalCRKeys.h> |
|
30 #include <messaginginternalcrkeys.h> // for Central Repository keys |
|
31 #include <CoreApplicationUIsSDKCRKeys.h> |
|
32 |
|
33 #include <AknFepGlobalEnums.h> // Global Fep enums (ELatin, ENumber) |
|
34 |
|
35 // Base editor stuff |
|
36 #include <MsgBodyControl.h> // CMsgBodyControl |
|
37 #include <MsgEditorView.h> // CMsgEditorView |
|
38 #include <MsgAddressControl.h> // CMsgAddressControl |
|
39 #include <MsgAttachmentUtils.h> // CMsgAttachmentUtils |
|
40 #include <MsgEditorAppUiExtension.h> // CMsgEditorAppUiExtension |
|
41 |
|
42 // Help |
|
43 #include <csxhelp/mms.hlp.hrh> |
|
44 #include <hlplch.h> // For HlpLauncher |
|
45 |
|
46 // Phone |
|
47 #include <commonphoneparser.h> // Common phone number validity checker |
|
48 |
|
49 // Contacts |
|
50 #include <cntdef.h> // KNullContactId |
|
51 |
|
52 // MUIU stuff |
|
53 #include <MuiuMsvUiServiceUtilities.h> // Call back to sender |
|
54 #include <muiumsvuiserviceutilitiesinternal.h> |
|
55 |
|
56 #include <MuiuOperationWait.h> // CMuiuOperationWait |
|
57 #include <akninputblock.h> // CAknInputBlock |
|
58 #include <MuiuMsvProgressReporterOperation.h> // CMsvProgressReporterOperation |
|
59 #include <MuiuMsgEmbeddedEditorWatchingOperation.h> |
|
60 |
|
61 // AKN Stuff |
|
62 #include <AknUtils.h> // Apac, layout, etc |
|
63 #include <AknsUtils.h> // AknsUtils |
|
64 #include <aknnotewrappers.h> // CAknInformationNote |
|
65 #include <applayout.cdl.h> // LAF |
|
66 #include <aknlayoutscalable_avkon.cdl.h> |
|
67 |
|
68 // Client MTM Stuff |
|
69 #include <mmsnotificationclient.h> // CMmsClientMtm |
|
70 #include <mtmuidef.hrh> // EMtmUiFlagEditorPreferEmbedded |
|
71 #include <mmsgenutils.h> // TMmsGenUtils |
|
72 #include <mmsmsventry.h> // TMmsMsvEntry |
|
73 #include <MtmExtendedCapabilities.hrh> // function id of MessageInfo |
|
74 |
|
75 // Send As Stuff |
|
76 #include <sendui.h> // SendUI (for Reply via SMS) |
|
77 #include <SenduiMtmUids.h> // MTM Uids |
|
78 #include <CMessageData.h> |
|
79 |
|
80 // Find item |
|
81 #include <FindItemmenu.rsg> // Find item stuff |
|
82 #include <finditemmenu.h> // |
|
83 #include <finditemdialog.h> // |
|
84 #include <finditem.hrh> |
|
85 #include <ItemFinder.h> |
|
86 |
|
87 #ifdef RD_SCALABLE_UI_V2 |
|
88 #include <akntoolbar.h> |
|
89 #endif |
|
90 |
|
91 #include <aknnavi.h> // CAknNavigationControlContainer |
|
92 #include <aknnavide.h> // CAknNavigationDecorator |
|
93 #include <akntabgrp.h> // CAknTabGroup |
|
94 #include <akntitle.h> |
|
95 #include <mmserrors.h> |
|
96 #include <mmsregisteredapplications.h> |
|
97 #include <mmssettings.h> |
|
98 |
|
99 #include <mmsui.mbg> // Bitmap identifiers |
|
100 #include <data_caging_path_literals.hrh> // KDC_APP_BITMAP_DIR |
|
101 #include "MmsMtmConst.h" |
|
102 #include "NotMtmUi.h" // Notification MTM UI |
|
103 #include "NotMtmUiData.h" // Notification MTM UI Data |
|
104 #include "NotViewerAppUi.h" |
|
105 #include "NotViewerDocument.h" |
|
106 #include "NotViewer.hrh" |
|
107 #include <NotViewer.rsg> |
|
108 #include <uniaddresshandler.h> |
|
109 #include "MmsSettingsHandler.h" |
|
110 #include <msgvoipextension.h> |
|
111 #include <textresolver.h> |
|
112 |
|
113 // CONSTANTS |
|
114 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
115 const TUint KNaviGranularity = 2; |
|
116 const TInt KIconDefaultColor = 0; |
|
117 #endif |
|
118 _LIT( KMmsUiMbmFile, "mmsui.mbm" ); |
|
119 |
|
120 const TInt KDateSize = 30; |
|
121 const TInt KMaxDetailsLength = 64; // Copy max this many chars to TMsvEntry iDetails |
|
122 const TInt KReplyToSenderSize = 2048; |
|
123 // Exit time when using CIdle to close the application |
|
124 const TInt KDelayedExitDelay = 2500000; |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CNotViewerAppUi |
|
128 // --------------------------------------------------------- |
|
129 // |
|
130 CNotViewerAppUi::CNotViewerAppUi() : |
|
131 iIdle( NULL ), |
|
132 iAbsorber( NULL ), |
|
133 iOperation( NULL ), |
|
134 iSenderType( EMuiuAddressTypeNone ), |
|
135 iFlags(0), |
|
136 iMsgId( 0 ) |
|
137 { |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // ~CNotViewerAppUi |
|
142 // --------------------------------------------------------- |
|
143 // |
|
144 CNotViewerAppUi::~CNotViewerAppUi() |
|
145 { |
|
146 FeatureManager::UnInitializeLib(); |
|
147 delete iOperation; |
|
148 if ( iView |
|
149 && !( iFlags & ENotViewerIsNotification ) ) |
|
150 { // FR mode |
|
151 if ( !( iMtm->Entry( ).Entry( ).ReadOnly( ) ) ) |
|
152 { // FR in edit mode |
|
153 CMsgAddressControl* to = |
|
154 static_cast<CMsgAddressControl*>( iView->ControlById( EMsgComponentIdTo ) ); |
|
155 if ( to ) |
|
156 { // Lets save the current input mode to shared data |
|
157 TInt inputMode = to->Editor().AknEditorCurrentInputMode(); |
|
158 iMuiuSettRepository->Set( KMuiuToInputMode, inputMode ); |
|
159 } |
|
160 } |
|
161 } |
|
162 if ( iNotifyHandler ) |
|
163 { |
|
164 iNotifyHandler->StopListening(); |
|
165 } |
|
166 delete iNotifyHandler; |
|
167 delete iCUiRepository; |
|
168 delete iMuiuSettRepository; |
|
169 |
|
170 delete iIdle; |
|
171 delete iAbsorber; |
|
172 delete iSendUi; |
|
173 delete iFindItemMenu; |
|
174 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
175 delete iNaviDecorator; |
|
176 #endif |
|
177 delete iMsgVoIPExtension; |
|
178 delete iAlias; |
|
179 delete iAddressHandler; |
|
180 delete iSettingsHandler; |
|
181 delete iAppIcon; |
|
182 } |
|
183 |
|
184 // --------------------------------------------------------- |
|
185 // ConstructL |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 void CNotViewerAppUi::ConstructL() |
|
189 { |
|
190 LOGTEXT(_L8("NotViewerAppUi: Construct start")); |
|
191 CMsgEditorAppUi::ConstructL(); // Constructor of the base class |
|
192 |
|
193 // Disable task swapper from options menu during launch |
|
194 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptionsNoTaskSwapper ); |
|
195 |
|
196 FeatureManager::InitializeLibL(); |
|
197 |
|
198 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
199 { |
|
200 iFlags |= ENotViewerFlagsHelp; |
|
201 } |
|
202 |
|
203 // KFeatureIdMmsNonDestructiveForward has been deprecated |
|
204 // Check of TMsvEntry::iMtmData2 & KMmsStoredInMMBox replaces it. |
|
205 // MMSEngine sets KMmsStoredInMMBox for received notifications |
|
206 |
|
207 if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) ) |
|
208 { |
|
209 iFlags |= ENotViewerOffline; |
|
210 } |
|
211 if ( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) ) |
|
212 { |
|
213 iFlags |= ENotViewerAudioMessaging; |
|
214 } |
|
215 |
|
216 iMtm = &(Document()->Mtm()); |
|
217 if ( !iMtm ) |
|
218 { |
|
219 User::Leave( KErrBadHandle ); |
|
220 } |
|
221 |
|
222 iSettingsHandler = CMmsSettingsHandler::NewL( *iMtm ); |
|
223 |
|
224 #ifndef RD_SCALABLE_UI_V2 |
|
225 iView = CMsgEditorView::NewL( *this, CMsgEditorView::EMsgReadOnly ); |
|
226 #endif |
|
227 |
|
228 iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
229 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
230 iTitlePane = static_cast<CAknTitlePane*> |
|
231 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
232 iSendUi = CSendUi::NewL(); |
|
233 |
|
234 TInt highlight = 0; |
|
235 iMuiuSettRepository = CRepository::NewL( KCRUidMuiuSettings ); |
|
236 |
|
237 iCUiRepository = CRepository::NewL( KCRUidCommonUi ); |
|
238 iCUiRepository->Get( KCuiAutomaticHighlight, highlight ); |
|
239 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, |
|
240 *iCUiRepository, |
|
241 CCenRepNotifyHandler::EIntKey, |
|
242 KCuiAutomaticHighlight ); |
|
243 iNotifyHandler->StartListeningL(); |
|
244 |
|
245 if ( highlight == 0 ) |
|
246 { // Disable autofind if it's disable in Shared Data |
|
247 iFlags &= ~ENotViewerAutoFind; |
|
248 } |
|
249 else |
|
250 { |
|
251 iFlags |= ENotViewerAutoFind; |
|
252 } |
|
253 |
|
254 // No other reply types as mms is not possible |
|
255 TInt features( 0 ); |
|
256 CRepository* repository = CRepository::NewL( KCRUidMuiuVariation ); |
|
257 repository->Get( KMuiuUniEditorFeatures, features ); |
|
258 if ( features & KUniEditorFeatureIdRestrictedReplyMms ) |
|
259 { |
|
260 iFlags |= ENotViewerRestrictedReply; |
|
261 } |
|
262 delete repository; |
|
263 |
|
264 LOGTEXT2(_L("CNotViewerAppUi::ConstructL: iFlags 0x%x"), iFlags ); |
|
265 |
|
266 iFindItemMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
|
267 iFindItemMenu->AttachItemFinderMenuL(0); |
|
268 |
|
269 if( !iEikonEnv->StartedAsServerApp( ) ) |
|
270 { |
|
271 Document()->PrepareToLaunchL( this ); |
|
272 } |
|
273 |
|
274 MenuBar()->SetContextMenuTitleResourceId( R_NOTVIEWER_SELECTIONMENUBAR ); |
|
275 |
|
276 // Set path of bitmap file |
|
277 TParse fileParse; |
|
278 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
279 |
|
280 iAppIcon = AknsUtils::CreateGulIconL( |
|
281 AknsUtils::SkinInstance(), |
|
282 KAknsIIDQgnPropMceMmsTitle, |
|
283 fileParse.FullName(), |
|
284 EMbmMmsuiQgn_prop_mce_mms_title, |
|
285 EMbmMmsuiQgn_prop_mce_mms_title_mask ); |
|
286 |
|
287 ApplyFormat(iLabelFormat, iLabelMask, ETrue); |
|
288 ApplyFormat(iValueFormat, iValueMask, EFalse); |
|
289 LOGTEXT(_L8("NotViewerAppUi: Construct end")); |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------- |
|
293 // LaunchViewL |
|
294 // --------------------------------------------------------- |
|
295 // |
|
296 void CNotViewerAppUi::LaunchViewL() |
|
297 { |
|
298 LOGTEXT(_L8("NotViewerAppUi: LaunchViewL start")); |
|
299 |
|
300 TRAPD( err, iMtm->LoadMessageL() ); |
|
301 |
|
302 if ( err ) |
|
303 { |
|
304 if ( err != KErrNoMemory ) |
|
305 { |
|
306 User::Leave( KErrCorrupt ); |
|
307 } |
|
308 User::Leave( err ); |
|
309 } |
|
310 |
|
311 GetTypeL( ); // Updates the iFlag |
|
312 |
|
313 SetTitleIconL(); |
|
314 |
|
315 #ifdef RD_SCALABLE_UI_V2 |
|
316 if ( AknLayoutUtils::PenEnabled() ) |
|
317 { |
|
318 // iToolbar should have been assigned already in HandleForegroundEventL() |
|
319 // If it failed, |
|
320 // - catch it here |
|
321 // - but it means also that some of functionality cannot be fulfilled |
|
322 if ( !iToolbar ) |
|
323 { |
|
324 iToolbar = CurrentFixedToolbar(); |
|
325 if ( iToolbar ) |
|
326 { |
|
327 iToolbar->SetToolbarObserver( this ); |
|
328 } |
|
329 } |
|
330 } |
|
331 |
|
332 if ( iToolbar |
|
333 && iToolbar->IsToolbarDisabled() ) |
|
334 { |
|
335 iToolbar->DisableToolbarL( EFalse ); |
|
336 iToolbar->SetToolbarVisibility( ETrue, EFalse ); |
|
337 } |
|
338 // Creation of CMsgEditorView must be after toolbar is set visible otherwise layout things can go wrong. |
|
339 // This has been moved here from ConstructL(). For that reason couple of 'if ( iView &&' checks has been added |
|
340 // at locations which could use CMsgEditorView very early at startup |
|
341 iView = CMsgEditorView::NewL( *this, CMsgEditorView::EMsgReadOnly ); |
|
342 |
|
343 #endif |
|
344 |
|
345 // Editors must not exit due to End key. Flag is set by GetTypeL(); |
|
346 if ( ! ( iFlags & ENotViewerIsNotification ) ) |
|
347 { |
|
348 SetCloseWithEndKey( EFalse ); |
|
349 } |
|
350 |
|
351 iMsgId = iMtm->Entry( ).Entry( ).Id( ); |
|
352 |
|
353 TInt focusedControl = 0; |
|
354 |
|
355 if( iFlags & ENotViewerIsNotification ) |
|
356 { // We are in the notification mode |
|
357 focusedControl = EMsgComponentIdFrom; |
|
358 iView->AddControlFromResourceL( |
|
359 R_NOTVIEWER_FROM, |
|
360 EMsgAddressControl, |
|
361 EMsgAppendControl, |
|
362 EMsgHeader ); |
|
363 } |
|
364 else |
|
365 { // we are in the forward request mode |
|
366 focusedControl = EMsgComponentIdTo; |
|
367 iView->AddControlFromResourceL( |
|
368 R_NOTVIEWER_TO, |
|
369 EMsgAddressControl, |
|
370 EMsgAppendControl, |
|
371 EMsgHeader ); |
|
372 CMsgAddressControl* to = AddressControl( ); |
|
373 |
|
374 // Remove the auto highlight in FR mode |
|
375 iFlags &= ~ENotViewerAutoFind; |
|
376 |
|
377 TMsvEntry msvEntry = iMtm->Entry( ).Entry( ); |
|
378 |
|
379 if( msvEntry.ReadOnly( ) ) // Sent |
|
380 { |
|
381 to->SetReadOnly( ETrue ); |
|
382 } |
|
383 else // Unsent: To-control must not be read only |
|
384 { |
|
385 to->SetReadOnly( EFalse ); |
|
386 TInt inputMode = ENumber; |
|
387 |
|
388 if ( iMuiuSettRepository->Get( KMuiuToInputMode, inputMode ) ) |
|
389 { |
|
390 inputMode = ENumber; |
|
391 } |
|
392 to->Editor( ).SetAknEditorCurrentInputMode( inputMode ); |
|
393 } |
|
394 UpdateTitlePaneL( ); // Updates the "Forward Request" to Title pane |
|
395 } |
|
396 |
|
397 // Adds the text in message body here |
|
398 if( iFlags & ENotViewerIsNotification ) |
|
399 { // We are in the Viewer so lets add from field |
|
400 const TPtrC sender = iMtm->Sender(); |
|
401 const TPtrC details = iMtm->Entry().Entry().iDetails; |
|
402 if ( sender.Length() ) |
|
403 { |
|
404 iSenderType = MsvUiServiceUtilitiesInternal::ResolveAddressTypeL( |
|
405 TMmsGenUtils::PureAddress( sender ), |
|
406 CommonPhoneParser::ESMSNumber ); |
|
407 |
|
408 if ( iSenderType != EMuiuAddressTypePhoneNumber ) |
|
409 { |
|
410 //We trust on that there won't be illegal addresses |
|
411 //in received messages |
|
412 iSenderType = EMuiuAddressTypeEmail; |
|
413 if ( iFindItemMenu ) |
|
414 { |
|
415 iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress ); |
|
416 } |
|
417 } |
|
418 CMsgAddressControl* fromControl = AddressControl( ); |
|
419 |
|
420 //Check if MMS engine has put an alias into iDetails field |
|
421 if ( sender.Compare( details ) != 0 ) |
|
422 { |
|
423 TPtrC alias = KNullDesC(); |
|
424 if ( details.Length() && !iAlias ) |
|
425 { |
|
426 iAlias = details.AllocL( ); |
|
427 alias.Set( *iAlias ); |
|
428 } |
|
429 |
|
430 // Resolve whether this is remote alias. Local alias takes precedence |
|
431 TPtrC tempAlias( TMmsGenUtils::Alias( sender ) ); |
|
432 if ( iAlias |
|
433 && tempAlias.Length() |
|
434 && !tempAlias.CompareF( *iAlias ) ) |
|
435 |
|
436 { |
|
437 iRemoteAlias = ETrue; |
|
438 } |
|
439 |
|
440 MVPbkContactLink* link = NULL; |
|
441 fromControl->AddRecipientL( alias, |
|
442 TMmsGenUtils::PureAddress( sender ), |
|
443 ETrue, |
|
444 link ); |
|
445 } |
|
446 else |
|
447 { |
|
448 MVPbkContactLink* link = NULL; |
|
449 fromControl->AddRecipientL( TMmsGenUtils::Alias( sender ), |
|
450 TMmsGenUtils::PureAddress( sender ), |
|
451 ETrue, |
|
452 link ); |
|
453 } |
|
454 } |
|
455 else |
|
456 { |
|
457 // Leave the address control empty |
|
458 // This should not happen, though |
|
459 } |
|
460 } |
|
461 else |
|
462 { |
|
463 const CMsvRecipientList& addresses = iMtm->AddresseeList(); |
|
464 |
|
465 TInt count = addresses.Count(); |
|
466 CMsgAddressControl* toControl = AddressControl( ); |
|
467 |
|
468 if ( count > 0 ) |
|
469 { |
|
470 CMsgRecipientList* recipientList = CMsgRecipientList::NewL(); |
|
471 CleanupStack::PushL( recipientList ); |
|
472 |
|
473 for ( TInt i = 0; i < count; i++) |
|
474 { |
|
475 CMsgRecipientItem* recipient = CMsgRecipientItem::NewLC( |
|
476 TMmsGenUtils::Alias( addresses[i] ), |
|
477 TMmsGenUtils::PureAddress( addresses[i] ) ); |
|
478 recipient->SetVerified( ETrue ); |
|
479 recipientList->AppendL( recipient ); |
|
480 CleanupStack::Pop(); |
|
481 recipient = NULL; |
|
482 } |
|
483 toControl->AddRecipientsL( *recipientList ); |
|
484 CleanupStack::PopAndDestroy(); |
|
485 } |
|
486 if ( !iMtm->Entry().Entry().ReadOnly( ) ) |
|
487 { // Address handler is created only when we have unsent Forward Request |
|
488 iAddressHandler = CUniAddressHandler::NewL( Document()->Mtm(), *toControl, *iCoeEnv ); |
|
489 } |
|
490 } |
|
491 |
|
492 // Add the body field stuff |
|
493 if( iFlags & ENotViewerIsNotification ) |
|
494 { // We are in the Viewer so lets add message field, too |
|
495 AddMessageFieldL( ); |
|
496 } |
|
497 AddSubjectFieldL( ); |
|
498 AddTextFieldL( ); |
|
499 AddSizeFieldL( ); |
|
500 if( iFlags & ENotViewerIsNotification ) |
|
501 { // We are in the Viewer so lets add expiry field, too |
|
502 AddExpiryFieldL( ); |
|
503 } |
|
504 AddClassFieldL( ); |
|
505 AddPriorityFieldL( ); |
|
506 |
|
507 if( iFlags & ENotViewerIsNotification ) |
|
508 { // We are in the Viewer so Find stuff too |
|
509 SetFindModeL( iFlags & ENotViewerAutoFind ); |
|
510 |
|
511 } |
|
512 else |
|
513 { |
|
514 if ( iView->ItemFinder() ) |
|
515 { |
|
516 iView->ItemFinder()->SetFindModeL( |
|
517 CItemFinder::ENoneSelected ); |
|
518 } |
|
519 } |
|
520 |
|
521 iView->ExecuteL( ClientRect(), focusedControl ); |
|
522 InitNavipaneL( ); |
|
523 |
|
524 // Enable task swapper to options menu after launch has been completed. |
|
525 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
|
526 |
|
527 |
|
528 LOGTEXT(_L8("NotViewerAppUi: LaunchViewL end")); |
|
529 } |
|
530 |
|
531 // --------------------------------------------------------- |
|
532 // DynInitMenuPaneL |
|
533 // --------------------------------------------------------- |
|
534 // |
|
535 void CNotViewerAppUi::DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane ) |
|
536 { |
|
537 if ( aMenuPane ) |
|
538 { |
|
539 TInt amountOfItems( aMenuPane->NumberOfItemsInPane() ); |
|
540 if ( !Document( )->IsLaunched( ) ) |
|
541 { |
|
542 if ( amountOfItems ) |
|
543 { |
|
544 aMenuPane->DeleteBetweenMenuItems( 0, amountOfItems - 1 ); |
|
545 } |
|
546 return; |
|
547 } |
|
548 switch ( aMenuId ) |
|
549 { |
|
550 case R_NOTVIEWER_OPTIONSMENU: |
|
551 { |
|
552 DynInitOptionsMenuL( aMenuPane ); |
|
553 break; |
|
554 } |
|
555 case R_NOTVIEWER_REPLY_SUBMENU: |
|
556 { |
|
557 DynInitReplyMenuL( aMenuPane ); |
|
558 break; |
|
559 } |
|
560 case R_NOTVIEWER_SELECTIONMENU: |
|
561 { |
|
562 DynInitContextMenuL( aMenuPane ); |
|
563 break; |
|
564 } |
|
565 case R_NOTVIEWER_ZOOM_SUBMENU: |
|
566 { |
|
567 TInt zoomLevel = KErrGeneral; |
|
568 iMsgEditorAppUiExtension-> |
|
569 iSettingCachePlugin.GetValue( KAknLocalZoomLayoutSwitch, zoomLevel ); |
|
570 switch ( zoomLevel ) |
|
571 { |
|
572 case EAknUiZoomAutomatic: |
|
573 aMenuPane->SetItemButtonState( EMsgDispSizeAutomatic, |
|
574 EEikMenuItemSymbolOn ); |
|
575 break; |
|
576 case EAknUiZoomNormal: |
|
577 aMenuPane->SetItemButtonState( EMsgDispSizeNormal, |
|
578 EEikMenuItemSymbolOn ); |
|
579 break; |
|
580 case EAknUiZoomSmall: |
|
581 aMenuPane->SetItemButtonState( EMsgDispSizeSmall, |
|
582 EEikMenuItemSymbolOn ); |
|
583 break; |
|
584 case EAknUiZoomLarge: |
|
585 aMenuPane->SetItemButtonState( EMsgDispSizeLarge, |
|
586 EEikMenuItemSymbolOn ); |
|
587 break; |
|
588 default: |
|
589 break; |
|
590 } |
|
591 } |
|
592 break; |
|
593 default: |
|
594 { |
|
595 // this does nothing if we're not, so this is safe |
|
596 iFindItemMenu->UpdateItemFinderMenuL( aMenuId, aMenuPane ); |
|
597 break; |
|
598 } |
|
599 } |
|
600 } |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------- |
|
604 // DynInitOptionsMenuL |
|
605 // --------------------------------------------------------- |
|
606 // |
|
607 void CNotViewerAppUi::DynInitOptionsMenuL( CEikMenuPane* aMenuPane ) |
|
608 { |
|
609 LOGTEXT(_L8("NotViewerAppUi: DynInitOptionsMenuL start")); |
|
610 if( !(iFlags & ENotViewerFlagsHelp ) ) |
|
611 { |
|
612 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
613 } |
|
614 if ( iFlags & ENotViewerIsNotification ) |
|
615 { // Notification mode |
|
616 if ( iView ) |
|
617 { |
|
618 if( (FocusedControlId( ) == EMsgComponentIdFrom) && ( ( iMtm->Sender( ) ).Length() ) ) |
|
619 { |
|
620 iFindItemMenu->SetSenderHighlightStatus( ETrue ); |
|
621 iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) ); |
|
622 } |
|
623 else |
|
624 { |
|
625 iFindItemMenu->SetSenderHighlightStatus( EFalse ); |
|
626 } |
|
627 iFindItemMenu->AddItemFindMenuL( |
|
628 ( FocusedControlId() == EMsgComponentIdBody ) ? iView->ItemFinder() : 0, |
|
629 aMenuPane, |
|
630 EFindItemMenuPlaceHolder, |
|
631 iMtm->Sender(), |
|
632 iAlias && !iRemoteAlias ? ETrue : EFalse, //"Is sender known" |
|
633 EFalse ); |
|
634 } |
|
635 |
|
636 aMenuPane->SetItemDimmed( ENotViewerSend, ETrue ); |
|
637 aMenuPane->SetItemDimmed( ENotViewerAddRecipient, ETrue ); |
|
638 aMenuPane->SetItemDimmed( ENotViewerCheckNames, ETrue ); |
|
639 |
|
640 CNotViewerDocument* doc = Document( ); |
|
641 |
|
642 CNotMtmUiData* uiData = &doc->MtmUiDataL( ); |
|
643 |
|
644 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
645 |
|
646 // Note: OperationSupportedL returns 0 if operation is supported, |
|
647 // otherwise it returns some kind of error code |
|
648 |
|
649 if( uiData->OperationSupportedL( KMtmUiFunctionFetchMMS, entry ) ) |
|
650 { |
|
651 aMenuPane->SetItemDimmed( ENotViewerRetrieve, ETrue ); |
|
652 } |
|
653 |
|
654 if( uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, entry ) ) |
|
655 { |
|
656 aMenuPane->SetItemDimmed( ENotViewerDelete, ETrue ); |
|
657 } |
|
658 |
|
659 if( uiData->OperationSupportedL( KMtmUiFunctionForward, entry ) ) |
|
660 { |
|
661 aMenuPane->SetItemDimmed( ENotViewerForward, ETrue ); |
|
662 } |
|
663 |
|
664 if( iMtm->Sender().Length()==0 ) |
|
665 { |
|
666 aMenuPane->SetItemDimmed( ENotViewerReplyMenu, ETrue ); |
|
667 } |
|
668 |
|
669 } |
|
670 else |
|
671 { // ForwReq mode |
|
672 aMenuPane->SetItemDimmed( EFindItemMenuPlaceHolder, ETrue ); |
|
673 aMenuPane->SetItemDimmed( ENotViewerRetrieve, ETrue ); |
|
674 aMenuPane->SetItemDimmed( ENotViewerForward, ETrue ); |
|
675 aMenuPane->SetItemDimmed( ENotViewerReplyMenu, ETrue ); |
|
676 if ( iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
677 { // Sent ForwReq |
|
678 aMenuPane->SetItemDimmed( ENotViewerMessageDetails, ETrue ); |
|
679 aMenuPane->SetItemDimmed( ENotViewerSend, ETrue ); |
|
680 aMenuPane->SetItemDimmed( ENotViewerAddRecipient, ETrue ); |
|
681 aMenuPane->SetItemDimmed( ENotViewerCheckNames, ETrue ); |
|
682 } |
|
683 else |
|
684 { |
|
685 // This is not needed when we are in edit mode |
|
686 // Send is always visible |
|
687 aMenuPane->SetItemDimmed( ENotViewerDelete, ETrue ); |
|
688 // Lets check if we need Send or not |
|
689 if ( iView ) |
|
690 { |
|
691 CMsgAddressControl* toCtrl = |
|
692 static_cast<CMsgAddressControl*>( iView->ControlById( EMsgComponentIdTo ) ); |
|
693 if ( toCtrl && toCtrl->GetRecipientsL()->Count() < 1 ) |
|
694 { |
|
695 // To field empty -> cannot send. |
|
696 aMenuPane->SetItemDimmed( ENotViewerCheckNames, ETrue ); |
|
697 } |
|
698 } |
|
699 } |
|
700 } |
|
701 LOGTEXT(_L8("NotViewerAppUi: DynInitOptionsMenuL end")); |
|
702 } |
|
703 |
|
704 // --------------------------------------------------------- |
|
705 // DynInitReplyMenuL |
|
706 // --------------------------------------------------------- |
|
707 // |
|
708 void CNotViewerAppUi::DynInitReplyMenuL( CEikMenuPane* aMenuPane ) |
|
709 { |
|
710 if( iSenderType == EMuiuAddressTypeNone ) |
|
711 { // If sender type is email, disable SMS |
|
712 aMenuPane->SetItemDimmed( ENotViewerReplyViaMessage, ETrue ); |
|
713 } |
|
714 |
|
715 if ( ! ( iFlags & ENotViewerAudioMessaging ) |
|
716 || iFlags & ENotViewerRestrictedReply |
|
717 || iSenderType == EMuiuAddressTypeNone ) |
|
718 { |
|
719 aMenuPane->SetItemDimmed( ENotViewerReplyViaAudio, ETrue ); |
|
720 } |
|
721 |
|
722 if ( iSenderType != EMuiuAddressTypeEmail || |
|
723 iFlags & ENotViewerRestrictedReply || |
|
724 MsvUiServiceUtilitiesInternal::DefaultServiceForMTML( |
|
725 Document()->Session(), |
|
726 KSenduiMtmSmtpUid, |
|
727 ETrue ) |
|
728 == KMsvUnknownServiceIndexEntryId ) |
|
729 { |
|
730 // "Reply via e-mail" feature |
|
731 aMenuPane->SetItemDimmed( ENotViewerReplyViaMail, ETrue ); |
|
732 } |
|
733 } |
|
734 |
|
735 // --------------------------------------------------------- |
|
736 // DynInitContextMenuL |
|
737 // --------------------------------------------------------- |
|
738 // |
|
739 void CNotViewerAppUi::DynInitContextMenuL( CEikMenuPane* aMenuPane ) |
|
740 { |
|
741 LOGTEXT(_L8("NotViewerAppUi: DynInitContextMenuL start")); |
|
742 if ( iFlags & ENotViewerIsNotification ) |
|
743 { // Notification |
|
744 if ( iView ) |
|
745 { |
|
746 if( (FocusedControlId( ) == EMsgComponentIdFrom) && ( ( iMtm->Sender( ) ).Length() ) ) |
|
747 { |
|
748 iFindItemMenu->SetSenderHighlightStatus( ETrue ); |
|
749 iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) ); |
|
750 } |
|
751 else |
|
752 { |
|
753 iFindItemMenu->SetSenderHighlightStatus( EFalse ); |
|
754 } |
|
755 iFindItemMenu->AddItemFindMenuL( |
|
756 ( FocusedControlId() == EMsgComponentIdBody ) ? iView->ItemFinder() : 0, |
|
757 aMenuPane, |
|
758 EFindItemContextMenuPlaceHolder, |
|
759 iMtm->Sender(), |
|
760 iAlias && !iRemoteAlias ? ETrue : EFalse, //"Is sender known" |
|
761 ETrue ); |
|
762 } |
|
763 |
|
764 if( iSenderType == EMuiuAddressTypeNone ) |
|
765 { // If sender type is none, disable Reply menu |
|
766 aMenuPane->SetItemDimmed( ENotViewerReplyMenu, ETrue ); |
|
767 } |
|
768 aMenuPane->SetItemDimmed( ENotViewerSend, ETrue ); |
|
769 aMenuPane->SetItemDimmed( ENotViewerAddRecipient, ETrue ); |
|
770 |
|
771 CNotViewerDocument* doc = Document( ); |
|
772 |
|
773 CNotMtmUiData* uiData = &doc->MtmUiDataL( ); |
|
774 |
|
775 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
776 |
|
777 // Note: OperationSupportedL returns 0 if operation is supported, |
|
778 // otherwise it returns some kind of error code |
|
779 |
|
780 if( uiData->OperationSupportedL( KMtmUiFunctionFetchMMS, entry ) ) |
|
781 { |
|
782 aMenuPane->SetItemDimmed( ENotViewerRetrieve, ETrue ); |
|
783 } |
|
784 } |
|
785 else |
|
786 { // ForwReq |
|
787 aMenuPane->SetItemDimmed( ENotViewerRetrieve, ETrue ); |
|
788 aMenuPane->SetItemDimmed( ENotViewerReplyMenu, ETrue ); |
|
789 aMenuPane->SetItemDimmed( EFindItemContextMenuPlaceHolder, ETrue ); |
|
790 if ( iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
791 { |
|
792 aMenuPane->SetItemDimmed( ENotViewerSend, ETrue ); |
|
793 aMenuPane->SetItemDimmed( ENotViewerAddRecipient, ETrue ); |
|
794 } |
|
795 // else - send key is always available |
|
796 } |
|
797 LOGTEXT(_L8("NotViewerAppUi: DynInitContextMenuL end")); |
|
798 } |
|
799 |
|
800 // --------------------------------------------------------- |
|
801 // HandleKeyEventL |
|
802 // --------------------------------------------------------- |
|
803 // |
|
804 TKeyResponse CNotViewerAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
805 { |
|
806 LOGTEXT(_L8("NotViewerAppUi: HandleKeyEventL start")); |
|
807 if ( !Document()->IsLaunched() || !iView ) |
|
808 { |
|
809 return EKeyWasNotConsumed; |
|
810 } |
|
811 if ( aType != EEventKey ) |
|
812 { |
|
813 return EKeyWasNotConsumed; |
|
814 } |
|
815 TMsvEntry msvEntry = iMtm->Entry( ).Entry( ); |
|
816 |
|
817 switch ( aKeyEvent.iCode ) |
|
818 { |
|
819 case EKeyBackspace: |
|
820 { |
|
821 if ( msvEntry.ReadOnly( ) || iFlags & ENotViewerIsNotification ) |
|
822 { // We have either a notification or sent FR open |
|
823 CNotViewerDocument* doc = Document( ); |
|
824 CNotMtmUiData* uiData = &doc->MtmUiDataL( ); |
|
825 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
826 if( !uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, entry ) ) |
|
827 { |
|
828 DeleteNotificationL( ); |
|
829 } |
|
830 // We can consume this because Delete is the only possible function here |
|
831 return EKeyWasConsumed; |
|
832 } |
|
833 // else we need to be able to delete characters in To field |
|
834 break; |
|
835 } |
|
836 case EKeyRightArrow: |
|
837 { |
|
838 if ( msvEntry.ReadOnly( ) || iFlags & ENotViewerIsNotification ) |
|
839 { // We have either a notification or sent FR open |
|
840 if( iNaviDecorator |
|
841 && IsNextMessageAvailableL( ETrue ) ) |
|
842 { |
|
843 NextMessageL( ETrue ); |
|
844 } |
|
845 // We can consume this because Next msg is the only possible function here |
|
846 return EKeyWasConsumed; |
|
847 } |
|
848 // else we need to be able to move inside To field |
|
849 break; |
|
850 } |
|
851 case EKeyLeftArrow: |
|
852 { |
|
853 if ( msvEntry.ReadOnly( ) || iFlags & ENotViewerIsNotification ) |
|
854 { // We have either a notification or sent FR open |
|
855 if( iNaviDecorator |
|
856 && IsNextMessageAvailableL( EFalse ) ) |
|
857 { |
|
858 NextMessageL( EFalse ); |
|
859 } |
|
860 // We can consume this because Next msg is the only possible function here |
|
861 return EKeyWasConsumed; |
|
862 } |
|
863 // else we need to be able to move inside To field |
|
864 break; |
|
865 } |
|
866 |
|
867 case EKeyDevice3: //Selection key |
|
868 case EKeyEnter: //Enter Key |
|
869 { |
|
870 if ( DoSelectionKeyL( ) ) |
|
871 { |
|
872 return EKeyWasConsumed; |
|
873 } |
|
874 break; //Lint e527 |
|
875 } |
|
876 case EKeyYes: //Send key |
|
877 { |
|
878 DoHandleSendKeyL( ); |
|
879 return EKeyWasConsumed; |
|
880 } |
|
881 default: |
|
882 break; |
|
883 } |
|
884 return iView->OfferKeyEventL( aKeyEvent, aType ); |
|
885 } |
|
886 |
|
887 // --------------------------------------------------------- |
|
888 // HandleCommandL |
|
889 // --------------------------------------------------------- |
|
890 // |
|
891 void CNotViewerAppUi::HandleCommandL( TInt aCommand ) |
|
892 { |
|
893 LOGTEXT(_L8("NotViewerAppUi: HandleCommandL start")); |
|
894 if ( aCommand != EEikCmdExit && |
|
895 ! Document()->IsLaunched() ) |
|
896 { |
|
897 return; |
|
898 } |
|
899 if ( iFindItemMenu && iFindItemMenu->CommandIsValidL( aCommand ) ) |
|
900 { |
|
901 iFindItemMenu->HandleItemFinderCommandL( aCommand ); |
|
902 return; |
|
903 } |
|
904 switch ( aCommand ) |
|
905 { |
|
906 case ENotViewerRetrieve: |
|
907 { |
|
908 FetchL( ); |
|
909 break; |
|
910 } |
|
911 case ENotViewerForward: |
|
912 { |
|
913 DoForwardL( ); |
|
914 break; |
|
915 } |
|
916 case ENotViewerSend: |
|
917 { |
|
918 DoHandleSendKeyL( ); |
|
919 break; |
|
920 } |
|
921 case ENotViewerReplyViaMessage: |
|
922 case ENotViewerReplyViaAudio: |
|
923 case ENotViewerReplyViaMail: |
|
924 { |
|
925 UniReplyL( aCommand ); |
|
926 break; |
|
927 } |
|
928 case ENotViewerAddRecipient: |
|
929 { |
|
930 AddRecipientL( ); |
|
931 break; |
|
932 } |
|
933 case ENotViewerCheckNames: |
|
934 { |
|
935 CheckNamesL( ); |
|
936 break; |
|
937 } |
|
938 case ENotViewerDelete: |
|
939 { |
|
940 DeleteNotificationL( ); |
|
941 break; |
|
942 } |
|
943 case ENotViewerMessageDetails: |
|
944 { |
|
945 MessageDetailsL( ); |
|
946 break; |
|
947 } |
|
948 case EMsgDispSizeAutomatic: |
|
949 case EMsgDispSizeLarge: |
|
950 case EMsgDispSizeNormal: |
|
951 case EMsgDispSizeSmall: |
|
952 HandleLocalZoomChangeL( (TMsgCommonCommands)aCommand ); |
|
953 break; |
|
954 case EAknCmdHelp: |
|
955 { |
|
956 LaunchHelpL( ); |
|
957 break; |
|
958 } |
|
959 case EEikCmdExit: |
|
960 iExitMode = MApaEmbeddedDocObserver::TExitMode(CMsgEmbeddedEditorWatchingOperation::EMsgExternalExit); |
|
961 // Let it flow thru.. |
|
962 case EAknSoftkeyBack: |
|
963 case EAknSoftkeyClose: |
|
964 case EAknSoftkeyCancel: |
|
965 // system exit |
|
966 Exit( aCommand ); |
|
967 break; |
|
968 default: |
|
969 break; |
|
970 } |
|
971 LOGTEXT(_L8("NotViewerAppUi: HandleCommandL end")); |
|
972 } |
|
973 |
|
974 // --------------------------------------------------------- |
|
975 // DoSelectionKeyL |
|
976 // --------------------------------------------------------- |
|
977 TBool CNotViewerAppUi::DoSelectionKeyL() |
|
978 { |
|
979 if ( iView ) |
|
980 { |
|
981 CMsgBaseControl* ctrl = iView->FocusedControl(); |
|
982 |
|
983 if ( ctrl ) |
|
984 { |
|
985 switch ( FocusedControlId() ) |
|
986 { |
|
987 case EMsgComponentIdTo: |
|
988 { |
|
989 if( iFlags & ENotViewerIsNotification ) |
|
990 { // We have a notification, we should handle recipients |
|
991 CMsgAddressControl* to = AddressControl( ); |
|
992 // Check is there any recipients in address ctrl |
|
993 TBool modified = EFalse; |
|
994 if ( to->GetRecipientsL()->Count() ) |
|
995 { |
|
996 // Recipients found. Verify addresses. |
|
997 if ( !VerifyAddressesL( modified ) ) |
|
998 { |
|
999 // Illegal address found. |
|
1000 modified = ETrue; |
|
1001 } |
|
1002 } |
|
1003 if ( !modified )//else |
|
1004 { |
|
1005 // Nothing changed on the UI. Open PhoneBook. |
|
1006 AddRecipientL(); |
|
1007 } |
|
1008 break; // break only if notification |
|
1009 } |
|
1010 else // If we are in Forward Request, it's ok to go down to menubar |
|
1011 { |
|
1012 return EFalse; |
|
1013 } |
|
1014 } |
|
1015 case EMsgComponentIdFrom: |
|
1016 case EMsgComponentIdBody: |
|
1017 { |
|
1018 MenuBar()->SetMenuTitleResourceId( R_NOTVIEWER_SELECTIONMENUBAR ); |
|
1019 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
1020 TRAPD( err, MenuBar()->TryDisplayMenuBarL() ); |
|
1021 MenuBar()->SetMenuTitleResourceId( R_NOTVIEWER_MENU ); |
|
1022 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
1023 User::LeaveIfError( err ); |
|
1024 } |
|
1025 break; |
|
1026 |
|
1027 default: |
|
1028 break; |
|
1029 } |
|
1030 } |
|
1031 } |
|
1032 return ETrue; |
|
1033 } |
|
1034 |
|
1035 // --------------------------------------------------------- |
|
1036 // DoHandleSendKeyL |
|
1037 // --------------------------------------------------------- |
|
1038 // |
|
1039 void CNotViewerAppUi::DoHandleSendKeyL() |
|
1040 { |
|
1041 if( iFlags & ENotViewerIsNotification ) |
|
1042 { // We have a notification, we should call to sender |
|
1043 CallToNumberL( ); |
|
1044 } |
|
1045 else if ( !iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
1046 { // We are not-readonly Forward Request -> Send is possible |
|
1047 |
|
1048 // Disable dialer |
|
1049 iAvkonAppUi->SetKeyEventFlags( |
|
1050 CAknAppUiBase::EDisableSendKeyShort | |
|
1051 CAknAppUiBase::EDisableSendKeyLong ); |
|
1052 |
|
1053 // CallCreationKey: Send message if recipients. |
|
1054 // Otherwise fetch recipients |
|
1055 CMsgAddressControl* to = AddressControl(); |
|
1056 |
|
1057 if ( to->GetRecipientsL()->Count() > 0 ) |
|
1058 { |
|
1059 // has addresses -> Send |
|
1060 SendL(); |
|
1061 } |
|
1062 else |
|
1063 { |
|
1064 AddRecipientL(); |
|
1065 } |
|
1066 } |
|
1067 } |
|
1068 |
|
1069 // --------------------------------------------------------- |
|
1070 // FetchL |
|
1071 // --------------------------------------------------------- |
|
1072 // |
|
1073 void CNotViewerAppUi::FetchL( ) |
|
1074 { |
|
1075 LOGTEXT(_L8("NotViewerAppUi: Fetch start")); |
|
1076 if( !(iFlags & ENotViewerIsNotification) ) |
|
1077 { // We are in forward request |
|
1078 return; |
|
1079 } |
|
1080 |
|
1081 if( iFlags & ENotViewerOffline |
|
1082 && MsvUiServiceUtilitiesInternal::IsPhoneOfflineL() ) |
|
1083 { // We are in offline at the moment -> Infonote & exit |
|
1084 ShowInformationNoteL( R_NOTVIEWER_OFFLINE_NOT_POSSIBLE, EFalse ); |
|
1085 DoDelayedExitL( KDelayedExitDelay ); |
|
1086 return; |
|
1087 } |
|
1088 |
|
1089 if( !CheckAPSettingsL( ) ) |
|
1090 { |
|
1091 return; |
|
1092 } |
|
1093 TTime currentTime; |
|
1094 currentTime.HomeTime( ); |
|
1095 TTime expiryTime = iMtm->ExpiryDate( ); |
|
1096 TLocale locale; |
|
1097 expiryTime += locale.UniversalTimeOffset(); |
|
1098 if (locale.QueryHomeHasDaylightSavingOn()) |
|
1099 { |
|
1100 TTimeIntervalHours daylightSaving(1); |
|
1101 expiryTime += daylightSaving; |
|
1102 } |
|
1103 |
|
1104 if( currentTime > expiryTime ) |
|
1105 { // Message is expired |
|
1106 if ( !ShowConfirmationQueryL( R_NOTVIEWER_QUEST_MSG_EXPIRED ) ) |
|
1107 { // User did not want to fetch expired message |
|
1108 return; |
|
1109 } |
|
1110 } |
|
1111 |
|
1112 CAknInputBlock* abs = CAknInputBlock::NewLC( ); |
|
1113 |
|
1114 ShowInformationNoteL( R_NOTVIEWER_RETRIEVING_MESSAGE, EFalse ); |
|
1115 |
|
1116 TMsvId entryId = iMtm->Entry( ).Entry( ).Id( ); |
|
1117 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
1118 |
|
1119 CMsvEntrySelection* sel = new ( ELeave ) CMsvEntrySelection; |
|
1120 CleanupStack::PushL( sel ); |
|
1121 sel->AppendL( entryId ); |
|
1122 |
|
1123 CMsvOperation* op = iMtm->FetchMessagesL( *sel, wait->iStatus ); |
|
1124 |
|
1125 if( !op ) |
|
1126 { |
|
1127 CleanupStack::PopAndDestroy( sel ); // selection |
|
1128 CleanupStack::PopAndDestroy( wait ); // wait |
|
1129 CleanupStack::PopAndDestroy( abs ); // abs |
|
1130 return; |
|
1131 } |
|
1132 |
|
1133 CleanupStack::PushL( op ); |
|
1134 wait->Start(); |
|
1135 |
|
1136 // Lets ignore the return value of wait |
|
1137 |
|
1138 CleanupStack::PopAndDestroy( op ); // op |
|
1139 CleanupStack::PopAndDestroy( sel ); // selection |
|
1140 CleanupStack::PopAndDestroy( wait ); // wait |
|
1141 CleanupStack::PopAndDestroy( abs ); // abs |
|
1142 LOGTEXT(_L8("NotViewerAppUi: Fetch end")); |
|
1143 // Let information note time to exit |
|
1144 DoDelayedExitL( KDelayedExitDelay ); |
|
1145 } |
|
1146 |
|
1147 // --------------------------------------------------------- |
|
1148 // DoForwardL |
|
1149 // --------------------------------------------------------- |
|
1150 // |
|
1151 void CNotViewerAppUi::DoForwardL( ) |
|
1152 { |
|
1153 LOGTEXT(_L8("NotViewerAppUi: ForwardL start")); |
|
1154 if( !(iFlags & ENotViewerIsNotification) ) |
|
1155 { // We are in forward request |
|
1156 return; |
|
1157 } |
|
1158 |
|
1159 // Lets check the disk space |
|
1160 if ( MsvUiServiceUtilities::DiskSpaceBelowCriticalLevelL( |
|
1161 Document()->Session( ), |
|
1162 KReplyToSenderSize ) ) |
|
1163 { |
|
1164 User::Leave( KErrDiskFull ); |
|
1165 } |
|
1166 |
|
1167 if( !CheckAPSettingsL( ) ) |
|
1168 { |
|
1169 return; |
|
1170 } |
|
1171 |
|
1172 TTime currentTime; |
|
1173 currentTime.HomeTime( ); |
|
1174 TTime expiryTime = iMtm->ExpiryDate( ); |
|
1175 TLocale locale; |
|
1176 expiryTime += locale.UniversalTimeOffset(); |
|
1177 if (locale.QueryHomeHasDaylightSavingOn()) |
|
1178 { |
|
1179 TTimeIntervalHours daylightSaving(1); |
|
1180 expiryTime += daylightSaving; |
|
1181 } |
|
1182 |
|
1183 if( currentTime > expiryTime ) |
|
1184 { // Message is expired |
|
1185 if ( !ShowConfirmationQueryL( R_NOTVIEWER_QUEST_MSG_EXPIRED ) ) |
|
1186 { |
|
1187 // User did not want to forward expired message |
|
1188 return; |
|
1189 } |
|
1190 } |
|
1191 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
1192 if( ! ( entry.iMtmData2 & KMmsStoredInMMBox ) ) |
|
1193 { // Query, if multiple forward is not possible |
|
1194 if ( !ShowConfirmationQueryL( R_NOTVIEWER_QUEST_FORWARD_NOTIF ) ) |
|
1195 { |
|
1196 // User did not want forward message, as it cannot not be fetched to the phone after that |
|
1197 return; |
|
1198 } |
|
1199 } |
|
1200 |
|
1201 TRAPD ( error, |
|
1202 { |
|
1203 ForwardL( Document()->DefaultMsgFolder() ); //Draft |
|
1204 } ); //end TRAP |
|
1205 if ( error ) |
|
1206 { |
|
1207 User::Leave( error ); |
|
1208 } |
|
1209 iMtm->Entry( ).SetEntryL( iMsgId ); |
|
1210 TRAP_IGNORE( iMtm->LoadMessageL( ) ); |
|
1211 EntryChangedL( ); |
|
1212 LOGTEXT(_L8("NotViewerAppUi: ForwardL end")); |
|
1213 } |
|
1214 |
|
1215 // --------------------------------------------------------- |
|
1216 // SendL |
|
1217 // --------------------------------------------------------- |
|
1218 // |
|
1219 void CNotViewerAppUi::SendL( ) |
|
1220 { |
|
1221 LOGTEXT(_L8("NotViewerAppUi: SendL start")); |
|
1222 if( iFlags & ENotViewerIsNotification ) |
|
1223 { // We are in notification |
|
1224 return; |
|
1225 } |
|
1226 TBool dummy; |
|
1227 if ( !VerifyAddressesL( dummy ) ) |
|
1228 { |
|
1229 return; |
|
1230 } |
|
1231 |
|
1232 // For eating key presses |
|
1233 CAknInputBlock* abs = CAknInputBlock::NewLC( ); |
|
1234 |
|
1235 DoSaveL( ); |
|
1236 |
|
1237 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
1238 CMsvOperation* op = iMtm->SendL( wait->iStatus ); |
|
1239 |
|
1240 if( !op ) |
|
1241 { |
|
1242 CleanupStack::PopAndDestroy( wait ); |
|
1243 CleanupStack::PopAndDestroy( abs ); |
|
1244 return; |
|
1245 } |
|
1246 |
|
1247 CleanupStack::PushL( op ); |
|
1248 wait->Start(); |
|
1249 |
|
1250 // Let's ignore the return value of wait |
|
1251 |
|
1252 CleanupStack::PopAndDestroy( 2 ); // op, wait |
|
1253 |
|
1254 CleanupStack::PopAndDestroy( abs ); |
|
1255 if( iFlags & ENotViewerOffline |
|
1256 && MsvUiServiceUtilitiesInternal::IsPhoneOfflineL() ) |
|
1257 { // We are in offline at the moment -> Infonote |
|
1258 ShowInformationNoteL( R_NOTVIEWER_SAVED_OUTBOX, EFalse ); |
|
1259 DoDelayedExitL( KDelayedExitDelay ); |
|
1260 LOGTEXT(_L8("NotViewerAppUi: Offline SendL end")); |
|
1261 return; |
|
1262 } |
|
1263 |
|
1264 LOGTEXT(_L8("NotViewerAppUi: SendL end")); |
|
1265 Exit( EAknSoftkeyBack ); |
|
1266 } |
|
1267 |
|
1268 // --------------------------------------------------------- |
|
1269 // UniReplyL |
|
1270 // --------------------------------------------------------- |
|
1271 // |
|
1272 void CNotViewerAppUi::UniReplyL( TInt aCommand ) |
|
1273 { |
|
1274 LOGTEXT(_L8("NotViewerAppUi: ReplyL start")); |
|
1275 if( !(iFlags & ENotViewerIsNotification) ) |
|
1276 { // We are in forward request |
|
1277 return; |
|
1278 } |
|
1279 |
|
1280 // Lets check the disk space |
|
1281 if ( MsvUiServiceUtilities::DiskSpaceBelowCriticalLevelL( |
|
1282 Document()->Session( ), |
|
1283 KReplyToSenderSize ) ) |
|
1284 { |
|
1285 User::Leave( KErrDiskFull ); |
|
1286 } |
|
1287 |
|
1288 CMessageData* msgData = CMessageData::NewLC(); |
|
1289 |
|
1290 const TPtrC sender = iMtm->Sender(); |
|
1291 |
|
1292 if ( sender != KNullDesC() ) |
|
1293 { |
|
1294 TMsvEntry entry = iMtm->Entry().Entry(); |
|
1295 |
|
1296 if ( sender.Compare( entry.iDetails ) ) |
|
1297 { |
|
1298 msgData->AppendToAddressL( TMmsGenUtils::PureAddress( sender ), *iAlias ); |
|
1299 } |
|
1300 else |
|
1301 { |
|
1302 msgData->AppendToAddressL( TMmsGenUtils::PureAddress( sender ), |
|
1303 TMmsGenUtils::Alias( sender ) ); |
|
1304 } |
|
1305 } |
|
1306 |
|
1307 // audio message has not subject field |
|
1308 if( aCommand != ENotViewerReplyViaAudio ) |
|
1309 { |
|
1310 HBufC* prefixSubject = CreateSubjectPrefixStringL( iMtm->SubjectL(), ETrue ); |
|
1311 CleanupStack::PushL( prefixSubject ); |
|
1312 if ( prefixSubject ) |
|
1313 { |
|
1314 msgData->SetSubjectL( prefixSubject ); |
|
1315 } |
|
1316 else |
|
1317 { |
|
1318 TPtrC subjectDes = iMtm->SubjectL(); |
|
1319 msgData->SetSubjectL( &subjectDes ); |
|
1320 } |
|
1321 CleanupStack::PopAndDestroy( prefixSubject ); |
|
1322 } |
|
1323 |
|
1324 |
|
1325 TUid mtmUid = KSenduiMtmUniMessageUid; |
|
1326 switch ( aCommand ) |
|
1327 { |
|
1328 case ENotViewerReplyViaAudio: |
|
1329 mtmUid = KSenduiMtmAudioMessageUid; |
|
1330 break; |
|
1331 case ENotViewerReplyViaMail: |
|
1332 mtmUid = KSenduiMtmSmtpUid; |
|
1333 break; |
|
1334 case ENotViewerReplyViaMessage: |
|
1335 default: |
|
1336 if( iFlags & ENotViewerRestrictedReply ) |
|
1337 { |
|
1338 mtmUid = KSenduiMtmMmsUid; |
|
1339 } |
|
1340 break; |
|
1341 } |
|
1342 |
|
1343 // And do the sending |
|
1344 TInt error; |
|
1345 TRAP ( error, |
|
1346 { |
|
1347 iSendUi->CreateAndSendMessageL( |
|
1348 mtmUid, |
|
1349 msgData); |
|
1350 } ); //TRAP |
|
1351 |
|
1352 CleanupStack::PopAndDestroy( msgData ); // msgData |
|
1353 |
|
1354 if ( error ) |
|
1355 { |
|
1356 iMtm->Entry( ).SetEntryL( iMsgId ); |
|
1357 TRAP_IGNORE( iMtm->LoadMessageL() ); |
|
1358 EntryChangedL( ); |
|
1359 LOGTEXT(_L8("NotViewerAppUi: Reply end error")); |
|
1360 User::Leave( error ); |
|
1361 } |
|
1362 else |
|
1363 { |
|
1364 LOGTEXT(_L8("NotViewerAppUi: Reply end success")); |
|
1365 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1366 { |
|
1367 Exit( EAknSoftkeyBack ); |
|
1368 } |
|
1369 } |
|
1370 } |
|
1371 |
|
1372 // --------------------------------------------------------- |
|
1373 // DeleteNotificationL |
|
1374 // --------------------------------------------------------- |
|
1375 // |
|
1376 void CNotViewerAppUi::DeleteNotificationL() |
|
1377 { |
|
1378 LOGTEXT(_L8("NotViewerAppUi: Delete start")); |
|
1379 __ASSERT_DEBUG( iOperation == NULL, Panic( ENotViewerOperationNotFinished ) ); |
|
1380 CMsgEditorDocument* doc = Document( ); |
|
1381 CNotMtmUi* uiMtm = static_cast<CNotMtmUi*>( &doc->MtmUi( ) ); |
|
1382 |
|
1383 |
|
1384 if( iFlags & ENotViewerIsNotification ) |
|
1385 { // This is a notification -> lets see if we have options |
|
1386 LOGTEXT(_L8("NotViewerAppUi: Delete: We r dealing with a notification")); |
|
1387 |
|
1388 TBool inboxNotification = EFalse; |
|
1389 |
|
1390 if( iMtm->Entry().Entry().Parent() == KMsvGlobalInBoxIndexEntryId ) |
|
1391 {// Are we in Inbox now |
|
1392 inboxNotification = ETrue; |
|
1393 LOGTEXT(_L8("NotViewerAppUi: Delete: in Inbox")); |
|
1394 } |
|
1395 |
|
1396 if( inboxNotification && uiMtm->DeleteQueryRequiredByMtm( ) && !AlreadyDeletedFromServer( ) ) |
|
1397 { // We are in Inbox, delete options supported and not deleted from server |
|
1398 LOGTEXT(_L8("NotViewerAppUi: Delete: Lets show the delete options")); |
|
1399 TInt index = 0; |
|
1400 |
|
1401 CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &index ); |
|
1402 dlg->PrepareLC( R_NOTVIEWER_DELETE_FROM_QUERY ); |
|
1403 |
|
1404 // Populate list query array |
|
1405 CDesCArrayFlat *array = new(ELeave) CDesCArrayFlat(2); |
|
1406 CleanupStack::PushL(array); |
|
1407 HBufC* buf = StringLoader::LoadLC( R_NOTVIEWER_DELETE_QUERY_REMOTEONLY ); |
|
1408 array->AppendL( *buf ); |
|
1409 CleanupStack::PopAndDestroy(); //buf |
|
1410 buf = StringLoader::LoadLC( R_NOTVIEWER_DELETE_QUERY_BOTHLOCALANDREMOTE ); |
|
1411 array->AppendL( *buf ); |
|
1412 CleanupStack::PopAndDestroy(); //buf |
|
1413 dlg->SetItemTextArray( array ); |
|
1414 CleanupStack::Pop(); //array |
|
1415 |
|
1416 LOGTEXT(_L8("NotViewerAppUi: Delete: Next asks the delete options")); |
|
1417 TInt queryOk = dlg->RunLD(); |
|
1418 if( queryOk ) |
|
1419 { |
|
1420 /* list query approved, index is usable to see what list item was selected */ |
|
1421 if( index == 0 ) |
|
1422 { |
|
1423 iFlags &= ~ENotViewerDeleteBoth; |
|
1424 LOGTEXT(_L8("NotViewerAppUi: Delete: Just the server")); |
|
1425 } |
|
1426 else |
|
1427 { // If action withe server was selected, keep it in mind |
|
1428 iFlags |= ENotViewerDeleteBoth; |
|
1429 LOGTEXT(_L8("NotViewerAppUi: Delete: Both ones")); |
|
1430 } |
|
1431 // The deletion process starts a bit later |
|
1432 } |
|
1433 else |
|
1434 { |
|
1435 // list query was cancelled -> just return |
|
1436 LOGTEXT(_L8("NotViewerAppUi: Delete: Query cancelled")); |
|
1437 return; |
|
1438 } |
|
1439 } |
|
1440 else |
|
1441 { // In this case we need just a query "Delete message?" |
|
1442 LOGTEXT(_L8("NotViewerAppUi: Delete: Show just Delete message?")); |
|
1443 if( ShowConfirmationQueryL( R_NOTVIEWER_QUEST_DELETE_MESSAGE ) ) |
|
1444 { // Delete message confirmed |
|
1445 LOGTEXT(_L8("NotViewerAppUi: Delete: Answered Yes")); |
|
1446 if( inboxNotification ) |
|
1447 { |
|
1448 // We are in Inbox, so it means we delete just the local one |
|
1449 LOGTEXT(_L8("NotViewerAppUi: Delete: Inbox notification again")); |
|
1450 CAknInputBlock* abs = CAknInputBlock::NewLC( ); |
|
1451 |
|
1452 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1453 CleanupStack::PushL( selection ); |
|
1454 selection->AppendL( iMtm->Entry().EntryId() ); |
|
1455 |
|
1456 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
1457 |
|
1458 LOGTEXT(_L8("NotViewerAppUi: Delete: Inbox locl deletion starts")); |
|
1459 CMsvOperation* deleteop = iMtm->DeleteNotificationL( |
|
1460 *selection, |
|
1461 EMmsDeleteNotificationOnly, |
|
1462 wait->iStatus ); |
|
1463 |
|
1464 LOGTEXT(_L8("NotViewerAppUi: Delete: and goes on..")); |
|
1465 if( !deleteop ) // Check this just in case |
|
1466 { |
|
1467 CleanupStack::PopAndDestroy( wait ); |
|
1468 CleanupStack::PopAndDestroy( selection ); |
|
1469 CleanupStack::PopAndDestroy( abs ); |
|
1470 LOGTEXT(_L8("NotViewerAppUi: Delete: NULL returned")); |
|
1471 return; |
|
1472 } |
|
1473 |
|
1474 CleanupStack::PushL( deleteop ); |
|
1475 wait->Start(); |
|
1476 |
|
1477 if( wait->iStatus != KErrNone ) |
|
1478 { |
|
1479 LOGTEXT(_L8("NotViewerAppUi: Delete: Wait->iStatus != KErrNone ")); |
|
1480 CleanupStack::PopAndDestroy( 3 ); // op, wait, sel |
|
1481 CleanupStack::PopAndDestroy( abs ); |
|
1482 return; |
|
1483 } |
|
1484 |
|
1485 // -> no error, we can exit the viewer |
|
1486 CleanupStack::PopAndDestroy( 3 ); // op, wait, sel |
|
1487 CleanupStack::PopAndDestroy( abs ); |
|
1488 // This was the local deletion so lets just exit from here |
|
1489 LOGTEXT(_L8("NotViewerAppUi: Delete: Local delete succesfull - exit")); |
|
1490 Exit( EAknSoftkeyBack ); |
|
1491 } |
|
1492 else |
|
1493 { |
|
1494 // else we are in MMBoxFolder and we can continue |
|
1495 // there we always need action with server and local |
|
1496 LOGTEXT(_L8("NotViewerAppUi: Delete: We have mmbox notification")); |
|
1497 iFlags |= ENotViewerDeleteBoth; |
|
1498 } |
|
1499 } |
|
1500 else |
|
1501 { // Answer was NO. |
|
1502 return; |
|
1503 } |
|
1504 } |
|
1505 // OK, now we are either in Inbox and chose some action related to server |
|
1506 // or we are in MMBoxView and wanted to delete a message in there.. |
|
1507 |
|
1508 if( !CheckAPSettingsL( ) ) |
|
1509 { // Are the settings OK |
|
1510 return; |
|
1511 } |
|
1512 LOGTEXT(_L8("NotViewerAppUi: Delete: AP Checked")); |
|
1513 // Just in case to make sure after checking settings |
|
1514 iMtm->Entry( ).SetEntryL( iMsgId ); |
|
1515 iMtm->LoadMessageL( ); |
|
1516 |
|
1517 if( iFlags & ENotViewerOffline |
|
1518 && MsvUiServiceUtilitiesInternal::IsPhoneOfflineL() ) |
|
1519 { // We are in offline at the moment -> Infonote and return |
|
1520 ShowInformationNoteL( R_NOTVIEWER_OFFLINE_NOT_POSSIBLE, EFalse ); |
|
1521 return; |
|
1522 } |
|
1523 LOGTEXT(_L8("NotViewerAppUi: Delete: Not Offline")); |
|
1524 |
|
1525 // OK, lets go on with the deletion process |
|
1526 CAknInputBlock* abs = CAknInputBlock::NewLC( ); |
|
1527 |
|
1528 CMsvSingleOpWatcher* singleOpWatcher=CMsvSingleOpWatcher::NewL(*this); |
|
1529 CleanupStack::PushL(singleOpWatcher); |
|
1530 |
|
1531 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1532 CleanupStack::PushL( selection ); |
|
1533 selection->AppendL( iMtm->Entry().EntryId() ); |
|
1534 |
|
1535 CMsvProgressReporterOperation* reporter = |
|
1536 CMsvProgressReporterOperation::NewL( |
|
1537 doc->Session(), |
|
1538 singleOpWatcher->iStatus, |
|
1539 EMbmAvkonQgn_note_erased ); |
|
1540 CleanupStack::PushL(reporter); |
|
1541 |
|
1542 LOGTEXT(_L8("NotViewerAppUi: Delete: Call unscheduled delete")); |
|
1543 CMsvOperation* deleteop = iMtm->UnscheduledDeleteNotificationL( |
|
1544 *selection, |
|
1545 EMmsDeleteMMBoxOnly, |
|
1546 reporter->RequestStatus() ); |
|
1547 LOGTEXT(_L8("NotViewerAppUi: Delete: End of call")); |
|
1548 reporter->SetProgressDecoder( *this ); |
|
1549 reporter->SetOperationL( deleteop ); // Takes immediate ownership |
|
1550 CleanupStack::Pop( reporter ); //reporter |
|
1551 CleanupStack::PopAndDestroy( selection); // selection ownership moved to reporter? |
|
1552 CleanupStack::Pop( singleOpWatcher ); |
|
1553 |
|
1554 iOperation = singleOpWatcher; |
|
1555 LOGTEXT(_L8("NotViewerAppUi: Delete: Set operation")); |
|
1556 iOperation->SetOperation( reporter ); |
|
1557 |
|
1558 CleanupStack::PopAndDestroy( abs ); |
|
1559 } |
|
1560 else if( !iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
1561 { // New Forward Request: It's not been saved -> just Exit |
|
1562 if( ShowConfirmationQueryL( R_NOTVIEWER_QUEST_DELETE_MESSAGE ) ) |
|
1563 { |
|
1564 Exit( EAknSoftkeyBack ); |
|
1565 } |
|
1566 } |
|
1567 else |
|
1568 { // We have an open Sent Forward Request open |
|
1569 if( ShowConfirmationQueryL( R_NOTVIEWER_QUEST_DELETE_MESSAGE ) ) |
|
1570 { |
|
1571 DeleteAndExitL( ); |
|
1572 } |
|
1573 } |
|
1574 LOGTEXT(_L8("NotViewerAppUi: Delete: End")); |
|
1575 } |
|
1576 |
|
1577 // --------------------------------------------------------- |
|
1578 // CallToNumberL |
|
1579 // --------------------------------------------------------- |
|
1580 // |
|
1581 void CNotViewerAppUi::CallToNumberL() |
|
1582 { |
|
1583 if( !(iFlags & ENotViewerIsNotification) ) |
|
1584 { // We are in forward request |
|
1585 return; |
|
1586 } |
|
1587 if ( !iMsgVoIPExtension ) |
|
1588 { |
|
1589 iMsgVoIPExtension = CMsgVoIPExtension::NewL(); |
|
1590 } |
|
1591 |
|
1592 TPtrC senderAddr = KNullDesC( ); |
|
1593 TPtrC senderAlias = KNullDesC( ); |
|
1594 TPtrC focusedAddr = KNullDesC( ); |
|
1595 TBool dialerDisabled = EFalse; |
|
1596 |
|
1597 senderAddr.Set( TMmsGenUtils::PureAddress( iMtm->Sender() ) ); |
|
1598 if ( iAlias ) |
|
1599 { |
|
1600 senderAlias.Set( *iAlias ); |
|
1601 } |
|
1602 |
|
1603 if ( FocusedControlId( ) == EMsgComponentIdBody |
|
1604 && iView |
|
1605 && iView->ItemFinder( ) ) |
|
1606 { |
|
1607 const CItemFinder::CFindItemExt& item = |
|
1608 iView->ItemFinder( )->CurrentItemExt( ); |
|
1609 if ( item.iItemDescriptor |
|
1610 && ( item.iItemType == CItemFinder::EPhoneNumber |
|
1611 || item.iItemType == CItemFinder::EEmailAddress ) ) |
|
1612 { |
|
1613 if ( item.iItemType == CItemFinder::EPhoneNumber ) |
|
1614 { |
|
1615 // Disable dialer |
|
1616 iAvkonAppUi->SetKeyEventFlags( |
|
1617 CAknAppUiBase::EDisableSendKeyShort | |
|
1618 CAknAppUiBase::EDisableSendKeyLong ); |
|
1619 dialerDisabled = ETrue; |
|
1620 } |
|
1621 focusedAddr.Set( *(item.iItemDescriptor) ); |
|
1622 } |
|
1623 } |
|
1624 |
|
1625 if ( FocusedControlId( ) == EMsgComponentIdFrom && |
|
1626 senderAddr.Length() && |
|
1627 iSenderType == EMuiuAddressTypePhoneNumber ) |
|
1628 { |
|
1629 // Disable dialer |
|
1630 iAvkonAppUi->SetKeyEventFlags( |
|
1631 CAknAppUiBase::EDisableSendKeyShort | |
|
1632 CAknAppUiBase::EDisableSendKeyLong ); |
|
1633 dialerDisabled = ETrue; |
|
1634 } |
|
1635 // Only when dialer is disabled try placing the call |
|
1636 if ( dialerDisabled ) |
|
1637 { |
|
1638 MsvUiServiceUtilitiesInternal::InternetOrVoiceCallServiceL( |
|
1639 *iMsgVoIPExtension, |
|
1640 senderAddr, |
|
1641 senderAlias, |
|
1642 focusedAddr, |
|
1643 ETrue, |
|
1644 iEikonEnv ); |
|
1645 } |
|
1646 } |
|
1647 |
|
1648 |
|
1649 // --------------------------------------------------------- |
|
1650 // MessageDetailsL |
|
1651 // --------------------------------------------------------- |
|
1652 // |
|
1653 void CNotViewerAppUi::MessageDetailsL( ) |
|
1654 { |
|
1655 LOGTEXT(_L8("NotViewerAppUi: Details start")); |
|
1656 //These are not used! They just have to be there. |
|
1657 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1658 CleanupStack::PushL( selection ); |
|
1659 TBuf8<1> param; |
|
1660 param.Zero(); |
|
1661 |
|
1662 CAknInputBlock::NewLC( ); |
|
1663 |
|
1664 CMsvSingleOpWatcher* watch = CMsvSingleOpWatcher::NewLC( *Document() ); |
|
1665 |
|
1666 CMsgEditorDocument* doc = Document( ); |
|
1667 |
|
1668 CMsgAddressControl* cntrl = AddressControl( ); |
|
1669 |
|
1670 if ( !cntrl ) |
|
1671 { |
|
1672 return; |
|
1673 } |
|
1674 |
|
1675 CNotMtmUi* uiMtm = static_cast<CNotMtmUi*>( &doc->MtmUi( ) ); |
|
1676 |
|
1677 if ( !(iFlags & ENotViewerIsNotification) ) |
|
1678 { |
|
1679 // Need to save only if addresses are changed. |
|
1680 if ( cntrl && cntrl->IsModified() ) |
|
1681 { |
|
1682 iAddressHandler->CopyAddressesToMtmL( EMsvRecipientTo ); |
|
1683 iMtm->SaveMessageL(); |
|
1684 } |
|
1685 } |
|
1686 |
|
1687 CMsvOperation* op = uiMtm->InvokeAsyncFunctionL( |
|
1688 KMtmUiFunctionMessageInfo, |
|
1689 *selection, |
|
1690 watch->iStatus, |
|
1691 param ); |
|
1692 CleanupStack::Pop(); // watch |
|
1693 Document()->AddSingleOperationL( op, watch ); |
|
1694 |
|
1695 CleanupStack::PopAndDestroy( 2 ); // selection, CAknInputBlock |
|
1696 LOGTEXT(_L8("NotViewerAppUi: Details end")); |
|
1697 } |
|
1698 |
|
1699 // --------------------------------------------------------- |
|
1700 // AddRecipientL |
|
1701 // --------------------------------------------------------- |
|
1702 // |
|
1703 void CNotViewerAppUi::AddRecipientL( ) |
|
1704 { |
|
1705 LOGTEXT(_L8("NotViewerAppUi: AddRecipient start")); |
|
1706 if( iFlags & ENotViewerIsNotification ) |
|
1707 { // We are in notification |
|
1708 return; |
|
1709 } |
|
1710 |
|
1711 TBool invalid = EFalse; |
|
1712 |
|
1713 TBool addressesAdded = iAddressHandler->AddRecipientL( invalid ); |
|
1714 |
|
1715 if ( addressesAdded ) |
|
1716 { |
|
1717 |
|
1718 Document()->SetHeaderModified( ETrue ); |
|
1719 |
|
1720 CMsgAddressControl* to = NULL; |
|
1721 to = AddressControl( ); |
|
1722 |
|
1723 if ( iView->FocusedControl() != to ) |
|
1724 { |
|
1725 // Focus was not in address control -> Move it |
|
1726 iView->SetFocus( EMsgComponentIdTo ); |
|
1727 } |
|
1728 } |
|
1729 LOGTEXT(_L8("NotViewerAppUi: AddRecipient end")); |
|
1730 } |
|
1731 |
|
1732 |
|
1733 // --------------------------------------------------------- |
|
1734 // CheckNamesL |
|
1735 // --------------------------------------------------------- |
|
1736 // |
|
1737 void CNotViewerAppUi::CheckNamesL( ) |
|
1738 { |
|
1739 LOGTEXT(_L8("NotViewerAppUi: CheckNamesL start")); |
|
1740 if( iFlags & ENotViewerIsNotification ) |
|
1741 { // We are in notification |
|
1742 return; |
|
1743 } |
|
1744 TBool dummy; |
|
1745 VerifyAddressesL( dummy ); |
|
1746 } |
|
1747 |
|
1748 // --------------------------------------------------------- |
|
1749 // VerifyAddressesL |
|
1750 // --------------------------------------------------------- |
|
1751 // |
|
1752 TBool CNotViewerAppUi::VerifyAddressesL( TBool& aModified ) |
|
1753 { |
|
1754 LOGTEXT(_L8("NotViewerAppUi: VerifyAddresses start")); |
|
1755 if( iFlags & ENotViewerIsNotification ) |
|
1756 { // We are in notification |
|
1757 return EFalse; |
|
1758 } |
|
1759 aModified = EFalse; |
|
1760 TBool retVal = iAddressHandler->VerifyAddressesL( aModified ); |
|
1761 if ( aModified ) |
|
1762 { |
|
1763 Document()->SetHeaderModified( ETrue ); |
|
1764 } |
|
1765 LOGTEXT(_L8("NotViewerAppUi: VerifyAddressesL end")); |
|
1766 return retVal; |
|
1767 } |
|
1768 |
|
1769 |
|
1770 // --------------------------------------------------------- |
|
1771 // RichText |
|
1772 // --------------------------------------------------------- |
|
1773 // |
|
1774 CRichText& CNotViewerAppUi::RichText() const |
|
1775 { |
|
1776 CMsgBaseControl* baseControl = iView->ControlById( |
|
1777 EMsgComponentIdBody ); |
|
1778 CMsgBodyControl* bodyControl = STATIC_CAST( |
|
1779 CMsgBodyControl*, |
|
1780 baseControl ); |
|
1781 return bodyControl->TextContent( ); |
|
1782 } |
|
1783 |
|
1784 // --------------------------------------------------------- |
|
1785 // DoSaveL |
|
1786 // --------------------------------------------------------- |
|
1787 // |
|
1788 void CNotViewerAppUi::DoSaveL( ) |
|
1789 { |
|
1790 LOGTEXT(_L8("NotViewerAppUi: DoSaveL start")); |
|
1791 iMtm = &(Document()->Mtm()); |
|
1792 if( !(iFlags & ENotViewerIsNotification) && !iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
1793 { |
|
1794 iAddressHandler->CopyAddressesToMtmL( EMsvRecipientTo ); |
|
1795 |
|
1796 iMtm->SaveMessageL(); |
|
1797 |
|
1798 TMmsMsvEntry tEntry = static_cast<TMmsMsvEntry>( Document()->Entry() ); |
|
1799 |
|
1800 TBuf<KMaxDetailsLength> detailsBuf; |
|
1801 iAddressHandler->MakeDetailsL( detailsBuf ); |
|
1802 tEntry.iDetails.Set( detailsBuf ); |
|
1803 if ( !tEntry.EditorOriented() ) |
|
1804 { |
|
1805 tEntry.SetEditorOriented( ETrue ); |
|
1806 } |
|
1807 tEntry.iDate.UniversalTime(); |
|
1808 |
|
1809 if ( !tEntry.Visible() ) |
|
1810 { |
|
1811 // Save from close or exit save. |
|
1812 // Message should be visible after save |
|
1813 tEntry.SetVisible( ETrue ); |
|
1814 tEntry.SetInPreparation( EFalse ); |
|
1815 } |
|
1816 Document()->CurrentEntry().ChangeL( tEntry ); |
|
1817 |
|
1818 Document()->SetHeaderModified( EFalse ); |
|
1819 } |
|
1820 LOGTEXT(_L8("NotViewerAppUi: DoSaveL end")); |
|
1821 } |
|
1822 |
|
1823 // --------------------------------------------------------- |
|
1824 // DoMsgSaveExitL |
|
1825 // --------------------------------------------------------- |
|
1826 // |
|
1827 void CNotViewerAppUi::DoMsgSaveExitL( ) |
|
1828 { |
|
1829 LOGTEXT(_L8("NotViewerAppUi: DoMsgSaveExitL")); |
|
1830 Exit( EAknSoftkeyBack ); |
|
1831 } |
|
1832 |
|
1833 // --------------------------------------------------------- |
|
1834 // HandleEntryDeletedL |
|
1835 // --------------------------------------------------------- |
|
1836 // |
|
1837 void CNotViewerAppUi::HandleEntryDeletedL() |
|
1838 { |
|
1839 LOGTEXT(_L8("NotViewerAppUi: HandleEntryDeletedL")); |
|
1840 Exit( EAknSoftkeyBack ); |
|
1841 } |
|
1842 |
|
1843 // --------------------------------------------------------- |
|
1844 // HandleEntryChangeL |
|
1845 // --------------------------------------------------------- |
|
1846 // |
|
1847 void CNotViewerAppUi::HandleEntryChangeL() |
|
1848 { // Call EntryChangedL to update the status |
|
1849 LOGTEXT(_L8("NotViewerAppUi: HandleEntryChangeL start")); |
|
1850 if( !( iFlags & ENotViewerIsNotification ) ) |
|
1851 { // We are not in notification mode -> entry change can be ignored |
|
1852 return; |
|
1853 } |
|
1854 iMtm->Entry( ).SetEntryL( iMsgId ); |
|
1855 TRAP_IGNORE( iMtm->LoadMessageL() ); |
|
1856 EntryChangedL( ); |
|
1857 LOGTEXT(_L8("NotViewerAppUi: HandleEntryChangeL end")); |
|
1858 } |
|
1859 |
|
1860 // --------------------------------------------------------- |
|
1861 // AddItemL |
|
1862 // --------------------------------------------------------- |
|
1863 // |
|
1864 void CNotViewerAppUi::AddItemL(const TDesC& aLabel, const TDesC& aValue ) |
|
1865 { |
|
1866 if ( aLabel.Length() > 0 ) |
|
1867 { |
|
1868 AppendTextL( aLabel , iLabelFormat, iLabelMask ); |
|
1869 } |
|
1870 |
|
1871 if ( aValue.Length() > 0 ) |
|
1872 { |
|
1873 AppendTextL( aValue , iValueFormat, iValueMask ); |
|
1874 } |
|
1875 } |
|
1876 |
|
1877 // --------------------------------------------------------- |
|
1878 // ApplyFormat |
|
1879 // --------------------------------------------------------- |
|
1880 // |
|
1881 void CNotViewerAppUi::ApplyFormat(TCharFormat& aFormat, TCharFormatMask& aMask, TBool aIsLabel) |
|
1882 { |
|
1883 TRect mainPane; |
|
1884 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane ); |
|
1885 TAknLayoutText textLayout; |
|
1886 |
|
1887 if( aIsLabel ) |
|
1888 { // Font for headings |
|
1889 textLayout.LayoutText( |
|
1890 mainPane, |
|
1891 AppLayout::Smart_Messages_Line_1( 0 ) ); |
|
1892 } |
|
1893 else |
|
1894 { // Font for data |
|
1895 textLayout.LayoutText( |
|
1896 mainPane, |
|
1897 AppLayout::Smart_Messages_Line_2( 0 ) ); |
|
1898 } |
|
1899 |
|
1900 aFormat.iFontSpec = textLayout.Font( )->FontSpecInTwips(); |
|
1901 aMask.ClearAll(); |
|
1902 aMask.SetAttrib(EAttFontStrokeWeight); |
|
1903 // If following line in use, it disables text zooming |
|
1904 //aMask.SetAttrib(EAttFontHeight); |
|
1905 aMask.SetAttrib(EAttFontTypeface); |
|
1906 } |
|
1907 |
|
1908 // --------------------------------------------------------- |
|
1909 // AppendTextL |
|
1910 // --------------------------------------------------------- |
|
1911 // |
|
1912 void CNotViewerAppUi::AppendTextL( const TDesC& aText, |
|
1913 const TCharFormat& aFormat, |
|
1914 const TCharFormatMask& aMask ) |
|
1915 { |
|
1916 // Create the modifiable descriptor |
|
1917 HBufC* buf = HBufC::NewLC( aText.Length() ); |
|
1918 TPtr modifiedText = buf->Des(); |
|
1919 modifiedText = aText; |
|
1920 TInt pos(0); |
|
1921 |
|
1922 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( modifiedText ); |
|
1923 |
|
1924 /* |
|
1925 We have three cases, where specific character(s) must be |
|
1926 converted to the CRichText understandable linebreak character |
|
1927 (CEditableText::ELineBreak). |
|
1928 1) Text contains ascii code linefeed (LF) character 0x0A, which |
|
1929 is converted to linebreak. |
|
1930 2) Text contains ascii code carrier return (CR) character 0x0D |
|
1931 3) Text contains both CR and LF characters particularly in this order. |
|
1932 These two characters must be converted to one linebreak. |
|
1933 */ |
|
1934 |
|
1935 TUint LF(0x0A); // Linefeed character in ascii set |
|
1936 TUint CR(0x0D); // Carriage return character in ascii set |
|
1937 |
|
1938 // Case 2 and 3 |
|
1939 while ( ( pos = modifiedText.Locate( CR ) ) != KErrNotFound ) // Locate CR |
|
1940 { |
|
1941 if ( pos + 1 < modifiedText.Length() && LF == modifiedText[pos + 1] ) // Is the next LF? |
|
1942 { |
|
1943 modifiedText.Delete( pos + 1, 1 ); // Delete if LF |
|
1944 } |
|
1945 modifiedText[pos] = CEditableText::ELineBreak; // Replace CR with linebreak |
|
1946 } |
|
1947 |
|
1948 // Case 1 |
|
1949 while ( ( pos = modifiedText.Locate( LF ) ) != KErrNotFound ) // Locate LF |
|
1950 { |
|
1951 modifiedText[pos] = CEditableText::ELineBreak; // Replace LF with linebreak |
|
1952 } |
|
1953 |
|
1954 // Append the modified text to the richtext. |
|
1955 CRichText& rich = RichText(); |
|
1956 |
|
1957 TInt documentPos = rich.DocumentLength(); |
|
1958 |
|
1959 // Every time when text is added, the cursor is left at the end of the line. |
|
1960 // When the new text is added we must first add linebreak and then the text |
|
1961 // linebreak is not added if the text is first item. |
|
1962 if ( iFlags & ENotViewerIsNotFirstItem ) |
|
1963 { |
|
1964 //Append the linebreak to the end of the richtext. |
|
1965 rich.InsertL(documentPos, CEditableText::ELineBreak); |
|
1966 |
|
1967 } |
|
1968 else |
|
1969 { |
|
1970 iFlags |= ENotViewerIsNotFirstItem; |
|
1971 } |
|
1972 |
|
1973 documentPos = rich.DocumentLength(); |
|
1974 rich.SetInsertCharFormatL(aFormat, aMask, documentPos); |
|
1975 rich.InsertL( documentPos, *buf ); |
|
1976 rich.CancelInsertCharFormat(); |
|
1977 |
|
1978 CleanupStack::PopAndDestroy( buf ); |
|
1979 } |
|
1980 |
|
1981 // --------------------------------------------------------- |
|
1982 // CNotViewerAppUi::FocusedControlId |
|
1983 // --------------------------------------------------------- |
|
1984 // |
|
1985 TInt CNotViewerAppUi::FocusedControlId() |
|
1986 { |
|
1987 TInt ret = EMsgComponentIdNull; |
|
1988 if ( iView && iView->FocusedControl() ) |
|
1989 { |
|
1990 ret = iView->FocusedControl()->ControlId(); |
|
1991 } |
|
1992 return ret; |
|
1993 } |
|
1994 |
|
1995 // --------------------------------------------------------- |
|
1996 // Document |
|
1997 // --------------------------------------------------------- |
|
1998 // |
|
1999 CNotViewerDocument* CNotViewerAppUi::Document() const |
|
2000 { |
|
2001 return static_cast<CNotViewerDocument*>( CMsgEditorAppUi::Document() ); |
|
2002 } |
|
2003 |
|
2004 // --------------------------------------------------------- |
|
2005 // LaunchHelpL |
|
2006 // --------------------------------------------------------- |
|
2007 // |
|
2008 void CNotViewerAppUi::LaunchHelpL() |
|
2009 { |
|
2010 LOGTEXT(_L8("NotViewerAppUi: LaunchHelp")); |
|
2011 if ( iFlags & ENotViewerFlagsHelp ) |
|
2012 { |
|
2013 CArrayFix<TCoeHelpContext>* helpContext = AppHelpContextL(); |
|
2014 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
2015 } |
|
2016 } |
|
2017 |
|
2018 // --------------------------------------------------------- |
|
2019 // HelpContextL |
|
2020 // --------------------------------------------------------- |
|
2021 // |
|
2022 CArrayFix<TCoeHelpContext>* CNotViewerAppUi::HelpContextL() const |
|
2023 { |
|
2024 if ( iFlags & ENotViewerFlagsHelp ) |
|
2025 { |
|
2026 CArrayFix<TCoeHelpContext>* r = new ( ELeave ) CArrayFixFlat<TCoeHelpContext>(1); |
|
2027 CleanupStack::PushL( r ); |
|
2028 |
|
2029 if ( iFlags & ENotViewerIsNotification ) |
|
2030 { // Notification mode |
|
2031 r->AppendL( TCoeHelpContext( KUidMmsViewer, KMMS_HLP_NOTIFICATION_VIEWER() ) ); |
|
2032 } |
|
2033 else |
|
2034 { |
|
2035 if ( iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
2036 { |
|
2037 r->AppendL( TCoeHelpContext( KUidMmsViewer, KMMS_HLP_NOTIFICATION_VIEWER() ) ); |
|
2038 } |
|
2039 else |
|
2040 { |
|
2041 r->AppendL( TCoeHelpContext( KUidMmsViewer, KMMS_HLP_MMS_FWD_REQUEST() ) ); |
|
2042 } |
|
2043 } |
|
2044 CleanupStack::Pop( r ); |
|
2045 return r; |
|
2046 } |
|
2047 return NULL; |
|
2048 } |
|
2049 |
|
2050 // ------------------------------------------------------------- |
|
2051 // AddMessageFieldL |
|
2052 // ------------------------------------------------------------- |
|
2053 void CNotViewerAppUi::AddMessageFieldL( ) |
|
2054 { |
|
2055 LOGTEXT(_L8("NotViewerAppUi: AddMessageField start")); |
|
2056 TInt resourceId = 0; |
|
2057 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2058 |
|
2059 CTextResolver* resolver = CTextResolver::NewLC(); |
|
2060 const TDesC& error = resolver->ResolveErrorString( entry.iError, CTextResolver::ECtxNoCtxNoSeparator ); |
|
2061 |
|
2062 switch( iMsgStatus ) |
|
2063 { |
|
2064 case ENotViewerStatusFailed: |
|
2065 resourceId = R_NOTVIEWER_INFO_FAILED; |
|
2066 break; |
|
2067 case ENotViewerStatusExpired: |
|
2068 resourceId = R_NOTVIEWER_INFO_EXPIRED; |
|
2069 break; |
|
2070 case ENotViewerStatusForwarding: |
|
2071 resourceId = R_NOTVIEWER_INFO_FORWARDING; |
|
2072 break; |
|
2073 case ENotViewerStatusForwarded: |
|
2074 resourceId = R_NOTVIEWER_INFO_FORWARDED; |
|
2075 break; |
|
2076 case ENotViewerStatusNull: |
|
2077 case ENotViewerStatusWaiting: |
|
2078 default: |
|
2079 resourceId = R_NOTVIEWER_INFO_WAITING; |
|
2080 break; |
|
2081 } |
|
2082 HBufC* message = StringLoader::LoadLC( resourceId ); |
|
2083 AddItemL( message->Des( ), error ); |
|
2084 CleanupStack::PopAndDestroy( 2 ); //message, resolver |
|
2085 LOGTEXT(_L8("NotViewerAppUi: AddMessageField end")); |
|
2086 } |
|
2087 // ------------------------------------------------------------- |
|
2088 // AddSubjectFieldL |
|
2089 // ------------------------------------------------------------- |
|
2090 void CNotViewerAppUi::AddSubjectFieldL( ) |
|
2091 { |
|
2092 LOGTEXT(_L8("NotViewerAppUi: AddSubject start")); |
|
2093 TPtrC subject = iMtm->SubjectL( ); |
|
2094 if( subject.Length( ) > 0 ) |
|
2095 { |
|
2096 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_SUBJECT ); |
|
2097 AddItemL( label->Des( ), subject ); |
|
2098 CleanupStack::PopAndDestroy( label ); |
|
2099 } |
|
2100 LOGTEXT(_L8("NotViewerAppUi: AddSubject end")); |
|
2101 } |
|
2102 |
|
2103 // ------------------------------------------------------------- |
|
2104 // AddTextFieldL |
|
2105 // ------------------------------------------------------------- |
|
2106 // |
|
2107 void CNotViewerAppUi::AddTextFieldL( ) |
|
2108 { |
|
2109 LOGTEXT(_L8("NotViewerAppUi: AddText start")); |
|
2110 TPtrC text = iMtm->GetExtendedText( ); |
|
2111 if( text.Length( ) > 0 ) |
|
2112 { |
|
2113 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_TEXT ); |
|
2114 AddItemL( label->Des( ), text ); |
|
2115 CleanupStack::PopAndDestroy( label ); |
|
2116 } |
|
2117 LOGTEXT(_L8("NotViewerAppUi: AddText end")); |
|
2118 } |
|
2119 |
|
2120 // ------------------------------------------------------------- |
|
2121 // AddExpiryFieldL |
|
2122 // ------------------------------------------------------------- |
|
2123 void CNotViewerAppUi::AddExpiryFieldL( ) |
|
2124 { |
|
2125 LOGTEXT(_L8("NotViewerAppUi: AddExpiry start")); |
|
2126 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_EXPIRES ); |
|
2127 TTime messageDate = iMtm->ExpiryDate( ); |
|
2128 |
|
2129 TLocale locale; |
|
2130 messageDate += locale.UniversalTimeOffset(); |
|
2131 if (locale.QueryHomeHasDaylightSavingOn()) |
|
2132 { |
|
2133 TTimeIntervalHours daylightSaving(1); |
|
2134 messageDate += daylightSaving; |
|
2135 } |
|
2136 |
|
2137 HBufC* dateFormat = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO, iCoeEnv ); |
|
2138 TBuf<KDateSize> dateString; |
|
2139 messageDate.FormatL( dateString, *dateFormat ); |
|
2140 CleanupStack::PopAndDestroy(); //dateFormat |
|
2141 |
|
2142 dateFormat = StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO, iCoeEnv ); |
|
2143 TBuf<KDateSize> timeString; |
|
2144 messageDate.FormatL( timeString, *dateFormat ); |
|
2145 CleanupStack::PopAndDestroy(); //dateFormat |
|
2146 |
|
2147 CDesC16ArrayFlat* array = new(ELeave) CDesC16ArrayFlat( 2 ); |
|
2148 CleanupStack::PushL( array ); |
|
2149 array->AppendL( timeString ); |
|
2150 array->AppendL( dateString ); |
|
2151 HBufC* expiryString = |
|
2152 StringLoader::LoadLC( R_NOTVIEWER_VALUE_EXPIRES, *array, iCoeEnv ); |
|
2153 AddItemL( label->Des( ), expiryString->Des( ) ); |
|
2154 CleanupStack::PopAndDestroy( expiryString ); |
|
2155 CleanupStack::PopAndDestroy( array ); |
|
2156 CleanupStack::PopAndDestroy( label ); |
|
2157 LOGTEXT(_L8("NotViewerAppUi: AddExpiry end")); |
|
2158 } |
|
2159 |
|
2160 // ------------------------------------------------------------- |
|
2161 // AddSizeFieldL |
|
2162 // ------------------------------------------------------------- |
|
2163 void CNotViewerAppUi::AddSizeFieldL( ) |
|
2164 { |
|
2165 LOGTEXT(_L8("NotViewerAppUi: AddSize start")); |
|
2166 TInt size = iMtm->MessageTransferSize( ); |
|
2167 |
|
2168 TInt maxSize = static_cast<TInt>( iMtm->MmsSettings().MaximumReceiveSize( ) ); |
|
2169 if( maxSize > 0 ) |
|
2170 { |
|
2171 if( size > maxSize ) |
|
2172 { |
|
2173 size = maxSize; |
|
2174 } |
|
2175 } |
|
2176 |
|
2177 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_SIZE ); |
|
2178 |
|
2179 TBuf<20> sizeString; |
|
2180 |
|
2181 MsgAttachmentUtils::FileSizeToStringL( sizeString, size, ETrue ); |
|
2182 |
|
2183 sizeString.Trim(); |
|
2184 |
|
2185 AddItemL( label->Des( ), sizeString ); |
|
2186 CleanupStack::PopAndDestroy( label ); |
|
2187 LOGTEXT(_L8("NotViewerAppUi: AddSize end")); |
|
2188 } |
|
2189 |
|
2190 // ------------------------------------------------------------- |
|
2191 // AddClassFieldL |
|
2192 // ------------------------------------------------------------- |
|
2193 void CNotViewerAppUi::AddClassFieldL( ) |
|
2194 { |
|
2195 LOGTEXT(_L8("NotViewerAppUi: AddClass start")); |
|
2196 TInt msgClass = iMtm->MessageClass( ); |
|
2197 TInt resourceId; |
|
2198 switch( msgClass ) |
|
2199 { |
|
2200 case EMmsClassPersonal: |
|
2201 { |
|
2202 resourceId = R_NOTVIEWER_VALUE_CLASS_PERSONAL; |
|
2203 break; |
|
2204 } |
|
2205 case EMmsClassAdvertisement: |
|
2206 { |
|
2207 resourceId = R_NOTVIEWER_VALUE_CLASS_ADVERTISEMENT; |
|
2208 break; |
|
2209 } |
|
2210 case EMmsClassInformational: |
|
2211 { |
|
2212 resourceId = R_NOTVIEWER_VALUE_CLASS_INFORMATIVE; |
|
2213 break; |
|
2214 } |
|
2215 default: |
|
2216 { // In case no class is returned (0), don't add the field |
|
2217 return; |
|
2218 } |
|
2219 } |
|
2220 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_CLASS ); |
|
2221 HBufC* value = StringLoader::LoadLC( resourceId ); |
|
2222 AddItemL( label->Des( ), value->Des( ) ); |
|
2223 CleanupStack::PopAndDestroy( value ); |
|
2224 CleanupStack::PopAndDestroy( label ); |
|
2225 LOGTEXT(_L8("NotViewerAppUi: AddClass end")); |
|
2226 } |
|
2227 |
|
2228 // ------------------------------------------------------------- |
|
2229 // AddPriorityFieldL |
|
2230 // ------------------------------------------------------------- |
|
2231 void CNotViewerAppUi::AddPriorityFieldL( ) |
|
2232 { |
|
2233 LOGTEXT(_L8("NotViewerAppUi: AddPriority start")); |
|
2234 TInt msgPri = iMtm->MessagePriority( ); |
|
2235 TInt resourceId; |
|
2236 switch( msgPri ) |
|
2237 { |
|
2238 case EMmsPriorityLow: |
|
2239 { |
|
2240 resourceId = R_NOTVIEWER_VALUE_PRIORITY_LOW; |
|
2241 break; |
|
2242 } |
|
2243 case EMmsPriorityHigh: |
|
2244 { |
|
2245 resourceId = R_NOTVIEWER_VALUE_PRIORITY_HIGH; |
|
2246 break; |
|
2247 } |
|
2248 case EMmsPriorityNormal: |
|
2249 { |
|
2250 resourceId = R_NOTVIEWER_VALUE_PRIORITY_NORMAL; |
|
2251 break; |
|
2252 } |
|
2253 default: |
|
2254 { // In case no priority is returned (0), don't add the field |
|
2255 return; |
|
2256 } |
|
2257 } |
|
2258 HBufC* label = StringLoader::LoadLC( R_NOTVIEWER_LABEL_PRIORITY ); |
|
2259 HBufC* value = StringLoader::LoadLC( resourceId ); |
|
2260 AddItemL( label->Des( ), value->Des( ) ); |
|
2261 CleanupStack::PopAndDestroy( value ); |
|
2262 CleanupStack::PopAndDestroy( label ); |
|
2263 LOGTEXT(_L8("NotViewerAppUi: AddPriority end")); |
|
2264 } |
|
2265 |
|
2266 // --------------------------------------------------------- |
|
2267 // CNotViewerAppUi::ShowConfirmationQueryL |
|
2268 // --------------------------------------------------------- |
|
2269 // |
|
2270 TInt CNotViewerAppUi::ShowConfirmationQueryL( TInt aResourceId ) const |
|
2271 { |
|
2272 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
2273 HBufC* prompt = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
2274 TInt retVal = dlg->ExecuteLD( R_NOTVIEWER_CONFIRMATION_QUERY, *prompt ); |
|
2275 CleanupStack::PopAndDestroy( prompt ); |
|
2276 return retVal; |
|
2277 } |
|
2278 |
|
2279 // --------------------------------------------------------- |
|
2280 // CNotViewerAppUi::ShowInformationNoteL |
|
2281 // --------------------------------------------------------- |
|
2282 // |
|
2283 void CNotViewerAppUi::ShowInformationNoteL( TInt aResourceID, TBool aWaiting ) |
|
2284 { |
|
2285 HBufC* string = NULL; |
|
2286 string = StringLoader::LoadLC( aResourceID, iCoeEnv ); |
|
2287 |
|
2288 CAknInformationNote* note = new ( ELeave ) |
|
2289 CAknInformationNote( aWaiting ); |
|
2290 note->ExecuteLD( *string ); |
|
2291 |
|
2292 CleanupStack::PopAndDestroy(); //string |
|
2293 } |
|
2294 |
|
2295 // --------------------------------------------------------- |
|
2296 // CNotViewerAppUi::AddressControl |
|
2297 // --------------------------------------------------------- |
|
2298 // |
|
2299 CMsgAddressControl* CNotViewerAppUi::AddressControl( ) |
|
2300 { |
|
2301 TInt controlType = 0; |
|
2302 if( iFlags & ENotViewerIsNotification ) |
|
2303 { // We are in notification mode |
|
2304 controlType = EMsgComponentIdFrom; |
|
2305 } |
|
2306 else |
|
2307 { // we are in the ForwReq mode |
|
2308 controlType = EMsgComponentIdTo; |
|
2309 } |
|
2310 return static_cast<CMsgAddressControl*>( iView->ControlById( controlType ) ); |
|
2311 } |
|
2312 |
|
2313 // --------------------------------------------------------- |
|
2314 // CNotViewerAppUi::EntryChangedL |
|
2315 // --------------------------------------------------------- |
|
2316 // |
|
2317 void CNotViewerAppUi::EntryChangedL( ) |
|
2318 { |
|
2319 LOGTEXT(_L8("NotViewerAppUi: EntryChangedL start")); |
|
2320 if ( !Document()->IsLaunched() ) |
|
2321 { |
|
2322 return; |
|
2323 } |
|
2324 |
|
2325 TNotViewerStatus status = MessageStatus( ); |
|
2326 if( iMsgStatus != status ) |
|
2327 { |
|
2328 iMsgStatus = status; |
|
2329 |
|
2330 iFlags &= ~ENotViewerIsNotFirstItem; |
|
2331 |
|
2332 CMsgBaseControl* control = iView->RemoveControlL( EMsgComponentIdBody ); |
|
2333 delete control; |
|
2334 |
|
2335 CMsgBodyControl* bodyC = CMsgBodyControl::NewL(iView); |
|
2336 iView->AddControlL(bodyC, EMsgComponentIdBody, EMsgAppendControl, EMsgBody); |
|
2337 |
|
2338 AddMessageFieldL( ); |
|
2339 AddSubjectFieldL( ); |
|
2340 AddTextFieldL( ); |
|
2341 AddSizeFieldL( ); |
|
2342 if( iFlags & ENotViewerIsNotification ) |
|
2343 { // We are in the Viewer so lets add expiry, too |
|
2344 AddExpiryFieldL( ); |
|
2345 } |
|
2346 AddClassFieldL( ); |
|
2347 AddPriorityFieldL( ); |
|
2348 |
|
2349 // without this editor control does not become properly visible |
|
2350 bodyC->Editor( ).NotifyNewDocumentL( ); |
|
2351 } |
|
2352 |
|
2353 // update toolbar |
|
2354 if( iToolbar ) //check to be provided for non-touch devices. |
|
2355 { |
|
2356 CNotViewerDocument* doc = Document( ); |
|
2357 CNotMtmUiData* uiData = &doc->MtmUiDataL( ); |
|
2358 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2359 |
|
2360 if( iFlags & ENotViewerIsNotification ) |
|
2361 { |
|
2362 // return value 0=> OK, !=0 => NOK |
|
2363 if( uiData->OperationSupportedL( KMtmUiFunctionFetchMMS, entry ) ) |
|
2364 { |
|
2365 iToolbar->SetItemDimmed( ENotViewerToolbarRetrieve, |
|
2366 ETrue, |
|
2367 ETrue ); |
|
2368 } |
|
2369 else |
|
2370 { |
|
2371 iToolbar->SetItemDimmed( ENotViewerToolbarRetrieve, |
|
2372 EFalse, |
|
2373 ETrue ); |
|
2374 } |
|
2375 } |
|
2376 } |
|
2377 |
|
2378 LOGTEXT(_L8("NotViewerAppUi: EntryChangedL end")); |
|
2379 } |
|
2380 |
|
2381 // --------------------------------------------------------- |
|
2382 // CNotViewerAppUi::UpdateTitlePaneL |
|
2383 // --------------------------------------------------------- |
|
2384 // |
|
2385 void CNotViewerAppUi::UpdateTitlePaneL( ) |
|
2386 { |
|
2387 LOGTEXT(_L8("NotViewerAppUi: UpdateTitle")); |
|
2388 HBufC* str = StringLoader::LoadLC( R_NOTVIEWER_TITLE_FWD_RQST, iCoeEnv ); |
|
2389 CAknTitlePane* title = static_cast<CAknTitlePane*> |
|
2390 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
2391 title->SetTextL( str->Des( ) ); |
|
2392 CleanupStack::PopAndDestroy(); //str |
|
2393 if( !iMtm->Entry( ).Entry( ).ReadOnly() ) |
|
2394 { // We have a new unsent FR, change CBA too |
|
2395 Cba()->SetCommandSetL( R_NOTVIEWER_SOFTKEYS_FORWARD_OPTIONS_CANCEL__CONTEXTOPTIONS ); |
|
2396 Cba()->DrawNow(); |
|
2397 } |
|
2398 } |
|
2399 |
|
2400 // --------------------------------------------------------- |
|
2401 // CNotViewerAppUi::MessageStatus |
|
2402 // --------------------------------------------------------- |
|
2403 // |
|
2404 TNotViewerStatus CNotViewerAppUi::MessageStatus( ) const |
|
2405 { |
|
2406 TNotViewerStatus status = ENotViewerStatusNull; |
|
2407 TTime currentTime; |
|
2408 currentTime.HomeTime( ); |
|
2409 TTime expiryTime = iMtm->ExpiryDate( ); |
|
2410 TLocale locale; |
|
2411 expiryTime += locale.UniversalTimeOffset(); |
|
2412 if (locale.QueryHomeHasDaylightSavingOn()) |
|
2413 { |
|
2414 TTimeIntervalHours daylightSaving(1); |
|
2415 expiryTime += daylightSaving; |
|
2416 } |
|
2417 |
|
2418 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2419 |
|
2420 if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageMNotificationInd ) // Notification |
|
2421 { |
|
2422 if( !( entry.iMtmData2 & KMmsOperationForward ) |
|
2423 && ( entry.iMtmData2 & KMmsOperationFetch ) |
|
2424 && !( entry.iMtmData2 & KMmsOperationOngoing ) // It's !ongoing |
|
2425 && ( entry.iMtmData2 & KMmsOperationFinished ) // It's finished |
|
2426 && ( entry.iMtmData2 & KMmsOperationResult || |
|
2427 entry.iError ) ) // There's error code |
|
2428 { // Fetch has been failed |
|
2429 status = ENotViewerStatusFailed; |
|
2430 } |
|
2431 else if( currentTime > expiryTime ) |
|
2432 { |
|
2433 status = ENotViewerStatusExpired; |
|
2434 } |
|
2435 else if( ( entry.iMtmData2 & KMmsOperationForward ) // It's forward |
|
2436 && !( entry.iMtmData2 & KMmsOperationFetch ) // It's not delete |
|
2437 && ( entry.iMtmData2 & KMmsOperationOngoing ) // It's ongoing |
|
2438 && !( entry.iMtmData2 & KMmsOperationFinished ) ) // It's not finished |
|
2439 { // Message is being forwarded |
|
2440 status = ENotViewerStatusForwarding; |
|
2441 } |
|
2442 else if( ( entry.iMtmData2 & KMmsOperationForward ) // It's forward |
|
2443 && !( entry.iMtmData2 & KMmsOperationFetch ) // It's not delete |
|
2444 && !( entry.iMtmData2 & KMmsOperationOngoing ) // It's !ongoing |
|
2445 && ( entry.iMtmData2 & KMmsOperationFinished ) // It's finished |
|
2446 && !( entry.iMtmData2 & KMmsOperationResult ) ) // There was no error |
|
2447 { // Message has been forwarded |
|
2448 status = ENotViewerStatusForwarded; |
|
2449 } |
|
2450 else |
|
2451 { // Normal waiting state |
|
2452 status = ENotViewerStatusWaiting; |
|
2453 } |
|
2454 } |
|
2455 |
|
2456 return status; |
|
2457 } |
|
2458 |
|
2459 // --------------------------------------------------------- |
|
2460 // CNotViewerAppUi::GetTypeL |
|
2461 // --------------------------------------------------------- |
|
2462 // |
|
2463 void CNotViewerAppUi::GetTypeL( ) |
|
2464 { |
|
2465 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2466 |
|
2467 if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageMNotificationInd ) // Notification |
|
2468 { |
|
2469 iFlags |= ENotViewerIsNotification; |
|
2470 } |
|
2471 else if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageForwardReq ) // Forward Request |
|
2472 { |
|
2473 iFlags &= ~ENotViewerIsNotification; |
|
2474 } |
|
2475 else |
|
2476 { |
|
2477 User::Leave( KErrNotSupported); // Unsupported msg type |
|
2478 } |
|
2479 iMsgStatus = MessageStatus( ); |
|
2480 } |
|
2481 |
|
2482 // --------------------------------------------------------- |
|
2483 // CNotViewerAppUi::HandleNotifyInt |
|
2484 // |
|
2485 // Notification from central repository |
|
2486 // |
|
2487 // There is no need to check aId as we are listening events |
|
2488 // only from one key |
|
2489 // --------------------------------------------------------- |
|
2490 // |
|
2491 void CNotViewerAppUi::HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue ) |
|
2492 { |
|
2493 LOGTEXT(_L8("NotViewerAppUi: HandleNotifyInt")); |
|
2494 if( iFlags & ENotViewerIsNotification ) |
|
2495 { |
|
2496 if ( aNewValue == 0 ) |
|
2497 { |
|
2498 iFlags &= ~ENotViewerAutoFind; |
|
2499 } |
|
2500 else |
|
2501 { |
|
2502 iFlags |= ENotViewerAutoFind; |
|
2503 } |
|
2504 TRAP_IGNORE( SetFindModeL( iFlags & ENotViewerAutoFind ) ); |
|
2505 } |
|
2506 } |
|
2507 |
|
2508 // --------------------------------------------------------- |
|
2509 // CNotViewerAppUi::HandleNotifyGeneric |
|
2510 // --------------------------------------------------------- |
|
2511 // |
|
2512 void CNotViewerAppUi::HandleNotifyGeneric( TUint32 /*aId*/ ) |
|
2513 { |
|
2514 //Nothing. |
|
2515 } |
|
2516 |
|
2517 // --------------------------------------------------------- |
|
2518 // CNotViewerAppUi::HandleNotifyError |
|
2519 // --------------------------------------------------------- |
|
2520 // |
|
2521 void CNotViewerAppUi::HandleNotifyError( TUint32 /*aId*/, TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/ ) |
|
2522 { |
|
2523 //Nothing. |
|
2524 } |
|
2525 |
|
2526 // |
|
2527 // NOTICE: |
|
2528 // |
|
2529 // Startup observer moved to own class because Publish & Subscribe |
|
2530 // requires an active object for event handling. |
|
2531 // |
|
2532 |
|
2533 // --------------------------------------------------------- |
|
2534 // CNotViewerAppUi::SetFindModeL |
|
2535 // --------------------------------------------------------- |
|
2536 // |
|
2537 void CNotViewerAppUi::SetFindModeL( TBool aEnable ) |
|
2538 { |
|
2539 if ( iView ) |
|
2540 { |
|
2541 if ( iView->ItemFinder() ) |
|
2542 { |
|
2543 TInt findMode = aEnable ? |
|
2544 CItemFinder::EPhoneNumber | |
|
2545 CItemFinder::EUrlAddress | |
|
2546 CItemFinder::EEmailAddress : |
|
2547 CItemFinder::ENoneSelected; |
|
2548 iView->ItemFinder()->SetFindModeL( findMode ); |
|
2549 } |
|
2550 CMsgBaseControl* fromControl = iView->ControlById( EMsgComponentIdFrom ); |
|
2551 if ( fromControl && iMtm->Sender().Length() ) |
|
2552 { |
|
2553 static_cast<CMsgAddressControl*>( fromControl ) |
|
2554 ->SetAddressFieldAutoHighlight( aEnable ); |
|
2555 } |
|
2556 } |
|
2557 } |
|
2558 |
|
2559 // ---------------------------------------------------- |
|
2560 // CNotViewerAppUi::OpCompleted |
|
2561 // ---------------------------------------------------- |
|
2562 // |
|
2563 void CNotViewerAppUi::OpCompleted( |
|
2564 CMsvSingleOpWatcher& aOpWatcher, |
|
2565 TInt aCompletionCode ) |
|
2566 { |
|
2567 LOGTEXT(_L8("NotViewerAppUi: OpCompleted start")); |
|
2568 CMsvOperation* op=&aOpWatcher.Operation(); |
|
2569 |
|
2570 if( iOperation ) |
|
2571 { |
|
2572 if( iOperation->Operation( ).Id( ) == op->Id( ) ) |
|
2573 { |
|
2574 delete iOperation; |
|
2575 iOperation = NULL; |
|
2576 } |
|
2577 else |
|
2578 { |
|
2579 // This should never happen ie. unrecognised operation completed |
|
2580 return; |
|
2581 } |
|
2582 } |
|
2583 else |
|
2584 { |
|
2585 // This should never happen ie. unrecognised operation completed |
|
2586 return; |
|
2587 } |
|
2588 |
|
2589 if ( aCompletionCode == KErrCancel ) |
|
2590 { |
|
2591 LOGTEXT(_L8("NotViewerAppUi: OpCompleted end3")); |
|
2592 return; |
|
2593 } |
|
2594 |
|
2595 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2596 |
|
2597 if( ( entry.iMtmData2 & KMmsOperationFetch ) // Fetch + forward |
|
2598 && ( entry.iMtmData2 & KMmsOperationForward ) // == DELETE! |
|
2599 && ( entry.iMtmData2 & KMmsOperationFinished ) // It's finished |
|
2600 && ( entry.iMtmData2 & KMmsOperationResult ) ) // Error code |
|
2601 { |
|
2602 // Error note here! |
|
2603 TRAP_IGNORE( ShowInformationNoteL( R_NOTVIEWER_REMOTE_DELETE_FAILED, EFalse ) ); |
|
2604 // Ignore err |
|
2605 } |
|
2606 else |
|
2607 { |
|
2608 LOGTEXT(_L8("NotViewerAppUi: OpCompleted: First delete successful")); |
|
2609 // If also local chosen, call that and exit |
|
2610 // else show completed note |
|
2611 if( iFlags & ENotViewerDeleteBoth ) |
|
2612 { // Deletion was succesfull, but also local delete still needed |
|
2613 TRAPD( err, DoDeleteOpCompletedL( ) ); |
|
2614 if( err ) |
|
2615 { // We may not leave as we are in non-leaving function |
|
2616 delete iAbsorber; |
|
2617 iAbsorber = NULL; |
|
2618 } |
|
2619 LOGTEXT(_L8("NotViewerAppUi: OpCompleted end2")); |
|
2620 return; |
|
2621 } |
|
2622 else |
|
2623 { |
|
2624 // MMBox Deletion was succesfull |
|
2625 TRAP_IGNORE( ShowInformationNoteL( R_NOTVIEWER_REMOTE_DELETED, EFalse ) ); |
|
2626 // Ignore err |
|
2627 } |
|
2628 } |
|
2629 LOGTEXT(_L8("NotViewerAppUi: OpCompleted end")); |
|
2630 } |
|
2631 |
|
2632 // ---------------------------------------------------- |
|
2633 // CNotViewerAppUi::DoDeleteOpCompletedL |
|
2634 // ---------------------------------------------------- |
|
2635 // |
|
2636 void CNotViewerAppUi::DoDeleteOpCompletedL( ) |
|
2637 { |
|
2638 LOGTEXT(_L8("NotViewerAppUi: DoDeleteOpCompletedL start")); |
|
2639 iAbsorber = CAknInputBlock::NewLC( ); |
|
2640 CleanupStack::Pop(); // Pop the absorber |
|
2641 |
|
2642 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
2643 CleanupStack::PushL( selection ); |
|
2644 selection->AppendL( iMtm->Entry().EntryId() ); |
|
2645 |
|
2646 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
2647 |
|
2648 CMsvOperation* deleteop = iMtm->DeleteNotificationL( |
|
2649 *selection, |
|
2650 EMmsDeleteNotificationOnly, |
|
2651 wait->iStatus ); |
|
2652 |
|
2653 if( !deleteop ) // Check this just in case |
|
2654 { |
|
2655 CleanupStack::PopAndDestroy( 2 ); // wait, sel |
|
2656 return; |
|
2657 } |
|
2658 |
|
2659 CleanupStack::PushL( deleteop ); |
|
2660 wait->Start(); |
|
2661 |
|
2662 if( wait->iStatus != KErrNone ) |
|
2663 { |
|
2664 CleanupStack::PopAndDestroy( 3 ); // op, wait, sel |
|
2665 return; |
|
2666 } |
|
2667 |
|
2668 // -> no error, we can exit the viewer |
|
2669 CleanupStack::PopAndDestroy( 3 ); // op, wait, sel |
|
2670 |
|
2671 DoDelayedExitL( 0 ); |
|
2672 LOGTEXT(_L8("NotViewerAppUi: DoDeleteOpCompleted end")); |
|
2673 return; |
|
2674 } |
|
2675 |
|
2676 //-------------------------------- |
|
2677 // DecodeProgress |
|
2678 //-------------------------------- |
|
2679 TInt CNotViewerAppUi::DecodeProgress( |
|
2680 const TDesC8& /*aProgress*/, |
|
2681 TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString, |
|
2682 TInt& aTotalEntryCount, |
|
2683 TInt& aEntriesDone, |
|
2684 TInt& aCurrentEntrySize, |
|
2685 TInt& aCurrentBytesTrans, |
|
2686 TBool /*aInternal*/ ) |
|
2687 { |
|
2688 aCurrentEntrySize = 0; |
|
2689 aCurrentBytesTrans = 0; |
|
2690 aEntriesDone = 0; |
|
2691 aTotalEntryCount = 0; |
|
2692 StringLoader::Load( aReturnString, |
|
2693 R_NOTVIEWER_WAIT_DELETING_REMOTE, |
|
2694 iCoeEnv ); |
|
2695 return KErrNone; |
|
2696 } |
|
2697 |
|
2698 // --------------------------------------------------------- |
|
2699 // CNotViewerAppUi::HandleIteratorEventL |
|
2700 // --------------------------------------------------------- |
|
2701 // |
|
2702 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2703 void CNotViewerAppUi::HandleIteratorEventL( TMessageIteratorEvent aEvent ) |
|
2704 { |
|
2705 LOGTEXT(_L8("NotViewerAppUi: HandleIteratorEventL")); |
|
2706 if (aEvent == EFolderCountChanged) |
|
2707 { |
|
2708 InitNavipaneL(); |
|
2709 } |
|
2710 } |
|
2711 #endif |
|
2712 |
|
2713 // --------------------------------------------------------- |
|
2714 // CNotViewerAppUi::InitNavipaneL |
|
2715 // --------------------------------------------------------- |
|
2716 // |
|
2717 void CNotViewerAppUi::InitNavipaneL() |
|
2718 { |
|
2719 LOGTEXT(_L8("NotViewerAppUi: InitNavipaneL start")); |
|
2720 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2721 if ( !iNaviDecorator ) |
|
2722 { |
|
2723 TMsgEditorMsgPriority priority = EMsgEditorMsgPriorityNormal; |
|
2724 |
|
2725 if ( iMtm->MessagePriority() == EMmsPriorityHigh ) |
|
2726 { |
|
2727 priority = EMsgEditorMsgPriorityHigh; |
|
2728 } |
|
2729 else if ( iMtm->MessagePriority() == EMmsPriorityLow ) |
|
2730 { |
|
2731 priority = EMsgEditorMsgPriorityLow; |
|
2732 } |
|
2733 CreateViewerNaviPaneL( Document()->Entry().iDate, priority, ETrue ); |
|
2734 } |
|
2735 |
|
2736 iNaviPane->PushL( *iNaviDecorator ); |
|
2737 #else |
|
2738 TMsvEntry msvEntry = iMtm->Entry( ).Entry( ); |
|
2739 |
|
2740 if( msvEntry.ReadOnly( ) || iFlags & ENotViewerIsNotification ) |
|
2741 // If message is readonly or it is a notification -> |
|
2742 // we need msg ordinal number and scroll arrows visible |
|
2743 { |
|
2744 TInt indexInFolder = 0; |
|
2745 TInt msgsInFolder = 0; |
|
2746 MessageIndexInFolderL( indexInFolder, msgsInFolder ); |
|
2747 |
|
2748 if ( indexInFolder < 0 |
|
2749 || msgsInFolder == 0 ) |
|
2750 { |
|
2751 // this may occur when viewer is used in cover ui. Viewer is started as |
|
2752 // stand alone without current folder and '1/0' would be visible. |
|
2753 iNaviPane->PushDefaultL( ); |
|
2754 return; |
|
2755 } |
|
2756 |
|
2757 CArrayFixFlat<TInt>* array = new ( ELeave ) CArrayFixFlat<TInt>(KNaviGranularity); |
|
2758 CleanupStack::PushL( array ); |
|
2759 array->AppendL( indexInFolder + 1 ); |
|
2760 array->AppendL( msgsInFolder ); |
|
2761 |
|
2762 HBufC* buf = StringLoader::LoadLC( R_NOTVIEWER_ORDINAL_NUMBER, *array, iCoeEnv ); |
|
2763 CreateTabGroupL( *buf ); |
|
2764 CleanupStack::PopAndDestroy( 2 ); //buf, array |
|
2765 |
|
2766 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
2767 |
|
2768 //NaviButtons are dimmed by default |
|
2769 if ( IsNextMessageAvailableL( ETrue ) ) |
|
2770 { |
|
2771 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse ); |
|
2772 } |
|
2773 if ( IsNextMessageAvailableL( EFalse ) ) |
|
2774 { |
|
2775 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse ); |
|
2776 } |
|
2777 } |
|
2778 else // Unsent FR: Make navipane null |
|
2779 { |
|
2780 CreateTabGroupL( KNullDesC ); |
|
2781 } |
|
2782 iNaviPane->PushL( *iNaviDecorator ); // Make it visible |
|
2783 #endif // RD_MSG_NAVIPANE_IMPROVEMENT |
|
2784 LOGTEXT(_L8("NotViewerAppUi: InitNavipaneL end")); |
|
2785 } |
|
2786 |
|
2787 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2788 // --------------------------------------------------------- |
|
2789 // CNotViewerAppUi::CreateTabGroupL |
|
2790 // --------------------------------------------------------- |
|
2791 // |
|
2792 void CNotViewerAppUi::CreateTabGroupL( const TDesC& aText ) |
|
2793 { |
|
2794 //Delete (possibly) existing navi decorator |
|
2795 delete iNaviDecorator; |
|
2796 iNaviDecorator = NULL; |
|
2797 |
|
2798 //Create TabGroup |
|
2799 iNaviDecorator = iNaviPane->CreateTabGroupL(); |
|
2800 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*> |
|
2801 ( iNaviDecorator->DecoratedControl() ); |
|
2802 |
|
2803 |
|
2804 TRect naviPane; |
|
2805 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ENaviPane, naviPane ); |
|
2806 |
|
2807 TAknLayoutRect naviTabsPane; |
|
2808 naviTabsPane.LayoutRect( naviPane, |
|
2809 AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine() ); |
|
2810 |
|
2811 TAknLayoutRect navi2TabsPane; |
|
2812 navi2TabsPane.LayoutRect( naviTabsPane.Rect(), |
|
2813 AknLayoutScalable_Avkon::navi_tabs_2_pane().LayoutLine() ); |
|
2814 |
|
2815 TAknLayoutRect tabs2ActivePane; |
|
2816 tabs2ActivePane.LayoutRect( navi2TabsPane.Rect(), |
|
2817 AknLayoutScalable_Avkon::tabs_2_active_pane( 0 ).LayoutLine() ); |
|
2818 |
|
2819 TAknLayoutRect tabs2ActivePaneIcon; |
|
2820 tabs2ActivePaneIcon.LayoutRect( tabs2ActivePane.Rect(), |
|
2821 AknLayoutScalable_Avkon::tabs_2_active_pane_g1().LayoutLine() ); |
|
2822 |
|
2823 TSize indicatorIconSize( tabs2ActivePaneIcon.Rect().Size() ); |
|
2824 |
|
2825 CFbsBitmap* bitmapPriority = NULL; |
|
2826 CFbsBitmap* maskPriority = NULL; |
|
2827 |
|
2828 // Create message priority bitmap |
|
2829 if ( iMtm->MessagePriority() == EMmsPriorityHigh || |
|
2830 iMtm->MessagePriority() == EMmsPriorityLow ) |
|
2831 { |
|
2832 // Set path of bitmap file |
|
2833 TParse fileParse; |
|
2834 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
2835 |
|
2836 if ( iMtm->MessagePriority() == EMmsPriorityHigh ) |
|
2837 { |
|
2838 // Create high priority bitmap |
|
2839 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
2840 KAknsIIDQgnIndiMcePriorityHigh, |
|
2841 KAknsIIDQsnIconColors, |
|
2842 EAknsCIQsnIconColorsCG7, |
|
2843 bitmapPriority, |
|
2844 maskPriority, |
|
2845 fileParse.FullName(), |
|
2846 EMbmMmsuiQgn_indi_mce_priority_high, |
|
2847 EMbmMmsuiQgn_indi_mce_priority_high_mask, |
|
2848 AKN_LAF_COLOR( KIconDefaultColor ), |
|
2849 indicatorIconSize, |
|
2850 EAspectRatioPreserved ); |
|
2851 } |
|
2852 else |
|
2853 { |
|
2854 // Create low priority bitmap |
|
2855 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
2856 KAknsIIDQgnIndiMcePriorityLow, |
|
2857 KAknsIIDQsnIconColors, |
|
2858 EAknsCIQsnIconColorsCG7, |
|
2859 bitmapPriority, |
|
2860 maskPriority, |
|
2861 fileParse.FullName(), |
|
2862 EMbmMmsuiQgn_indi_mce_priority_low, |
|
2863 EMbmMmsuiQgn_indi_mce_priority_low_mask, |
|
2864 AKN_LAF_COLOR( KIconDefaultColor ), |
|
2865 indicatorIconSize, |
|
2866 EAspectRatioPreserved ); |
|
2867 } |
|
2868 |
|
2869 if ( !bitmapPriority ) |
|
2870 { |
|
2871 User::Leave( KErrNotFound ); |
|
2872 } |
|
2873 |
|
2874 CleanupStack::PushL( bitmapPriority ); |
|
2875 CleanupStack::PushL( maskPriority ); |
|
2876 |
|
2877 if ( tabGroup->TabCount() == 0 ) |
|
2878 { |
|
2879 tabGroup->AddTabL( 0, aText, bitmapPriority, maskPriority ); |
|
2880 } |
|
2881 else |
|
2882 { |
|
2883 tabGroup->ReplaceTabL( 0, aText, bitmapPriority, maskPriority ); |
|
2884 } |
|
2885 |
|
2886 CleanupStack::Pop( maskPriority ); |
|
2887 CleanupStack::Pop( bitmapPriority ); |
|
2888 } |
|
2889 else |
|
2890 { |
|
2891 if ( tabGroup->TabCount() == 0 ) |
|
2892 { |
|
2893 tabGroup->AddTabL( 0, aText ); |
|
2894 } |
|
2895 else |
|
2896 { |
|
2897 tabGroup->ReplaceTabL( 0, aText ); |
|
2898 } |
|
2899 } |
|
2900 |
|
2901 tabGroup->SetActiveTabById( 0 ); |
|
2902 tabGroup->SetTabFixedWidthL( KTabWidthWithOneTab ); |
|
2903 } |
|
2904 #endif // !RD_MSG_NAVIPANE_IMPROVEMENT |
|
2905 |
|
2906 // --------------------------------------------------------- |
|
2907 // CNotViewerAppUi::AlreadyDeletedFromServer |
|
2908 // --------------------------------------------------------- |
|
2909 // |
|
2910 TBool CNotViewerAppUi::AlreadyDeletedFromServer( ) |
|
2911 { |
|
2912 TBool resp = EFalse; |
|
2913 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
2914 if( ( entry.iMtmData2 & KMmsOperationFetch ) // Fetch + forward |
|
2915 && ( entry.iMtmData2 & KMmsOperationForward ) // == DELETE! |
|
2916 && ( entry.iMtmData2 & KMmsOperationFinished ) // It's finished |
|
2917 && !( entry.iMtmData2 & KMmsOperationResult ) ) // No error code |
|
2918 { // Message fetch has been failed |
|
2919 resp = ETrue; |
|
2920 } |
|
2921 return resp; |
|
2922 } |
|
2923 |
|
2924 // --------------------------------------------------------- |
|
2925 // CNotViewerAppUi::CheckAPSettingsL |
|
2926 // --------------------------------------------------------- |
|
2927 // |
|
2928 TBool CNotViewerAppUi::CheckAPSettingsL( ) |
|
2929 { |
|
2930 LOGTEXT(_L8("NotViewerAppUi: CheckAPSettingsL start")); |
|
2931 CMsgEditorDocument* doc = Document( ); |
|
2932 |
|
2933 CNotMtmUi* uiMtm = static_cast<CNotMtmUi*>( &doc->MtmUi( ) ); |
|
2934 |
|
2935 CMmsSettingsDialog::TMmsExitCode exitCode = CMmsSettingsDialog::EMmsExternalInterrupt; |
|
2936 |
|
2937 if ( iToolbar ) //check to be provided for non-touch devices. |
|
2938 { |
|
2939 iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); // Hide the toolbar before settings dialog is launched |
|
2940 } |
|
2941 // Enable Dialer as MMS Settings dialog may be launched |
|
2942 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
2943 if( !uiMtm->CheckSettingsL( exitCode ) ) |
|
2944 { |
|
2945 |
|
2946 // Refresh the settings because they were changed |
|
2947 iSettingsHandler->RefreshSettingsL( ); |
|
2948 TInt32 ap = iSettingsHandler->MmsSettings( )->AccessPoint( 0 ); |
|
2949 |
|
2950 //settings saved |
|
2951 if( !( exitCode==CMmsSettingsDialog::EMmsBack && uiMtm->ApExistsL( ap ) ) ) |
|
2952 { // Settings NOK |
|
2953 if ( iToolbar ) //check to be provided for non-touch devices. |
|
2954 { |
|
2955 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); // Show the toolbar |
|
2956 } |
|
2957 return EFalse; |
|
2958 } |
|
2959 //Settings now OK |
|
2960 } |
|
2961 if ( iToolbar ) //check to be provided for non-touch devices. |
|
2962 { |
|
2963 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); // Show the toolbar |
|
2964 } |
|
2965 if( exitCode==CMmsSettingsDialog::EMmsExit ) |
|
2966 { |
|
2967 // Exit was called |
|
2968 Exit( ); |
|
2969 } |
|
2970 |
|
2971 LOGTEXT(_L8("NotViewerAppUi: CheckAPSettingsL end")); |
|
2972 return ETrue; |
|
2973 } |
|
2974 |
|
2975 // --------------------------------------------------------- |
|
2976 // DoDelayedExitL |
|
2977 // --------------------------------------------------------- |
|
2978 void CNotViewerAppUi::DoDelayedExitL( const TInt aDelay ) |
|
2979 { |
|
2980 delete iIdle; |
|
2981 iIdle = 0; |
|
2982 iIdle = CPeriodic::NewL( EPriorityNormal - 1 ); |
|
2983 iIdle->Start( aDelay, |
|
2984 aDelay, |
|
2985 TCallBack( DelayedExit, this ) ); |
|
2986 } |
|
2987 |
|
2988 // --------------------------------------------------------- |
|
2989 // DelayedExit |
|
2990 // --------------------------------------------------------- |
|
2991 TInt CNotViewerAppUi::DelayedExit( TAny* aThis ) |
|
2992 { |
|
2993 CNotViewerAppUi* editor = static_cast<CNotViewerAppUi*>( aThis ); |
|
2994 TRAP_IGNORE( editor->DoInternalExitL() ); |
|
2995 CAknEnv::RunAppShutter( ); |
|
2996 return KErrNone; |
|
2997 } |
|
2998 |
|
2999 // --------------------------------------------------------- |
|
3000 // DoExternalExitL |
|
3001 // --------------------------------------------------------- |
|
3002 void CNotViewerAppUi::DoInternalExitL() |
|
3003 { |
|
3004 delete iAbsorber; // Remove absorber now just in case |
|
3005 iAbsorber = NULL; |
|
3006 Exit( EAknSoftkeyBack ); |
|
3007 } |
|
3008 |
|
3009 // --------------------------------------------------------- |
|
3010 // EditorObserver |
|
3011 // --------------------------------------------------------- |
|
3012 void CNotViewerAppUi::EditorObserver(TMsgEditorObserverFunc aFunc, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
3013 { |
|
3014 TRAP_IGNORE(DoEditorObserverL(aFunc,aArg1,aArg2,aArg3 ) ); |
|
3015 } |
|
3016 |
|
3017 // --------------------------------------------------------- |
|
3018 // EditorObserver |
|
3019 // --------------------------------------------------------- |
|
3020 void CNotViewerAppUi::DoEditorObserverL(TMsgEditorObserverFunc aFunc, TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
3021 { |
|
3022 switch ( aFunc ) |
|
3023 { |
|
3024 case EMsgButtonEvent: |
|
3025 { |
|
3026 if( !( iFlags & ENotViewerIsNotification ) && !iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
3027 { |
|
3028 CMsgAddressControl* addrControl = AddressControl( ); |
|
3029 if( addrControl == static_cast<CMsgAddressControl*>( aArg1 ) ) |
|
3030 { |
|
3031 TBool modified = EFalse; |
|
3032 if ( addrControl->GetRecipientsL()->Count() ) |
|
3033 { |
|
3034 // Recipients found. Verify addresses. |
|
3035 if ( !VerifyAddressesL( modified ) ) |
|
3036 { |
|
3037 // Illegal address found. |
|
3038 modified = ETrue; |
|
3039 } |
|
3040 } |
|
3041 if ( !modified )//else |
|
3042 { |
|
3043 // Nothing changed on the UI. Open PhoneBook. |
|
3044 AddRecipientL(); |
|
3045 } |
|
3046 } |
|
3047 } |
|
3048 } |
|
3049 break; |
|
3050 case EMsgHandleFocusChange: |
|
3051 case EMsgControlPointerEvent: |
|
3052 { |
|
3053 // Enable Dialer |
|
3054 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
3055 break; |
|
3056 } |
|
3057 default: |
|
3058 break; |
|
3059 } |
|
3060 } |
|
3061 |
|
3062 // ----------------------------------------------------------------------------- |
|
3063 // handles the touch-ui related control events for next/previous message |
|
3064 // ----------------------------------------------------------------------------- |
|
3065 // |
|
3066 #ifdef RD_SCALABLE_UI_V2 |
|
3067 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
3068 void CNotViewerAppUi::HandleNaviDecoratorEventL( TInt aEventID ) |
|
3069 { |
|
3070 if ( AknLayoutUtils::PenEnabled() ) |
|
3071 { |
|
3072 if ( iNaviDecorator |
|
3073 && iNaviPane->Top( ) == iNaviDecorator ) |
|
3074 { |
|
3075 if( IsNextMessageAvailableL( aEventID == EAknNaviDecoratorEventRightTabArrow ) ) |
|
3076 { |
|
3077 /* no need for separate checks for right and left arrows |
|
3078 because IsNextMessageAvailableL() and NextMessageL |
|
3079 are called with the truth-value of the same comparison */ |
|
3080 NextMessageL( aEventID == EAknNaviDecoratorEventRightTabArrow ); |
|
3081 } |
|
3082 } |
|
3083 } |
|
3084 } |
|
3085 #endif |
|
3086 #endif |
|
3087 |
|
3088 // --------------------------------------------------------- |
|
3089 // DynInitToolbarL |
|
3090 // --------------------------------------------------------- |
|
3091 // |
|
3092 #ifdef RD_SCALABLE_UI_V2 |
|
3093 void CNotViewerAppUi::DynInitToolbarL( TInt /*aResourceId*/, |
|
3094 CAknToolbar* aToolbar ) |
|
3095 { |
|
3096 if ( iToolbar |
|
3097 && iToolbar == aToolbar ) |
|
3098 { |
|
3099 // Dimming buttons follow |
|
3100 CNotViewerDocument* doc = Document( ); |
|
3101 CNotMtmUiData* uiData = &doc->MtmUiDataL( ); |
|
3102 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
3103 |
|
3104 if( iFlags & ENotViewerIsNotification ) |
|
3105 { |
|
3106 // Hide always Send and Add |
|
3107 iToolbar->HideItem( ENotViewerToolbarSend, |
|
3108 ETrue, |
|
3109 EFalse ); |
|
3110 iToolbar->HideItem( ENotViewerToolbarAdd, |
|
3111 ETrue, |
|
3112 EFalse ); |
|
3113 |
|
3114 if( uiData->OperationSupportedL( KMtmUiFunctionFetchMMS, entry ) ) |
|
3115 { |
|
3116 iToolbar->SetItemDimmed( ENotViewerToolbarRetrieve, |
|
3117 ETrue, |
|
3118 EFalse ); |
|
3119 } |
|
3120 if( iMtm->Sender().Length()==0 ) |
|
3121 { |
|
3122 iToolbar->SetItemDimmed( ENotViewerToolbarReply, |
|
3123 ETrue, |
|
3124 EFalse ); |
|
3125 } |
|
3126 if( uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, entry ) ) |
|
3127 { |
|
3128 iToolbar->SetItemDimmed( ENotViewerToolbarDelete, |
|
3129 ETrue, |
|
3130 EFalse ); |
|
3131 } |
|
3132 } |
|
3133 else |
|
3134 { |
|
3135 // Hide always Retrieve and Reply |
|
3136 iToolbar->HideItem( ENotViewerToolbarRetrieve, |
|
3137 ETrue, |
|
3138 EFalse ); |
|
3139 iToolbar->HideItem( ENotViewerToolbarReply, |
|
3140 ETrue, |
|
3141 EFalse ); |
|
3142 |
|
3143 if( !iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
3144 { |
|
3145 iToolbar->SetItemDimmed( ENotViewerToolbarDelete, |
|
3146 ETrue, |
|
3147 EFalse ); |
|
3148 } |
|
3149 if( iMtm->Entry( ).Entry( ).ReadOnly( ) ) |
|
3150 { |
|
3151 iToolbar->SetItemDimmed( ENotViewerToolbarSend, |
|
3152 ETrue, |
|
3153 EFalse ); |
|
3154 iToolbar->SetItemDimmed( ENotViewerToolbarAdd, |
|
3155 ETrue, |
|
3156 EFalse ); |
|
3157 } |
|
3158 } |
|
3159 |
|
3160 } |
|
3161 } |
|
3162 #endif |
|
3163 |
|
3164 |
|
3165 // --------------------------------------------------------- |
|
3166 // OfferToolbarEventL |
|
3167 // --------------------------------------------------------- |
|
3168 // |
|
3169 #ifdef RD_SCALABLE_UI_V2 |
|
3170 void CNotViewerAppUi::OfferToolbarEventL( TInt aCommand ) |
|
3171 { |
|
3172 switch ( aCommand ) |
|
3173 { |
|
3174 case ENotViewerToolbarRetrieve: |
|
3175 HandleCommandL( ENotViewerRetrieve ); |
|
3176 break; |
|
3177 |
|
3178 case ENotViewerToolbarReply: |
|
3179 HandleCommandL( ENotViewerReplyViaMessage ); |
|
3180 break; |
|
3181 |
|
3182 case ENotViewerToolbarSend: |
|
3183 HandleCommandL( ENotViewerSend ); |
|
3184 break; |
|
3185 |
|
3186 case ENotViewerToolbarAdd: |
|
3187 HandleCommandL( ENotViewerAddRecipient ); |
|
3188 break; |
|
3189 |
|
3190 case ENotViewerToolbarDelete: |
|
3191 HandleCommandL( ENotViewerDelete ); |
|
3192 break; |
|
3193 |
|
3194 default: |
|
3195 break; |
|
3196 } |
|
3197 } |
|
3198 |
|
3199 // --------------------------------------------------------- |
|
3200 // OperationOngoing |
|
3201 // --------------------------------------------------------- |
|
3202 // |
|
3203 TBool CNotViewerAppUi::OperationOngoing( const TMsvEntry& aEntry ) const |
|
3204 { |
|
3205 return ( aEntry.iMtmData2 & KMmsOperationOngoing |
|
3206 && !( aEntry.iMtmData2 & KMmsOperationFinished ) ); |
|
3207 } |
|
3208 |
|
3209 // --------------------------------------------------------- |
|
3210 // OperationFinished |
|
3211 // --------------------------------------------------------- |
|
3212 // |
|
3213 TBool CNotViewerAppUi::OperationFinished( const TMsvEntry& aEntry ) const |
|
3214 { |
|
3215 return ( aEntry.iMtmData2 & KMmsOperationFinished |
|
3216 && !( aEntry.iMtmData2 & KMmsOperationOngoing ) ); |
|
3217 } |
|
3218 |
|
3219 // --------------------------------------------------------- |
|
3220 // HandleForegroundEventL |
|
3221 // --------------------------------------------------------- |
|
3222 // |
|
3223 void CNotViewerAppUi::HandleForegroundEventL(TBool aForeground) |
|
3224 { |
|
3225 if ( AknLayoutUtils::PenEnabled() ) |
|
3226 { |
|
3227 if ( !iToolbar ) |
|
3228 { |
|
3229 iToolbar = CurrentFixedToolbar(); |
|
3230 if ( iToolbar ) |
|
3231 { |
|
3232 iToolbar->SetToolbarObserver( this ); |
|
3233 iToolbar->DisableToolbarL( ETrue ); |
|
3234 } |
|
3235 } |
|
3236 } |
|
3237 CMsgEditorAppUi::HandleForegroundEventL( aForeground ); |
|
3238 } |
|
3239 #endif |
|
3240 |
|
3241 // --------------------------------------------------------- |
|
3242 // HandleResourceChangeL |
|
3243 // --------------------------------------------------------- |
|
3244 // |
|
3245 void CNotViewerAppUi::HandleResourceChangeL(TInt aType) |
|
3246 { |
|
3247 // Base class call must be first |
|
3248 CMsgEditorAppUi::HandleResourceChangeL(aType); |
|
3249 |
|
3250 if ( aType == KAknsMessageSkinChange ) |
|
3251 { |
|
3252 if ( iAppIcon ) |
|
3253 { |
|
3254 delete iAppIcon; |
|
3255 iAppIcon = NULL; |
|
3256 } |
|
3257 |
|
3258 // Set path of bitmap file |
|
3259 TParse fileParse; |
|
3260 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
3261 |
|
3262 iAppIcon = AknsUtils::CreateGulIconL( |
|
3263 AknsUtils::SkinInstance(), |
|
3264 KAknsIIDQgnPropMceMmsTitle, |
|
3265 fileParse.FullName(), |
|
3266 EMbmMmsuiQgn_prop_mce_mms_title, |
|
3267 EMbmMmsuiQgn_prop_mce_mms_title_mask ); |
|
3268 SetTitleIconL(); |
|
3269 } |
|
3270 else if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
3271 { |
|
3272 SetTitleIconL(); |
|
3273 } |
|
3274 } |
|
3275 |
|
3276 // --------------------------------------------------------- |
|
3277 // SetTitleIconL |
|
3278 // --------------------------------------------------------- |
|
3279 // |
|
3280 void CNotViewerAppUi::SetTitleIconL() |
|
3281 { |
|
3282 SetTitleIconSizeL( iAppIcon->Bitmap() ); |
|
3283 // Create duplicates of the icon to be used |
|
3284 CFbsBitmap* bitmap = new( ELeave ) CFbsBitmap(); |
|
3285 CleanupStack::PushL( bitmap ); |
|
3286 |
|
3287 CFbsBitmap* bitmapMask = new( ELeave ) CFbsBitmap(); |
|
3288 CleanupStack::PushL( bitmapMask ); |
|
3289 |
|
3290 User::LeaveIfError( bitmap->Duplicate( iAppIcon->Bitmap()->Handle() ) ); |
|
3291 User::LeaveIfError( bitmapMask->Duplicate( iAppIcon->Mask()->Handle() ) ); |
|
3292 |
|
3293 iTitlePane->SetSmallPicture( bitmap, bitmapMask, ETrue ); |
|
3294 iTitlePane->DrawNow(); |
|
3295 |
|
3296 CleanupStack::Pop( bitmapMask ); |
|
3297 CleanupStack::Pop( bitmap ); |
|
3298 } |