|
1 /* |
|
2 * Copyright (c) 2006 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 CMmsViewerAppUi class methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <gmxmlconstants.h> |
|
24 |
|
25 #include <e32keys.h> // EStdKey* |
|
26 |
|
27 #include <eikmenup.h> // CEikMenuPane |
|
28 #include <eikmenub.h> // CEikMenuBar |
|
29 #include <eikrted.h> |
|
30 #include <MsgBodyControl.h> // CMsgBodyControl |
|
31 #include <MsgEditorView.h> // CMsgEditorView |
|
32 #include <MsgEditor.hrh> // Base editor commands & enums |
|
33 #include <MsgEditorCommon.h> |
|
34 #include <MsgRecipientItem.h> |
|
35 #include <msgeditor.mbg> // bitmap identifiers |
|
36 #include <MmsViewer.rsg> // resouce identifiers |
|
37 #include <mmsui.mbg> |
|
38 #include <data_caging_path_literals.hrh> |
|
39 |
|
40 #include <apgwgnam.h> // CApaWindowGroupName |
|
41 |
|
42 #include <msvuids.h> |
|
43 #include <MsgAddressControl.h> |
|
44 #include <mtclbase.h> |
|
45 #include <MsgFolderSelectionDialog.h> //Folder Selection dialog |
|
46 #include <MuiuMsvUiServiceUtilities.h> |
|
47 #include <muiumsvuiserviceutilitiesinternal.h> |
|
48 |
|
49 #include <MuiuOperationWait.h> // CMuiuOperationWait |
|
50 #include <MuiuMsgEmbeddedEditorWatchingOperation.h> |
|
51 #include <akninputblock.h> // CAknInputBlock |
|
52 #include <muiumsguploadparam.h> |
|
53 |
|
54 #include <avkon.hrh> |
|
55 #include <avkon.rsg> // R_AVKON_SOFTKEYS_OPTIONS_BACK, R_AVKON_NAVI_PANE_VOLUME_INDICATOR |
|
56 #include <aknnavide.h> // CAknNavigationDecorator |
|
57 #include <akntitle.h> // CAknTitlePane |
|
58 #include <Aknvolumecontrol.h> // CAknVolumeControl |
|
59 #include <AknQueryDialog.h> |
|
60 #include <AknWaitDialog.h> |
|
61 #include <aknnotewrappers.h> |
|
62 #include <aknlists.h> // CAknSinglePopupMenuStyleListBox |
|
63 #include <aknPopup.h> // |
|
64 #include <akntabgrp.h> // CAknTabGroup |
|
65 #include <aknclearer.h> // CAknLocalScreenClearer |
|
66 #include <AknsUtils.h> |
|
67 #include <AknsConstants.h> |
|
68 #include <AknStatuspaneUtils.h> |
|
69 |
|
70 #include <AiwGenericParam.h> // CAiwGenericParamList |
|
71 |
|
72 #include <aknlayoutscalable_apps.cdl.h> |
|
73 #include <aknlayoutscalable_avkon.cdl.h> |
|
74 |
|
75 #include <cntdef.h> // KNullContactId |
|
76 |
|
77 #include <centralrepository.h> |
|
78 #include <cenrepnotifyhandler.h> |
|
79 #include <messaginginternalcrkeys.h> |
|
80 #include <CommonUiInternalCRKeys.h> |
|
81 #include <MusicPlayerInternalCRKeys.h> |
|
82 #include <ProfileEngineSDKCRKeys.h> // silence mode status check |
|
83 #include <settingsinternalcrkeys.h> // KCRUidRichCallSettings |
|
84 #include <messagingvariant.hrh> |
|
85 |
|
86 #include <Profile.hrh> // silence mode status check |
|
87 |
|
88 #include <DocumentHandler.h> // CDocumentHandler |
|
89 #include <commonphoneparser.h> // CommonPhoneParser |
|
90 |
|
91 #include <FindItemmenu.rsg> // Find item stuff |
|
92 #include <finditemmenu.h> // |
|
93 #include <finditemdialog.h> // |
|
94 #include <finditem.hrh> // |
|
95 #include <ItemFinder.h> // |
|
96 |
|
97 #include <StringLoader.h> // StringLoader |
|
98 #include <ErrorUI.h> // Default error notes |
|
99 |
|
100 #include <charconv.h> // Character sets |
|
101 |
|
102 #include <basched.h> // KErrExtended, KLeaveExit |
|
103 |
|
104 #include <eikbtgpc.h> |
|
105 #include <baclipb.h> |
|
106 #include <txtetext.h> |
|
107 #include <txtrich.h> |
|
108 |
|
109 #include <msvstd.h> // Message entries |
|
110 #include <msvapi.h> // MsvOperation |
|
111 #include <msvstore.h> // CMsvStore |
|
112 #include <MtmExtendedCapabilities.hrh> // function id of MessageInfo |
|
113 |
|
114 #include <CSendingServiceInfo.h> |
|
115 #include <sendui.h> // SendUI (for Reply via SMS) |
|
116 #include <SenduiMtmUids.h> // MTM Uids |
|
117 #include <CMessageData.h> |
|
118 |
|
119 #include <mdaaudiosampleplayer.h> |
|
120 #include <AudioPreference.h> |
|
121 #include <NpdApi.h> // CNotePadApi |
|
122 |
|
123 // DRM |
|
124 #include <DRMCommon.h> |
|
125 |
|
126 // SMIL Player |
|
127 #include <SmilPlayerDialog.h> |
|
128 |
|
129 // Features |
|
130 #include <featmgr.h> |
|
131 #include <bldvariant.hrh> |
|
132 |
|
133 // Help |
|
134 #include <csxhelp/mms.hlp.hrh> |
|
135 #include <hlplch.h> // For HlpLauncher |
|
136 |
|
137 #include "MmsMtmUi.h" // Mms Mtm Ui |
|
138 |
|
139 #include "MsgAttachmentUtils.h" // enumerations for objects view |
|
140 |
|
141 #include <msgtextutils.h> |
|
142 #include <MsgMedia.hrh> |
|
143 #include <MsgMediaInfo.h> |
|
144 #include <MsgVideoInfo.h> |
|
145 #include <MsgAttachmentInfo.h> |
|
146 |
|
147 #include <MmsConformance.h> |
|
148 #include <fileprotectionresolver.h> |
|
149 #include <msgmediacontrol.h> |
|
150 #include <msgimagecontrol.h> |
|
151 #include <msgaudiocontrol.h> |
|
152 #include <msgvideocontrol.h> |
|
153 #ifdef RD_SVGT_IN_MESSAGING |
|
154 #include <msgsvgcontrol.h> |
|
155 #endif |
|
156 #include <unidatamodel.h> // CUniDataModel |
|
157 #include <unismilmodel.h> // CUniSmilModel |
|
158 #include <unidatautils.h> // enumerations |
|
159 #include <uniobject.h> |
|
160 #include <unimimeinfo.h> |
|
161 |
|
162 #include <unislideloader.h> |
|
163 |
|
164 #include <uniobjectsviewdialog.h> // Common objects view implementation |
|
165 #include <uniobjectsmodel.h> // Model part of the objects view |
|
166 #include <uniobjectlist.h> |
|
167 #include <unismillist.h> |
|
168 #include <uniobjectsinfo.h> |
|
169 |
|
170 #include <mmsclient.h> // CMmsClientMtm, mmsconst.h |
|
171 #include <mmsgenutils.h> |
|
172 #include <mmsmsventry.h> |
|
173 #include <mmsversion.h> |
|
174 |
|
175 #include "MmsViewer.hrh" // application specific commands & enums |
|
176 #include "UniMmsViewerDocument.h" // CMmsViewerDocument |
|
177 #include "UniMmsViewerAppUi.h" // CMmsViewerAppUi |
|
178 #include "MmsViewerHeader.h" |
|
179 #include "MmsViewerLaunchOperation.h" |
|
180 #include "MmsViewerChangeSlideOperation.h" |
|
181 #include "MmsViewerSendReadReportOperation.h" |
|
182 |
|
183 #include "MmsMtmConst.h" // File logger |
|
184 #include <msgvoipextension.h> |
|
185 |
|
186 #ifdef RD_SCALABLE_UI_V2 |
|
187 #include <aknnavide.h> // pen support on navi pane |
|
188 #include <AknNaviObserver.h> // pen support of volume control of navi pane |
|
189 #endif |
|
190 #include <akntoolbar.h> |
|
191 #include <MsgEditorAppUiExtension.h>// for iMsgEditorAppUiExtension |
|
192 #include <MsgEditorSettingCacheUpdatePlugin.h> |
|
193 #include <e32property.h> |
|
194 #include <ctsydomainpskeys.h> |
|
195 #include <aknstyluspopupmenu.h> |
|
196 // CONSTANTS |
|
197 |
|
198 // following is minimum value for player |
|
199 const TInt KVolumeControlMinValuePlayer = 0; |
|
200 // following are minimum values for avkon volume indicator component |
|
201 const TInt KVolumeControlMinValue = 0; //from "AKNVOLUMECONTROL.CPP" |
|
202 const TInt KVolumeControlMaxValue = 10; //from "AKNVOLUMECONTROL.CPP" |
|
203 const TInt KVolumeDefault = 8; |
|
204 const TInt KVolumeLevels = 10; |
|
205 const TInt KMmsSizeWaitDialogDisabled = 204800; |
|
206 |
|
207 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
208 const TUint KNaviGranularity = 2; |
|
209 const TInt KIconDefaultColor = 0; |
|
210 #endif |
|
211 _LIT( KMmsUiMbmFile, "mmsui.mbm" ); |
|
212 |
|
213 const TInt KReplyToSenderSize = 2048; |
|
214 const TInt KReplyToAllSize = 2048; |
|
215 const TMsvId KNewMessageFolder = KMsvDraftEntryIdValue; |
|
216 const TInt KInvalidResourceId = -1; |
|
217 |
|
218 // Fast swap window group |
|
219 #define KFastSwapAppUid TUid::Uid( 0x10207218 ) |
|
220 #define KAknNotifyServerAppUid TUid::Uid( 0x10281ef2 ) |
|
221 #define KScreenSaverAppUid TUid::Uid( 0x100056CF ) |
|
222 |
|
223 _LIT( KMmsViewerSpace, " " ); |
|
224 |
|
225 const TUid KNotepadUID3 = { KTextHandler }; // Notepad viever |
|
226 |
|
227 // Exiting in launch. Let this time to show error notes |
|
228 //const TInt KDelayedExitShort = 100000; |
|
229 |
|
230 |
|
231 // ================= MEMBER FUNCTIONS ======================= |
|
232 |
|
233 // --------------------------------------------------------- |
|
234 // C++ default constructor can NOT contain any code, that |
|
235 // might leave. |
|
236 // --------------------------------------------------------- |
|
237 // |
|
238 CMmsViewerAppUi::CMmsViewerAppUi( ) : |
|
239 iPendingNoteResource( KInvalidResourceId ), |
|
240 iViewerFlags( EInitialFlags ), |
|
241 iViewerState( ENormal ) |
|
242 { |
|
243 LOGTIMESTAMP("CMmsViewerAppUi::CMmsViewerAppUi "); |
|
244 } |
|
245 |
|
246 // --------------------------------------------------------- |
|
247 // Symbian OS default constructor can leave. |
|
248 // --------------------------------------------------------- |
|
249 // |
|
250 void CMmsViewerAppUi::ConstructL( ) |
|
251 { |
|
252 CMsgEditorAppUi::ConstructL( ); |
|
253 |
|
254 // Disable task swapper from options menu during launch |
|
255 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptionsNoTaskSwapper ); |
|
256 |
|
257 LOGTEXT(_L8("CMmsViewerAppUi::ConstructL starting") ); |
|
258 FeatureManager::InitializeLibL( ); |
|
259 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
260 { |
|
261 iSupportedFeatures |= EMmsFeatureHelp; |
|
262 } |
|
263 if ( FeatureManager::FeatureSupported( KFeatureIdDrmFull ) ) |
|
264 { |
|
265 iSupportedFeatures |= EMmsFeatureDrmFull; |
|
266 } |
|
267 if ( FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) |
|
268 { |
|
269 iSupportedFeatures |= EMmsFeatureSVK; |
|
270 } |
|
271 if ( FeatureManager::FeatureSupported( KFeatureIdSenduiMmsUpload ) ) |
|
272 { |
|
273 iSupportedFeatures |= EMmsFeatureUpload; |
|
274 } |
|
275 if ( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) ) |
|
276 { |
|
277 iSupportedFeatures |= EMmsFeatureAudioMessaging; |
|
278 } |
|
279 FeatureManager::UnInitializeLib( ); |
|
280 |
|
281 #ifdef RD_SCALABLE_UI_V2 |
|
282 // Creation of CMsgEditorView must be after toolbar is set visible otherwise layout things can go wrong. |
|
283 // Toolbar itself seems to set itself invisible temporary at some startup time. Toolbar is set visible here, too. |
|
284 if ( AknLayoutUtils::PenEnabled() ) |
|
285 { |
|
286 iToolbar = CurrentFixedToolbar(); |
|
287 if ( iToolbar ) |
|
288 { |
|
289 iToolbar->SetToolbarObserver( this ); |
|
290 iToolbar->SetToolbarVisibility( ETrue, EFalse ); |
|
291 } |
|
292 } |
|
293 #endif |
|
294 |
|
295 iView = CMsgEditorView::NewL( *this, |
|
296 CMsgEditorView::EMsgReadOnly | |
|
297 CMsgEditorView::EMsgDoNotUseDefaultBodyControl ); |
|
298 |
|
299 iMtm = &(Document( )->Mtm( )); |
|
300 iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
301 ( StatusPane( )->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
302 iTitlePane = static_cast<CAknTitlePane*> |
|
303 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
304 iButtonGroup = Cba( ); |
|
305 iSvkEvents = CMmsSvkEvents::NewL( *this ); |
|
306 |
|
307 if ( !iButtonGroup || !iNaviPane || !iMtm ) |
|
308 { |
|
309 User::Leave( KErrBadHandle ); |
|
310 } |
|
311 |
|
312 TInt highlight = 0; |
|
313 TInt drmPlayback = 0; |
|
314 // Volume level storage |
|
315 iMmsRepository = CRepository::NewL( KCRUidMmsui ); |
|
316 |
|
317 // Automatic highlight setting storage and change notifications |
|
318 iCUiRepository = CRepository::NewL( KCRUidCommonUi ); |
|
319 iCUiRepository->Get( KCuiAutomaticHighlight, highlight ); |
|
320 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, |
|
321 *iCUiRepository, |
|
322 CCenRepNotifyHandler::EIntKey, |
|
323 KCuiAutomaticHighlight ); |
|
324 iNotifyHandler->StartListeningL( ); |
|
325 |
|
326 CRepository* repository = CRepository::NewLC( KCRUidMusicPlayerFeatures ); |
|
327 repository->Get( KRequireDRMInPlayback, drmPlayback ); |
|
328 |
|
329 if ( drmPlayback ) |
|
330 { |
|
331 TBuf<1> tmp; // Magic: 1 char to get length of actual value |
|
332 TInt realLen = 0; |
|
333 TInt err = repository->Get( KPlaybackRestrictedMimeTypes, |
|
334 tmp, |
|
335 realLen ); |
|
336 |
|
337 if ( err == KErrOverflow ) |
|
338 { |
|
339 // Prepare list of blocked MIME types |
|
340 iProhibitMimeTypeBuffer = HBufC::NewL( realLen + KMmsViewerSpace().Length() ); |
|
341 TPtr bufferPtr = iProhibitMimeTypeBuffer->Des(); |
|
342 |
|
343 User::LeaveIfError( repository->Get( KPlaybackRestrictedMimeTypes, bufferPtr ) ); |
|
344 bufferPtr.Append( KMmsViewerSpace ); |
|
345 } |
|
346 else |
|
347 { |
|
348 User::LeaveIfError( err ); |
|
349 } |
|
350 } |
|
351 |
|
352 CleanupStack::PopAndDestroy( repository ); |
|
353 repository = NULL; |
|
354 |
|
355 TInt features(0); |
|
356 repository = CRepository::NewL( KCRUidMuiuVariation ); |
|
357 |
|
358 repository->Get( KMuiuMmsFeatures, features ); |
|
359 if ( features & KMmsFeatureIdDeliveryStatusDialog ) |
|
360 { |
|
361 iSupportedFeatures |= EMmsFeatureDeliveryStatus; |
|
362 } |
|
363 |
|
364 repository->Get( KMuiuUniEditorFeatures, features ); |
|
365 if ( features & KUniEditorFeatureIdRestrictedReplyMms ) |
|
366 { |
|
367 iSupportedFeatures |= EMmsFeatureRestrictedReply; |
|
368 } |
|
369 delete repository; |
|
370 |
|
371 repository = CRepository::NewL( KCRUidUniEditor ); |
|
372 repository->Get( KUniEditorMaxSlideCount, iMaxForwardSlideCount ); |
|
373 delete repository; |
|
374 |
|
375 // Set up highlighting |
|
376 if ( highlight == 0 ) |
|
377 { |
|
378 iViewerFlags &= ~EAutohighLightEnabled; |
|
379 } |
|
380 else |
|
381 { |
|
382 iViewerFlags |= EAutohighLightEnabled; |
|
383 } |
|
384 |
|
385 if ( drmPlayback ) |
|
386 { |
|
387 iViewerFlags |= EProhibitNonDrmMusic; |
|
388 } |
|
389 |
|
390 if ( Document( )->CreationMode( ) == EMmsCreationModeWarning ) |
|
391 { |
|
392 iViewerFlags |= EShowGuidedConf; |
|
393 } |
|
394 |
|
395 iMmsConformance = CMmsConformance::NewL( ); |
|
396 |
|
397 // Set path of bitmap file |
|
398 TParse fileParse; |
|
399 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
400 |
|
401 iAppIcon = AknsUtils::CreateGulIconL( |
|
402 AknsUtils::SkinInstance(), |
|
403 KAknsIIDQgnPropMceMmsTitle, |
|
404 fileParse.FullName(), |
|
405 EMbmMmsuiQgn_prop_mce_mms_title, |
|
406 EMbmMmsuiQgn_prop_mce_mms_title_mask ); |
|
407 |
|
408 // Get important window group ids |
|
409 GetNonStoppingWgIds( ); |
|
410 |
|
411 // Priority must be lower than the priority of iWrappedWaitDialog |
|
412 // Constructed here to ensure exit on low memory situations. |
|
413 iIdle = CPeriodic::NewL( EPriorityNormal - 1); |
|
414 |
|
415 if( !iEikonEnv->StartedAsServerApp( ) ) |
|
416 { |
|
417 Document( )->PrepareToLaunchL( this ); |
|
418 } |
|
419 LOGTEXT2(_L16("CMmsViewerAppUi::ConstructL read. iSupportedFeatures 0x%x"), iSupportedFeatures ); |
|
420 iLongTapDetector = CAknLongTapDetector::NewL( this ); |
|
421 iLongTapDetector->SetTimeDelayBeforeAnimation( KUniLongTapStartDelay ); |
|
422 iLongTapDetector->SetLongTapDelay( KUniLongTapTimeDelay ); |
|
423 iTapConsumed = EFalse; |
|
424 } |
|
425 |
|
426 // --------------------------------------------------------- |
|
427 // Destructor |
|
428 // --------------------------------------------------------- |
|
429 // |
|
430 CMmsViewerAppUi::~CMmsViewerAppUi( ) |
|
431 { |
|
432 LOGTEXT(_L8("CMmsViewerAppUi::~CMmsViewerAppUi starting") ); |
|
433 iViewerFlags |= EViewerExiting; |
|
434 iViewerState = EReseted; |
|
435 EndActiveWait(); |
|
436 // Input blocker is also deleted |
|
437 DeactivateInputBlocker(); |
|
438 if ( iNotifyHandler ) |
|
439 { |
|
440 iNotifyHandler->StopListening( ); |
|
441 } |
|
442 delete iNotifyHandler; |
|
443 delete iCUiRepository; |
|
444 delete iMmsRepository; |
|
445 |
|
446 //iMtm not owned - just a reference pointer |
|
447 //iSmilModel not owned - just a reference pointer |
|
448 //iNaviPane not owned - just a reference pointer |
|
449 //iButtonGroup not owned - just a reference pointer |
|
450 |
|
451 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
452 delete iNaviDecorator; |
|
453 #endif |
|
454 delete iVolumeDecorator; |
|
455 delete iWaitDialog; |
|
456 delete iFindItemMenu; |
|
457 delete iDocHandler; |
|
458 |
|
459 delete iHeader; |
|
460 delete iSlideLoader; |
|
461 delete iLaunchOperation; |
|
462 delete iChangeSlideOperation; |
|
463 delete iScreenClearer; |
|
464 iUploadServices.ResetAndDestroy( ); |
|
465 delete iMmsVoIPExtension; |
|
466 delete iSvkEvents; |
|
467 delete iMmsConformance; |
|
468 delete iTitleIcon; |
|
469 |
|
470 delete iProhibitMimeTypeBuffer; |
|
471 delete iSendReadReportOperation; |
|
472 delete iIdle; |
|
473 delete iAppIcon; |
|
474 if(iLongTapDetector) |
|
475 { |
|
476 delete iLongTapDetector; |
|
477 } |
|
478 if(iEmbeddedObjectStylusPopup) |
|
479 { |
|
480 delete iEmbeddedObjectStylusPopup; |
|
481 iEmbeddedObjectStylusPopup = NULL; |
|
482 } |
|
483 |
|
484 LOGTEXT(_L8("CMmsViewerAppUi::~CMmsViewerAppUi end") ); |
|
485 } |
|
486 |
|
487 // --------------------------------------------------------- |
|
488 // CMmsViewerAppUi::Document |
|
489 // --------------------------------------------------------- |
|
490 // |
|
491 CMmsViewerDocument* CMmsViewerAppUi::Document( ) const |
|
492 { |
|
493 return static_cast<CMmsViewerDocument*>( CMsgEditorAppUi::Document( ) ); |
|
494 } |
|
495 |
|
496 // --------------------------------------------------------- |
|
497 // CMmsViewerAppUi::MsgSaveExitL |
|
498 // framework function |
|
499 // --------------------------------------------------------- |
|
500 // |
|
501 void CMmsViewerAppUi::DoMsgSaveExitL( ) |
|
502 { |
|
503 MediaStop( ); |
|
504 iExitMode = MApaEmbeddedDocObserver::TExitMode(CMsgEmbeddedEditorWatchingOperation::EMsgExternalExit); |
|
505 Exit( ); |
|
506 } |
|
507 |
|
508 |
|
509 // --------------------------------------------------------- |
|
510 // CMmsViewerAppUi::LaunchViewL |
|
511 // --------------------------------------------------------- |
|
512 // |
|
513 |
|
514 void CMmsViewerAppUi::LaunchViewL( ) |
|
515 { |
|
516 __ASSERT_DEBUG( Document( )->Entry( ).Id( ) != KMsvNullIndexEntryId, Panic( EMmsViewerNoMessage ) ); |
|
517 TBool exitViewer( EFalse ); |
|
518 if ( iViewerFlags & EViewerExiting ) |
|
519 { |
|
520 exitViewer = ETrue; |
|
521 } |
|
522 else |
|
523 { |
|
524 TRAPD( error, DoLaunchViewL() ); |
|
525 |
|
526 if ( error != KErrNone ) |
|
527 { |
|
528 iEikonEnv->HandleError( error ); |
|
529 exitViewer = ETrue; |
|
530 } |
|
531 } |
|
532 |
|
533 if ( exitViewer ) |
|
534 { |
|
535 // Start the delayed exit here if exit command was given before application was |
|
536 // ready to handle it or error happened when performing lauch view. |
|
537 // Delayed exit is used as LauchViewL cannot make proper exit if Exit() is called here. |
|
538 DoDelayedExit( 0 ); |
|
539 } |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------- |
|
543 // CMmsViewerAppUi::DoLaunchViewL |
|
544 // --------------------------------------------------------- |
|
545 // |
|
546 void CMmsViewerAppUi::DoLaunchViewL() |
|
547 { |
|
548 // Exiting here leaves incomplete mms viewer view visible |
|
549 // Let the launch happen until ViewerOperationEvent() |
|
550 TRAPD( error, iMtm->LoadMessageL( ) ); |
|
551 LOGTEXT2(_L16("CMmsViewerAppUi::LaunchViewL error %d"), error ); |
|
552 if ( error ) |
|
553 { |
|
554 if ( error != KErrNoMemory ) |
|
555 { |
|
556 ShowErrorNoteL( R_MMSVIEWER_ERROR_MSG_CORRUPT ); |
|
557 } |
|
558 User::Leave( error ); |
|
559 } |
|
560 |
|
561 iViewerState = EBusy; |
|
562 iOpeningState = EOpeningMessage; |
|
563 |
|
564 // Disabling Wait Dialog for messages less than 200kB |
|
565 if ( iMtm->MessageSize() > KMmsSizeWaitDialogDisabled ) |
|
566 { |
|
567 LaunchWaitDialogL( 0 ); |
|
568 } |
|
569 |
|
570 // iWaitDialog was deleted in case of error. Is this needed ? |
|
571 iLaunchOperation = new ( ELeave ) CMmsViewerLaunchOperation( |
|
572 this, |
|
573 *this, |
|
574 *this, |
|
575 *Document( ), |
|
576 *iView, |
|
577 iCoeEnv->FsSession( ) ); |
|
578 ActivateInputBlockerL( iLaunchOperation ); |
|
579 iLaunchOperation ? iLaunchOperation->Launch( ) : User::Leave( KErrNoMemory ); |
|
580 } |
|
581 |
|
582 // --------------------------------------------------------- |
|
583 // CMmsViewerAppUi::ChangeSlideL |
|
584 // --------------------------------------------------------- |
|
585 // |
|
586 void CMmsViewerAppUi::ChangeSlideL( TInt aSlideNumber, TBool aScreenClearer ) |
|
587 { |
|
588 if ( aSlideNumber < 0 || aSlideNumber >= iSmilModel->SlideCount( ) ) |
|
589 { |
|
590 User::Leave( KErrArgument ); |
|
591 } |
|
592 MediaStop( ); |
|
593 |
|
594 iViewerState = EBusy; |
|
595 iOpeningState = EOpeningSlide; |
|
596 iViewerFlags |= EVideoHasAudio; |
|
597 iVideo = NULL; |
|
598 iAudio = NULL; |
|
599 iImage = NULL; |
|
600 #ifdef RD_SVGT_IN_MESSAGING |
|
601 iSvgt = NULL; |
|
602 #endif |
|
603 iPendingNoteResource = KInvalidResourceId; |
|
604 iPendingNotePriority = 0; |
|
605 iPendingNoteObject = NULL; |
|
606 iPendingNoteError = KErrNone; |
|
607 |
|
608 // use case: |
|
609 // precondition: text on two slide and from field empty on the emulator |
|
610 // crash when: |
|
611 // - goto slide 2 and take selection menu on text |
|
612 // - goto slide 1 and take selection menu on from field (which is empty) => crash |
|
613 // iFindItem contains 'deleted' objects |
|
614 delete iFindItemMenu; |
|
615 iFindItemMenu = NULL; |
|
616 |
|
617 UpdateMskL(); |
|
618 |
|
619 |
|
620 if ( !iChangeSlideOperation ) |
|
621 { |
|
622 iChangeSlideOperation = new ( ELeave )CMmsViewerChangeSlideOperation ( |
|
623 *this, |
|
624 *( Document( ) ), |
|
625 *iHeader, |
|
626 *iSlideLoader, |
|
627 *iView, |
|
628 iCoeEnv->FsSession( ) ); |
|
629 } |
|
630 |
|
631 iChangeSlideOperation ? iChangeSlideOperation->ChangeSlide( aSlideNumber ) : User::Leave( KErrNoMemory ); |
|
632 |
|
633 if ( aScreenClearer ) |
|
634 { |
|
635 iScreenClearer = CAknLocalScreenClearer::NewLC( EFalse ); |
|
636 CleanupStack::Pop( iScreenClearer ); |
|
637 iScreenClearer->SetExtent( iScreenClearer->Position(), ClientRect().Size() ); |
|
638 } |
|
639 |
|
640 if ( aScreenClearer ) |
|
641 { |
|
642 LaunchWaitDialogL( aSlideNumber ); |
|
643 } |
|
644 ActivateInputBlockerL( iChangeSlideOperation ); |
|
645 |
|
646 // TODO: Get rid of active wait! |
|
647 BeginActiveWait( iChangeSlideOperation ); |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------- |
|
651 // CMmsViewerAppUi::LaunchWaitDialogL |
|
652 // --------------------------------------------------------- |
|
653 // |
|
654 void CMmsViewerAppUi::LaunchWaitDialogL( TInt aParam ) |
|
655 { |
|
656 if ( iWaitDialog ) |
|
657 { |
|
658 delete iWaitDialog; |
|
659 iWaitDialog = NULL; |
|
660 } |
|
661 |
|
662 if ( iOpeningState == EOpeningMessage ) |
|
663 { |
|
664 iWaitDialog = new ( ELeave ) CAknWaitDialog( |
|
665 ( reinterpret_cast<CEikDialog**>( &iWaitDialog ) ), |
|
666 ETrue ); |
|
667 iWaitDialog->ExecuteLD( R_MMSVIEWER_WAIT_LOADING ); |
|
668 } |
|
669 else if ( iOpeningState == EOpeningSlide ) |
|
670 { |
|
671 iWaitDialog = new ( ELeave ) CAknWaitDialog( |
|
672 ( reinterpret_cast<CEikDialog**>( &iWaitDialog ) ), |
|
673 EFalse ); |
|
674 CArrayFixFlat<TInt>* array = new ( ELeave ) CArrayFixFlat<TInt>(2); |
|
675 CleanupStack::PushL( array ); |
|
676 array->AppendL( aParam + 1 ); |
|
677 array->AppendL( iSmilModel->SlideCount( ) ); |
|
678 HBufC* string = StringLoader::LoadLC( |
|
679 R_MMSVIEWER_OPENING_PAGE, |
|
680 *array, |
|
681 iCoeEnv ); |
|
682 iWaitDialog->SetTextL( *string ); |
|
683 iWaitDialog->ExecuteLD( R_MMSVIEWER_WAIT_OPENING_PAGE ); |
|
684 CleanupStack::PopAndDestroy( 2, array ); // + string |
|
685 } |
|
686 } |
|
687 |
|
688 |
|
689 // --------------------------------------------------------- |
|
690 // CMmsViewerAppUi::SetPendingNote |
|
691 // --------------------------------------------------------- |
|
692 // |
|
693 void CMmsViewerAppUi::SetPendingNote( TInt aResourceId, |
|
694 CUniObject* aObject, |
|
695 TInt aError ) |
|
696 { |
|
697 TInt priority = 0; |
|
698 switch ( aResourceId ) |
|
699 { |
|
700 case R_MMSVIEWER_DRM_ERROR: |
|
701 { |
|
702 // do not show note during launch or slide change except for image |
|
703 if ( !aObject |
|
704 || !aObject->MediaInfo( ) |
|
705 || ( ( iOpeningState == EOpeningMessage |
|
706 || iOpeningState == EOpeningSlide ) |
|
707 && aObject->MediaType( ) != EMsgMediaImage ) ) |
|
708 { |
|
709 return; |
|
710 } |
|
711 else if ( aObject->MediaType( ) == EMsgMediaImage |
|
712 #ifdef RD_SVGT_IN_MESSAGING |
|
713 || aObject->MediaType( ) == EMsgMediaSvg |
|
714 #endif |
|
715 ) |
|
716 { |
|
717 if ( aObject->DrmInfo( ) ) |
|
718 { |
|
719 TBool consumed = EFalse; |
|
720 aObject->DrmInfo( )->EvaluateRights( consumed ); |
|
721 if ( consumed ) |
|
722 { |
|
723 return; |
|
724 } |
|
725 } |
|
726 else |
|
727 { |
|
728 // can't do anything without drm info |
|
729 return; |
|
730 } |
|
731 } |
|
732 priority = 5; |
|
733 break; |
|
734 } |
|
735 case R_MMSVIEWER_DRM_PREVIEW_RIGHTS: |
|
736 priority = 4; |
|
737 break; |
|
738 case R_MMSVIEWER_DRM_OBJECT_REMOVED: |
|
739 if (!priority) |
|
740 { |
|
741 priority = 3; |
|
742 } |
|
743 break; |
|
744 case R_MMSVIEWER_CANNOT_DISPLAY_OBJECTS: |
|
745 { |
|
746 |
|
747 // during launch only |
|
748 if ( iOpeningState != EOpeningMessage ) |
|
749 { |
|
750 return; |
|
751 } |
|
752 if (!priority) |
|
753 { |
|
754 priority = 2; |
|
755 } |
|
756 break; |
|
757 } |
|
758 case R_QTN_MMS_CANNOT_OPEN_CORRUPTED: |
|
759 { |
|
760 // during play only |
|
761 if ( iOpeningState != EOpeningNone ) |
|
762 { |
|
763 return; |
|
764 } |
|
765 priority = 1; |
|
766 break; |
|
767 } |
|
768 default: |
|
769 break; |
|
770 } |
|
771 if ( priority > iPendingNotePriority ) |
|
772 { |
|
773 iPendingNotePriority = priority; |
|
774 iPendingNoteResource = aResourceId; |
|
775 iPendingNoteObject = aObject; |
|
776 iPendingNoteError = aError; |
|
777 } |
|
778 } |
|
779 |
|
780 // --------------------------------------------------------- |
|
781 // CMmsViewerAppUi::ShowPendingNoteL |
|
782 // --------------------------------------------------------- |
|
783 // |
|
784 void CMmsViewerAppUi::ShowPendingNoteL( ) |
|
785 { |
|
786 // show note only once and after every control has been initialised |
|
787 // in order to show the highest priority note |
|
788 if ( !AreControlsReadyAndWaitNoteDismissedL() ) |
|
789 { |
|
790 return; |
|
791 } |
|
792 |
|
793 iOpeningState = EOpeningNone; |
|
794 |
|
795 // It may occur that this code point is entered twice when control state changes take place |
|
796 // Temp variable is second action to avoid it. Resetting iPending* variables earlier in ReloadControlL |
|
797 // and ChangeSlide is first one |
|
798 TInt pendingNoteResource = iPendingNoteResource; |
|
799 iPendingNoteResource = KInvalidResourceId; |
|
800 switch ( pendingNoteResource ) |
|
801 { |
|
802 case R_MMSVIEWER_DRM_ERROR: |
|
803 { |
|
804 if ( iPendingNoteObject |
|
805 && iPendingNoteObject->DrmInfo( ) ) |
|
806 { |
|
807 TRAP_IGNORE( iPendingNoteObject->DrmInfo( )->HandleDrmErrorL( iPendingNoteError ) ); |
|
808 } |
|
809 break; |
|
810 } |
|
811 case R_MMSVIEWER_DRM_PREVIEW_RIGHTS: |
|
812 case R_MMSVIEWER_DRM_OBJECT_REMOVED: |
|
813 case R_MMSVIEWER_CANNOT_DISPLAY_OBJECTS: |
|
814 case R_QTN_MMS_CANNOT_OPEN_CORRUPTED: |
|
815 { |
|
816 ShowInformationNoteL( pendingNoteResource ); |
|
817 } |
|
818 break; |
|
819 case KInvalidResourceId: |
|
820 default: |
|
821 break; |
|
822 } |
|
823 iPendingNotePriority = 0; |
|
824 iPendingNoteObject = NULL; |
|
825 iPendingNoteError = KErrNone; |
|
826 } |
|
827 |
|
828 |
|
829 // --------------------------------------------------------- |
|
830 // CMmsViewerAppUi::InitNavipaneL |
|
831 // --------------------------------------------------------- |
|
832 // |
|
833 void CMmsViewerAppUi::InitNavipaneL( ) |
|
834 { |
|
835 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT |
|
836 if ( !iNaviDecorator ) |
|
837 { |
|
838 TMsgEditorMsgPriority priority = EMsgEditorMsgPriorityNormal; |
|
839 |
|
840 if ( iMtm->MessagePriority() == EMmsPriorityHigh ) |
|
841 { |
|
842 priority = EMsgEditorMsgPriorityHigh; |
|
843 } |
|
844 else if ( iMtm->MessagePriority() == EMmsPriorityLow ) |
|
845 { |
|
846 priority = EMsgEditorMsgPriorityLow; |
|
847 } |
|
848 |
|
849 CreateViewerNaviPaneL( Document()->Entry().iDate, priority, ETrue ); |
|
850 } |
|
851 |
|
852 if ( MediaIsRunning( iAudio ) || |
|
853 MediaIsRunning( iVideo ) ) |
|
854 { |
|
855 iNaviPane->PushL( *iVolumeDecorator ); |
|
856 } |
|
857 else |
|
858 { |
|
859 iNaviPane->PushL( *iNaviDecorator ); |
|
860 } |
|
861 #else |
|
862 TInt indexInFolder = 0; |
|
863 TInt msgsInFolder = 0; |
|
864 MessageIndexInFolderL( indexInFolder, msgsInFolder ); |
|
865 |
|
866 if ( indexInFolder < 0 |
|
867 || msgsInFolder == 0 ) |
|
868 { |
|
869 // this may occur when viewer is used in cover ui. Viewer is started as |
|
870 // stand alone without current folder and '1/0' would be visible. |
|
871 iNaviPane->PushDefaultL( ); |
|
872 return; |
|
873 } |
|
874 |
|
875 CArrayFixFlat<TInt>* array = new ( ELeave ) CArrayFixFlat<TInt>(KNaviGranularity); |
|
876 CleanupStack::PushL( array ); |
|
877 array->AppendL( indexInFolder + 1 ); |
|
878 array->AppendL( msgsInFolder ); |
|
879 |
|
880 HBufC* buf = StringLoader::LoadLC( R_MMSVIEWER_ORDINAL_NUMBER, *array, iCoeEnv ); |
|
881 //Pushed into CleanupStack |
|
882 |
|
883 //Creates iNaviDecorator |
|
884 CreateTabGroupL( *buf ); |
|
885 CleanupStack::PopAndDestroy( 2, array ); // + buf |
|
886 |
|
887 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
888 |
|
889 //NaviButtons are dimmed by default |
|
890 if ( IsNextMessageAvailableL( ETrue ) ) |
|
891 { |
|
892 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse ); |
|
893 } |
|
894 if ( IsNextMessageAvailableL( EFalse ) ) |
|
895 { |
|
896 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse ); |
|
897 } |
|
898 |
|
899 if ( !MediaIsRunning( iAudio ) |
|
900 && !MediaIsRunning( iVideo ) ) |
|
901 { |
|
902 iNaviPane->PushL( *iNaviDecorator ); |
|
903 } |
|
904 #endif |
|
905 } |
|
906 |
|
907 |
|
908 // --------------------------------------------------------- |
|
909 // CMmsViewerAppUi::UpdatePanesL |
|
910 // --------------------------------------------------------- |
|
911 // |
|
912 void CMmsViewerAppUi::UpdatePanesL( TBool aAudioPlaying, TBool aVideoPlaying ) |
|
913 { |
|
914 if ( aAudioPlaying || aVideoPlaying ) |
|
915 { |
|
916 // Silent mode is handled in DoChangeVolumeL |
|
917 TInt newVolume = DoChangeVolumeL( 0, ETrue, aAudioPlaying ); |
|
918 if ( newVolume >= KVolumeControlMinValue ) |
|
919 { |
|
920 // Show the volume |
|
921 ShowVolumeL( newVolume, aAudioPlaying ); |
|
922 } |
|
923 if ( aAudioPlaying ) |
|
924 { |
|
925 iButtonGroup->SetCommandSetL( R_MMSVIEWER_SOFTKEYS_EMPTY_STOP ); |
|
926 } |
|
927 else if ( aVideoPlaying ) |
|
928 { |
|
929 iButtonGroup->SetCommandSetL( R_MMSVIEWER_SOFTKEYS_EMPTY_STOPVIDEO ); |
|
930 } |
|
931 else |
|
932 { |
|
933 iButtonGroup->SetCommandSetL( R_MMSVIEWER_SOFTKEYS_OPTIONS_BACK_EMPTY ); |
|
934 } |
|
935 |
|
936 if ( iNaviDecorator |
|
937 && iNaviPane->Top( ) == iNaviDecorator ) |
|
938 { |
|
939 // Silent mode is ON or video has not audio |
|
940 // Hide navi pane during playback |
|
941 iNaviPane->PushDefaultL( ); |
|
942 } |
|
943 } |
|
944 else |
|
945 { |
|
946 iButtonGroup->SetCommandSetL( R_MMSVIEWER_SOFTKEYS_OPTIONS_BACK_EMPTY ); |
|
947 if ( iNaviDecorator ) |
|
948 { |
|
949 iNaviPane->PushL( *iNaviDecorator ); |
|
950 } |
|
951 else |
|
952 { |
|
953 iNaviPane->PushDefaultL( ); |
|
954 } |
|
955 } |
|
956 // forces to update MSK, which was overridden here |
|
957 iMskId = 0; |
|
958 iButtonGroup->DrawNow( ); |
|
959 #ifdef RD_SCALABLE_UI_V2 |
|
960 SetToolBarItemVisibilities(); |
|
961 #endif |
|
962 } |
|
963 |
|
964 |
|
965 // --------------------------------------------------------- |
|
966 // CMmsViewerAppUi::CreateTabGroupL |
|
967 // --------------------------------------------------------- |
|
968 // |
|
969 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
970 void CMmsViewerAppUi::CreateTabGroupL( const TDesC& aText ) |
|
971 { |
|
972 if ( !iNaviDecorator ) |
|
973 { |
|
974 // Create TabGroup |
|
975 iNaviDecorator = iNaviPane->CreateTabGroupL(); |
|
976 } |
|
977 |
|
978 #ifdef RD_SCALABLE_UI_V2 |
|
979 if ( AknLayoutUtils::PenEnabled() ) |
|
980 { |
|
981 iNaviDecorator->SetNaviDecoratorObserver( this ); |
|
982 } |
|
983 #endif |
|
984 |
|
985 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( iNaviDecorator->DecoratedControl() ); |
|
986 // Create message priority bitmap |
|
987 if ( iMtm->MessagePriority() == EMmsPriorityHigh || |
|
988 iMtm->MessagePriority() == EMmsPriorityLow ) |
|
989 { |
|
990 TRect naviPane; |
|
991 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ENaviPane, naviPane ); |
|
992 |
|
993 TAknLayoutRect naviTabsPane; |
|
994 naviTabsPane.LayoutRect( naviPane, |
|
995 AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine() ); |
|
996 |
|
997 TAknLayoutRect navi2TabsPane; |
|
998 navi2TabsPane.LayoutRect( naviTabsPane.Rect(), |
|
999 AknLayoutScalable_Avkon::navi_tabs_2_pane().LayoutLine() ); |
|
1000 |
|
1001 TAknLayoutRect tabs2ActivePane; |
|
1002 tabs2ActivePane.LayoutRect( navi2TabsPane.Rect(), |
|
1003 AknLayoutScalable_Avkon::tabs_2_active_pane( 0 ).LayoutLine() ); |
|
1004 |
|
1005 TAknLayoutRect tabs2ActivePaneIcon; |
|
1006 tabs2ActivePaneIcon.LayoutRect( tabs2ActivePane.Rect(), |
|
1007 AknLayoutScalable_Avkon::tabs_2_active_pane_g1().LayoutLine() ); |
|
1008 |
|
1009 TSize indicatorIconSize( tabs2ActivePaneIcon.Rect().Size() ); |
|
1010 |
|
1011 // Set path of bitmap file |
|
1012 TParse fileParse; |
|
1013 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
1014 |
|
1015 CFbsBitmap* bitmapPriority = NULL; |
|
1016 CFbsBitmap* maskPriority = NULL; |
|
1017 |
|
1018 if ( iMtm->MessagePriority() == EMmsPriorityHigh ) |
|
1019 { |
|
1020 // Create high priority bitmap |
|
1021 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
1022 KAknsIIDQgnIndiMcePriorityHigh, |
|
1023 KAknsIIDQsnIconColors, |
|
1024 EAknsCIQsnIconColorsCG7, |
|
1025 bitmapPriority, |
|
1026 maskPriority, |
|
1027 fileParse.FullName(), |
|
1028 EMbmMmsuiQgn_indi_mce_priority_high, |
|
1029 EMbmMmsuiQgn_indi_mce_priority_high_mask, |
|
1030 AKN_LAF_COLOR( KIconDefaultColor ), |
|
1031 indicatorIconSize, |
|
1032 EAspectRatioPreserved ); |
|
1033 } |
|
1034 else |
|
1035 { |
|
1036 // Create low priority bitmap |
|
1037 AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), |
|
1038 KAknsIIDQgnIndiMcePriorityLow, |
|
1039 KAknsIIDQsnIconColors, |
|
1040 EAknsCIQsnIconColorsCG7, |
|
1041 bitmapPriority, |
|
1042 maskPriority, |
|
1043 fileParse.FullName(), |
|
1044 EMbmMmsuiQgn_indi_mce_priority_low, |
|
1045 EMbmMmsuiQgn_indi_mce_priority_low_mask, |
|
1046 AKN_LAF_COLOR( KIconDefaultColor ), |
|
1047 indicatorIconSize, |
|
1048 EAspectRatioPreserved ); |
|
1049 } |
|
1050 |
|
1051 if ( !bitmapPriority ) |
|
1052 { |
|
1053 User::Leave( KErrNotFound ); |
|
1054 } |
|
1055 |
|
1056 CleanupStack::PushL( bitmapPriority ); |
|
1057 CleanupStack::PushL( maskPriority ); |
|
1058 |
|
1059 if ( tabGroup->TabCount() == 0 ) |
|
1060 { |
|
1061 tabGroup->AddTabL( 0, aText, bitmapPriority, maskPriority ); |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 tabGroup->ReplaceTabL( 0, aText, bitmapPriority, maskPriority ); |
|
1066 } |
|
1067 |
|
1068 CleanupStack::Pop( maskPriority ); // ownership tranferred to tabgroup |
|
1069 CleanupStack::Pop( bitmapPriority ); // ownership tranferred to tabgroup |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 // Set <message-index>/<message count> |
|
1074 if ( tabGroup->TabCount() == 0 ) |
|
1075 { |
|
1076 tabGroup->AddTabL( 0, aText ); |
|
1077 } |
|
1078 else |
|
1079 { |
|
1080 tabGroup->ReplaceTabL( 0, aText ); |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 tabGroup->SetActiveTabById( 0 ); |
|
1085 tabGroup->SetTabFixedWidthL( KTabWidthWithOneTab ); |
|
1086 } |
|
1087 #endif // !RD_MSG_NAVIPANE_IMPROVEMENT |
|
1088 |
|
1089 // --------------------------------------------------------- |
|
1090 // CMmsViewerAppUi::DynInitMenuPaneL |
|
1091 // --------------------------------------------------------- |
|
1092 // |
|
1093 void CMmsViewerAppUi::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) |
|
1094 { |
|
1095 TInt amountOfItems( aMenuPane->NumberOfItemsInPane( ) ); |
|
1096 if ( !IsLaunched( ) ) |
|
1097 { |
|
1098 if ( amountOfItems ) |
|
1099 { |
|
1100 aMenuPane->DeleteBetweenMenuItems( 0, amountOfItems - 1 ); |
|
1101 } |
|
1102 return; |
|
1103 } |
|
1104 |
|
1105 if ( !iFindItemMenu ) |
|
1106 { |
|
1107 iFindItemMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
|
1108 iFindItemMenu->SetCallSubMenuVisibility ( EFalse ); // Click-To-Call |
|
1109 if ( iHeader->SenderType( ) == EMuiuAddressTypeEmail ) |
|
1110 { |
|
1111 // Set sender type to find menu |
|
1112 iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress ); |
|
1113 } |
|
1114 } |
|
1115 |
|
1116 if ( iSupportedFeatures & EMmsFeatureUpload && |
|
1117 !( iViewerFlags & EUploadInitialized ) ) |
|
1118 { |
|
1119 iViewerFlags |= EUploadInitialized; |
|
1120 CSendUi* sendui = CSendUi::NewLC( ); |
|
1121 sendui->AvailableServicesL( iUploadServices, KMmsDirectUpload ); |
|
1122 sendui->AvailableServicesL( iUploadServices, KMmsIndirectUpload ); |
|
1123 CleanupStack::PopAndDestroy( sendui ); |
|
1124 } |
|
1125 |
|
1126 |
|
1127 switch ( aMenuId ) |
|
1128 { |
|
1129 case R_MMSVIEWER_SELECTIONMENU: |
|
1130 { |
|
1131 // No find item for recipient fields in Sent folder |
|
1132 if ( !IsOwnMessage( ) ) |
|
1133 { |
|
1134 if( (FocusedControlId( ) == EMsgComponentIdFrom) && ( ( iMtm->Sender( ) ).Length() ) ) |
|
1135 { |
|
1136 iFindItemMenu->SetSenderHighlightStatus( ETrue ); |
|
1137 iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) ); |
|
1138 } |
|
1139 else |
|
1140 { |
|
1141 iFindItemMenu->SetSenderHighlightStatus( EFalse ); |
|
1142 } |
|
1143 } |
|
1144 iFindItemMenu->AddItemFindMenuL( |
|
1145 ( FocusedControlId( ) == EMsgComponentIdBody ) ? iView->ItemFinder( ) : 0, |
|
1146 aMenuPane, |
|
1147 EFindItemContextMenuPlaceHolder, |
|
1148 TMmsGenUtils::PureAddress( iMtm->Sender( ) ), |
|
1149 iHeader->Alias( ) && !iHeader->IsRemoteAlias( ) ? ETrue : EFalse, //"Is sender known" |
|
1150 ETrue ); |
|
1151 |
|
1152 |
|
1153 break; |
|
1154 } |
|
1155 case R_MMSVIEWER_OPTIONSMENU: |
|
1156 { |
|
1157 |
|
1158 if ( iViewerState == EReseted ) |
|
1159 { |
|
1160 //Exit is the last item... leave it there. |
|
1161 aMenuPane->DeleteBetweenMenuItems( 0, amountOfItems - 2 ); |
|
1162 return; |
|
1163 } |
|
1164 |
|
1165 TInt focusedControl = FocusedControlId( ); |
|
1166 |
|
1167 TBool senderHighlighted = EFalse; |
|
1168 if ( focusedControl == EMsgComponentIdFrom ) |
|
1169 { |
|
1170 CMsgAddressControl* address = static_cast<CMsgAddressControl*>( |
|
1171 iView->ControlById( EMsgComponentIdFrom ) ); |
|
1172 |
|
1173 if ( address && address->Editor().SelectionLength() ) |
|
1174 { |
|
1175 senderHighlighted = ETrue; |
|
1176 } |
|
1177 } |
|
1178 |
|
1179 if ( !IsOwnMessage( ) ) |
|
1180 { |
|
1181 if( ( focusedControl == EMsgComponentIdFrom ) && ( ( iMtm->Sender( ) ).Length() ) |
|
1182 && senderHighlighted ) |
|
1183 { |
|
1184 iFindItemMenu->SetSenderHighlightStatus( ETrue ); |
|
1185 iFindItemMenu->SetSenderDisplayText( TMmsGenUtils::PureAddress( iMtm->Sender( ) ) ); |
|
1186 } |
|
1187 else |
|
1188 { |
|
1189 iFindItemMenu->SetSenderHighlightStatus( EFalse ); |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 iFindItemMenu->AddItemFindMenuL( |
|
1194 ( iView->ItemFinder() && |
|
1195 iView->ItemFinder()->CurrentSelection().Length() ) |
|
1196 ? iView->ItemFinder() : 0, |
|
1197 aMenuPane, |
|
1198 EFindItemMenuPlaceHolder, |
|
1199 senderHighlighted ? |
|
1200 TMmsGenUtils::PureAddress( iMtm->Sender( ) ) : KNullDesC(), |
|
1201 iHeader->Alias( ) && !iHeader->IsRemoteAlias( ) ? ETrue : EFalse, //"Is sender known" |
|
1202 EFalse ); |
|
1203 |
|
1204 const TMsvEntry& context = Document( )->Entry( ); |
|
1205 // local variation for MMS Delivery Status dialog feature |
|
1206 if (! ( iSupportedFeatures & EMmsFeatureDeliveryStatus |
|
1207 && ( ( context.iMtmData2 & KMmsDeliveryStatusMask) != KMmsDeliveryStatusNotRequested ) ) ) |
|
1208 { |
|
1209 aMenuPane->DeleteMenuItem(EMmsViewerDeliveryStatus); |
|
1210 } |
|
1211 |
|
1212 if ( iSmilModel->SlideCount( ) > iMaxForwardSlideCount ) |
|
1213 { |
|
1214 aMenuPane->SetItemDimmed( EMmsViewerForward, ETrue ); |
|
1215 } |
|
1216 |
|
1217 |
|
1218 |
|
1219 if ( ! ( iSupportedFeatures & EMmsFeatureUpload ) |
|
1220 || !iUploadServices.Count( ) ) |
|
1221 { |
|
1222 aMenuPane->SetItemDimmed( EMmsViewerUpload, ETrue ); |
|
1223 } |
|
1224 |
|
1225 // Set help menu-item visibility according featureManager |
|
1226 if ( !( iSupportedFeatures & EMmsFeatureHelp ) ) |
|
1227 { |
|
1228 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
1229 } |
|
1230 if ( !Document( )->SmilList( )->Count( ) ) |
|
1231 { |
|
1232 aMenuPane->SetItemDimmed( EMmsViewerShowMessage, ETrue ); |
|
1233 |
|
1234 } |
|
1235 else |
|
1236 { |
|
1237 if ( Document( )->SmilType( ) != EMmsSmil ) |
|
1238 { |
|
1239 aMenuPane->SetItemDimmed( EMmsViewerShowMessage, ETrue ); |
|
1240 } |
|
1241 |
|
1242 } |
|
1243 |
|
1244 if ( !ShowReplyMenu( ) ) |
|
1245 { |
|
1246 aMenuPane->SetItemDimmed( EMmsViewerReplyMenu, ETrue ); |
|
1247 } |
|
1248 |
|
1249 if ( Document( )->ObjectList( )->Count( ) == 0 && |
|
1250 Document( )->AttachmentList( )->Count( ) == 0 ) |
|
1251 { |
|
1252 aMenuPane->SetItemDimmed( EMmsViewerObjects, ETrue ); |
|
1253 } |
|
1254 break; |
|
1255 } |
|
1256 case R_MMSVIEWER_REPLY_SUBMENU: |
|
1257 { |
|
1258 if ( IsOwnMessage( ) |
|
1259 || !HasSender( ) ) |
|
1260 { |
|
1261 aMenuPane->SetItemDimmed( EMmsViewerReplyToSender, ETrue ); |
|
1262 } |
|
1263 if ( !ShowReplyToAll( ) ) |
|
1264 { |
|
1265 aMenuPane->SetItemDimmed( EMmsViewerReplyToAll, ETrue ); |
|
1266 } |
|
1267 if ( !( iSupportedFeatures & EMmsFeatureAudioMessaging ) |
|
1268 || IsOwnMessage( ) |
|
1269 || !HasSender( ) |
|
1270 || iSupportedFeatures & EMmsFeatureRestrictedReply ) |
|
1271 { |
|
1272 aMenuPane->SetItemDimmed( EMmsViewerReplyViaAudio, ETrue ); |
|
1273 } |
|
1274 |
|
1275 if ( IsOwnMessage( ) || |
|
1276 iHeader->SenderType( ) != EMuiuAddressTypeEmail || |
|
1277 iSupportedFeatures & EMmsFeatureRestrictedReply || |
|
1278 MsvUiServiceUtilitiesInternal::DefaultServiceForMTML( |
|
1279 Document( )->Session( ), |
|
1280 KSenduiMtmSmtpUid, |
|
1281 ETrue ) |
|
1282 == KMsvUnknownServiceIndexEntryId ) |
|
1283 { |
|
1284 // "Reply via e-mail" feature |
|
1285 aMenuPane->SetItemDimmed( EMmsViewerReplyViaMail, ETrue ); |
|
1286 } |
|
1287 break; |
|
1288 } |
|
1289 case R_MMSVIEWER_ZOOM_SUBMENU: |
|
1290 { |
|
1291 TInt zoomLevel = KErrGeneral; |
|
1292 iMsgEditorAppUiExtension-> |
|
1293 iSettingCachePlugin.GetValue( KAknLocalZoomLayoutSwitch, zoomLevel ); |
|
1294 switch ( zoomLevel ) |
|
1295 { |
|
1296 case EAknUiZoomAutomatic: |
|
1297 aMenuPane->SetItemButtonState( EMsgDispSizeAutomatic, |
|
1298 EEikMenuItemSymbolOn ); |
|
1299 break; |
|
1300 case EAknUiZoomNormal: |
|
1301 aMenuPane->SetItemButtonState( EMsgDispSizeNormal, |
|
1302 EEikMenuItemSymbolOn ); |
|
1303 break; |
|
1304 case EAknUiZoomSmall: |
|
1305 aMenuPane->SetItemButtonState( EMsgDispSizeSmall, |
|
1306 EEikMenuItemSymbolOn ); |
|
1307 break; |
|
1308 case EAknUiZoomLarge: |
|
1309 aMenuPane->SetItemButtonState( EMsgDispSizeLarge, |
|
1310 EEikMenuItemSymbolOn ); |
|
1311 break; |
|
1312 default: |
|
1313 break; |
|
1314 } |
|
1315 } |
|
1316 break; |
|
1317 default: // we are in FindItem submenu |
|
1318 { |
|
1319 // this does nothing if we're not, so this is safe |
|
1320 iFindItemMenu->UpdateItemFinderMenuL( aMenuId, aMenuPane ); |
|
1321 break; |
|
1322 } |
|
1323 } |
|
1324 } |
|
1325 |
|
1326 |
|
1327 // --------------------------------------------------------- |
|
1328 // CMmsViewerAppUi::UploadL |
|
1329 // --------------------------------------------------------- |
|
1330 // |
|
1331 void CMmsViewerAppUi::UploadL( ) |
|
1332 { |
|
1333 TInt count = iUploadServices.Count( ); |
|
1334 |
|
1335 TInt selectedIndex = 0; |
|
1336 CAknListQueryDialog* dlg = new ( ELeave ) |
|
1337 CAknListQueryDialog( &selectedIndex ); |
|
1338 dlg->PrepareLC( R_MMSVIEWER_UPLOAD_LIST_QUERY ); |
|
1339 |
|
1340 // Populate list query array |
|
1341 CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( 4 ); |
|
1342 CleanupStack::PushL( array ); |
|
1343 for ( TInt i = 0; i < count; i++ ) |
|
1344 { |
|
1345 array->AppendL( iUploadServices[ i ]->ServiceMenuName( ) ); |
|
1346 } |
|
1347 dlg->SetItemTextArray( array ); |
|
1348 CleanupStack::Pop( array ); |
|
1349 |
|
1350 if ( dlg->RunLD( ) ) |
|
1351 { |
|
1352 CSendingServiceInfo* info = iUploadServices[ selectedIndex ]; |
|
1353 TMsgUploadParameters uploadParams; |
|
1354 uploadParams.iDirect = ( info->ServiceProviderId( ) == KMmsDirectUpload ); |
|
1355 uploadParams.iRealAddress = info->ServiceAddress( ); |
|
1356 uploadParams.iAlias = info->ServiceName( ); |
|
1357 |
|
1358 // Pack upload parameters |
|
1359 TPckgBuf<TMsgUploadParameters> param( uploadParams ); |
|
1360 |
|
1361 MediaStop( ); |
|
1362 ResetViewL( ); |
|
1363 |
|
1364 //These are not used! They just have to be there. |
|
1365 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1366 CleanupStack::PushL( selection ); |
|
1367 |
|
1368 CAknInputBlock::NewLC( ); |
|
1369 CMuiuOperationWait* wait = |
|
1370 CMuiuOperationWait::NewLC( EActivePriorityWsEvents + 10 ); |
|
1371 |
|
1372 CMsvOperation* oper = Document( )->MtmUiL( ).InvokeAsyncFunctionL( |
|
1373 KMtmUiFunctionUpload, |
|
1374 *selection, |
|
1375 wait->iStatus, |
|
1376 param ); |
|
1377 |
|
1378 CleanupStack::PushL( oper ); |
|
1379 |
|
1380 wait->Start( ); |
|
1381 |
|
1382 CleanupStack::PopAndDestroy( 4, selection ); // absorber, wait, oper, selection |
|
1383 Exit( EAknSoftkeyClose ); |
|
1384 } |
|
1385 } |
|
1386 |
|
1387 |
|
1388 // --------------------------------------------------------- |
|
1389 // CMmsViewerAppUi::ProcessCommandL |
|
1390 // --------------------------------------------------------- |
|
1391 // |
|
1392 void CMmsViewerAppUi::ProcessCommandL( TInt aCommand ) |
|
1393 { |
|
1394 if ( aCommand == EAknSoftkeyOptions |
|
1395 && iViewerState == EBusy) |
|
1396 { |
|
1397 LOGTEXT(_L8("CMmsViewerAppUi::ProcessCommandL returns immediately...")); |
|
1398 return; |
|
1399 } |
|
1400 CAknAppUi::ProcessCommandL( aCommand ); |
|
1401 } |
|
1402 |
|
1403 // --------------------------------------------------------- |
|
1404 // CMmsViewerAppUi::HandleCommandL |
|
1405 // --------------------------------------------------------- |
|
1406 // |
|
1407 void CMmsViewerAppUi::HandleCommandL( TInt aCommand ) |
|
1408 { |
|
1409 #ifdef USE_LOGGER |
|
1410 LOGTEXT2(_L16("CMmsViewerAppUi::HandleCommandL in. Command %d"), aCommand ); |
|
1411 TRAPD(error, DoHandleCommandL( aCommand ) ); |
|
1412 LOGTEXT2(_L16("CMmsViewerAppUi::HandleCommandL %d"), error ); |
|
1413 User::LeaveIfError( error ); |
|
1414 #else |
|
1415 DoHandleCommandL( aCommand ); |
|
1416 #endif |
|
1417 } |
|
1418 |
|
1419 |
|
1420 // --------------------------------------------------------- |
|
1421 // CMmsViewerAppUi::DoHandleCommandL |
|
1422 // --------------------------------------------------------- |
|
1423 // |
|
1424 void CMmsViewerAppUi::DoHandleCommandL( TInt aCommand ) |
|
1425 { |
|
1426 if ( !IsLaunched() ) |
|
1427 { |
|
1428 if ( aCommand == EEikCmdExit ) |
|
1429 { |
|
1430 LOGTEXT(_L8("CMmsViewerAppUi::DoHandleCommandL Setting iViewerFlags |= EViewerExiting")); |
|
1431 iViewerFlags |= EViewerExiting; |
|
1432 } |
|
1433 return; |
|
1434 } |
|
1435 |
|
1436 if ( iFindItemMenu && iFindItemMenu->CommandIsValidL( aCommand ) ) |
|
1437 { |
|
1438 iFindItemMenu->HandleItemFinderCommandL( aCommand ); |
|
1439 return; |
|
1440 } |
|
1441 //MediaStop( ); |
|
1442 switch ( aCommand ) |
|
1443 { |
|
1444 case EMmsViewerShowPresentation: |
|
1445 case EMmsViewerShowMessage: |
|
1446 DoShowPresentationL( ); |
|
1447 break; |
|
1448 case EMmsViewerForward: |
|
1449 if ( !ShowOutOfDiskNoteIfBelowCriticalLevelL( |
|
1450 Document( )->MessageSize( ) ) ) |
|
1451 { |
|
1452 DoForwardL( ); |
|
1453 } |
|
1454 break; |
|
1455 case EMmsViewerDelete: |
|
1456 DoDeleteAndExitL( ); |
|
1457 break; |
|
1458 case EMmsViewerViewImage: |
|
1459 MediaPlayL( iImage ); |
|
1460 break; |
|
1461 case EMmsViewerPlayAudio: |
|
1462 MediaPlayL( iAudio ); |
|
1463 break; |
|
1464 case EMmsViewerPlayVideo: |
|
1465 MediaPlayL( iVideo ); |
|
1466 break; |
|
1467 #ifdef RD_SVGT_IN_MESSAGING |
|
1468 case EMmsViewerPlaySvg: |
|
1469 MediaPlayL( iSvgt ); |
|
1470 break; |
|
1471 #endif |
|
1472 case EMmsViewerObjects: |
|
1473 DoObjectsL( ); |
|
1474 break; |
|
1475 case EMmsViewerMessageInfo: |
|
1476 DoMessageInfoL( ); |
|
1477 break; |
|
1478 case EMmsViewerDeliveryStatus: |
|
1479 OpenDeliveryPopupL( ); |
|
1480 break; |
|
1481 case EMmsViewerMove: |
|
1482 DoMoveMessageL( ); |
|
1483 break; |
|
1484 case EMmsViewerReplyToSender: |
|
1485 if ( !ShowOutOfDiskNoteIfBelowCriticalLevelL( |
|
1486 KReplyToSenderSize ) ) |
|
1487 { |
|
1488 DoReplyL( ETrue ); |
|
1489 } |
|
1490 break; |
|
1491 case EMmsViewerReplyToAll: |
|
1492 if ( !ShowOutOfDiskNoteIfBelowCriticalLevelL( |
|
1493 KReplyToAllSize ) ) |
|
1494 { |
|
1495 DoReplyL( EFalse ); |
|
1496 } |
|
1497 break; |
|
1498 case EMmsViewerReplyViaAudio: |
|
1499 case EMmsViewerReplyViaMail: |
|
1500 if ( !ShowOutOfDiskNoteIfBelowCriticalLevelL( |
|
1501 KReplyToAllSize ) ) |
|
1502 { |
|
1503 DoReplyViaL( aCommand ); |
|
1504 } |
|
1505 break; |
|
1506 |
|
1507 case EMmsViewerSoftStopVideo: |
|
1508 MediaStop(iVideo); |
|
1509 break; |
|
1510 #ifdef RD_SVGT_IN_MESSAGING |
|
1511 case EMmsViewerSoftStopSvg: |
|
1512 MediaStop( iSvgt ); |
|
1513 break; |
|
1514 #endif |
|
1515 |
|
1516 case EMmsViewerSaveObject: |
|
1517 SaveObjectL( ); |
|
1518 break; |
|
1519 |
|
1520 case EMmsViewerUpload: |
|
1521 { |
|
1522 UploadL( ); |
|
1523 break; |
|
1524 } |
|
1525 |
|
1526 case EMmsViewerSoftStopAudio: |
|
1527 MediaStop(iAudio); |
|
1528 break; |
|
1529 case EMsgDispSizeAutomatic: |
|
1530 case EMsgDispSizeLarge: |
|
1531 case EMsgDispSizeNormal: |
|
1532 case EMsgDispSizeSmall: |
|
1533 HandleLocalZoomChangeL( (TMsgCommonCommands)aCommand ); |
|
1534 break; |
|
1535 case EAknCmdHelp: |
|
1536 LaunchHelpL( ); |
|
1537 break; |
|
1538 |
|
1539 case EAknSoftkeyBack: |
|
1540 MediaStop( ); |
|
1541 Exit( EAknSoftkeyClose ); |
|
1542 break; |
|
1543 case EEikCmdExit: |
|
1544 { |
|
1545 DoMsgSaveExitL( ); |
|
1546 break; |
|
1547 } |
|
1548 default: |
|
1549 break; |
|
1550 } |
|
1551 } |
|
1552 |
|
1553 // --------------------------------------------------------- |
|
1554 // CMmsViewerAppUi::HandleKeyEventL |
|
1555 // --------------------------------------------------------- |
|
1556 // |
|
1557 TKeyResponse CMmsViewerAppUi::HandleKeyEventL( |
|
1558 const TKeyEvent& aKeyEvent, |
|
1559 TEventCode aType ) |
|
1560 { |
|
1561 if ( !IsLaunched( ) ) |
|
1562 { |
|
1563 return EKeyWasNotConsumed; |
|
1564 } |
|
1565 if ( aType != EEventKey ) |
|
1566 { |
|
1567 return EKeyWasNotConsumed; |
|
1568 } |
|
1569 |
|
1570 if ( iViewerState == EBusy |
|
1571 || iViewerState == EReseted ) |
|
1572 { |
|
1573 return EKeyWasConsumed; |
|
1574 } |
|
1575 switch ( aKeyEvent.iCode ) |
|
1576 { |
|
1577 case EKeyLeftArrow: |
|
1578 { |
|
1579 if ( iVolumeDecorator |
|
1580 && iNaviPane->Top( ) == iVolumeDecorator ) |
|
1581 { |
|
1582 if( !( iSupportedFeatures & EMmsFeatureSVK ) ) |
|
1583 { |
|
1584 ChangeVolumeL( -1, ETrue ); |
|
1585 } |
|
1586 else if ( IsNextMessageAvailableL( EFalse ) ) |
|
1587 { |
|
1588 // playing audio/video is stopped by destructor |
|
1589 NextMessageL( EFalse ); |
|
1590 } |
|
1591 } |
|
1592 else if ( iNaviDecorator |
|
1593 && iNaviPane->Top( ) == iNaviDecorator ) |
|
1594 { |
|
1595 if ( IsNextMessageAvailableL( EFalse ) ) |
|
1596 { |
|
1597 NextMessageL( EFalse ); |
|
1598 } |
|
1599 } |
|
1600 } |
|
1601 break; |
|
1602 case EKeyRightArrow: |
|
1603 { |
|
1604 if ( iVolumeDecorator |
|
1605 && iNaviPane->Top( ) == iVolumeDecorator ) |
|
1606 { |
|
1607 if( !( iSupportedFeatures & EMmsFeatureSVK ) ) |
|
1608 { |
|
1609 ChangeVolumeL( +1, ETrue ); |
|
1610 } |
|
1611 else if ( IsNextMessageAvailableL( ETrue ) ) |
|
1612 { |
|
1613 // playing audio/video is stopped by destructor |
|
1614 NextMessageL( ETrue ); |
|
1615 } |
|
1616 } |
|
1617 else if ( iNaviDecorator |
|
1618 && iNaviPane->Top( ) == iNaviDecorator ) |
|
1619 { |
|
1620 if ( IsNextMessageAvailableL( ETrue ) ) |
|
1621 { |
|
1622 NextMessageL( ETrue ); |
|
1623 } |
|
1624 } |
|
1625 } |
|
1626 break; |
|
1627 case EKeyDevice3: //Selection key |
|
1628 case EKeyEnter: //Enter Key |
|
1629 { |
|
1630 CMsgExpandableControl* ctrl = NULL; |
|
1631 TBool checkHighlight = EFalse; |
|
1632 |
|
1633 if( iView->FocusedControl() ) |
|
1634 { |
|
1635 ctrl = static_cast<CMsgExpandableControl*>( iView->FocusedControl() ); |
|
1636 if ( ctrl->ControlType() == EMsgAddressControl |
|
1637 && !ctrl->Editor().SelectionLength() ) |
|
1638 { |
|
1639 checkHighlight = ETrue; |
|
1640 } |
|
1641 else if ( ctrl->ControlType() == EMsgBodyControl ) |
|
1642 { |
|
1643 CItemFinder* itemFinder = iView->ItemFinder(); |
|
1644 if ( FocusedControlId() == EMsgComponentIdBody && itemFinder |
|
1645 && !itemFinder->CurrentSelection().Length() ) |
|
1646 { |
|
1647 checkHighlight = ETrue; |
|
1648 } |
|
1649 } |
|
1650 } |
|
1651 if ( ctrl && checkHighlight ) |
|
1652 { |
|
1653 // Check if highlight needs to be restored to editor, |
|
1654 // address/body editor offerkeyevent will handle it |
|
1655 if ( ctrl->Editor().OfferKeyEventL( aKeyEvent, aType ) |
|
1656 == EKeyWasConsumed ) |
|
1657 { |
|
1658 // Highlight was restored, just return, no cs menu needed |
|
1659 return EKeyWasConsumed; |
|
1660 } |
|
1661 } |
|
1662 |
|
1663 TInt focusedControl = FocusedControlId( ); |
|
1664 CMsgMediaControl* control = MediaControlById(focusedControl); |
|
1665 if (control) |
|
1666 { |
|
1667 if ( MediaCanStop( control ) ) |
|
1668 { |
|
1669 MediaStop(control); |
|
1670 } |
|
1671 else |
|
1672 { |
|
1673 MediaOpenL(control); |
|
1674 } |
|
1675 } |
|
1676 else if( focusedControl == EMsgComponentIdAttachment ) |
|
1677 { |
|
1678 DoObjectsL( ); |
|
1679 } |
|
1680 else if ( Document( )->SmilType( ) != EMmsSmil |
|
1681 && focusedControl == EMsgComponentIdImage ) |
|
1682 { |
|
1683 DoShowPresentationL( ); |
|
1684 } |
|
1685 else if ( iViewerState == ENormal ) |
|
1686 { |
|
1687 MenuBar( )->SetMenuTitleResourceId( R_MMSVIEWER_SELECTMENU ); |
|
1688 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
1689 TRAP_IGNORE( MenuBar( )->TryDisplayMenuBarL( ) ); |
|
1690 MenuBar( )->SetMenuTitleResourceId( R_MMSVIEWER_MENU ); |
|
1691 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
1692 } |
|
1693 break; |
|
1694 } |
|
1695 case EKeyYes: //Send key |
|
1696 DoHandleSendKeyL( ); |
|
1697 break; |
|
1698 case EKeyBackspace: // clear key |
|
1699 if ( !MediaIsRunning( iAudio ) && |
|
1700 !MediaIsRunning( iVideo ) ) |
|
1701 { |
|
1702 DoDeleteAndExitL( ); |
|
1703 } |
|
1704 break; |
|
1705 case EKeyNo: // End key |
|
1706 { |
|
1707 LOGTEXT(_L8("CMmsViewerAppUi::HandleKeyEventL EKeyNo")); |
|
1708 if ( MediaIsRunning( iAudio ) ) |
|
1709 { |
|
1710 MediaStop(iAudio); |
|
1711 } |
|
1712 else if ( MediaIsRunning( iVideo ) ) |
|
1713 { |
|
1714 MediaStop(iVideo); |
|
1715 } |
|
1716 // fall through |
|
1717 } |
|
1718 default: |
|
1719 // - Audio countdown & audio play cancelled on |
|
1720 // HandleViewDeactivation event!!! |
|
1721 // |
|
1722 //Power key |
|
1723 //Apps key |
|
1724 //End key |
|
1725 //Up key |
|
1726 //Down key |
|
1727 //Numeric keys |
|
1728 //Clear key |
|
1729 //Shift key |
|
1730 return iView->OfferKeyEventL( aKeyEvent, aType ); |
|
1731 } |
|
1732 return EKeyWasConsumed; |
|
1733 } |
|
1734 |
|
1735 // --------------------------------------------------------- |
|
1736 // CMmsViewerAppUi::HandleWsEventL |
|
1737 // --------------------------------------------------------- |
|
1738 // |
|
1739 void CMmsViewerAppUi::HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination) |
|
1740 { |
|
1741 TInt type = aEvent.Type( ); |
|
1742 switch ( type ) |
|
1743 { |
|
1744 case EEventFocusGroupChanged: |
|
1745 { |
|
1746 if ( !iIsStopPlaybackWgId ) |
|
1747 { |
|
1748 ResolveCurrentWgIdL( ); |
|
1749 |
|
1750 // Stop only if temporary change e.g. a waiting note etc. |
|
1751 if ( iIsStopPlaybackWgId ) |
|
1752 { |
|
1753 MediaStop(iAudio); |
|
1754 MediaStop(iVideo); |
|
1755 StopAnimation( ); |
|
1756 } |
|
1757 } |
|
1758 // else - no need to stop |
|
1759 break; |
|
1760 } |
|
1761 case EEventFocusGained: |
|
1762 { |
|
1763 if ( iIsStopPlaybackWgId ) |
|
1764 { |
|
1765 iIsStopPlaybackWgId = EFalse; |
|
1766 StartAnimationL( ); |
|
1767 }; |
|
1768 break; |
|
1769 } |
|
1770 // case EEventFocusLost: |
|
1771 default: |
|
1772 break; |
|
1773 } |
|
1774 CMsgEditorAppUi::HandleWsEventL(aEvent, aDestination); |
|
1775 } |
|
1776 |
|
1777 // --------------------------------------------------------- |
|
1778 // CMmsViewerAppUi::CreateCustomControlL |
|
1779 // --------------------------------------------------------- |
|
1780 // |
|
1781 CMsgBaseControl* CMmsViewerAppUi::CreateCustomControlL( |
|
1782 TInt /*aControlType*/ ) |
|
1783 { |
|
1784 return NULL; |
|
1785 } |
|
1786 |
|
1787 // --------------------------------------------------------- |
|
1788 // CMmsViewerAppUi::ShowInformationNoteL |
|
1789 // --------------------------------------------------------- |
|
1790 // |
|
1791 void CMmsViewerAppUi::ShowInformationNoteL( TInt aResourceId ) |
|
1792 { |
|
1793 HBufC* string = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
1794 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1795 note->ExecuteLD( *string ); |
|
1796 CleanupStack::PopAndDestroy( string ); |
|
1797 } |
|
1798 |
|
1799 // --------------------------------------------------------- |
|
1800 // CMmsViewerAppUi::ShowErrorNoteL |
|
1801 // --------------------------------------------------------- |
|
1802 // |
|
1803 void CMmsViewerAppUi::ShowErrorNoteL( TInt aResourceId ) |
|
1804 { |
|
1805 HBufC* string = StringLoader::LoadLC( aResourceId, iCoeEnv ); |
|
1806 CAknErrorNote* note = new ( ELeave ) CAknErrorNote( ETrue ); |
|
1807 note->ExecuteLD( *string ); |
|
1808 CleanupStack::PopAndDestroy( string ); |
|
1809 } |
|
1810 |
|
1811 |
|
1812 // --------------------------------------------------------- |
|
1813 // CMmsViewerAppUi::ShowConfirmationQueryL |
|
1814 // --------------------------------------------------------- |
|
1815 // |
|
1816 TInt CMmsViewerAppUi::ShowConfirmationQueryL( TInt aResourceId ) const |
|
1817 { |
|
1818 HBufC* queryString = StringLoader::LoadLC( |
|
1819 aResourceId, |
|
1820 iCoeEnv ); |
|
1821 CAknQueryDialog* dlg = CAknQueryDialog::NewL( ); |
|
1822 TInt retVal = dlg->ExecuteLD( R_MMSVIEWER_CONFIRMATION_QUERY, *queryString ); |
|
1823 CleanupStack::PopAndDestroy( queryString ); |
|
1824 return retVal; |
|
1825 } |
|
1826 |
|
1827 |
|
1828 // --------------------------------------------------------- |
|
1829 // CMmsViewerAppUi::ShowConfirmationQueryL |
|
1830 // --------------------------------------------------------- |
|
1831 // |
|
1832 TInt CMmsViewerAppUi::ShowConfirmationQueryL( TInt aResourceId, |
|
1833 const TDesC& aString) const |
|
1834 { |
|
1835 HBufC* queryString = StringLoader::LoadLC( |
|
1836 aResourceId, |
|
1837 aString, |
|
1838 iCoeEnv ); |
|
1839 CAknQueryDialog* dlg = CAknQueryDialog::NewL( ); |
|
1840 TInt retVal = dlg->ExecuteLD( R_MMSVIEWER_CONFIRMATION_QUERY, *queryString ); |
|
1841 CleanupStack::PopAndDestroy( queryString ); |
|
1842 return retVal; |
|
1843 } |
|
1844 |
|
1845 // --------------------------------------------------------- |
|
1846 // ShowGuidedModeConfirmationQueryL |
|
1847 // --------------------------------------------------------- |
|
1848 // |
|
1849 TInt CMmsViewerAppUi::ShowGuidedModeConfirmationQueryL( TInt aResourceID ) |
|
1850 { |
|
1851 TInt retVal = EFalse; |
|
1852 if ( iViewerFlags & EShowGuidedConf ) |
|
1853 { |
|
1854 retVal = ShowConfirmationQueryL( aResourceID ); |
|
1855 if ( retVal ) |
|
1856 { |
|
1857 iViewerFlags &= ~EShowGuidedConf; |
|
1858 } |
|
1859 |
|
1860 } |
|
1861 else |
|
1862 { |
|
1863 retVal = ( Document( )->CreationMode( ) != EMmsCreationModeRestricted ); |
|
1864 } |
|
1865 return retVal; |
|
1866 } |
|
1867 |
|
1868 // --------------------------------------------------------- |
|
1869 // CMmsViewerAppUi::ShowOutOfDiskNoteIfBelowCriticalLevelL |
|
1870 // --------------------------------------------------------- |
|
1871 // |
|
1872 TBool CMmsViewerAppUi::ShowOutOfDiskNoteIfBelowCriticalLevelL( TInt aSize ) |
|
1873 { |
|
1874 //Check whether there is enough free disk |
|
1875 //to create a copy of the message. |
|
1876 if ( MsvUiServiceUtilities::DiskSpaceBelowCriticalLevelL( |
|
1877 Document( )->Session( ), |
|
1878 aSize ) ) |
|
1879 { |
|
1880 CErrorUI* errorUI = CErrorUI::NewLC( *iCoeEnv ); |
|
1881 errorUI->ShowGlobalErrorNoteL( KErrDiskFull ); |
|
1882 //Returns TInt! (ETrue if note was displayed, EFalse otherwise) |
|
1883 //...ignored... |
|
1884 CleanupStack::PopAndDestroy( errorUI ); |
|
1885 return ETrue; |
|
1886 } |
|
1887 else |
|
1888 { |
|
1889 return EFalse; |
|
1890 } |
|
1891 } |
|
1892 |
|
1893 |
|
1894 // --------------------------------------------------------- |
|
1895 // CMmsViewerAppUi::DoReplyL |
|
1896 // --------------------------------------------------------- |
|
1897 // |
|
1898 void CMmsViewerAppUi::DoReplyL( TBool aReplyToSender ) |
|
1899 { |
|
1900 iViewerState = EBusy; |
|
1901 TRAPD ( error, |
|
1902 { |
|
1903 if ( !(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
1904 { |
|
1905 MediaStop( ); |
|
1906 ResetViewL( ); |
|
1907 } |
|
1908 |
|
1909 if ( iToolbar ) |
|
1910 { |
|
1911 iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
1912 } |
|
1913 |
|
1914 // Enable Dialer as MMS Settings dialog may be launched |
|
1915 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
1916 |
|
1917 if ( aReplyToSender ) |
|
1918 { |
|
1919 ReplyL( KNewMessageFolder ); //Draft |
|
1920 } |
|
1921 else |
|
1922 { |
|
1923 ReplyToAllL( KNewMessageFolder ); //Draft |
|
1924 } |
|
1925 |
|
1926 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1927 { |
|
1928 Exit( EAknSoftkeyClose ); |
|
1929 } |
|
1930 |
|
1931 if ( iToolbar ) |
|
1932 { |
|
1933 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
1934 } |
|
1935 iViewerState = ENormal; |
|
1936 }); //end TRAP |
|
1937 if ( error ) |
|
1938 { |
|
1939 LOGTEXT2(_L16("CMmsViewerAppUi::DoReplyL error %d"), error ); |
|
1940 iViewerState = EReseted; |
|
1941 User::Leave( error ); |
|
1942 } |
|
1943 } |
|
1944 |
|
1945 // --------------------------------------------------------- |
|
1946 // CMmsViewerAppUi::DoForwardL |
|
1947 // --------------------------------------------------------- |
|
1948 // |
|
1949 void CMmsViewerAppUi::DoForwardL( ) |
|
1950 { |
|
1951 TInt resourceId = 0; |
|
1952 Document()->DataModel().FinalizeMediaParse(); |
|
1953 if ( !CanForwardL( resourceId ) ) |
|
1954 { |
|
1955 // This if cannot be combined with the above |
|
1956 // one. -> Else would not work correctly. |
|
1957 if ( resourceId ) |
|
1958 { |
|
1959 ShowInformationNoteL( resourceId ); |
|
1960 } |
|
1961 } |
|
1962 else |
|
1963 { |
|
1964 iViewerState = EBusy; |
|
1965 TRAPD ( error, |
|
1966 { |
|
1967 if ( !(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
1968 { |
|
1969 MediaStop( ); |
|
1970 ResetViewL( ); |
|
1971 } |
|
1972 if ( iToolbar ) |
|
1973 { |
|
1974 iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
1975 } |
|
1976 |
|
1977 // Enable Dialer as MMS Settings dialog may be launched |
|
1978 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
1979 |
|
1980 if(iFindItemMenu) |
|
1981 { |
|
1982 delete iFindItemMenu; |
|
1983 iFindItemMenu = NULL; |
|
1984 } |
|
1985 |
|
1986 ForwardL( KNewMessageFolder ); //Draft |
|
1987 |
|
1988 if ( !(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
1989 { |
|
1990 Exit( EAknSoftkeyClose ); |
|
1991 } |
|
1992 |
|
1993 if ( iToolbar ) |
|
1994 { |
|
1995 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
1996 } |
|
1997 iViewerState = ENormal; |
|
1998 } ); //end TRAP |
|
1999 if ( error ) |
|
2000 { |
|
2001 LOGTEXT2(_L16("CMmsViewerAppUi::DoForwardL error %d"), error ); |
|
2002 iViewerState = EReseted; |
|
2003 User::Leave( error ); |
|
2004 } |
|
2005 } |
|
2006 } |
|
2007 |
|
2008 // --------------------------------------------------------- |
|
2009 // CMmsViewerAppUi::CanForward |
|
2010 // --------------------------------------------------------- |
|
2011 // |
|
2012 TBool CMmsViewerAppUi::CanForwardL( TInt& aResourceId ) |
|
2013 { |
|
2014 |
|
2015 TInt msgSize = Document( )->MessageSize( ); |
|
2016 if ( msgSize > TInt32( Document( )->MaxMessageSize( ) ) ) |
|
2017 { |
|
2018 // This could happen if MaxReceiveSize > MaxSendSize |
|
2019 aResourceId = R_MMSVIEWER_CANNOT_FW_BIG; |
|
2020 return EFalse; |
|
2021 } |
|
2022 |
|
2023 if ( Document( )->CreationMode( ) == EMmsCreationModeRestricted ) |
|
2024 { |
|
2025 if ( Document( )->SmilType( ) != EMmsSmil || |
|
2026 iViewerFlags & ESuspiciousSmil ) |
|
2027 { |
|
2028 aResourceId = ( iMmsConformance->CreationModeUserChangeable( ) && |
|
2029 !iMmsConformance->CreationMode( ) ) ? |
|
2030 R_MMSVIEWER_RMODE_CANNOT_FW_PRES: |
|
2031 R_MMSVIEWER_CANNOT_FW_PRES; |
|
2032 return EFalse; |
|
2033 } |
|
2034 else if ( msgSize > KClassMaxSizeVideoRich ) |
|
2035 { |
|
2036 aResourceId = R_MMSVIEWER_CANNOT_FW_BIG; |
|
2037 return EFalse; |
|
2038 } |
|
2039 } |
|
2040 TBool objectsOk = CanForwardObjectsL( aResourceId ); |
|
2041 TInt conformanceSize = KClassMaxSizeVideoRich; |
|
2042 if(iMmsConformance->ConformanceVersion() > KMmsVersion12) |
|
2043 { |
|
2044 conformanceSize = KClassMaxSizeMegapixel; |
|
2045 } |
|
2046 |
|
2047 if ( objectsOk && Document( )->CreationMode( ) == EMmsCreationModeWarning ) |
|
2048 { |
|
2049 if ( Document( )->SmilType( ) != EMmsSmil || |
|
2050 iViewerFlags & ESuspiciousSmil ) |
|
2051 { |
|
2052 aResourceId = 0; |
|
2053 return ShowGuidedModeConfirmationQueryL( R_MMSVIEWER_QUEST_GUIDED_PRESENTATION ); |
|
2054 } |
|
2055 else if ( msgSize > conformanceSize ) |
|
2056 { |
|
2057 aResourceId = 0; |
|
2058 return ShowGuidedModeConfirmationQueryL( R_MMSVIEWER_QUEST_GUIDED_INC_OBJ ); |
|
2059 } |
|
2060 } |
|
2061 return objectsOk; |
|
2062 } |
|
2063 |
|
2064 // --------------------------------------------------------- |
|
2065 // CMmsViewerAppUi::CanForwardObjectsInListL |
|
2066 // --------------------------------------------------------- |
|
2067 // |
|
2068 void CMmsViewerAppUi::CanForwardObjectsInListL( |
|
2069 CUniObjectList* aObjectList, |
|
2070 TInt& aSdCount, |
|
2071 TInt& aFlCount, |
|
2072 TInt& aNonConfCount, |
|
2073 TInt& aNormalCount, |
|
2074 TInt& aResourceId ) const |
|
2075 { |
|
2076 __ASSERT_ALWAYS( aObjectList, Panic( EMmsViewerNullPointer ) ); |
|
2077 for ( TInt i = aObjectList->Count( ); --i >= 0; ) |
|
2078 { |
|
2079 TUint32 confStatus( EMmsConfOk ); |
|
2080 |
|
2081 CUniObject* obj = aObjectList->GetByIndex( i ); |
|
2082 if ( obj |
|
2083 && obj->MediaInfo( ) ) |
|
2084 { |
|
2085 TMmsConformance conf = iMmsConformance->MediaConformance( * ( obj->MediaInfo( ) ) ); |
|
2086 confStatus = conf.iConfStatus; |
|
2087 } |
|
2088 if ( confStatus & EMmsConfNokTooBig ) |
|
2089 { |
|
2090 aFlCount++; |
|
2091 continue; |
|
2092 } |
|
2093 |
|
2094 if ( confStatus == EMmsConfOk ) |
|
2095 { |
|
2096 aNormalCount++; |
|
2097 continue; |
|
2098 } |
|
2099 |
|
2100 if ( iSupportedFeatures & EMmsFeatureDrmFull && |
|
2101 obj->MediaInfo( )->Protection( ) & EFileProtSuperDistributable ) |
|
2102 { |
|
2103 aSdCount++; |
|
2104 continue; |
|
2105 } |
|
2106 |
|
2107 if ( confStatus & EMmsConfNokDRM ) |
|
2108 { |
|
2109 |
|
2110 |
|
2111 aResourceId = ( iSupportedFeatures & EMmsFeatureDrmFull ) |
|
2112 ? R_MMSVIEWER_CANNOT_FW_DRM |
|
2113 : R_MMSVIEWER_CANNOT_FW_OBJECTS; |
|
2114 |
|
2115 if ( aResourceId == R_MMSVIEWER_CANNOT_FW_OBJECTS |
|
2116 && ( iMmsConformance->CreationModeUserChangeable( ) && |
|
2117 !iMmsConformance->CreationMode( ) ) ) |
|
2118 { |
|
2119 aResourceId = R_MMSVIEWER_RMODE_CANNOT_FW_OBJECTS; |
|
2120 } |
|
2121 |
|
2122 aFlCount++; |
|
2123 continue; |
|
2124 } |
|
2125 |
|
2126 if ( confStatus != EMmsConfOk ) |
|
2127 { |
|
2128 aNonConfCount++; |
|
2129 } |
|
2130 } |
|
2131 } |
|
2132 |
|
2133 |
|
2134 // --------------------------------------------------------- |
|
2135 // CMmsViewerAppUi::CanForwardObjects |
|
2136 // --------------------------------------------------------- |
|
2137 // |
|
2138 TBool CMmsViewerAppUi::CanForwardObjectsL( TInt& aResourceId ) |
|
2139 { |
|
2140 |
|
2141 TInt normalCount = 0; |
|
2142 TInt sdCount = 0; |
|
2143 TInt deniedCount = 0; |
|
2144 TInt nonConfCount = 0; |
|
2145 |
|
2146 CanForwardObjectsInListL( Document( )->ObjectList( ), |
|
2147 sdCount, |
|
2148 deniedCount, |
|
2149 nonConfCount, |
|
2150 normalCount, |
|
2151 aResourceId ); |
|
2152 CanForwardObjectsInListL( Document( )->AttachmentList( ), |
|
2153 sdCount, |
|
2154 deniedCount, |
|
2155 nonConfCount, |
|
2156 normalCount, |
|
2157 aResourceId ); |
|
2158 |
|
2159 if ( deniedCount ) |
|
2160 { |
|
2161 // resource ID set by CanForwardObjectsInListL |
|
2162 return EFalse; |
|
2163 } |
|
2164 |
|
2165 switch ( Document( )->CreationMode( ) ) |
|
2166 { |
|
2167 case EMmsCreationModeRestricted: |
|
2168 if ( sdCount || nonConfCount ) |
|
2169 { |
|
2170 aResourceId = ( iMmsConformance->CreationModeUserChangeable( ) && |
|
2171 !iMmsConformance->CreationMode( ) ) ? |
|
2172 R_MMSVIEWER_RMODE_CANNOT_FW_OBJECTS: |
|
2173 R_MMSVIEWER_CANNOT_FW_OBJECTS; |
|
2174 return EFalse; |
|
2175 } |
|
2176 break; |
|
2177 case EMmsCreationModeWarning: |
|
2178 { |
|
2179 if ( nonConfCount == 1 ) |
|
2180 { |
|
2181 aResourceId = 0; |
|
2182 return ShowGuidedModeConfirmationQueryL( R_MMSVIEWER_QUEST_GUIDED_INC_OBJ ); |
|
2183 } |
|
2184 else if ( nonConfCount ) |
|
2185 { |
|
2186 aResourceId = 0; |
|
2187 return ShowGuidedModeConfirmationQueryL( R_MMSVIEWER_QUEST_GUIDED_INC_OBJS ); |
|
2188 } |
|
2189 } |
|
2190 // Fallthrough |
|
2191 case EMmsCreationModeFree: |
|
2192 default: |
|
2193 { |
|
2194 if ( sdCount ) |
|
2195 { |
|
2196 // default singular |
|
2197 TInt everyWoRights = R_MMSVIEWER_QUEST_SEND_ONE_WO_RIGHTS; |
|
2198 if ( sdCount > 1) |
|
2199 { |
|
2200 // plural |
|
2201 everyWoRights = R_MMSVIEWER_QUEST_SEND_EVERY_WO_RIGHTS; |
|
2202 } |
|
2203 |
|
2204 aResourceId = 0; //Make sure resource id is zero. |
|
2205 return ( ShowConfirmationQueryL( normalCount |
|
2206 ? R_MMSVIEWER_QUEST_SEND_SOME_WO_RIGHTS |
|
2207 : everyWoRights ) ); |
|
2208 } |
|
2209 } |
|
2210 break; |
|
2211 } |
|
2212 |
|
2213 return ETrue; |
|
2214 } |
|
2215 |
|
2216 // --------------------------------------------------------- |
|
2217 // CMmsViewerAppUi::DoReplyViaL |
|
2218 // --------------------------------------------------------- |
|
2219 // |
|
2220 void CMmsViewerAppUi::DoReplyViaL( TInt aCase ) |
|
2221 { |
|
2222 if ( iHeader->SenderType( ) != EMuiuAddressTypeNone ) |
|
2223 { |
|
2224 TInt cleanupCount = 0; |
|
2225 |
|
2226 CMessageData* msgData = CMessageData::NewLC( ); |
|
2227 cleanupCount++; |
|
2228 |
|
2229 // Add address and alias |
|
2230 // Basically alias is taken from TMsvEntry.iDetails (see MmsViewerHeader.cpp) |
|
2231 // Alias can be one of the following in precedence order |
|
2232 // 1) local alias |
|
2233 // 2) remote alias. Remote alias maybe available when message arrives from |
|
2234 // email address |
|
2235 // 3) sender's address |
|
2236 const TPtrC sender = iMtm->Sender( ); |
|
2237 |
|
2238 if ( sender != KNullDesC( ) ) |
|
2239 { |
|
2240 if ( iHeader->Alias( ) ) |
|
2241 { |
|
2242 //const TPtrC alias = iHeader->Alias( ); |
|
2243 msgData->AppendToAddressL( TMmsGenUtils::PureAddress( sender ), *iHeader->Alias( ) ); |
|
2244 } |
|
2245 else |
|
2246 { |
|
2247 msgData->AppendToAddressL( TMmsGenUtils::PureAddress( sender ) ); |
|
2248 } |
|
2249 } |
|
2250 |
|
2251 TUid mtmUid( KSenduiMtmAudioMessageUid ); |
|
2252 switch( aCase ) |
|
2253 { |
|
2254 case EMmsViewerReplyViaAudio: |
|
2255 // default value OK |
|
2256 break; |
|
2257 case EMmsViewerReplyViaMail: |
|
2258 if ( iHeader->SenderType( ) == EMuiuAddressTypePhoneNumber ) |
|
2259 { |
|
2260 __ASSERT_DEBUG( EFalse, Panic( EMmsViewerUnexpectedReplyEvent ) ); |
|
2261 } |
|
2262 mtmUid = KSenduiMtmSmtpUid; |
|
2263 break; |
|
2264 default: |
|
2265 __ASSERT_DEBUG( EFalse, Panic( EMmsViewerUnexpectedReplyEvent ) ); |
|
2266 break; |
|
2267 } |
|
2268 |
|
2269 // audio message has not subject field |
|
2270 if ( mtmUid == KSenduiMtmSmtpUid ) |
|
2271 { |
|
2272 HBufC* prefixSubject = CreateSubjectPrefixStringL( iMtm->SubjectL( ), ETrue ); |
|
2273 CleanupStack::PushL( prefixSubject ); |
|
2274 if ( prefixSubject ) |
|
2275 { |
|
2276 msgData->SetSubjectL( prefixSubject ); |
|
2277 } |
|
2278 else |
|
2279 { |
|
2280 TPtrC subjectDes = iMtm->SubjectL( ); |
|
2281 msgData->SetSubjectL( &subjectDes ); |
|
2282 } |
|
2283 CleanupStack::PopAndDestroy( prefixSubject ); |
|
2284 } |
|
2285 |
|
2286 CSendUi* sendUi = CSendUi::NewLC( ); |
|
2287 cleanupCount++; |
|
2288 |
|
2289 iViewerState = EBusy; |
|
2290 if ( iToolbar ) |
|
2291 { |
|
2292 iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
2293 } |
|
2294 |
|
2295 // Enable Dialer as MMS Settings dialog may be launched |
|
2296 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
2297 |
|
2298 TRAPD ( error, |
|
2299 { |
|
2300 if ( !(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
2301 { |
|
2302 MediaStop( ); |
|
2303 ResetViewL( ); |
|
2304 } |
|
2305 |
|
2306 sendUi->CreateAndSendMessageL( |
|
2307 mtmUid, |
|
2308 msgData); |
|
2309 |
|
2310 } ); //TRAPD |
|
2311 CleanupStack::PopAndDestroy( cleanupCount ); |
|
2312 |
|
2313 if ( error ) |
|
2314 { |
|
2315 LOGTEXT2(_L16("CMmsViewerAppUi::DoReplyViaL error %d"), error ); |
|
2316 iViewerState = EReseted; |
|
2317 User::Leave( error ); |
|
2318 } |
|
2319 else if ( !(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
2320 { |
|
2321 Exit( EAknSoftkeyClose ); |
|
2322 } |
|
2323 if ( iToolbar ) |
|
2324 { |
|
2325 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
2326 } |
|
2327 iViewerState = ENormal; |
|
2328 } |
|
2329 } |
|
2330 |
|
2331 // --------------------------------------------------------- |
|
2332 // CMmsViewerAppUi::DoObjectsL |
|
2333 // --------------------------------------------------------- |
|
2334 // |
|
2335 void CMmsViewerAppUi::DoObjectsL( ) |
|
2336 { |
|
2337 MediaClose( iVideo ); |
|
2338 CUniObjectsModel& objectsViewModel = |
|
2339 static_cast<CUniObjectsModel&>( Document( )->AttachmentModel( ) ); |
|
2340 |
|
2341 iViewerState = EBusy; |
|
2342 |
|
2343 if ( iToolbar ) |
|
2344 { |
|
2345 iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
2346 } |
|
2347 // Enable Dialer |
|
2348 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
2349 |
|
2350 TUniObjectsDialogExitCmd dlgRet = EUniObjectsViewBack; |
|
2351 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2352 iNoTitlePaneUpdate = ETrue; |
|
2353 #endif |
|
2354 |
|
2355 iViewerFlags |= EInObjectsView; |
|
2356 TRAP_IGNORE ( CUniObjectsViewDialog::ObjectsViewL ( |
|
2357 CUniObjectsViewDialog::EViewer, |
|
2358 objectsViewModel, |
|
2359 iEikonEnv, |
|
2360 dlgRet, |
|
2361 Document()->DataModel( ) ) ); |
|
2362 |
|
2363 iViewerFlags &= ~EInObjectsView; |
|
2364 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2365 iNoTitlePaneUpdate = EFalse; |
|
2366 #endif |
|
2367 objectsViewModel.Reset(); |
|
2368 |
|
2369 if ( !IsAppShutterRunning() ) |
|
2370 { |
|
2371 if ( iToolbar ) |
|
2372 { |
|
2373 iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
2374 } |
|
2375 iViewerState = ENormal; |
|
2376 if ( dlgRet == EUniObjectsViewBack ) |
|
2377 { |
|
2378 if ( iVideo ) |
|
2379 { |
|
2380 CUniObject* videoObject = ObjectByBaseControl( *iVideo ); |
|
2381 if ( videoObject ) |
|
2382 { |
|
2383 ReloadControlL( iVideo, *videoObject ); |
|
2384 } |
|
2385 } |
|
2386 } |
|
2387 |
|
2388 InitNavipaneL( ); |
|
2389 |
|
2390 } |
|
2391 } |
|
2392 |
|
2393 // --------------------------------------------------------- |
|
2394 // CMmsViewerAppUi::DoShowPresentationL |
|
2395 // --------------------------------------------------------- |
|
2396 // |
|
2397 void CMmsViewerAppUi::DoShowPresentationL( ) |
|
2398 { |
|
2399 TMsvAttachmentId smilId = Document( )->SmilList( )->GetSmilAttachmentByIndex( 0 ); |
|
2400 |
|
2401 if ( smilId ) |
|
2402 { |
|
2403 MediaClose(); |
|
2404 |
|
2405 // Finish parsing media objects |
|
2406 Document()->DataModel().FinalizeMediaParse(); |
|
2407 |
|
2408 if ( Document( )->SmilType( ) == EMmsSmil && |
|
2409 !( iViewerFlags & ESuspiciousSmil ) ) |
|
2410 { |
|
2411 if ( !iSmilModel->ChangeLayoutL( Document( )->DataModel().Dom( ) ) ) |
|
2412 { |
|
2413 Document( )->DataModel().SetDom( iSmilModel->ComposeL( ) ); |
|
2414 } |
|
2415 |
|
2416 if ( !iSmilModel->CorrectTimingL( Document( )->DataModel().Dom( ) ) ) |
|
2417 { |
|
2418 Document( )->DataModel().SetDom( iSmilModel->ComposeL( ) ); |
|
2419 } |
|
2420 } |
|
2421 |
|
2422 CUniObjectList* objectList = Document( )->ObjectList( ); |
|
2423 TInt expiredCount = 0; |
|
2424 TInt norightsCount = 0; |
|
2425 |
|
2426 iViewerFlags &= (~EPresentationHasAudio); |
|
2427 for ( TInt index = 0; index < objectList->Count( ); index++ ) |
|
2428 { |
|
2429 CUniObject* current = objectList->GetByIndex( index ); |
|
2430 TBool ignoreConsumed (EFalse ); |
|
2431 TInt result = KErrNone; |
|
2432 if ( current |
|
2433 && current->DrmInfo( ) ) |
|
2434 { |
|
2435 result = current->DrmInfo( )->EvaluateRights( ignoreConsumed ); |
|
2436 } |
|
2437 |
|
2438 LOGTEXT2(_L16("CMmsViewerAppUi::DoShowPresentationL result %d"), result ); |
|
2439 if ( result == DRMCommon::ENoRights ) |
|
2440 { |
|
2441 norightsCount++; |
|
2442 } |
|
2443 else if ( result == DRMCommon::ERightsExpired ) |
|
2444 { |
|
2445 expiredCount++; |
|
2446 } |
|
2447 else if ( current ) |
|
2448 { |
|
2449 // Rights exist |
|
2450 // Smil player needs info whether audio clip is present or (one of the) video clip(s) |
|
2451 // has audio stream |
|
2452 TMsgMediaType media = current->MediaType( ); |
|
2453 if ( media == EMsgMediaAudio ) |
|
2454 { |
|
2455 iViewerFlags |= EPresentationHasAudio; |
|
2456 } |
|
2457 else if ( media == EMsgMediaVideo && |
|
2458 static_cast<CMsgVideoInfo*>( current->MediaInfo() )->IsAudio() ) |
|
2459 { |
|
2460 // existence of audio is checked after initialisation |
|
2461 iViewerFlags |= EPresentationHasAudio; |
|
2462 } |
|
2463 } |
|
2464 } |
|
2465 |
|
2466 if ( norightsCount > 0 ) |
|
2467 { |
|
2468 ShowInformationNoteL( R_QTN_DRM_NO_RIGHTS_FOR_SOME ); |
|
2469 } |
|
2470 else if ( expiredCount > 0 ) |
|
2471 { |
|
2472 ShowInformationNoteL( R_QTN_DRM_GEN_RIGHTS_EXP ); |
|
2473 } |
|
2474 |
|
2475 delete iSvkEvents; |
|
2476 iSvkEvents = NULL; |
|
2477 //EJJN-7MY3SM::MMS viewer, ReTe, RM505_MeDo_ivalo_rnd: Panic with note |
|
2478 //"Application closed: Multimedia" occurs after some operation. |
|
2479 |
|
2480 CEikButtonGroupContainer* cba1 = CEikButtonGroupContainer::Current(); |
|
2481 if (cba1) |
|
2482 { |
|
2483 cba1->MakeVisible(EFalse); |
|
2484 } |
|
2485 |
|
2486 if ( iToolbar ) |
|
2487 { |
|
2488 iToolbar->SetToolbarVisibility(EFalse, EFalse); |
|
2489 } |
|
2490 // Enable Dialer |
|
2491 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
2492 |
|
2493 CSmilPlayerDialog* dialog = CSmilPlayerDialog::NewL( |
|
2494 Document( )->DataModel().Dom( ), |
|
2495 Document( )->ObjectList( ), |
|
2496 KNullDesC( ), |
|
2497 EFalse, |
|
2498 iViewerFlags & EPresentationHasAudio ); |
|
2499 |
|
2500 iViewerState = EBusy; |
|
2501 TRAPD( error, dialog->ExecuteLD( ) ); |
|
2502 |
|
2503 CAknAppUiBase* appUi = static_cast<CAknAppUiBase*>( iEikonEnv->EikAppUi( ) ); |
|
2504 TRAP_IGNORE( appUi->SetOrientationL( CAknAppUiBase::EAppUiOrientationAutomatic ) ); |
|
2505 |
|
2506 if ( iToolbar ) |
|
2507 { |
|
2508 iToolbar->SetToolbarVisibility(ETrue, EFalse); |
|
2509 } |
|
2510 |
|
2511 iViewerState = ENormal; |
|
2512 |
|
2513 // re-calculate all pos and dimensions of layout's widgets, after |
|
2514 // status pane is set back to usual and fixed-toolbar is made visible. |
|
2515 HandleResourceChangeL(KEikDynamicLayoutVariantSwitch); |
|
2516 |
|
2517 if ( !IsAppShutterRunning() ) |
|
2518 { |
|
2519 ReloadSlideL( ); |
|
2520 } |
|
2521 else |
|
2522 { |
|
2523 InitNavipaneL( ); |
|
2524 } |
|
2525 |
|
2526 iSvkEvents = CMmsSvkEvents::NewL( *this ); |
|
2527 |
|
2528 User::LeaveIfError( error ); |
|
2529 } |
|
2530 } |
|
2531 |
|
2532 // --------------------------------------------------------- |
|
2533 // CMmsViewerAppUi::DoHandleSendKeyL |
|
2534 // --------------------------------------------------------- |
|
2535 // |
|
2536 void CMmsViewerAppUi::DoHandleSendKeyL( ) |
|
2537 { |
|
2538 if ( MediaIsRunning( iAudio ) || |
|
2539 MediaIsRunning( iVideo ) ) |
|
2540 { |
|
2541 //-> inactive |
|
2542 return; |
|
2543 } |
|
2544 |
|
2545 if ( !iMmsVoIPExtension ) |
|
2546 { |
|
2547 iMmsVoIPExtension = CMsgVoIPExtension::NewL( ); |
|
2548 } |
|
2549 |
|
2550 TPtrC senderAddr = KNullDesC( ); |
|
2551 TPtrC senderAlias = KNullDesC( ); |
|
2552 TBool dialerDisabled = EFalse; |
|
2553 |
|
2554 senderAddr.Set( TMmsGenUtils::PureAddress( iMtm->Sender() ) ); |
|
2555 if ( iHeader->Alias( ) ) |
|
2556 { |
|
2557 senderAlias.Set( *( iHeader->Alias( ) ) ); |
|
2558 } |
|
2559 |
|
2560 TPtrC focusedAddr = KNullDesC( ); |
|
2561 if ( FocusedControlId( ) == EMsgComponentIdBody && |
|
2562 iView->ItemFinder( ) ) |
|
2563 { |
|
2564 const CItemFinder::CFindItemExt& item = |
|
2565 iView->ItemFinder( )->CurrentItemExt( ); |
|
2566 if ( item.iItemDescriptor |
|
2567 && ( item.iItemType == CItemFinder::EPhoneNumber |
|
2568 || item.iItemType == CItemFinder::EEmailAddress ) ) |
|
2569 { |
|
2570 //Dialer is opened when creating a VoIP call from MMS via Call creation key |
|
2571 //Disabling the dialer when send is pressed |
|
2572 iAvkonAppUi->SetKeyEventFlags( |
|
2573 CAknAppUiBase::EDisableSendKeyShort | |
|
2574 CAknAppUiBase::EDisableSendKeyLong ); |
|
2575 dialerDisabled = ETrue; |
|
2576 focusedAddr.Set( *(item.iItemDescriptor) ); |
|
2577 } |
|
2578 } |
|
2579 |
|
2580 if ( FocusedControlId( ) == EMsgComponentIdFrom && |
|
2581 senderAddr.Length() && |
|
2582 iHeader->SenderType( ) == EMuiuAddressTypePhoneNumber ) |
|
2583 { |
|
2584 // Disable dialer |
|
2585 iAvkonAppUi->SetKeyEventFlags( |
|
2586 CAknAppUiBase::EDisableSendKeyShort | |
|
2587 CAknAppUiBase::EDisableSendKeyLong ); |
|
2588 dialerDisabled = ETrue; |
|
2589 } |
|
2590 // Only when dialer is disabled try placing the call |
|
2591 if ( dialerDisabled ) |
|
2592 { |
|
2593 MsvUiServiceUtilitiesInternal::InternetOrVoiceCallServiceL( |
|
2594 *iMmsVoIPExtension, |
|
2595 senderAddr, |
|
2596 senderAlias, |
|
2597 focusedAddr, |
|
2598 ETrue, |
|
2599 iEikonEnv ); |
|
2600 } |
|
2601 } |
|
2602 |
|
2603 // --------------------------------------------------------- |
|
2604 // CMmsViewerAppUi::DoMessageInfoL |
|
2605 // --------------------------------------------------------- |
|
2606 // |
|
2607 void CMmsViewerAppUi::DoMessageInfoL( ) |
|
2608 { |
|
2609 TPckgBuf<TInt> nullParam( 0 ); |
|
2610 |
|
2611 //These are not used! They just have to be there. |
|
2612 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
2613 CleanupStack::PushL( selection ); |
|
2614 |
|
2615 CMsvSingleOpWatcher* watch = CMsvSingleOpWatcher::NewLC( *Document( ) ); |
|
2616 CMsvOperation* op = Document( )->MtmUiL( ).InvokeAsyncFunctionL( |
|
2617 KMtmUiFunctionMessageInfo, |
|
2618 *selection, |
|
2619 watch->iStatus, |
|
2620 nullParam ); |
|
2621 CleanupStack::Pop( watch ); |
|
2622 Document( )->AddSingleOperationL( op, watch ); |
|
2623 |
|
2624 CleanupStack::PopAndDestroy( selection ); |
|
2625 } |
|
2626 |
|
2627 // --------------------------------------------------------- |
|
2628 // CMmsViewerAppUi::DoDeleteAndExitL |
|
2629 // --------------------------------------------------------- |
|
2630 // |
|
2631 void CMmsViewerAppUi::DoDeleteAndExitL( ) |
|
2632 { |
|
2633 // Confirm from user deletion of message and delete if needed. |
|
2634 if ( ShowConfirmationQueryL( R_MMSVIEWER_QUEST_DELETE_MESSAGE ) ) |
|
2635 { |
|
2636 MediaStop( ); |
|
2637 //Reset view (i.e. close all files!) |
|
2638 //If image is open, extra delay needs to be added that |
|
2639 //server side components can finish their tasks |
|
2640 iViewerState = EReseted; |
|
2641 ResetViewL( ); |
|
2642 // create delay, because every media object is not necessary closed immediately |
|
2643 Document( )->DeleteModel( ); |
|
2644 User::After(50000); |
|
2645 DeleteAndExitL( ); |
|
2646 } |
|
2647 } |
|
2648 |
|
2649 |
|
2650 // --------------------------------------------------------- |
|
2651 // CMmsViewerAppUi::DoMoveMessageL |
|
2652 // --------------------------------------------------------- |
|
2653 // |
|
2654 void CMmsViewerAppUi::DoMoveMessageL( ) |
|
2655 { |
|
2656 //ask folder with a dialog (from muiu) |
|
2657 TMsvId target = Document( )->Entry( ).Parent( ); |
|
2658 HBufC* title = StringLoader::LoadLC( R_MMSVIEWER_MOVE_TEXT, iCoeEnv ); |
|
2659 TBool success = CMsgFolderSelectionDialog::SelectFolderL(target, *title); |
|
2660 CleanupStack::PopAndDestroy( title ); |
|
2661 if (success) |
|
2662 { |
|
2663 MediaStop( ); |
|
2664 iViewerState = EReseted; |
|
2665 ResetViewL( ); |
|
2666 iViewerState = EBusy; |
|
2667 TInt error(KErrNone); |
|
2668 TRAP(error, MoveMessageEntryL( target ) ); |
|
2669 iViewerState = EReseted; |
|
2670 |
|
2671 LOGTEXT2(_L16("CMmsViewerAppUi::DoMoveMessageL %d"), error ); |
|
2672 User::LeaveIfError( error ); |
|
2673 Exit( EAknSoftkeyClose ); |
|
2674 } |
|
2675 } |
|
2676 |
|
2677 |
|
2678 // --------------------------------------------------------- |
|
2679 // CMmsViewerAppUi::IsOwnMessage |
|
2680 // --------------------------------------------------------- |
|
2681 // |
|
2682 TBool CMmsViewerAppUi::IsOwnMessage( ) const |
|
2683 { |
|
2684 const TMmsMsvEntry* mmsEntry = |
|
2685 static_cast<const TMmsMsvEntry*>( &Document( )->Entry( ) ); |
|
2686 return ( !(mmsEntry->IsMobileTerminated( ) ) ); |
|
2687 } |
|
2688 |
|
2689 // --------------------------------------------------------- |
|
2690 // CMmsViewerAppUi::HasSender |
|
2691 // --------------------------------------------------------- |
|
2692 // |
|
2693 TBool CMmsViewerAppUi::HasSender( ) const |
|
2694 { |
|
2695 return ( iMtm->Sender( ).Length( ) > 0 ); |
|
2696 } |
|
2697 |
|
2698 // --------------------------------------------------------- |
|
2699 // CMmsViewerAppUi::ShowReplyToAll |
|
2700 // --------------------------------------------------------- |
|
2701 // |
|
2702 TBool CMmsViewerAppUi::ShowReplyToAll( ) const |
|
2703 { |
|
2704 return ( iMtm->AddresseeList( ).Count( ) > |
|
2705 ( IsOwnMessage( ) ? 0 : 1 ) ); |
|
2706 } |
|
2707 |
|
2708 // --------------------------------------------------------- |
|
2709 // CMmsViewerAppUi::ShowReplyMenu |
|
2710 // --------------------------------------------------------- |
|
2711 // |
|
2712 TBool CMmsViewerAppUi::ShowReplyMenu( ) const |
|
2713 { |
|
2714 if ( Document( )->IsUpload( ) ) |
|
2715 { |
|
2716 return EFalse; |
|
2717 } |
|
2718 else |
|
2719 { |
|
2720 return ( HasSender( ) || ShowReplyToAll( ) ); |
|
2721 } |
|
2722 } |
|
2723 |
|
2724 // --------------------------------------------------------- |
|
2725 // CMmsViewerAppUi::ResetViewL |
|
2726 // --------------------------------------------------------- |
|
2727 // |
|
2728 void CMmsViewerAppUi::ResetViewL( ) |
|
2729 { |
|
2730 iVideo = NULL; |
|
2731 iAudio = NULL; |
|
2732 iImage = NULL; |
|
2733 #ifdef RD_SVGT_IN_MESSAGING |
|
2734 iSvgt = NULL; |
|
2735 #endif |
|
2736 |
|
2737 if ( iSlideLoader ) |
|
2738 { |
|
2739 iSlideLoader->ResetViewL( ); |
|
2740 } |
|
2741 // When attachments view is visible but not focused, eye striking focus movement takes |
|
2742 // place to attachments field e.g durign forwarding. |
|
2743 iHeader->RemoveAttachmentL(); |
|
2744 iHeader->RemoveFromViewL( ); |
|
2745 } |
|
2746 |
|
2747 // --------------------------------------------------------- |
|
2748 // CMmsViewerAppUi::EditorObserver |
|
2749 // --------------------------------------------------------- |
|
2750 // |
|
2751 void CMmsViewerAppUi::EditorObserver(TMsgEditorObserverFunc aFunc, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
2752 { |
|
2753 TRAP_IGNORE(DoEditorObserverL(aFunc,aArg1,aArg2,aArg3 ) ); |
|
2754 } |
|
2755 |
|
2756 |
|
2757 // --------------------------------------------------------- |
|
2758 // CMmsViewerAppUi::EditorObserver |
|
2759 // --------------------------------------------------------- |
|
2760 // |
|
2761 void CMmsViewerAppUi::DoEditorObserverL(TMsgEditorObserverFunc aFunc, TAny* aArg1, TAny* aArg2, TAny* aArg3) |
|
2762 { |
|
2763 TInt slides = iSmilModel->SlideCount( ); |
|
2764 TBool multiSlide = |
|
2765 ( Document( )->SmilType( ) == EMmsSmil && slides > 1 ); |
|
2766 switch ( aFunc ) |
|
2767 { |
|
2768 case EMsgScrollParts: |
|
2769 { |
|
2770 if ( multiSlide ) |
|
2771 { |
|
2772 TInt* parts = static_cast<TInt*>( aArg1 ); |
|
2773 *parts = slides; |
|
2774 } |
|
2775 } |
|
2776 break; |
|
2777 case EMsgHandleFocusChange: |
|
2778 { |
|
2779 // Enable Dialer |
|
2780 iAvkonAppUi->SetKeyEventFlags( 0x00 ); |
|
2781 |
|
2782 TMsgFocusEvent event = |
|
2783 *( static_cast<TMsgFocusEvent*>( aArg1 ) ); |
|
2784 TMsgAfterFocusEventFunc* after = |
|
2785 static_cast<TMsgAfterFocusEventFunc*>( aArg2 ); |
|
2786 TInt* currPart = |
|
2787 static_cast<TInt*>( aArg3 ); |
|
2788 |
|
2789 switch (event) |
|
2790 { |
|
2791 case EMsgFocusAtBottom: |
|
2792 #ifdef RD_SCALABLE_UI_V2 |
|
2793 // check the legality of slide change |
|
2794 if ( multiSlide && *currPart > Document( )->CurrentSlide( ) ) |
|
2795 { |
|
2796 TInt moveToSlide( *currPart ); |
|
2797 if ( moveToSlide >= slides ) |
|
2798 { |
|
2799 moveToSlide = slides - 1; |
|
2800 } |
|
2801 |
|
2802 ChangeSlideL( moveToSlide, ETrue ); |
|
2803 *after = EMsgCursorToBodyBeginning; |
|
2804 } |
|
2805 else |
|
2806 { |
|
2807 *after = EMsgAfterFocusNone; |
|
2808 } |
|
2809 *currPart = Document( )->CurrentSlide( ); |
|
2810 #else |
|
2811 if ( multiSlide && Document( )->CurrentSlide( ) + 1 < slides ) |
|
2812 { |
|
2813 ChangeSlideL( Document( )->CurrentSlide( ) + 1, ETrue); |
|
2814 *after = EMsgCursorToBodyBeginning; |
|
2815 *currPart = Document( )->CurrentSlide( ); |
|
2816 } |
|
2817 #endif |
|
2818 break; |
|
2819 case EMsgFocusAtTop: |
|
2820 #ifdef RD_SCALABLE_UI_V2 |
|
2821 // check the legality of slide change |
|
2822 if ( multiSlide && *currPart < Document( )->CurrentSlide( ) ) |
|
2823 { |
|
2824 TInt moveToSlide( *currPart ); |
|
2825 if ( moveToSlide < 0 ) |
|
2826 { |
|
2827 moveToSlide = 0; |
|
2828 } |
|
2829 |
|
2830 ChangeSlideL( moveToSlide, ETrue); |
|
2831 *after = EMsgCursorToBodyEnd; |
|
2832 } |
|
2833 else |
|
2834 { |
|
2835 *after = EMsgAfterFocusNone; |
|
2836 } |
|
2837 *currPart = Document( )->CurrentSlide( ); |
|
2838 #else |
|
2839 if ( multiSlide && Document( )->CurrentSlide( ) > 0 ) |
|
2840 { |
|
2841 ChangeSlideL( Document( )->CurrentSlide( ) - 1, ETrue); |
|
2842 *after = EMsgCursorToBodyEnd; |
|
2843 *currPart = Document( )->CurrentSlide( ); |
|
2844 } |
|
2845 #endif |
|
2846 break; |
|
2847 case EMsgFocusMovingFrom: |
|
2848 { |
|
2849 if ( MediaIsRunning( iVideo ) ) |
|
2850 { |
|
2851 MediaStop( iVideo ); |
|
2852 } |
|
2853 break; |
|
2854 } |
|
2855 case EMsgFocusMovedTo: |
|
2856 { |
|
2857 StartAnimationL( ); |
|
2858 UpdateMskL( ); |
|
2859 break; |
|
2860 } |
|
2861 case EMsgFocusToBody: |
|
2862 case EMsgFocusToHeader: |
|
2863 default: |
|
2864 break; |
|
2865 } |
|
2866 } |
|
2867 break; |
|
2868 case EMsgControlPointerEvent: |
|
2869 { |
|
2870 #ifdef RD_SCALABLE_UI_V2 |
|
2871 if ( AknLayoutUtils::PenEnabled() ) |
|
2872 { |
|
2873 TPointerEvent* pointerEvent = static_cast<TPointerEvent*>( aArg2 ); |
|
2874 CMsgBaseControl* baseControl = static_cast<CMsgBaseControl*>( aArg1 ); |
|
2875 TWsEvent* wsEvent = static_cast<TWsEvent*>(aArg2); |
|
2876 |
|
2877 if ( pointerEvent |
|
2878 && pointerEvent->iType == TPointerEvent::EButton1Down ) |
|
2879 { |
|
2880 // We are looking for a valid tap (button down and up) |
|
2881 // on a focused object. |
|
2882 iPointerTarget = baseControl; |
|
2883 |
|
2884 if ( baseControl && |
|
2885 ( baseControl->ControlId() == EMsgComponentIdAudio || |
|
2886 baseControl->ControlId() == EMsgComponentIdImage || |
|
2887 baseControl->ControlId() == EMsgComponentIdVideo || |
|
2888 baseControl->ControlId() == EMsgComponentIdSvg )&& |
|
2889 ((Document()->SmilType()!=ETemplateSmil)&&(Document()->SmilType()!=E3GPPSmil) )) |
|
2890 { |
|
2891 if(iLongTapDetector) |
|
2892 { |
|
2893 iLongTapDetector->EnableLongTapAnimation(ETrue); |
|
2894 iLongTapDetector->PointerEventL( *pointerEvent ); |
|
2895 } |
|
2896 } |
|
2897 iTapConsumed = EFalse; |
|
2898 } |
|
2899 else if ( (!iTapConsumed) && (pointerEvent |
|
2900 && pointerEvent->iType == TPointerEvent::EButton1Up) ) |
|
2901 { |
|
2902 iLongTapDetector->MonitorWsMessage(*wsEvent); |
|
2903 iTapConsumed = ETrue; |
|
2904 CMsgBaseControl* focusedControl = iView->FocusedControl(); |
|
2905 if ( baseControl && iPointerTarget == baseControl ) |
|
2906 { |
|
2907 switch( iMskId ) |
|
2908 { |
|
2909 // Tapping on selected object functions as a |
|
2910 // selection key was pressed. But command set |
|
2911 // is limited to ones below. |
|
2912 case R_MMSVIEWER_MSK_BUTTON_PLAY_PRESENTATION: // fallthrough |
|
2913 case R_MMSVIEWER_MSK_BUTTON_PLAY_AUDIO: // fallthrough |
|
2914 case R_MMSVIEWER_MSK_BUTTON_OPEN_IMAGE: // fallthrough |
|
2915 case R_MMSVIEWER_MSK_BUTTON_PLAY_VIDEO: // fallthrough |
|
2916 case R_MMSVIEWER_MSK_BUTTON_STOP_AUDIO: |
|
2917 case R_MMSVIEWER_MSK_BUTTON_STOP_VIDEO: |
|
2918 case R_MMSVIEWER_MSK_BUTTON_OPEN_OBJECTS: |
|
2919 #ifdef RD_SVGT_IN_MESSAGING |
|
2920 case R_MMSVIEWER_MSK_BUTTON_PLAY_SVG: |
|
2921 #endif |
|
2922 { |
|
2923 HandleSelectionKeyL(); |
|
2924 *static_cast<TBool*>( aArg3 ) = ETrue; // handled |
|
2925 } |
|
2926 default: |
|
2927 ; |
|
2928 } |
|
2929 } |
|
2930 else if ( focusedControl && iPointerTarget == focusedControl ) |
|
2931 { |
|
2932 if ( iMskId == R_MMSVIEWER_MSK_BUTTON_PLAY_VIDEO || |
|
2933 iMskId == R_MMSVIEWER_MSK_BUTTON_STOP_VIDEO ) |
|
2934 { |
|
2935 HandleSelectionKeyL(); |
|
2936 *static_cast<TBool*>( aArg3 ) = ETrue; // handled |
|
2937 } |
|
2938 } |
|
2939 |
|
2940 iPointerTarget = NULL; |
|
2941 } |
|
2942 } |
|
2943 #endif // RD_SCALABLE_UI_V2 |
|
2944 break; |
|
2945 } |
|
2946 case EMsgButtonEvent: |
|
2947 { |
|
2948 #ifdef RD_SCALABLE_UI_V2 |
|
2949 if ( AknLayoutUtils::PenEnabled() ) |
|
2950 { |
|
2951 if ( iHeader->AttachmentControl( ) == static_cast<CMsgBaseControl*>( aArg1 ) ) |
|
2952 { |
|
2953 DoObjectsL(); |
|
2954 } |
|
2955 } |
|
2956 #endif // RD_SCALABLE_UI_V2 |
|
2957 break; |
|
2958 } |
|
2959 default: |
|
2960 break; |
|
2961 } |
|
2962 } |
|
2963 |
|
2964 // --------------------------------------------------------- |
|
2965 // CMmsViewerAppUi::HandleNotifyInt |
|
2966 // |
|
2967 // Notification from central repository |
|
2968 // --------------------------------------------------------- |
|
2969 // |
|
2970 void CMmsViewerAppUi::HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue ) |
|
2971 { |
|
2972 if ( aNewValue == 0 ) |
|
2973 { |
|
2974 iViewerFlags &= ~EAutohighLightEnabled; |
|
2975 } |
|
2976 else |
|
2977 { |
|
2978 iViewerFlags |= EAutohighLightEnabled; |
|
2979 } |
|
2980 TRAP_IGNORE( SetFindModeL( iViewerFlags & EAutohighLightEnabled ) ); |
|
2981 } |
|
2982 |
|
2983 // --------------------------------------------------------- |
|
2984 // CMmsViewerAppUi::HandleNotifyGeneric |
|
2985 // --------------------------------------------------------- |
|
2986 // |
|
2987 void CMmsViewerAppUi::HandleNotifyGeneric( TUint32 /*aId*/ ) |
|
2988 { |
|
2989 //Nothing. |
|
2990 } |
|
2991 |
|
2992 // --------------------------------------------------------- |
|
2993 // CMmsViewerAppUi::HandleNotifyError |
|
2994 // --------------------------------------------------------- |
|
2995 // |
|
2996 void CMmsViewerAppUi::HandleNotifyError( TUint32 /*aId*/, TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/ ) |
|
2997 { |
|
2998 //Nothing. |
|
2999 } |
|
3000 |
|
3001 // |
|
3002 // NOTICE: |
|
3003 // |
|
3004 // Startup observer moved to own class because Publish & Subscribe |
|
3005 // requires an active object for event handling. |
|
3006 // |
|
3007 |
|
3008 // --------------------------------------------------------- |
|
3009 // CMmsViewerAppUi::HandleIteratorEventL |
|
3010 // --------------------------------------------------------- |
|
3011 // |
|
3012 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
3013 void CMmsViewerAppUi::HandleIteratorEventL( TMessageIteratorEvent aEvent ) |
|
3014 { |
|
3015 if ( aEvent == EFolderCountChanged |
|
3016 && iViewerState == ENormal |
|
3017 && !iNoTitlePaneUpdate ) |
|
3018 { |
|
3019 InitNavipaneL( ); |
|
3020 } |
|
3021 } |
|
3022 #endif |
|
3023 |
|
3024 // --------------------------------------------------------- |
|
3025 // MmsSvkChangeVolumeL |
|
3026 // --------------------------------------------------------- |
|
3027 // Callback function |
|
3028 void CMmsViewerAppUi::MmsSvkChangeVolumeL( TInt aVolumeChange ) |
|
3029 { |
|
3030 ChangeVolumeL( aVolumeChange, ETrue ); |
|
3031 } |
|
3032 |
|
3033 // --------------------------------------------------------- |
|
3034 // ChangeVolumeL |
|
3035 // --------------------------------------------------------- |
|
3036 // |
|
3037 void CMmsViewerAppUi::ChangeVolumeL( TInt aVolume, TBool aChange ) |
|
3038 { |
|
3039 TBool audioPlaying ( MediaCanStop( iAudio ) ); |
|
3040 TBool videoPlaying = |
|
3041 ( ( MediaCanStop( iVideo ) ) && |
|
3042 ( FocusedControlId( ) == EMsgComponentIdVideo ) ); |
|
3043 |
|
3044 if ( audioPlaying || videoPlaying ) |
|
3045 { |
|
3046 TInt newVolume = DoChangeVolumeL( aVolume, aChange, audioPlaying ); |
|
3047 if ( newVolume >= KVolumeControlMinValue ) |
|
3048 { |
|
3049 // Finally show the volume |
|
3050 ShowVolumeL( newVolume, audioPlaying ); |
|
3051 } |
|
3052 } |
|
3053 } |
|
3054 |
|
3055 // --------------------------------------------------------- |
|
3056 // CMmsViewerAppUi::DoChangeVolumeL |
|
3057 // --------------------------------------------------------- |
|
3058 // |
|
3059 TInt CMmsViewerAppUi::DoChangeVolumeL( TInt aVolume, TBool aChange, TBool aAudioPlaying ) |
|
3060 { |
|
3061 #ifdef _DEBUG |
|
3062 if ( aAudioPlaying ) |
|
3063 { |
|
3064 __ASSERT_DEBUG( iAudio, Panic( EMmsViewerNullPointer ) ); |
|
3065 } |
|
3066 else |
|
3067 { |
|
3068 __ASSERT_DEBUG( iVideo, Panic( EMmsViewerNullPointer ) ); |
|
3069 } |
|
3070 #endif |
|
3071 TInt newVolume = aVolume; |
|
3072 // In practise the variable indicates whether volume indicator is shown in the navi pane |
|
3073 // and whether audio can be heard |
|
3074 TBool updateIntoCenRepAllowed( aAudioPlaying ); |
|
3075 |
|
3076 // Changes the volume level into the CenRep, if: |
|
3077 // 1) audio is playing or |
|
3078 // 2) video is playing and video has audio and silent mode is not On |
|
3079 // |
|
3080 // Sets the volume level into audio/video player if |
|
3081 // 1) as above |
|
3082 // 2) video is playing and silent mode is On |
|
3083 // |
|
3084 if ( aAudioPlaying |
|
3085 || ( !aAudioPlaying |
|
3086 && iViewerFlags & EVideoHasAudio ) ) |
|
3087 { |
|
3088 if ( !aAudioPlaying |
|
3089 && iViewerFlags & EVideoHasAudio |
|
3090 && !IsSilenceL( ) ) |
|
3091 { |
|
3092 updateIntoCenRepAllowed = ETrue; |
|
3093 } |
|
3094 else if ( !aAudioPlaying ) |
|
3095 { |
|
3096 updateIntoCenRepAllowed = EFalse; |
|
3097 } |
|
3098 |
|
3099 // First determine new value to be written into Cenrep |
|
3100 TInt currVolume( KVolumeDefault ); |
|
3101 if ( aChange ) |
|
3102 { |
|
3103 iMmsRepository->Get( KMmsuiHandsfreeVolume, currVolume ); |
|
3104 newVolume = currVolume+aVolume; |
|
3105 } |
|
3106 else |
|
3107 { |
|
3108 // force change |
|
3109 currVolume = KErrNotFound; |
|
3110 } |
|
3111 // else - newVolume has correct value and currVolume forces always change |
|
3112 |
|
3113 newVolume = Max( KVolumeControlMinValue, |
|
3114 Min( KVolumeControlMaxValue, newVolume ) ); |
|
3115 if ( updateIntoCenRepAllowed |
|
3116 && newVolume != currVolume ) |
|
3117 { |
|
3118 iMmsRepository->Set( KMmsuiHandsfreeVolume, newVolume ); |
|
3119 } |
|
3120 |
|
3121 // Then write the value into control |
|
3122 if ( aAudioPlaying ) |
|
3123 { |
|
3124 if (iAudio) |
|
3125 { |
|
3126 TInt maxVolume = reinterpret_cast<CMsgAudioControl*>(iAudio)->MaxVolume( ); |
|
3127 reinterpret_cast<CMsgAudioControl*>(iAudio)-> |
|
3128 SetVolume( ( newVolume * maxVolume ) / KVolumeLevels ); |
|
3129 } |
|
3130 } |
|
3131 else |
|
3132 { |
|
3133 if ( iVideo ) |
|
3134 { |
|
3135 if ( !updateIntoCenRepAllowed ) |
|
3136 { |
|
3137 newVolume = KVolumeControlMinValuePlayer; |
|
3138 } |
|
3139 |
|
3140 TInt maxVolume = reinterpret_cast<CMsgVideoControl*>( iVideo )->MaxVolume( ); |
|
3141 TInt dummy(KErrNone); |
|
3142 TRAP( dummy, |
|
3143 reinterpret_cast<CMsgVideoControl*>(iVideo)-> |
|
3144 SetVolumeL( ( newVolume * maxVolume ) / KVolumeLevels ) ); |
|
3145 } |
|
3146 } |
|
3147 } |
|
3148 if ( !updateIntoCenRepAllowed ) |
|
3149 { |
|
3150 newVolume = KErrNotFound; |
|
3151 } |
|
3152 return newVolume; |
|
3153 } |
|
3154 |
|
3155 // --------------------------------------------------------- |
|
3156 // ShowVolumeL |
|
3157 // --------------------------------------------------------- |
|
3158 // |
|
3159 void CMmsViewerAppUi::ShowVolumeL( TInt aNewVolume, |
|
3160 TBool aAudioPlaying ) |
|
3161 { |
|
3162 // Shows volume control, if: |
|
3163 // 1) audio is playing or |
|
3164 // 2) video is playing and (either or both of the below conditions is ETrue ) |
|
3165 // - silent mode is not On or |
|
3166 // - video has audio |
|
3167 if ( aAudioPlaying |
|
3168 || ( !aAudioPlaying |
|
3169 && ( iViewerFlags & EVideoHasAudio ) |
|
3170 || !IsSilenceL( ) ) ) |
|
3171 { |
|
3172 if ( !iVolumeDecorator ) |
|
3173 { |
|
3174 iVolumeDecorator = iNaviPane->CreateVolumeIndicatorL( R_AVKON_NAVI_PANE_VOLUME_INDICATOR ); |
|
3175 |
|
3176 #ifdef RD_SCALABLE_UI_V2 |
|
3177 if ( AknLayoutUtils::PenEnabled() ) |
|
3178 { |
|
3179 static_cast<CAknVolumeControl*> |
|
3180 ( iVolumeDecorator->DecoratedControl() )->SetObserver( this ); |
|
3181 } |
|
3182 #endif |
|
3183 } |
|
3184 |
|
3185 if ( ! ( iViewerFlags & EVolumeControlTriggered ) ) |
|
3186 { |
|
3187 // Set new volume and show it |
|
3188 static_cast<CAknVolumeControl*> |
|
3189 ( iVolumeDecorator->DecoratedControl() )->SetValue( aNewVolume ); |
|
3190 } |
|
3191 iNaviPane->PushL( *iVolumeDecorator ); |
|
3192 } |
|
3193 } |
|
3194 |
|
3195 // --------------------------------------------------------- |
|
3196 // CMmsViewerAppUi::MsgAsyncControlStateChanged |
|
3197 // --------------------------------------------------------- |
|
3198 // |
|
3199 void CMmsViewerAppUi::MsgAsyncControlStateChanged( |
|
3200 CMsgBaseControl& aControl, |
|
3201 TMsgAsyncControlState aNewState, |
|
3202 TMsgAsyncControlState aOldState ) |
|
3203 |
|
3204 { |
|
3205 switch ( aControl.ControlId( ) ) |
|
3206 { |
|
3207 case EMsgComponentIdAudio: |
|
3208 case EMsgComponentIdVideo: |
|
3209 case EMsgComponentIdImage: |
|
3210 case EMsgComponentIdSvg: |
|
3211 // Must be derived from CMsgMediaControl |
|
3212 TRAP_IGNORE( DoMsgMediaControlStateChangedL( |
|
3213 static_cast<CMsgMediaControl&>( aControl ), |
|
3214 aNewState, |
|
3215 aOldState ) ); |
|
3216 break; |
|
3217 default: |
|
3218 // not derived from CMsgMediaControl |
|
3219 break; |
|
3220 } |
|
3221 } |
|
3222 |
|
3223 // --------------------------------------------------------- |
|
3224 // CMmsViewerAppUi::MsgAsyncControlStateChanged |
|
3225 // --------------------------------------------------------- |
|
3226 void CMmsViewerAppUi::MsgAsyncControlResourceChanged( CMsgBaseControl& aControl, TInt aType ) |
|
3227 { |
|
3228 if ( aType == KEikDynamicLayoutVariantSwitch && |
|
3229 aControl.ControlType() == EMsgImageControl ) |
|
3230 { |
|
3231 CMsgImageControl& imageControl = static_cast<CMsgImageControl&>( aControl ); |
|
3232 |
|
3233 if ( imageControl.IconBitmapId() == EMbmMmsuiQgn_graf_mms_play ) |
|
3234 { |
|
3235 // 3GPP icons needs to be handled by ourself |
|
3236 TAknLayoutRect iconLayout; |
|
3237 iconLayout.LayoutRect( MsgEditorCommons::MsgDataPane(), |
|
3238 AknLayoutScalable_Apps::msg_data_pane_g4().LayoutLine() ); |
|
3239 |
|
3240 TRAP_IGNORE( imageControl.SetIconSizeL( iconLayout.Rect().Size() ) ); |
|
3241 } |
|
3242 } |
|
3243 } |
|
3244 |
|
3245 // --------------------------------------------------------- |
|
3246 // CMmsViewerAppUi::DoMsgMediaControlStateChangingL |
|
3247 // --------------------------------------------------------- |
|
3248 // |
|
3249 void CMmsViewerAppUi::DoMsgMediaControlStateChangedL( |
|
3250 CMsgMediaControl& aControl, |
|
3251 TMsgAsyncControlState aNewState, |
|
3252 TMsgAsyncControlState aOldState ) |
|
3253 { |
|
3254 #ifdef USE_LOGGER |
|
3255 switch ( aControl.ControlId( ) ) |
|
3256 { |
|
3257 case EMsgComponentIdAudio: |
|
3258 LOGTEXT2(_L16("CMmsViewerAppUi::MsgMediaControlStateChanged. Audio: Old state %d"), aOldState ); |
|
3259 LOGTEXT2(_L16(" Audio: new state %d"), aNewState ); |
|
3260 LOGTEXT2(_L16(" Audio: error %d"), aControl.Error() ); |
|
3261 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3262 { |
|
3263 LOGTIMESTAMP("CMmsViewerAppUi::DoMsgMediaControlStateChangedL Audio is ready "); |
|
3264 } |
|
3265 break; |
|
3266 case EMsgComponentIdVideo: |
|
3267 LOGTEXT2(_L16("CMmsViewerAppUi::MsgMediaControlStateChanged. Video: Old state %d"), aOldState ); |
|
3268 LOGTEXT2(_L16(" Video: new state %d"), aNewState ); |
|
3269 LOGTEXT2(_L16(" Video: error %d"), aControl.Error() ); |
|
3270 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3271 { |
|
3272 LOGTIMESTAMP("CMmsViewerAppUi::DoMsgMediaControlStateChangedL Video is ready "); |
|
3273 } |
|
3274 break; |
|
3275 case EMsgComponentIdImage: |
|
3276 LOGTEXT2(_L16("CMmsViewerAppUi::MsgMediaControlStateChanged. Image: Old state %d"), aOldState ); |
|
3277 LOGTEXT2(_L16(" Image: new state %d"), aNewState ); |
|
3278 LOGTEXT2(_L16(" Image: error %d"), aControl.Error() ); |
|
3279 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3280 { |
|
3281 LOGTIMESTAMP("CMmsViewerAppUi::DoMsgMediaControlStateChangedL Image is ready "); |
|
3282 } |
|
3283 break; |
|
3284 case EMsgComponentIdSvg: |
|
3285 LOGTEXT2(_L16("CMmsViewerAppUi::MsgMediaControlStateChanged. Svg: Old state %d"), aOldState ); |
|
3286 LOGTEXT2(_L16(" Svg: new state %d"), aNewState ); |
|
3287 LOGTEXT2(_L16(" Svg: error %d"), aControl.Error() ); |
|
3288 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3289 { |
|
3290 LOGTIMESTAMP("CMmsViewerAppUi::DoMsgMediaControlStateChangedL Svg is ready "); |
|
3291 } |
|
3292 break; |
|
3293 default: |
|
3294 // not derived from CMsgMediaControl |
|
3295 break; |
|
3296 } |
|
3297 #endif |
|
3298 |
|
3299 // Resets iOpeningState |
|
3300 ShowPendingNoteL( ); |
|
3301 |
|
3302 // component independent |
|
3303 switch ( aNewState ) |
|
3304 { |
|
3305 case EMsgAsyncControlStatePlaying: |
|
3306 UpdatePanesL( MediaIsRunning( iAudio ) ,MediaIsRunning( iVideo ) ); |
|
3307 break; |
|
3308 |
|
3309 case EMsgAsyncControlStateStopped: |
|
3310 case EMsgAsyncControlStateNoRights: |
|
3311 case EMsgAsyncControlStateCorrupt: |
|
3312 UpdatePanesL( EFalse, EFalse ); |
|
3313 break; |
|
3314 |
|
3315 default: |
|
3316 break; |
|
3317 } |
|
3318 |
|
3319 // Keep UpdateMskL() after UpdatePanesL( ) |
|
3320 UpdateMskL( ); |
|
3321 |
|
3322 // component specific |
|
3323 switch ( aControl.ControlId( ) ) |
|
3324 { |
|
3325 case EMsgComponentIdVideo: |
|
3326 { |
|
3327 if ( aNewState == EMsgAsyncControlStateReady && |
|
3328 !static_cast<CMsgVideoControl&>( aControl ).HasAudioL() ) |
|
3329 { |
|
3330 iViewerFlags &= ~EVideoHasAudio; |
|
3331 } |
|
3332 else if ( aNewState == EMsgAsyncControlStateReady ) |
|
3333 { |
|
3334 // Lie that video is playing to set initial volume level. |
|
3335 DoChangeVolumeL( 0, ETrue, EFalse ); |
|
3336 } |
|
3337 #ifdef USE_LOGGER |
|
3338 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3339 { |
|
3340 LOGTEXT2(_L16("CMmsViewerAppUi::DoMsgMediaControlStateChangedL. Video: HasAudioL()? %d"), static_cast<CMsgVideoControl&>( aControl ).HasAudioL() ); |
|
3341 } |
|
3342 #endif |
|
3343 if ( aNewState == EMsgAsyncControlStateStopped |
|
3344 || aNewState == EMsgAsyncControlStateNoRights |
|
3345 || aNewState == EMsgAsyncControlStateCorrupt ) |
|
3346 { |
|
3347 CUniObject* object = ObjectByMediaControl( aControl ); |
|
3348 if ( object |
|
3349 && object->DrmInfo( ) ) |
|
3350 { |
|
3351 TInt err = object->DrmInfo( )->ReleaseRights( ); |
|
3352 } |
|
3353 } |
|
3354 break; |
|
3355 } |
|
3356 // fall through |
|
3357 case EMsgComponentIdAudio: |
|
3358 { |
|
3359 if ( aNewState == EMsgAsyncControlStateReady ) |
|
3360 { |
|
3361 // Lie that audio is playing to set initial volume level. |
|
3362 DoChangeVolumeL( 0, ETrue, ETrue ); |
|
3363 } |
|
3364 if ( aNewState == EMsgAsyncControlStateStopped |
|
3365 || aNewState == EMsgAsyncControlStateNoRights |
|
3366 || aNewState == EMsgAsyncControlStateCorrupt ) |
|
3367 { |
|
3368 CUniObject* object = ObjectByMediaControl( aControl ); |
|
3369 if ( object |
|
3370 && object->DrmInfo( ) ) |
|
3371 { |
|
3372 TInt err = object->DrmInfo( )->ReleaseRights( ); |
|
3373 } |
|
3374 } |
|
3375 break; |
|
3376 } |
|
3377 case EMsgComponentIdImage: |
|
3378 StartAnimationL(); |
|
3379 // fall through |
|
3380 case EMsgComponentIdSvg: |
|
3381 if ( aNewState == EMsgAsyncControlStateIdle ) |
|
3382 { |
|
3383 CUniObject* object = ObjectByMediaControl( aControl ); |
|
3384 if ( object |
|
3385 && object->DrmInfo( ) ) |
|
3386 { |
|
3387 TInt err = object->DrmInfo( )->ReleaseRights( ); |
|
3388 } |
|
3389 } |
|
3390 break; |
|
3391 default: |
|
3392 break; |
|
3393 } |
|
3394 } |
|
3395 |
|
3396 // --------------------------------------------------------- |
|
3397 // CMmsViewerAppUi::LaunchHelpL |
|
3398 // --------------------------------------------------------- |
|
3399 // |
|
3400 void CMmsViewerAppUi::LaunchHelpL( ) |
|
3401 { |
|
3402 // activate Help application |
|
3403 |
|
3404 if ( iSupportedFeatures & EMmsFeatureHelp ) |
|
3405 { |
|
3406 CArrayFix<TCoeHelpContext>* helpContext = AppHelpContextL( ); |
|
3407 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession( ), helpContext ); |
|
3408 } |
|
3409 } |
|
3410 |
|
3411 |
|
3412 // --------------------------------------------------------- |
|
3413 // CMmsViewerAppUi::HelpContextL |
|
3414 // --------------------------------------------------------- |
|
3415 // |
|
3416 CArrayFix<TCoeHelpContext>* CMmsViewerAppUi::HelpContextL( ) const |
|
3417 { |
|
3418 if ( iSupportedFeatures & EMmsFeatureHelp ) |
|
3419 { |
|
3420 CArrayFix<TCoeHelpContext>* r = new ( ELeave ) CArrayFixFlat<TCoeHelpContext>(1); |
|
3421 CleanupStack::PushL( r ); |
|
3422 r->AppendL( TCoeHelpContext( KUidMmsViewer, KMMS_HLP_MMS_VIEWER( ) ) ); |
|
3423 CleanupStack::Pop( r ); |
|
3424 return r; |
|
3425 } |
|
3426 return NULL; |
|
3427 } |
|
3428 |
|
3429 // --------------------------------------------------------- |
|
3430 // CMmsViewerAppUi::SetFindModeL |
|
3431 // --------------------------------------------------------- |
|
3432 // |
|
3433 void CMmsViewerAppUi::SetFindModeL( TBool aEnable ) |
|
3434 { |
|
3435 if ( iView ) |
|
3436 { |
|
3437 if ( iView->ItemFinder( ) ) |
|
3438 { |
|
3439 TInt findMode = aEnable ? |
|
3440 CItemFinder::EPhoneNumber | |
|
3441 CItemFinder::EUrlAddress | |
|
3442 CItemFinder::EEmailAddress : |
|
3443 CItemFinder::ENoneSelected; |
|
3444 iView->ItemFinder( )->SetFindModeL( findMode ); |
|
3445 } |
|
3446 CMsgBaseControl* fromControl = iView->ControlById( EMsgComponentIdFrom ); |
|
3447 if ( fromControl && iMtm->Sender( ).Length( ) ) |
|
3448 { |
|
3449 static_cast<CMsgAddressControl*>( fromControl ) |
|
3450 ->SetAddressFieldAutoHighlight( aEnable ); |
|
3451 } |
|
3452 } |
|
3453 } |
|
3454 |
|
3455 |
|
3456 // --------------------------------------------------------- |
|
3457 // CMmsViewerAppUi::MediaOpenL |
|
3458 // for single control |
|
3459 // --------------------------------------------------------- |
|
3460 // This function is entered when selection key is pressed. |
|
3461 // Actions allowed are play, embedded play, activate and get rights. |
|
3462 void CMmsViewerAppUi::MediaOpenL( CMsgMediaControl* aMedia ) |
|
3463 { |
|
3464 if ( aMedia ) |
|
3465 { |
|
3466 if ( MediaInitializedL( aMedia ) ) |
|
3467 { |
|
3468 MediaPlayL( aMedia ); |
|
3469 } |
|
3470 } |
|
3471 } |
|
3472 |
|
3473 |
|
3474 // --------------------------------------------------------- |
|
3475 // CMmsViewerAppUi::MediaPlayL |
|
3476 // for single control |
|
3477 // --------------------------------------------------------- |
|
3478 void CMmsViewerAppUi::MediaPlayL(CMsgMediaControl* aMedia) |
|
3479 { |
|
3480 if ( aMedia ) |
|
3481 { |
|
3482 CUniObject* currObject = ObjectByMediaControl( *aMedia ); |
|
3483 if ( currObject |
|
3484 && currObject->Corrupted() ) |
|
3485 { |
|
3486 UpdatePanesL( MediaIsRunning( iAudio ) ,MediaIsRunning( iVideo ) ); |
|
3487 UpdateMskL( ); |
|
3488 ShowInformationNoteL( R_QTN_MMS_CANNOT_OPEN_CORRUPTED ); |
|
3489 return; |
|
3490 } |
|
3491 #ifdef RD_SVGT_IN_MESSAGING |
|
3492 if ( aMedia == iSvgt || aMedia == iImage ) |
|
3493 { |
|
3494 ViewImageL( *aMedia ); |
|
3495 } |
|
3496 #else |
|
3497 if (aMedia == iImage) |
|
3498 { |
|
3499 ViewImageL( reinterpret_cast< CMsgImageControl& >( *aMedia ) ); |
|
3500 } |
|
3501 #endif |
|
3502 else |
|
3503 { |
|
3504 if (aMedia == iVideo) |
|
3505 { |
|
3506 if(IsVideoCall()) |
|
3507 { |
|
3508 ShowInformationNoteL( R_MMSVIEWER_CANNOT_PLAY_VIDEOCALL_ONGOING ); |
|
3509 return; |
|
3510 } |
|
3511 reinterpret_cast<CMsgVideoControl*>(aMedia)->ContinueOnFocus( ETrue ); |
|
3512 } |
|
3513 else if ( aMedia == iAudio ) |
|
3514 { |
|
3515 __ASSERT_ALWAYS( ObjectByMediaControl( *iAudio ) || ObjectByMediaControl( *iAudio )->MediaInfo( ), |
|
3516 Panic( EMmsViewerNullPointer ) ); |
|
3517 CUniObject* obj = ObjectByMediaControl( *iAudio ); |
|
3518 // Coverty fix, Null pointer return, http://ousrv057/cov.cgi?cid=37099 |
|
3519 if (obj) |
|
3520 { |
|
3521 if ( iViewerFlags & EProhibitNonDrmMusic |
|
3522 && !( obj->MediaInfo( )->Protection( ) & |
|
3523 ( EFileProtSuperDistributable | EFileProtForwardLocked ) ) ) |
|
3524 { |
|
3525 // Prepare buffer for aMimeType |
|
3526 HBufC* mimeBuffer = HBufC::NewLC( obj->MimeType().Length() + KMmsViewerSpace().Length() ); |
|
3527 TPtr mimeBufferPtr = mimeBuffer->Des(); |
|
3528 mimeBufferPtr.Copy( obj->MimeType() ); |
|
3529 |
|
3530 // FindF() would find "audio/3gpp" in "audio/3gpp2" without |
|
3531 // the added space. |
|
3532 mimeBufferPtr.Append( KMmsViewerSpace ); |
|
3533 |
|
3534 // If result is not KErrNotFound, this MIME-type is indeed on blocked list. |
|
3535 if ( iProhibitMimeTypeBuffer->FindF( mimeBufferPtr ) >= 0 ) |
|
3536 { |
|
3537 ShowInformationNoteL( R_MMSVIEWER_PLAIN_MUSIC_PROHIBITED ); |
|
3538 /* Allocated buffer must be destroyed and pop'd !!! */ |
|
3539 CleanupStack::PopAndDestroy( mimeBuffer ); |
|
3540 return; |
|
3541 } |
|
3542 /* Allocated buffer must be destroyed and pop'd !!! */ |
|
3543 CleanupStack::PopAndDestroy( mimeBuffer ); |
|
3544 } |
|
3545 } |
|
3546 if ( IsSilenceL( ) |
|
3547 && !ShowConfirmationQueryL( R_QTN_MMS_OBEY_SILENT_MODE ) ) |
|
3548 { |
|
3549 return; |
|
3550 } |
|
3551 } |
|
3552 |
|
3553 if ( !HandleConsumeRightsL( *aMedia ) ) |
|
3554 { |
|
3555 UpdatePanesL( MediaIsRunning( iAudio ) ,MediaIsRunning( iVideo ) ); |
|
3556 UpdateMskL( ); |
|
3557 return; |
|
3558 } |
|
3559 aMedia->PlayL( ); |
|
3560 } |
|
3561 } |
|
3562 } |
|
3563 |
|
3564 // --------------------------------------------------------- |
|
3565 // CMmsViewerAppUi::MediaStop |
|
3566 // for every control |
|
3567 // --------------------------------------------------------- |
|
3568 // |
|
3569 void CMmsViewerAppUi::MediaStop( ) |
|
3570 { |
|
3571 MediaStop( iImage ); |
|
3572 MediaStop( iAudio ); |
|
3573 MediaStop( iVideo ); |
|
3574 #ifdef RD_SVGT_IN_MESSAGING |
|
3575 MediaStop( iSvgt ); |
|
3576 #endif |
|
3577 } |
|
3578 |
|
3579 |
|
3580 // --------------------------------------------------------- |
|
3581 // CMmsViewerAppUi::MediaStop |
|
3582 // for single control |
|
3583 // --------------------------------------------------------- |
|
3584 // |
|
3585 void CMmsViewerAppUi::MediaStop(CMsgMediaControl* aMedia ) |
|
3586 { |
|
3587 if ( MediaCanStop( aMedia ) ) |
|
3588 { |
|
3589 if (aMedia == iVideo) |
|
3590 { |
|
3591 reinterpret_cast<CMsgVideoControl*>( aMedia )->ContinueOnFocus( EFalse ); |
|
3592 } |
|
3593 CUniObject* object = ObjectByMediaControl( *aMedia ); |
|
3594 if ( object |
|
3595 && object->DrmInfo( ) ) |
|
3596 { |
|
3597 TInt err = object->DrmInfo( )->ReleaseRights( ); |
|
3598 } |
|
3599 aMedia->Stop( ); |
|
3600 } |
|
3601 } |
|
3602 |
|
3603 |
|
3604 // --------------------------------------------------------- |
|
3605 // CMmsViewerAppUi::MediaClose |
|
3606 // for every control |
|
3607 // --------------------------------------------------------- |
|
3608 // |
|
3609 void CMmsViewerAppUi::MediaClose( ) |
|
3610 { |
|
3611 MediaClose( iImage ); |
|
3612 MediaClose( iAudio ); |
|
3613 MediaClose( iVideo ); |
|
3614 #ifdef RD_SVGT_IN_MESSAGING |
|
3615 MediaClose( iSvgt ); |
|
3616 #endif |
|
3617 } |
|
3618 |
|
3619 // --------------------------------------------------------- |
|
3620 // CMmsViewerAppUi::MediaClose |
|
3621 // for single control |
|
3622 // --------------------------------------------------------- |
|
3623 // |
|
3624 void CMmsViewerAppUi::MediaClose(CMsgMediaControl* aMedia) |
|
3625 { |
|
3626 if ( aMedia ) |
|
3627 { |
|
3628 if ( MediaCanStop ( aMedia ) ) |
|
3629 { |
|
3630 aMedia->Stop( ); |
|
3631 } |
|
3632 |
|
3633 // Release rights - image only |
|
3634 if ( aMedia |
|
3635 && iImage == aMedia ) |
|
3636 { |
|
3637 CUniObject* object = ObjectByMediaControl( *aMedia ); |
|
3638 if ( object |
|
3639 && object->DrmInfo( ) ) |
|
3640 { |
|
3641 TInt err = object->DrmInfo( )->ReleaseRights( ); |
|
3642 } |
|
3643 } |
|
3644 aMedia->Close( ); |
|
3645 } |
|
3646 } |
|
3647 |
|
3648 // --------------------------------------------------------- |
|
3649 // CMmsViewerAppUi::ReloadSlideL |
|
3650 // for every control |
|
3651 // --------------------------------------------------------- |
|
3652 // |
|
3653 void CMmsViewerAppUi::ReloadSlideL( ) |
|
3654 { |
|
3655 LOGTEXT(_L8("CMmsViewerAppUi::ReloadSlideL")); |
|
3656 // Get focused control to restore focus after other view |
|
3657 if ( iView->FocusedControl( ) ) |
|
3658 { |
|
3659 iFocusedControlId = iView->FocusedControl( )->ControlId(); |
|
3660 if ( iFocusedControlId ) |
|
3661 { |
|
3662 // Disable autofind temporarily, if On, because when slide is reloaded |
|
3663 // focus moves to From: field temporarily. |
|
3664 // Autohighlight is disabled temporarily |
|
3665 if ( !IsOwnMessage( ) |
|
3666 && iFocusedControlId != EMsgComponentIdFrom ) |
|
3667 { |
|
3668 // Get highlight status |
|
3669 TInt highlight = 0; |
|
3670 iCUiRepository->Get( KCuiAutomaticHighlight, highlight ); |
|
3671 if ( highlight ) |
|
3672 { |
|
3673 SetFindModeL( EFalse ); |
|
3674 } |
|
3675 } |
|
3676 } |
|
3677 } |
|
3678 |
|
3679 if ( Document( )->SmilType( ) == EMmsSmil ) |
|
3680 { |
|
3681 ChangeSlideL( Document( )->CurrentSlide( ), EFalse ); |
|
3682 } |
|
3683 SetFindModeL( iViewerFlags & EAutohighLightEnabled ); |
|
3684 |
|
3685 InitNavipaneL( ); |
|
3686 } |
|
3687 |
|
3688 // --------------------------------------------------------- |
|
3689 // CMmsViewerAppUi::ReloadControlL |
|
3690 // --------------------------------------------------------- |
|
3691 // |
|
3692 void CMmsViewerAppUi::ReloadControlL( CMsgMediaControl* aControl, CUniObject& aObject ) |
|
3693 { |
|
3694 LOGTEXT(_L8("CMmsViewerAppUi::ReloadControlL")); |
|
3695 if ( aControl |
|
3696 && Document( )->SmilType( ) == EMmsSmil ) |
|
3697 { |
|
3698 // Get focused control to restore focus after other view |
|
3699 if ( iView->FocusedControl( ) ) |
|
3700 { |
|
3701 iFocusedControlId = iView->FocusedControl( )->ControlId(); |
|
3702 if ( iFocusedControlId ) |
|
3703 { |
|
3704 // Disable autofind temporarily, if On, because when slide is reloaded |
|
3705 // focus moves to From: field temporarily. |
|
3706 // Autohighlight is disabled temporarily |
|
3707 if ( !IsOwnMessage( ) |
|
3708 && iFocusedControlId != EMsgComponentIdFrom ) |
|
3709 { |
|
3710 // Get highlight status |
|
3711 TInt highlight = 0; |
|
3712 iCUiRepository->Get( KCuiAutomaticHighlight, highlight ); |
|
3713 if ( highlight ) |
|
3714 { |
|
3715 SetFindModeL( EFalse ); |
|
3716 } |
|
3717 } |
|
3718 } |
|
3719 } |
|
3720 |
|
3721 MediaStop( ); |
|
3722 |
|
3723 if ( iVideo |
|
3724 && iVideo == aControl ) |
|
3725 { |
|
3726 iScreenClearer = CAknLocalScreenClearer::NewLC( EFalse ); |
|
3727 CleanupStack::Pop( iScreenClearer ); |
|
3728 } |
|
3729 |
|
3730 iViewerState = EBusy; |
|
3731 iOpeningState = EOpeningSlide; |
|
3732 iViewerFlags |= EVideoHasAudio; |
|
3733 iVideo = NULL; |
|
3734 iAudio = NULL; |
|
3735 iImage = NULL; |
|
3736 #ifdef RD_SVGT_IN_MESSAGING |
|
3737 iSvgt = NULL; |
|
3738 #endif |
|
3739 iPendingNoteResource = KInvalidResourceId; |
|
3740 iPendingNotePriority = 0; |
|
3741 iPendingNoteObject = NULL; |
|
3742 iPendingNoteError = KErrNone; |
|
3743 |
|
3744 delete iFindItemMenu; |
|
3745 iFindItemMenu = NULL; |
|
3746 |
|
3747 UpdateMskL(); |
|
3748 |
|
3749 if ( !iChangeSlideOperation ) |
|
3750 { |
|
3751 iChangeSlideOperation = new ( ELeave )CMmsViewerChangeSlideOperation ( |
|
3752 *this, |
|
3753 *( Document( ) ), |
|
3754 *iHeader, |
|
3755 *iSlideLoader, |
|
3756 *iView, |
|
3757 iCoeEnv->FsSession( ) ); |
|
3758 } |
|
3759 |
|
3760 ActivateInputBlockerL( iChangeSlideOperation ); |
|
3761 iChangeSlideOperation->ReLoadControlL( aControl, &aObject ); |
|
3762 |
|
3763 // TODO: Get rid of active wait! |
|
3764 BeginActiveWait( iChangeSlideOperation ); |
|
3765 InitNavipaneL( ); |
|
3766 } |
|
3767 } |
|
3768 |
|
3769 |
|
3770 // --------------------------------------------------------- |
|
3771 // CMmsViewerAppUi::StopAnimation |
|
3772 // --------------------------------------------------------- |
|
3773 // |
|
3774 void CMmsViewerAppUi::StopAnimation( ) |
|
3775 { |
|
3776 if ( iImage |
|
3777 && iImage->IsAnimation( ) ) |
|
3778 { |
|
3779 iImage->Stop( ); |
|
3780 } |
|
3781 } |
|
3782 |
|
3783 // --------------------------------------------------------- |
|
3784 // CMmsViewerAppUi::StartAnimationL |
|
3785 // --------------------------------------------------------- |
|
3786 // |
|
3787 void CMmsViewerAppUi::StartAnimationL( ) |
|
3788 { |
|
3789 if ( iImage |
|
3790 && iImage->IsAnimation( ) ) |
|
3791 { |
|
3792 TMsgAsyncControlState state = iImage->State( ); |
|
3793 if ( state == EMsgAsyncControlStateReady |
|
3794 || state == EMsgAsyncControlStatePaused |
|
3795 || state == EMsgAsyncControlStateStopped ) |
|
3796 { |
|
3797 iImage->PlayL( ); |
|
3798 } |
|
3799 } |
|
3800 } |
|
3801 |
|
3802 // --------------------------------------------------------- |
|
3803 // CMmsViewerAppUi::ViewerOperationEvent |
|
3804 // --------------------------------------------------------- |
|
3805 // |
|
3806 void CMmsViewerAppUi::ViewerOperationEvent( |
|
3807 TMmsViewerOperationType aOperation, |
|
3808 TMmsViewerOperationEvent aEvent, |
|
3809 TInt aError) |
|
3810 { |
|
3811 if ( aEvent == EMmsViewerOperationCancel ) |
|
3812 { |
|
3813 LOGTEXT(_L8("CMmsViewerAppUi::ViewerOperationEvent EMmsViewerOperationCancel") ); |
|
3814 // Operation by operation should be considered what is proper action |
|
3815 // in Cancel situation |
|
3816 ResetOperationState(); |
|
3817 return; |
|
3818 } |
|
3819 |
|
3820 if ( aOperation == EMmsViewerOperationReadReport |
|
3821 && aEvent == EMmsViewerOperationError ) |
|
3822 { |
|
3823 // Not worth exiting |
|
3824 aError = KErrNone; |
|
3825 } |
|
3826 |
|
3827 TInt error(aError); |
|
3828 if ( !error ) |
|
3829 { |
|
3830 |
|
3831 TRAP( error, DoViewerOperationEventL( aOperation, aEvent ) ); |
|
3832 if ( aEvent == EMmsViewerOperationCancel ) |
|
3833 { |
|
3834 // ignore errors |
|
3835 error = KErrNone; |
|
3836 } |
|
3837 } |
|
3838 else |
|
3839 { |
|
3840 ResetOperationState(); |
|
3841 if ( error == KErrCorrupt ) |
|
3842 { |
|
3843 TRAP_IGNORE( ShowErrorNoteL( R_MMSVIEWER_ERROR_MSG_CORRUPT ) ); |
|
3844 } |
|
3845 } |
|
3846 |
|
3847 if ( error ) |
|
3848 { |
|
3849 MediaStop( ); |
|
3850 Exit( error ); |
|
3851 } |
|
3852 } |
|
3853 |
|
3854 // --------------------------------------------------------- |
|
3855 // CMmsViewerAppUi::ViewerOperationEvent |
|
3856 // --------------------------------------------------------- |
|
3857 // |
|
3858 void CMmsViewerAppUi::DoViewerOperationEventL( |
|
3859 TMmsViewerOperationType aOperation, |
|
3860 TMmsViewerOperationEvent aEvent ) |
|
3861 { |
|
3862 TInt error( KErrNone ); |
|
3863 switch ( aOperation ) |
|
3864 { |
|
3865 case EMmsViewerOperationChangeSlide: |
|
3866 { |
|
3867 EndActiveWait( ); |
|
3868 // restore focus |
|
3869 if ( iFocusedControlId > EMsgComponentIdNull ) |
|
3870 { |
|
3871 if ( FocusedControlId( ) != iFocusedControlId ) |
|
3872 { |
|
3873 CMsgBaseControl* control = iView->ControlById( iFocusedControlId ) ; |
|
3874 if ( control ) |
|
3875 { |
|
3876 iView->SetFocus( iFocusedControlId ); |
|
3877 } |
|
3878 } |
|
3879 iFocusedControlId = EMsgComponentIdNull; |
|
3880 } |
|
3881 iImage = reinterpret_cast< CMsgImageControl* > |
|
3882 ( iView->ControlById( EMsgComponentIdImage ) ); |
|
3883 HandleImageNoRightsInLaunch( ); |
|
3884 StartAnimationL( ); |
|
3885 iAudio = reinterpret_cast< CMsgAudioControl* > |
|
3886 ( iView->ControlById( EMsgComponentIdAudio ) ); |
|
3887 iVideo = reinterpret_cast< CMsgVideoControl* > |
|
3888 ( iView->ControlById( EMsgComponentIdVideo ) ); |
|
3889 #ifdef RD_SVGT_IN_MESSAGING |
|
3890 iSvgt = reinterpret_cast< CMsgSvgControl* > |
|
3891 ( iView->ControlById( EMsgComponentIdSvg ) ); |
|
3892 #endif |
|
3893 break; |
|
3894 } |
|
3895 case EMmsViewerOperationLaunch: |
|
3896 { |
|
3897 if ( aEvent == EMmsViewerOperationCancel ) |
|
3898 { |
|
3899 return; |
|
3900 } |
|
3901 else |
|
3902 { |
|
3903 LOGTEXT(_L8("CMmsViewerAppUi::DoViewerOperationEventL DoViewerOperationEventLaunchL in ")); |
|
3904 TRAP( error, DoViewerOperationEventLaunchL( ) ); |
|
3905 LOGTEXT(_L8("CMmsViewerAppUi::DoViewerOperationEventL DoViewerOperationEventLaunchL out ")); |
|
3906 } |
|
3907 break; |
|
3908 } |
|
3909 case EMmsViewerOperationReadReport: |
|
3910 // free resources |
|
3911 DeactivateInputBlocker(); |
|
3912 delete iSendReadReportOperation; |
|
3913 iSendReadReportOperation = NULL; |
|
3914 // Viewer is already running normally |
|
3915 return; |
|
3916 |
|
3917 default: |
|
3918 break; |
|
3919 } |
|
3920 |
|
3921 ResetOperationState(); |
|
3922 User::LeaveIfError( error ); |
|
3923 |
|
3924 SetFindModeL( iViewerFlags & EAutohighLightEnabled ); |
|
3925 ShowPendingNoteL( ); |
|
3926 |
|
3927 // iViewer state must be ENormal. |
|
3928 // UpdateMskL() must be after UpdatePanesL() |
|
3929 UpdatePanesL( EFalse, EFalse ); |
|
3930 UpdateMskL( ); |
|
3931 |
|
3932 // Call of SendReadReportL cannot be in DoViewerOperationEventLaunchL, because |
|
3933 // ResetOperationState() deletes the input blocker launched from SendReadReportL |
|
3934 if ( aOperation == EMmsViewerOperationLaunch |
|
3935 && aEvent == EMmsViewerOperationComplete ) |
|
3936 { |
|
3937 // Less important stuff follows. |
|
3938 // It is OK, that flags and state indicate successful launch |
|
3939 #ifndef USE_LOGGER |
|
3940 TRAP_IGNORE( SendReadReportL( aOperation, aEvent ) ); |
|
3941 #else |
|
3942 TRAPD( error, SendReadReportL( aOperation, aEvent ) ); |
|
3943 if ( error ) |
|
3944 { |
|
3945 LOGTEXT2(_L16("CMmsViewerAppUi::DoViewerOperationEventLaunchL SendReadReportL error %d"), error ); |
|
3946 } |
|
3947 #endif // USE_LOGGER |
|
3948 } |
|
3949 } |
|
3950 |
|
3951 // --------------------------------------------------------- |
|
3952 // DoViewerOperationEventLaunchL |
|
3953 // --------------------------------------------------------- |
|
3954 // |
|
3955 void CMmsViewerAppUi::DoViewerOperationEventLaunchL( ) |
|
3956 { |
|
3957 if ( Document( )->ParseResult( ) & |
|
3958 ( ERegionMediaTypeMismatch | EBadlyReferencedObjects ) ) |
|
3959 { |
|
3960 iViewerFlags |= ESuspiciousSmil; |
|
3961 } |
|
3962 |
|
3963 iSmilModel = Document( )->SmilModel( ); |
|
3964 iHeader = iLaunchOperation->DetachHeader( ); |
|
3965 iSlideLoader = iLaunchOperation->DetachSlideLoader( ); |
|
3966 |
|
3967 TMsvEntry entry = iMtm->Entry( ).Entry( ); |
|
3968 if ( entry.iMtmData1 & EMmsDrmCorruptedAttachment ) |
|
3969 { |
|
3970 SetPendingNote( R_MMSVIEWER_DRM_OBJECT_REMOVED ); |
|
3971 } |
|
3972 |
|
3973 // Condition was EUnsupportedObjects, but region may be resolved even |
|
3974 // if it is set. |
|
3975 if ( Document( )->ParseResult( ) & EBadlyReferencedObjects ) |
|
3976 { |
|
3977 SetPendingNote( R_MMSVIEWER_CANNOT_DISPLAY_OBJECTS ); |
|
3978 } |
|
3979 |
|
3980 if ( Document( )->AttachmentList( )->Count( ) ) |
|
3981 { |
|
3982 SetPendingNote( R_MMSVIEWER_CANNOT_DISPLAY_OBJECTS ); |
|
3983 } |
|
3984 |
|
3985 ResolveDrmWaitingNotes( ); // e.g. R_MMSVIEWER_DRM_PREVIEW_RIGHTS |
|
3986 |
|
3987 TInt focusedControl = ( Document( )->SmilType( ) != EMmsSmil ) |
|
3988 ? EMsgComponentIdImage |
|
3989 : EMsgComponentIdNull; |
|
3990 iView->ExecuteL( ClientRect( ), focusedControl ); |
|
3991 |
|
3992 SetTitleIconL(); |
|
3993 InitNavipaneL( ); |
|
3994 TRAP_IGNORE( CheckAndSetDescriptionL( ) ); |
|
3995 |
|
3996 if (focusedControl != EMsgComponentIdImage ) |
|
3997 { |
|
3998 // 3GPP icon is not assigned |
|
3999 iImage = reinterpret_cast< CMsgImageControl* > |
|
4000 ( iView->ControlById( EMsgComponentIdImage ) ); |
|
4001 HandleImageNoRightsInLaunch( ); |
|
4002 StartAnimationL( ); |
|
4003 } |
|
4004 iAudio = reinterpret_cast< CMsgAudioControl* > |
|
4005 ( iView->ControlById( EMsgComponentIdAudio ) ); |
|
4006 iVideo = reinterpret_cast< CMsgVideoControl* > |
|
4007 ( iView->ControlById( EMsgComponentIdVideo ) ); |
|
4008 #ifdef RD_SVGT_IN_MESSAGING |
|
4009 iSvgt = reinterpret_cast< CMsgSvgControl* > |
|
4010 ( iView->ControlById( EMsgComponentIdSvg ) ); |
|
4011 #endif |
|
4012 // Enable task swapper to options menu after launch has been completed. |
|
4013 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
|
4014 |
|
4015 #ifdef RD_SCALABLE_UI_V2 |
|
4016 if ( iToolbar ) |
|
4017 { |
|
4018 SetToolBarItemVisibilities(); |
|
4019 } |
|
4020 #endif |
|
4021 } |
|
4022 |
|
4023 // --------------------------------------------------------- |
|
4024 // BeginActiveWait |
|
4025 // --------------------------------------------------------- |
|
4026 // |
|
4027 void CMmsViewerAppUi::BeginActiveWait( CMmsViewerOperation* aOperation ) |
|
4028 { |
|
4029 if( iWait.IsStarted() ) |
|
4030 { |
|
4031 if ( iActiveOperation ) |
|
4032 { |
|
4033 iActiveOperation->Cancel(); |
|
4034 } |
|
4035 else |
|
4036 { |
|
4037 return; |
|
4038 } |
|
4039 } |
|
4040 iActiveOperation = aOperation; |
|
4041 iWait.Start(); |
|
4042 } |
|
4043 |
|
4044 // --------------------------------------------------------- |
|
4045 // EndActiveWait |
|
4046 // --------------------------------------------------------- |
|
4047 // |
|
4048 void CMmsViewerAppUi::EndActiveWait( ) |
|
4049 { |
|
4050 if( !iWait.IsStarted( ) ) |
|
4051 { |
|
4052 return; |
|
4053 } |
|
4054 iWait.AsyncStop( ); |
|
4055 iActiveOperation = NULL; |
|
4056 } |
|
4057 |
|
4058 |
|
4059 // --------------------------------------------------------- |
|
4060 // CMmsViewerAppUi::FocusedControlId |
|
4061 // --------------------------------------------------------- |
|
4062 // |
|
4063 TInt CMmsViewerAppUi::FocusedControlId( ) |
|
4064 { |
|
4065 TInt controlType = EMsgComponentIdNull; |
|
4066 if ( iView && iView->FocusedControl( ) ) |
|
4067 { |
|
4068 controlType = iView->FocusedControl( )->ControlId( ); |
|
4069 } |
|
4070 return controlType; |
|
4071 } |
|
4072 |
|
4073 // --------------------------------------------------------- |
|
4074 // CMmsViewerAppUi::MediaControlById |
|
4075 // --------------------------------------------------------- |
|
4076 // |
|
4077 CMsgMediaControl* CMmsViewerAppUi::MediaControlById(TInt aControl) |
|
4078 { |
|
4079 CMsgMediaControl* control = NULL; |
|
4080 switch (aControl) |
|
4081 { |
|
4082 case EMsgComponentIdVideo: |
|
4083 control = iVideo; |
|
4084 break; |
|
4085 case EMsgComponentIdAudio: |
|
4086 control = iAudio; |
|
4087 break; |
|
4088 case EMsgComponentIdImage: |
|
4089 control = iImage; |
|
4090 break; |
|
4091 #ifdef RD_SVGT_IN_MESSAGING |
|
4092 case EMsgComponentIdSvg: |
|
4093 control = iSvgt; |
|
4094 break; |
|
4095 #endif |
|
4096 default: |
|
4097 break; |
|
4098 } |
|
4099 return control; |
|
4100 } |
|
4101 |
|
4102 // --------------------------------------------------------- |
|
4103 // CMmsViewerAppUi::MediaInitializedL |
|
4104 // --------------------------------------------------------- |
|
4105 // |
|
4106 TBool CMmsViewerAppUi::MediaInitializedL( CMsgMediaControl* aMedia ) |
|
4107 { |
|
4108 if ( aMedia ) |
|
4109 { |
|
4110 TBool noRights( EFalse ); |
|
4111 CUniObject* currObject = ObjectByMediaControl( *aMedia ); |
|
4112 // test has two purpose |
|
4113 // If object has not rights, assume it is initialised. |
|
4114 // Image: If rights have not been consumed, object had not rights. |
|
4115 // Other objects: DRM rights do not matter, because they are handled separately during |
|
4116 // 'launch'. |
|
4117 if ( currObject |
|
4118 && currObject->DrmInfo() ) |
|
4119 { |
|
4120 if ( aMedia == iImage ) |
|
4121 { |
|
4122 noRights = !IsRightsConsumed( *currObject ); |
|
4123 } |
|
4124 else |
|
4125 { |
|
4126 noRights = ( !IsRightsConsumed( *currObject ) |
|
4127 && !IsRightsNow( *currObject ) ); |
|
4128 } |
|
4129 } |
|
4130 |
|
4131 if ( noRights || MediaCanPlay( aMedia, currObject ) ) |
|
4132 { |
|
4133 return ETrue; |
|
4134 } |
|
4135 else |
|
4136 { |
|
4137 return EFalse; |
|
4138 } |
|
4139 } |
|
4140 // else - no media - assume initialized |
|
4141 return ETrue; |
|
4142 } |
|
4143 |
|
4144 // --------------------------------------------------------- |
|
4145 // CMmsViewerAppUi::MediaCanPlay( ) |
|
4146 // --------------------------------------------------------- |
|
4147 // |
|
4148 TBool CMmsViewerAppUi::MediaCanPlay(const CMsgMediaControl* aMedia, |
|
4149 const CUniObject* aMmsObject ) const |
|
4150 { |
|
4151 TBool corrupted( EFalse ); |
|
4152 if ( aMmsObject |
|
4153 && aMmsObject->Corrupted() ) |
|
4154 { |
|
4155 corrupted = ETrue; |
|
4156 } |
|
4157 |
|
4158 if ( aMedia ) |
|
4159 { |
|
4160 TMsgAsyncControlState state = aMedia->State( ); |
|
4161 if ( state == EMsgAsyncControlStateReady |
|
4162 || state == EMsgAsyncControlStatePaused |
|
4163 || state == EMsgAsyncControlStateStopped |
|
4164 || state == EMsgAsyncControlStateNoRights |
|
4165 || state == EMsgAsyncControlStateCorrupt |
|
4166 || corrupted |
|
4167 || ( aMedia == iImage |
|
4168 && ( state == EMsgAsyncControlStatePlaying |
|
4169 || state == EMsgAsyncControlStatePaused ) |
|
4170 && iImage->IsAnimation() ) ) |
|
4171 { |
|
4172 return ETrue; |
|
4173 } |
|
4174 } |
|
4175 return EFalse; |
|
4176 } |
|
4177 |
|
4178 // --------------------------------------------------------- |
|
4179 // CMmsViewerAppUi::MediaCanStop( ) |
|
4180 // --------------------------------------------------------- |
|
4181 // |
|
4182 TBool CMmsViewerAppUi::MediaCanStop(CMsgMediaControl* aMedia) |
|
4183 { |
|
4184 if ( aMedia ) |
|
4185 { |
|
4186 TMsgAsyncControlState state = aMedia->State( ); |
|
4187 if ( state == EMsgAsyncControlStateAboutToPlay |
|
4188 || state == EMsgAsyncControlStateBuffering |
|
4189 || state == EMsgAsyncControlStatePlaying |
|
4190 || state == EMsgAsyncControlStatePaused ) |
|
4191 { |
|
4192 return ETrue; |
|
4193 } |
|
4194 } |
|
4195 return EFalse; |
|
4196 } |
|
4197 |
|
4198 |
|
4199 // --------------------------------------------------------- |
|
4200 // CMmsViewerAppUi::MediaIsRunning( ) |
|
4201 // --------------------------------------------------------- |
|
4202 // |
|
4203 TBool CMmsViewerAppUi::MediaIsRunning(CMsgMediaControl* aMedia) |
|
4204 { |
|
4205 if ( aMedia ) |
|
4206 { |
|
4207 TMsgAsyncControlState state = aMedia->State( ); |
|
4208 if ( state == EMsgAsyncControlStatePlaying ) |
|
4209 { |
|
4210 return ETrue; |
|
4211 } |
|
4212 } |
|
4213 return EFalse; |
|
4214 } |
|
4215 |
|
4216 |
|
4217 |
|
4218 // --------------------------------------------------------- |
|
4219 // CMmsViewerAppUi::ResolveDrmWaitingNotes( ) |
|
4220 // --------------------------------------------------------- |
|
4221 // |
|
4222 void CMmsViewerAppUi::ResolveDrmWaitingNotes( ) |
|
4223 { |
|
4224 // resolve need of R_MMSVIEWER_DRM_PREVIEW_RIGHTS |
|
4225 TBool jumpOut(EFalse); |
|
4226 |
|
4227 // go through all recipients |
|
4228 CUniObjectList* objectList = Document( )->ObjectList( ); |
|
4229 TInt objectCount = 0; |
|
4230 if (objectList) |
|
4231 { |
|
4232 objectCount = objectList->Count( ); |
|
4233 } |
|
4234 |
|
4235 for ( TInt i = 0; i < objectCount && !jumpOut; i++ ) |
|
4236 { |
|
4237 CUniObject* obj = objectList->GetByIndex( i ); |
|
4238 if ( obj ) |
|
4239 { |
|
4240 switch ( obj->Region( ) ) |
|
4241 { |
|
4242 case EUniRegionImage: |
|
4243 // fall through |
|
4244 case EUniRegionAudio: |
|
4245 if ( obj->DrmInfo( ) |
|
4246 && obj->DrmInfo( )->IsDrmWithOnePreview( ) ) |
|
4247 { |
|
4248 SetPendingNote( R_MMSVIEWER_DRM_PREVIEW_RIGHTS, obj ); |
|
4249 jumpOut = ETrue; |
|
4250 } |
|
4251 break; |
|
4252 case EUniRegionText: |
|
4253 case EUniRegionUnresolved: |
|
4254 default: |
|
4255 // not interested |
|
4256 break; |
|
4257 } |
|
4258 } |
|
4259 } |
|
4260 } |
|
4261 |
|
4262 // --------------------------------------------------------- |
|
4263 // CMmsViewerAppUi::SaveObjectL( ) |
|
4264 // --------------------------------------------------------- |
|
4265 // |
|
4266 void CMmsViewerAppUi::SaveObjectL( ) |
|
4267 { |
|
4268 // returns only image, audio, video and svg controls |
|
4269 CMsgMediaControl* mediaControl = MediaControlById( FocusedControlId( ) ); |
|
4270 CMsgBaseControl* control = mediaControl; |
|
4271 if ( !control ) |
|
4272 { |
|
4273 if ( iView->FocusedControl() |
|
4274 && iView->FocusedControl()->ControlType() == EMsgXhtmlBodyControl ) |
|
4275 { |
|
4276 control = iView->FocusedControl(); |
|
4277 } |
|
4278 } |
|
4279 |
|
4280 if ( control ) |
|
4281 { |
|
4282 // if-branch intended for multimedia and xHTML |
|
4283 CUniObject* obj = ObjectByBaseControl( *control ); |
|
4284 if ( obj ) |
|
4285 { |
|
4286 DoSaveObjectL( *obj ); |
|
4287 } |
|
4288 } |
|
4289 else if (FocusedControlId( ) == EMsgComponentIdBody ) |
|
4290 { |
|
4291 CUniObject* textObj = NULL; |
|
4292 TUint objectCount = iSmilModel->SlideObjectCount( Document( )->CurrentSlide( ) ); |
|
4293 for ( TUint i = 0; i < objectCount; i++ ) |
|
4294 { |
|
4295 CUniObject* obj = iSmilModel->GetObjectByIndex( Document( )->CurrentSlide( ), i ); |
|
4296 if ( obj->Region( ) == EUniRegionText ) |
|
4297 { |
|
4298 // found |
|
4299 textObj = obj; |
|
4300 break; |
|
4301 } |
|
4302 } |
|
4303 |
|
4304 if ( textObj |
|
4305 && textObj->MediaType( ) == EMsgMediaText ) |
|
4306 { |
|
4307 // Save text files directly to Notepad. |
|
4308 // This is needed because automatic character set recognation |
|
4309 // is not too reliable. |
|
4310 TUint mibCharset = textObj->MimeInfo( )->Charset( ); |
|
4311 if ( !mibCharset ) |
|
4312 { |
|
4313 //assume US-ASCII - mandated by RFC 2046 |
|
4314 mibCharset = KCharacterSetMIBEnumUsAscii; |
|
4315 } |
|
4316 |
|
4317 TUint charconvCharsetID = Document( )->DataUtils( )->MibIdToCharconvIdL( mibCharset ); |
|
4318 RFile textFile = Document( )->GetAttachmentFileL( *textObj ); |
|
4319 |
|
4320 CleanupClosePushL( textFile ); |
|
4321 |
|
4322 CNotepadApi::SaveFileAsMemoL( |
|
4323 textFile, |
|
4324 charconvCharsetID ); |
|
4325 |
|
4326 CleanupStack::PopAndDestroy(&textFile); |
|
4327 |
|
4328 // Show confirmation note |
|
4329 RApaLsSession appList; |
|
4330 if ( appList.Connect( ) == KErrNone ) |
|
4331 { |
|
4332 TApaAppInfo appInfo; |
|
4333 if ( appList.GetAppInfo( appInfo, KNotepadUID3 ) == KErrNone ) |
|
4334 { |
|
4335 textObj->SetSaved( ETrue ); |
|
4336 HBufC* text = StringLoader::LoadLC( R_MMS_FILE_SAVED_TO, appInfo.iCaption ); |
|
4337 CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
4338 note->ExecuteLD( *text ); |
|
4339 CleanupStack::PopAndDestroy( text ); |
|
4340 } |
|
4341 appList.Close( ); |
|
4342 } |
|
4343 } |
|
4344 } |
|
4345 } |
|
4346 |
|
4347 |
|
4348 // --------------------------------------------------------- |
|
4349 // CMmsViewerAppUi::DoSaveObjectL( ) |
|
4350 // --------------------------------------------------------- |
|
4351 // |
|
4352 void CMmsViewerAppUi::DoSaveObjectL(CUniObject& aObject ) |
|
4353 { |
|
4354 CMsgMediaInfo* media = aObject.MediaInfo( ); |
|
4355 if ( media ) |
|
4356 { |
|
4357 TParsePtrC plainFileName( media->FullFilePath( ) ); |
|
4358 const TPtrC newName = plainFileName.NameAndExt( ); |
|
4359 TDataType dataType( aObject.MimeType( ) ); |
|
4360 |
|
4361 CDocumentHandler* docHandler = CDocumentHandler::NewL( ); |
|
4362 CleanupStack::PushL(docHandler); |
|
4363 |
|
4364 RFile mediaFile = Document( )->GetAttachmentFileL( aObject ); |
|
4365 CleanupClosePushL( mediaFile ); |
|
4366 |
|
4367 TInt ret = docHandler->CopyL( mediaFile, |
|
4368 newName, |
|
4369 dataType, |
|
4370 KEntryAttNormal ); |
|
4371 if ( ret != KErrNone && ret != KUserCancel ) |
|
4372 { |
|
4373 User::LeaveIfError( ret ); |
|
4374 } |
|
4375 else if ( ret == KErrNone ) |
|
4376 { |
|
4377 aObject.SetSaved( ETrue ); |
|
4378 } |
|
4379 |
|
4380 CleanupStack::PopAndDestroy(2, docHandler); // + mediaFile |
|
4381 } |
|
4382 } |
|
4383 |
|
4384 |
|
4385 // ---------------------------------------------------- |
|
4386 // IsSilenceL |
|
4387 // |
|
4388 // ---------------------------------------------------- |
|
4389 TBool CMmsViewerAppUi:: IsSilenceL( ) |
|
4390 { |
|
4391 TBool result( EFalse ); |
|
4392 |
|
4393 CRepository* repository = CRepository::NewLC( KCRUidProfileEngine ); |
|
4394 |
|
4395 TInt ringType( EProfileRingingTypeRinging ); |
|
4396 User::LeaveIfError( repository->Get( KProEngActiveRingingType, ringType ) ); |
|
4397 CleanupStack::PopAndDestroy( repository ); |
|
4398 |
|
4399 if ( ringType == EProfileRingingTypeSilent ) |
|
4400 { |
|
4401 result = ETrue; |
|
4402 } |
|
4403 return result; |
|
4404 } |
|
4405 |
|
4406 |
|
4407 // --------------------------------------------------------- |
|
4408 // CMmsViewerAppUi::OpenDeliveryPopupL( ) |
|
4409 // Forwards the request to the MMS UI |
|
4410 // --------------------------------------------------------- |
|
4411 // |
|
4412 void CMmsViewerAppUi::OpenDeliveryPopupL( ) |
|
4413 { |
|
4414 |
|
4415 //These are not used! They just have to be there. |
|
4416 TPckgBuf<TInt> param( 0 ); |
|
4417 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
4418 CleanupStack::PushL( selection ); |
|
4419 |
|
4420 CMsvSingleOpWatcher* watch = CMsvSingleOpWatcher::NewLC( *Document( ) ); |
|
4421 CMsvOperation* op = Document( )->MtmUiL( ).InvokeAsyncFunctionL( |
|
4422 KMtmUiFunctionDeliveryStatus, |
|
4423 *selection, |
|
4424 watch->iStatus, |
|
4425 param ); // launch the dialog through MMSUI |
|
4426 CleanupStack::Pop( watch ); |
|
4427 Document( )->AddSingleOperationL( op, watch ); |
|
4428 |
|
4429 CleanupStack::PopAndDestroy( selection ); |
|
4430 } |
|
4431 |
|
4432 |
|
4433 // --------------------------------------------------------- |
|
4434 // CMmsViewerAppUi::HandleResourceChangeL |
|
4435 // --------------------------------------------------------- |
|
4436 // |
|
4437 void CMmsViewerAppUi::HandleResourceChangeL(TInt aType) |
|
4438 { |
|
4439 // Base class call must be first |
|
4440 CMsgEditorAppUi::HandleResourceChangeL(aType); |
|
4441 |
|
4442 if ( iHeader ) |
|
4443 { |
|
4444 iHeader->HandleResourceChange(aType); |
|
4445 } |
|
4446 |
|
4447 if ( aType == KAknsMessageSkinChange ) |
|
4448 { |
|
4449 if ( iAppIcon ) |
|
4450 { |
|
4451 delete iAppIcon; |
|
4452 iAppIcon = NULL; |
|
4453 } |
|
4454 |
|
4455 // Set path of bitmap file |
|
4456 TParse fileParse; |
|
4457 fileParse.Set( KMmsUiMbmFile, &KDC_APP_BITMAP_DIR, NULL ); |
|
4458 |
|
4459 iAppIcon = AknsUtils::CreateGulIconL( |
|
4460 AknsUtils::SkinInstance(), |
|
4461 KAknsIIDQgnPropMceMmsTitle, |
|
4462 fileParse.FullName(), |
|
4463 EMbmMmsuiQgn_prop_mce_mms_title, |
|
4464 EMbmMmsuiQgn_prop_mce_mms_title_mask ); |
|
4465 SetTitleIconL(); |
|
4466 } |
|
4467 else if ( aType == KEikDynamicLayoutVariantSwitch && IsLaunched() ) |
|
4468 { |
|
4469 SetTitleIconL(); |
|
4470 } |
|
4471 } |
|
4472 |
|
4473 // --------------------------------------------------------- |
|
4474 // IsLaunched |
|
4475 // --------------------------------------------------------- |
|
4476 inline TBool CMmsViewerAppUi::IsLaunched( ) const |
|
4477 { |
|
4478 return ( iViewerFlags & ELaunchSuccessful ); |
|
4479 } |
|
4480 |
|
4481 |
|
4482 // --------------------------------------------------------- |
|
4483 // PrepareToExit |
|
4484 // --------------------------------------------------------- |
|
4485 void CMmsViewerAppUi::PrepareToExit( ) |
|
4486 { |
|
4487 CEikAppUi::PrepareToExit( ); |
|
4488 } |
|
4489 |
|
4490 // --------------------------------------------------------- |
|
4491 // ObjectByMediaControl |
|
4492 // --------------------------------------------------------- |
|
4493 CUniObject* CMmsViewerAppUi::ObjectByMediaControl( CMsgMediaControl& aControl ) |
|
4494 { |
|
4495 TInt controlId = aControl.ControlId( ); |
|
4496 if ( controlId == EMsgComponentIdImage |
|
4497 || controlId == EMsgComponentIdAudio |
|
4498 || controlId == EMsgComponentIdVideo |
|
4499 #ifdef RD_SVGT_IN_MESSAGING |
|
4500 || controlId == EMsgComponentIdSvg |
|
4501 #endif |
|
4502 ) |
|
4503 { |
|
4504 return ObjectByBaseControl( aControl ); |
|
4505 } |
|
4506 else |
|
4507 { |
|
4508 return NULL; |
|
4509 } |
|
4510 |
|
4511 } |
|
4512 |
|
4513 // --------------------------------------------------------- |
|
4514 // ObjectByBaseControl |
|
4515 // --------------------------------------------------------- |
|
4516 CUniObject* CMmsViewerAppUi::ObjectByBaseControl( CMsgBaseControl& aControl ) |
|
4517 { |
|
4518 TInt controlId = aControl.ControlId( ); |
|
4519 TUniRegion region( EUniRegionUnresolved ); |
|
4520 switch ( controlId ) |
|
4521 { |
|
4522 case EMsgComponentIdImage: |
|
4523 region = EUniRegionImage; |
|
4524 break; |
|
4525 case EMsgComponentIdAudio: |
|
4526 region = EUniRegionAudio; |
|
4527 break; |
|
4528 case EMsgComponentIdVideo: |
|
4529 region = EUniRegionImage; |
|
4530 break; |
|
4531 #ifdef RD_SVGT_IN_MESSAGING |
|
4532 case EMsgComponentIdSvg: |
|
4533 region = EUniRegionImage; |
|
4534 break; |
|
4535 #endif |
|
4536 case EMsgComponentIdBody: |
|
4537 region = EUniRegionText; |
|
4538 break; |
|
4539 default: |
|
4540 break; |
|
4541 } |
|
4542 if ( region == EUniRegionUnresolved ) |
|
4543 { |
|
4544 return NULL; |
|
4545 } |
|
4546 |
|
4547 if ( iSmilModel ) |
|
4548 { |
|
4549 TInt countObjectsOnSlide( |
|
4550 iSmilModel->SlideObjectCount( Document( )->CurrentSlide( ) ) ); |
|
4551 for ( TInt i = 0; i < countObjectsOnSlide; i++ ) |
|
4552 { |
|
4553 CUniObject* object = iSmilModel->GetObject( |
|
4554 Document( )->CurrentSlide( ), region ); |
|
4555 if ( object ) |
|
4556 { |
|
4557 return object; |
|
4558 } |
|
4559 } |
|
4560 } |
|
4561 return NULL; |
|
4562 } |
|
4563 |
|
4564 |
|
4565 // --------------------------------------------------------- |
|
4566 // CMmsViewerAppUi::SetAndSaveDescriptionL |
|
4567 // --------------------------------------------------------- |
|
4568 // |
|
4569 void CMmsViewerAppUi::CheckAndSetDescriptionL( ) |
|
4570 { |
|
4571 TMsvEntry tEntry = Document( )->Entry( ); |
|
4572 if( !tEntry.iDescription.Length( ) ) |
|
4573 { |
|
4574 // is it on current slide |
|
4575 CMsgBodyControl* bodyControl = static_cast<CMsgBodyControl*> |
|
4576 ( iView->ControlById( EMsgComponentIdBody ) ); |
|
4577 if ( bodyControl ) |
|
4578 { |
|
4579 SetAndSaveDescriptionL(bodyControl->TextContent( )); |
|
4580 } |
|
4581 else |
|
4582 { |
|
4583 // Continue searching from other slides |
|
4584 // Take first text attachment |
|
4585 CUniSmilModel* smilModel = Document( )->SmilModel( ); |
|
4586 if ( smilModel ) |
|
4587 { |
|
4588 // search for first text attachment |
|
4589 TInt slideCount = smilModel->SlideCount( ); |
|
4590 for (TInt slideI = 1; slideI < slideCount ; slideI++ ) |
|
4591 { |
|
4592 TInt objectCountOnSlide = smilModel->SlideObjectCount( slideI ); |
|
4593 for (TInt objectI = 0; objectI < objectCountOnSlide ; objectI++ ) |
|
4594 { |
|
4595 CUniObject* obj = smilModel->GetObjectByIndex( slideI, objectI ); |
|
4596 if ( obj |
|
4597 && obj->Region( ) == EUniRegionText ) |
|
4598 { |
|
4599 TUint attaCharset = obj->MimeInfo( )->Charset( ); |
|
4600 if ( !attaCharset ) |
|
4601 { |
|
4602 //assume US-ASCII - mandated by RFC 2046 |
|
4603 attaCharset = KMmsUsAscii; |
|
4604 } |
|
4605 |
|
4606 TUint charconvCharsetID = 0; |
|
4607 charconvCharsetID = Document( )->DataUtils()->MibIdToCharconvIdL( attaCharset ); |
|
4608 RFile file = Document( )->GetAttachmentFileL( *obj ); |
|
4609 CleanupClosePushL( file ); |
|
4610 |
|
4611 RFileReadStream stream( file ); |
|
4612 CleanupClosePushL( stream ); |
|
4613 |
|
4614 CPlainText::TImportExportParam param; |
|
4615 param.iForeignEncoding = charconvCharsetID; |
|
4616 param.iOrganisation = CPlainText::EOrganiseByParagraph; |
|
4617 |
|
4618 CPlainText::TImportExportResult result; |
|
4619 |
|
4620 CPlainText* plainText = CPlainText::NewL( ); |
|
4621 CleanupStack::PushL( plainText ); |
|
4622 |
|
4623 plainText->ImportTextL( 0, stream, param, result ); |
|
4624 SetAndSaveDescriptionL( *plainText ); |
|
4625 |
|
4626 CleanupStack::PopAndDestroy( 3, &file ); // plainText, file, stream |
|
4627 break; |
|
4628 } // else - no object or wrong type of object |
|
4629 } // for - objects of one slide |
|
4630 } // for - slides |
|
4631 }// else - no smil model |
|
4632 } // else - no body text on first slide |
|
4633 } // else - description exists |
|
4634 } |
|
4635 |
|
4636 // --------------------------------------------------------- |
|
4637 // CMmsViewerAppUi::SetAndSaveDescriptionL |
|
4638 // --------------------------------------------------------- |
|
4639 // |
|
4640 void CMmsViewerAppUi::SetAndSaveDescriptionL(const CPlainText& aText) |
|
4641 { |
|
4642 TBuf<KMmsMaxDescription> description; |
|
4643 description.Zero( ); |
|
4644 aText.Extract( description, 0, KMmsMaxDescription ); |
|
4645 TInt length( description.Length( ) ); |
|
4646 while( length-- ) |
|
4647 { |
|
4648 |
|
4649 if ( description[length] == CEditableText::ETabCharacter |
|
4650 || description[length] == CEditableText::EPageBreak |
|
4651 || description[length] == CEditableText::ENonBreakingSpace |
|
4652 || description[length] == CEditableText::EHyphen |
|
4653 || description[length] == CEditableText::ENonBreakingHyphen |
|
4654 || description[length] == CEditableText::ELeftSingleQuote |
|
4655 || description[length] == CEditableText::ERightSingleQuote |
|
4656 || description[length] == CEditableText::ELeftDoubleQuote |
|
4657 || description[length] == CEditableText::ERightDoubleQuote |
|
4658 || description[length] == CEditableText::EBullet |
|
4659 || description[length] == CEditableText::EEllipsis |
|
4660 || description[length] == CEditableText::ELineBreak |
|
4661 || description[length] == CEditableText::EParagraphDelimiter |
|
4662 || description[length] == CEditableText::EPictureCharacter |
|
4663 || description[length] == CEditableText::EZeroWidthNoBreakSpace |
|
4664 || description[length] == CEditableText::EByteOrderMark |
|
4665 || description[length] == CEditableText::EReversedByteOrderMark |
|
4666 || description[length] == '\n' ) |
|
4667 { |
|
4668 description[length] = ' '; |
|
4669 } |
|
4670 } |
|
4671 description.Trim( ); |
|
4672 |
|
4673 if ( description.Length( ) > 0 ) |
|
4674 { |
|
4675 TMsvEntry tEntry = Document( )->Entry( ); |
|
4676 tEntry.iDescription.Set( description ); |
|
4677 Document( )->CurrentEntry( ).ChangeL( tEntry ); |
|
4678 } |
|
4679 } |
|
4680 |
|
4681 |
|
4682 |
|
4683 // --------------------------------------------------------- |
|
4684 // CMmsViewerAppUi::ViewImageL |
|
4685 // --------------------------------------------------------- |
|
4686 // |
|
4687 void CMmsViewerAppUi::ViewImageL( CMsgMediaControl& aMediaCtrl ) |
|
4688 { |
|
4689 CUniObject* launchObject = ObjectByMediaControl( aMediaCtrl ); |
|
4690 if ( !launchObject ) |
|
4691 { |
|
4692 return; |
|
4693 } |
|
4694 |
|
4695 if ( !iDocHandler ) |
|
4696 { |
|
4697 iDocHandler = CDocumentHandler::NewL( ); |
|
4698 iDocHandler->SetExitObserver( this ); |
|
4699 } |
|
4700 |
|
4701 if ( &aMediaCtrl == iImage && |
|
4702 ( reinterpret_cast< CMsgImageControl& >( aMediaCtrl ).IsAnimation() ) ) |
|
4703 { |
|
4704 aMediaCtrl.Stop( ); |
|
4705 } |
|
4706 |
|
4707 if ( launchObject->DrmInfo() ) |
|
4708 { |
|
4709 launchObject->DrmInfo()->ReleaseRights(); |
|
4710 } |
|
4711 |
|
4712 TDataType mimeDataType( launchObject->MimeType() ); |
|
4713 |
|
4714 RFile sharedFile = Document( )->GetAttachmentFileL( *launchObject ); |
|
4715 CleanupClosePushL( sharedFile ); |
|
4716 |
|
4717 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); |
|
4718 if ( !launchObject->IsSaved() ) |
|
4719 { |
|
4720 TAiwGenericParam genericParamAllowSave |
|
4721 ( EGenericParamAllowSave, ETrue); |
|
4722 paramList->AppendL( genericParamAllowSave ); |
|
4723 } |
|
4724 |
|
4725 TInt err( KErrNone ); |
|
4726 TRAP( err, err = iDocHandler->OpenFileEmbeddedL( sharedFile, |
|
4727 mimeDataType, |
|
4728 *paramList ) ); |
|
4729 LOGTEXT2(_L16("CMmsViewerAppUi::ViewImageL error %d"), err ); |
|
4730 CleanupStack::PopAndDestroy( 2, &sharedFile ); // + paramList |
|
4731 } |
|
4732 |
|
4733 // --------------------------------------------------------- |
|
4734 // CMmsViewerAppUi::HandleServerAppExit |
|
4735 // --------------------------------------------------------- |
|
4736 // |
|
4737 void CMmsViewerAppUi::HandleServerAppExit(TInt /*aReason*/) |
|
4738 { |
|
4739 // Currently only image is possible |
|
4740 if ( iImage |
|
4741 && iImage->IsAnimation() ) |
|
4742 { |
|
4743 TRAP_IGNORE( iImage->PlayL( ) ); |
|
4744 } |
|
4745 } |
|
4746 |
|
4747 // --------------------------------------------------------- |
|
4748 // CMmsViewerAppUi::HandleConsumeRightsL |
|
4749 // --------------------------------------------------------- |
|
4750 // |
|
4751 TBool CMmsViewerAppUi::HandleConsumeRightsL( CMsgMediaControl& aMedia ) |
|
4752 { |
|
4753 TBool result( ETrue ); |
|
4754 |
|
4755 CUniObject* object = ObjectByMediaControl( aMedia); |
|
4756 TBuf<ContentAccess::KMaxCafUniqueId> defaultContent( ContentAccess::KDefaultContentObject( ) ); |
|
4757 if ( object |
|
4758 && object->DrmInfo( ) |
|
4759 && defaultContent == aMedia.UniqueContentId( ) ) |
|
4760 { |
|
4761 TInt err = object->DrmInfo( )->ConsumeRights( ); |
|
4762 switch ( err ) |
|
4763 { |
|
4764 case KErrNone: |
|
4765 break; |
|
4766 case DRMCommon::EGeneralError: |
|
4767 case DRMCommon::EUnknownMIME: |
|
4768 case DRMCommon::EVersionNotSupported: |
|
4769 case DRMCommon::ESessionError: |
|
4770 case DRMCommon::ENoRights: |
|
4771 case DRMCommon::ERightsDBCorrupted: |
|
4772 case DRMCommon::EUnsupported: |
|
4773 case DRMCommon::ERightsExpired: |
|
4774 case DRMCommon::EInvalidRights: |
|
4775 SetPendingNote( R_MMSVIEWER_DRM_ERROR, |
|
4776 object, |
|
4777 err ); |
|
4778 result = EFalse; |
|
4779 break; |
|
4780 default: |
|
4781 SetPendingNote(R_QTN_MMS_CANNOT_OPEN_CORRUPTED); |
|
4782 object->SetCorrupted( ETrue ); |
|
4783 result = EFalse; |
|
4784 break; |
|
4785 } |
|
4786 } |
|
4787 |
|
4788 if ( !result ) |
|
4789 { |
|
4790 iSlideLoader->UpdateControlIconL( aMedia, object ); |
|
4791 aMedia.DrawDeferred(); |
|
4792 ShowPendingNoteL( ); |
|
4793 } |
|
4794 return result; |
|
4795 } |
|
4796 |
|
4797 // --------------------------------------------------------- |
|
4798 // CMmsViewerAppUi::HandleImageNoRightsInLaunch |
|
4799 // --------------------------------------------------------- |
|
4800 // |
|
4801 void CMmsViewerAppUi::HandleImageNoRightsInLaunch( ) |
|
4802 { |
|
4803 if ( iImage ) |
|
4804 { |
|
4805 CUniObject* object = ObjectByMediaControl( *iImage ); |
|
4806 if ( object |
|
4807 && object->DrmInfo( ) ) |
|
4808 { |
|
4809 TBool ignoreConsumed ( EFalse ); |
|
4810 TInt err = object->DrmInfo( )->EvaluateRights( ignoreConsumed ); |
|
4811 switch ( err ) |
|
4812 { |
|
4813 case KErrNone: |
|
4814 break; |
|
4815 case DRMCommon::EGeneralError: |
|
4816 case DRMCommon::EUnknownMIME: |
|
4817 case DRMCommon::EVersionNotSupported: |
|
4818 case DRMCommon::ESessionError: |
|
4819 case DRMCommon::ENoRights: |
|
4820 case DRMCommon::ERightsDBCorrupted: |
|
4821 case DRMCommon::EUnsupported: |
|
4822 case DRMCommon::ERightsExpired: |
|
4823 case DRMCommon::EInvalidRights: |
|
4824 SetPendingNote( R_MMSVIEWER_DRM_ERROR, |
|
4825 object, |
|
4826 err ); |
|
4827 break; |
|
4828 default: |
|
4829 break; |
|
4830 } |
|
4831 } |
|
4832 } |
|
4833 } |
|
4834 |
|
4835 // --------------------------------------------------------- |
|
4836 // CMmsViewerAppUi::UpdateMskL |
|
4837 // --------------------------------------------------------- |
|
4838 void CMmsViewerAppUi::UpdateMskL( ) |
|
4839 { |
|
4840 TInt resId = (-1); |
|
4841 if ( iView && iViewerState == ENormal ) |
|
4842 { |
|
4843 CMsgBaseControl* ctrl = iView->FocusedControl(); |
|
4844 if ( ctrl ) |
|
4845 { |
|
4846 // If entered here, some command must be set even empty |
|
4847 switch ( ctrl->ControlId() ) |
|
4848 { |
|
4849 case EMsgComponentIdAttachment: |
|
4850 resId = R_MMSVIEWER_MSK_BUTTON_OPEN_OBJECTS; |
|
4851 break; |
|
4852 case EMsgComponentIdImage: |
|
4853 if ( Document( )->SmilType( ) != EMmsSmil ) |
|
4854 { |
|
4855 resId = R_MMSVIEWER_MSK_BUTTON_PLAY_PRESENTATION; |
|
4856 } |
|
4857 else if ( MediaInitializedL( iImage ) ) |
|
4858 { |
|
4859 resId = R_MMSVIEWER_MSK_BUTTON_OPEN_IMAGE; |
|
4860 } |
|
4861 else |
|
4862 { |
|
4863 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4864 } |
|
4865 break; |
|
4866 case EMsgComponentIdAudio: |
|
4867 if ( MediaIsRunning( iAudio ) ) |
|
4868 { |
|
4869 resId = R_MMSVIEWER_MSK_BUTTON_STOP_AUDIO; |
|
4870 } |
|
4871 else if ( MediaInitializedL( iAudio ) ) |
|
4872 { |
|
4873 resId = R_MMSVIEWER_MSK_BUTTON_PLAY_AUDIO; |
|
4874 } |
|
4875 else |
|
4876 { |
|
4877 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4878 } |
|
4879 break; |
|
4880 case EMsgComponentIdVideo: |
|
4881 if ( MediaIsRunning( iVideo ) ) |
|
4882 { |
|
4883 resId = R_MMSVIEWER_MSK_BUTTON_STOP_VIDEO; |
|
4884 } |
|
4885 else if ( MediaInitializedL( iVideo ) ) |
|
4886 { |
|
4887 resId = R_MMSVIEWER_MSK_BUTTON_PLAY_VIDEO; |
|
4888 } |
|
4889 else |
|
4890 { |
|
4891 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4892 } |
|
4893 break; |
|
4894 #ifdef RD_SVGT_IN_MESSAGING |
|
4895 case EMsgComponentIdSvg: |
|
4896 if ( MediaIsRunning( iSvgt ) ) |
|
4897 { |
|
4898 resId = R_MMSVIEWER_MSK_BUTTON_STOP_SVG; |
|
4899 } |
|
4900 else if ( MediaInitializedL( iSvgt ) ) |
|
4901 { |
|
4902 resId = R_MMSVIEWER_MSK_BUTTON_PLAY_SVG; |
|
4903 } |
|
4904 else |
|
4905 { |
|
4906 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4907 } |
|
4908 break; |
|
4909 #endif |
|
4910 default: |
|
4911 { |
|
4912 |
|
4913 if ( iWaitDialog |
|
4914 && ( iOpeningState == EOpeningMessage |
|
4915 || iOpeningState == EOpeningSlide ) ) |
|
4916 { |
|
4917 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4918 } |
|
4919 else |
|
4920 { |
|
4921 resId = R_MMSVIEWER_MSK_BUTTON_CONTEXT_MENU; |
|
4922 if ( resId != iMskId ) |
|
4923 { |
|
4924 MenuBar()->SetContextMenuTitleResourceId( |
|
4925 R_MMSVIEWER_SELECTMENU ); |
|
4926 } |
|
4927 } |
|
4928 break; |
|
4929 } |
|
4930 } |
|
4931 } |
|
4932 } |
|
4933 else if ( iView ) |
|
4934 { |
|
4935 resId = R_MMSVIEWER_MSK_NO_COMMAND_EMPTY_TEXT; |
|
4936 } |
|
4937 |
|
4938 if ( resId != iMskId |
|
4939 && resId != (-1) ) |
|
4940 { |
|
4941 const TInt KMskPosition = 3; |
|
4942 CEikButtonGroupContainer* cba = Cba(); |
|
4943 if ( cba ) |
|
4944 { |
|
4945 if( resId != 0 ) |
|
4946 { |
|
4947 cba->SetCommandL( KMskPosition, resId ); |
|
4948 } |
|
4949 else |
|
4950 { // nullify the command |
|
4951 cba->SetCommandL( KMskPosition, 0, KNullDesC( ) ); |
|
4952 } |
|
4953 cba->DrawDeferred( ); |
|
4954 iMskId = resId; |
|
4955 } |
|
4956 } |
|
4957 return; |
|
4958 } |
|
4959 |
|
4960 // ----------------------------------------------------------------------------- |
|
4961 // MediaHasNoDrmRights |
|
4962 // ----------------------------------------------------------------------------- |
|
4963 // |
|
4964 TInt CMmsViewerAppUi::MediaHasNoDrmRights(CMsgMediaControl* aMedia) |
|
4965 { |
|
4966 TInt result = KErrNone; |
|
4967 if ( aMedia ) |
|
4968 { |
|
4969 CUniObject* object = ObjectByMediaControl( *aMedia); |
|
4970 TBuf<ContentAccess::KMaxCafUniqueId> defaultContent( ContentAccess::KDefaultContentObject( ) ); |
|
4971 |
|
4972 TBool ignoreConsumed (EFalse ); |
|
4973 if ( object |
|
4974 && object->DrmInfo( ) ) |
|
4975 { |
|
4976 result = object->DrmInfo( )->EvaluateRights( ignoreConsumed ); |
|
4977 switch ( result ) |
|
4978 { |
|
4979 case DRMCommon::EGeneralError: |
|
4980 case DRMCommon::EUnknownMIME: |
|
4981 case DRMCommon::EVersionNotSupported: |
|
4982 case DRMCommon::ESessionError: |
|
4983 case DRMCommon::ENoRights: |
|
4984 case DRMCommon::ERightsDBCorrupted: |
|
4985 case DRMCommon::EUnsupported: |
|
4986 case DRMCommon::ERightsExpired: |
|
4987 case DRMCommon::EInvalidRights: |
|
4988 break; |
|
4989 default: |
|
4990 result = KErrNone; |
|
4991 break; |
|
4992 } |
|
4993 } |
|
4994 } |
|
4995 return result; |
|
4996 } |
|
4997 |
|
4998 // ----------------------------------------------------------------------------- |
|
4999 // handles the touch-ui related control events for next/previous message |
|
5000 // ----------------------------------------------------------------------------- |
|
5001 // |
|
5002 #ifdef RD_SCALABLE_UI_V2 |
|
5003 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
5004 void CMmsViewerAppUi::HandleNaviDecoratorEventL( TInt aEventID ) |
|
5005 { |
|
5006 if ( AknLayoutUtils::PenEnabled() ) |
|
5007 { |
|
5008 if ( iNaviDecorator |
|
5009 && iNaviPane->Top( ) == iNaviDecorator ) |
|
5010 { |
|
5011 if( IsNextMessageAvailableL( aEventID == EAknNaviDecoratorEventRightTabArrow ) ) |
|
5012 { |
|
5013 /* no need for separate checks for right and left arrows |
|
5014 because IsNextMessageAvailableL() and NextMessageL |
|
5015 are called with the truth-value of the same comparison */ |
|
5016 NextMessageL( aEventID == EAknNaviDecoratorEventRightTabArrow ); |
|
5017 } |
|
5018 } |
|
5019 } |
|
5020 } |
|
5021 #endif // !RD_MSG_NAVIPANE_IMPROVEMENT |
|
5022 #endif // RD_SCALABLE_UI_V2 |
|
5023 |
|
5024 // ----------------------------------------------------------------------------- |
|
5025 // SendReadReportL |
|
5026 // ----------------------------------------------------------------------------- |
|
5027 // |
|
5028 void CMmsViewerAppUi::SendReadReportL( TMmsViewerOperationType aOperation, |
|
5029 TMmsViewerOperationEvent aEvent ) |
|
5030 { |
|
5031 // send read report |
|
5032 if ( aOperation == EMmsViewerOperationLaunch |
|
5033 && aEvent == EMmsViewerOperationComplete |
|
5034 && Document( )->LaunchFlags() & EMsgUnreadMessage ) |
|
5035 { |
|
5036 iSendReadReportOperation = new (ELeave ) CMmsViewerSendReadReportOperation( |
|
5037 *this, |
|
5038 *Document( ), |
|
5039 iCoeEnv->FsSession( ) ); |
|
5040 ActivateInputBlockerL( iSendReadReportOperation ); |
|
5041 iSendReadReportOperation->SendReadReportL( ); |
|
5042 } |
|
5043 } |
|
5044 |
|
5045 // ----------------------------------------------------------------------------- |
|
5046 // HandleControlEventL |
|
5047 // ----------------------------------------------------------------------------- |
|
5048 // |
|
5049 #ifdef RD_SCALABLE_UI_V2 |
|
5050 void CMmsViewerAppUi::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType ) |
|
5051 #else |
|
5052 void CMmsViewerAppUi::HandleControlEventL(CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/) |
|
5053 #endif |
|
5054 { |
|
5055 #ifdef RD_SCALABLE_UI_V2 |
|
5056 if ( AknLayoutUtils::PenEnabled() ) |
|
5057 { |
|
5058 if ( iVolumeDecorator |
|
5059 && iNaviPane->Top( ) == iVolumeDecorator |
|
5060 && aControl == iVolumeDecorator->DecoratedControl() |
|
5061 && aEventType >= MAknNavigationObserver::ENaviEventHandleNavigation |
|
5062 && aEventType <= MAknNavigationObserver::ENaviEventAlreadyRightmostItem ) |
|
5063 { |
|
5064 iViewerFlags |= EVolumeControlTriggered; |
|
5065 TRAP_IGNORE( ChangeVolumeL( |
|
5066 static_cast<CAknVolumeControl*> |
|
5067 ( iVolumeDecorator->DecoratedControl() )->Value( ), |
|
5068 EFalse ) ); |
|
5069 iViewerFlags &= ( ~EVolumeControlTriggered ); |
|
5070 } |
|
5071 } |
|
5072 |
|
5073 #endif |
|
5074 } |
|
5075 |
|
5076 // ----------------------------------------------------------------------------- |
|
5077 // GetNonStoppingWGIdsL |
|
5078 // ----------------------------------------------------------------------------- |
|
5079 // |
|
5080 void CMmsViewerAppUi::GetNonStoppingWgIds( ) |
|
5081 { |
|
5082 iMmsViewerWgId = iCoeEnv->RootWin().Identifier(); |
|
5083 CApaWindowGroupName::FindByAppUid( |
|
5084 KFastSwapAppUid, |
|
5085 iCoeEnv->WsSession(), |
|
5086 iFastSwapWgId ); |
|
5087 CApaWindowGroupName::FindByAppUid( |
|
5088 KAknNotifyServerAppUid, |
|
5089 iCoeEnv->WsSession(), |
|
5090 iAknNotifyServerWgId ); |
|
5091 CApaWindowGroupName::FindByAppUid( |
|
5092 KScreenSaverAppUid, |
|
5093 iCoeEnv->WsSession(), |
|
5094 iScreenSaverWgId ); |
|
5095 // start receivingn events |
|
5096 iCoeEnv->RootWin().EnableFocusChangeEvents(); |
|
5097 } |
|
5098 |
|
5099 // ----------------------------------------------------------------------------- |
|
5100 // ResolveCurrentWgIdL |
|
5101 // ----------------------------------------------------------------------------- |
|
5102 // |
|
5103 void CMmsViewerAppUi::ResolveCurrentWgIdL( ) |
|
5104 { |
|
5105 // magic constant |
|
5106 const TInt KSystemAppWgId( 4 ); |
|
5107 TInt windowGroupId = iEikonEnv->WsSession().GetFocusWindowGroup(); |
|
5108 |
|
5109 /*#ifdef USE_LOGGER |
|
5110 CApaWindowGroupName* winGroupInfo = CApaWindowGroupName::NewL(iCoeEnv->WsSession() ); |
|
5111 CleanupStack::PushL( winGroupInfo ); |
|
5112 winGroupInfo->ConstructFromWgIdL( windowGroupId ); |
|
5113 TUid uid = winGroupInfo->AppUid( ); |
|
5114 TPtrC caption = winGroupInfo->Caption( ); |
|
5115 |
|
5116 LOGTEXT2(_L16("HandleWsEventL EEventFocusLost winGroup: %d"), windowGroupId ); |
|
5117 LOGTEXT2(_L16("HandleWsEventL EEventFocusLost appUid: 0x%x"), uid ); |
|
5118 LOGTEXT2(_L16("HandleWsEventL EEventFocusLost caption: %S"), &caption ); |
|
5119 |
|
5120 CleanupStack::PopAndDestroy( winGroupInfo ); |
|
5121 #endif*/ |
|
5122 |
|
5123 // Stop only if temporary change e.g. a waiting note etc. |
|
5124 if ( ! ( windowGroupId == iFastSwapWgId |
|
5125 || windowGroupId == KSystemAppWgId |
|
5126 || windowGroupId == iAknNotifyServerWgId |
|
5127 || windowGroupId == iMmsViewerWgId |
|
5128 || windowGroupId == iScreenSaverWgId ) ) |
|
5129 { |
|
5130 iIsStopPlaybackWgId = ETrue; |
|
5131 } |
|
5132 } |
|
5133 |
|
5134 // --------------------------------------------------------- |
|
5135 // ActivateInputBlockerL |
|
5136 // --------------------------------------------------------- |
|
5137 // |
|
5138 void CMmsViewerAppUi::ActivateInputBlockerL( CActive* aActiveObjectToCancel ) |
|
5139 { |
|
5140 LOGTEXT(_L8("CMmsViewerAppUi::ActivateInputBlockerL")); |
|
5141 delete iInputBlocker; |
|
5142 iInputBlocker = NULL; |
|
5143 |
|
5144 iInputBlocker = CAknInputBlock::NewLC(); |
|
5145 CleanupStack::Pop( iInputBlocker ); |
|
5146 |
|
5147 if ( aActiveObjectToCancel ) |
|
5148 { |
|
5149 iInputBlocker->SetCancelActive( aActiveObjectToCancel ); |
|
5150 } |
|
5151 } |
|
5152 |
|
5153 // --------------------------------------------------------- |
|
5154 // DeactivateInputBlocker |
|
5155 // --------------------------------------------------------- |
|
5156 // |
|
5157 void CMmsViewerAppUi::DeactivateInputBlocker() |
|
5158 { |
|
5159 if ( iInputBlocker ) |
|
5160 { |
|
5161 LOGTEXT(_L8("CMmsViewerAppUi::DeactivateInputBlockerL")); |
|
5162 iInputBlocker->SetCancelActive( NULL ); |
|
5163 delete iInputBlocker; |
|
5164 iInputBlocker = NULL; |
|
5165 } |
|
5166 } |
|
5167 |
|
5168 // --------------------------------------------------------- |
|
5169 // ResetOperationState |
|
5170 // --------------------------------------------------------- |
|
5171 // |
|
5172 void CMmsViewerAppUi::ResetOperationState() |
|
5173 { |
|
5174 // Operation by operation should be considered what is proper action |
|
5175 // in Cancel situation |
|
5176 DeactivateInputBlocker(); |
|
5177 |
|
5178 EndActiveWait(); |
|
5179 delete iWaitDialog; |
|
5180 iWaitDialog = NULL; |
|
5181 |
|
5182 delete iScreenClearer; |
|
5183 iScreenClearer = NULL; |
|
5184 |
|
5185 // Following takes place also in Cancel event to enable |
|
5186 // exit through HandleCommandL() |
|
5187 iViewerState = ENormal; |
|
5188 iOpeningState = EOpeningNone; |
|
5189 iViewerFlags |= ELaunchSuccessful; |
|
5190 } |
|
5191 |
|
5192 // --------------------------------------------------------- |
|
5193 // DoDelayedExit |
|
5194 // --------------------------------------------------------- |
|
5195 // |
|
5196 void CMmsViewerAppUi::DoDelayedExit( TInt aDelayTime ) |
|
5197 { |
|
5198 LOGTEXT(_L8("CMmsViewerAppUi::DoDelayedExit in ") ); |
|
5199 iIdle->Start( aDelayTime, |
|
5200 aDelayTime, |
|
5201 TCallBack( DelayedExitL, this )); |
|
5202 } |
|
5203 |
|
5204 // --------------------------------------------------------- |
|
5205 // DelayedExit |
|
5206 // --------------------------------------------------------- |
|
5207 // |
|
5208 TInt CMmsViewerAppUi::DelayedExitL( TAny* aThis ) |
|
5209 { |
|
5210 CMmsViewerAppUi* viewer = static_cast<CMmsViewerAppUi*>( aThis ); |
|
5211 viewer->DoMsgSaveExitL(); |
|
5212 return KErrNone; |
|
5213 } |
|
5214 // --------------------------------------------------------- |
|
5215 // IsVideoCall |
|
5216 // --------------------------------------------------------- |
|
5217 // |
|
5218 TBool CMmsViewerAppUi::IsVideoCall() |
|
5219 { |
|
5220 TInt callType; |
|
5221 |
|
5222 RProperty::Get( KPSUidCtsyCallInformation, |
|
5223 KCTsyCallType, |
|
5224 callType );// Ignore errors |
|
5225 |
|
5226 TBool videoCall = ( callType == EPSCTsyCallTypeH324Multimedia ); |
|
5227 |
|
5228 return videoCall; |
|
5229 } |
|
5230 // --------------------------------------------------------- |
|
5231 // DynInitToolbarL |
|
5232 // --------------------------------------------------------- |
|
5233 // |
|
5234 #ifdef RD_SCALABLE_UI_V2 |
|
5235 void CMmsViewerAppUi::DynInitToolbarL( TInt /*aResourceId*/, |
|
5236 CAknToolbar* /*aToolbar*/ ) |
|
5237 { |
|
5238 } |
|
5239 #endif |
|
5240 // --------------------------------------------------------- |
|
5241 // OfferToolbarEventL |
|
5242 // --------------------------------------------------------- |
|
5243 // |
|
5244 #ifdef RD_SCALABLE_UI_V2 |
|
5245 void CMmsViewerAppUi::OfferToolbarEventL( TInt aCommand ) |
|
5246 { |
|
5247 switch ( aCommand ) |
|
5248 { |
|
5249 case EMmsViewerToolbarReply: |
|
5250 if ( IsOwnMessage( ) ) |
|
5251 { |
|
5252 HandleCommandL( EMmsViewerReplyToAll ); |
|
5253 } |
|
5254 else |
|
5255 { |
|
5256 HandleCommandL( EMmsViewerReplyToSender ); |
|
5257 } |
|
5258 |
|
5259 break; |
|
5260 |
|
5261 case EMmsViewerToolbarForward: |
|
5262 HandleCommandL( EMmsViewerForward ); |
|
5263 break; |
|
5264 |
|
5265 case EMmsViewerToolbarDelete: |
|
5266 HandleCommandL( EMmsViewerDelete ); |
|
5267 break; |
|
5268 |
|
5269 default: |
|
5270 break; |
|
5271 } |
|
5272 } |
|
5273 |
|
5274 // --------------------------------------------------------- |
|
5275 // SetToolBarItemVisibilities |
|
5276 // --------------------------------------------------------- |
|
5277 // |
|
5278 void CMmsViewerAppUi::SetToolBarItemVisibilities() |
|
5279 { |
|
5280 TBool replyDimming( EFalse ); |
|
5281 TBool forwardDimming( EFalse ); |
|
5282 TBool deleteDimming( EFalse ); |
|
5283 |
|
5284 if ( iToolbar ) |
|
5285 { |
|
5286 CEikButtonGroupContainer* cba = Cba(); |
|
5287 if ( cba |
|
5288 && !cba->ControlOrNull( EAknSoftkeyOptions ) ) |
|
5289 { |
|
5290 // dim every item |
|
5291 replyDimming = ETrue; |
|
5292 forwardDimming = ETrue; |
|
5293 deleteDimming = ETrue; |
|
5294 } |
|
5295 else |
|
5296 { |
|
5297 if ( IsOwnMessage( ) ) |
|
5298 { |
|
5299 if ( !ShowReplyToAll( ) |
|
5300 || Document( )->IsUpload( ) ) |
|
5301 { |
|
5302 replyDimming = ETrue; |
|
5303 } |
|
5304 } |
|
5305 else if ( !HasSender( ) ) |
|
5306 { |
|
5307 replyDimming = ETrue; |
|
5308 } |
|
5309 if ( iSmilModel->SlideCount( ) > iMaxForwardSlideCount ) |
|
5310 { |
|
5311 forwardDimming = ETrue; |
|
5312 } |
|
5313 } |
|
5314 iToolbar->SetItemDimmed( EMmsViewerToolbarReply, |
|
5315 replyDimming, |
|
5316 ETrue ); |
|
5317 iToolbar->SetItemDimmed( EMmsViewerToolbarForward, |
|
5318 forwardDimming, |
|
5319 ETrue ); |
|
5320 iToolbar->SetItemDimmed( EMmsViewerToolbarDelete, |
|
5321 deleteDimming, |
|
5322 ETrue ); |
|
5323 } |
|
5324 } |
|
5325 #endif |
|
5326 |
|
5327 // --------------------------------------------------------- |
|
5328 // AreControlsReadyAndWaitNoteDismissedL |
|
5329 // --------------------------------------------------------- |
|
5330 // |
|
5331 TBool CMmsViewerAppUi::AreControlsReadyAndWaitNoteDismissedL( ) |
|
5332 { |
|
5333 if ( |
|
5334 MediaInitializedL( iImage ) |
|
5335 && MediaInitializedL( iAudio ) |
|
5336 && MediaInitializedL( iVideo ) |
|
5337 #ifdef RD_SVGT_IN_MESSAGING |
|
5338 && MediaInitializedL( iSvgt ) |
|
5339 #endif |
|
5340 && !iWaitDialog ) |
|
5341 { |
|
5342 return ETrue; |
|
5343 } |
|
5344 return EFalse; |
|
5345 } |
|
5346 |
|
5347 |
|
5348 // --------------------------------------------------------- |
|
5349 // IsRightsConsumed |
|
5350 // --------------------------------------------------------- |
|
5351 // |
|
5352 TBool CMmsViewerAppUi::IsRightsConsumed( CUniObject& aObject ) const |
|
5353 { |
|
5354 TBool consumed( EFalse ); |
|
5355 if ( aObject.DrmInfo( ) ) |
|
5356 { |
|
5357 aObject.DrmInfo( )->EvaluateRights( consumed ); |
|
5358 } |
|
5359 LOGTEXT2(_L16("CMmsViewerAppUi::IsRightsConsumed consumed %d"), consumed ); |
|
5360 return consumed; |
|
5361 } |
|
5362 |
|
5363 // --------------------------------------------------------- |
|
5364 // IsRightsNow |
|
5365 // --------------------------------------------------------- |
|
5366 // |
|
5367 TBool CMmsViewerAppUi::IsRightsNow( CUniObject& aObject ) const |
|
5368 { |
|
5369 TBool rightsNow( EFalse ); |
|
5370 if ( aObject.DrmInfo( ) ) |
|
5371 { |
|
5372 TInt consumed( EFalse ); |
|
5373 // KErrNone: rights exist |
|
5374 rightsNow = !aObject.DrmInfo( )->EvaluateRights( consumed ); |
|
5375 |
|
5376 /*TBool rightsNow2( EFalse ); |
|
5377 rightsNow2 = aObject.DrmInfo( )->RightsValidL( ETrue ); |
|
5378 TInt j; |
|
5379 j++;*/ |
|
5380 } |
|
5381 LOGTEXT2(_L16("CMmsViewerAppUi::IsRightsNow rightsNow %d"), rightsNow ); |
|
5382 |
|
5383 |
|
5384 return rightsNow; |
|
5385 } |
|
5386 |
|
5387 // --------------------------------------------------------- |
|
5388 // IsDrmRightsWhenLoaded |
|
5389 // --------------------------------------------------------- |
|
5390 // |
|
5391 TBool CMmsViewerAppUi::IsDrmRightsWhenLoaded( CUniObject& aObject ) const |
|
5392 { |
|
5393 // Separate function just because of LOG traces |
|
5394 TBool rightsWhenLoaded = aObject.IsDrmRightsWhenLoaded(); |
|
5395 LOGTEXT2(_L16("CMmsViewerAppUi::IsDrmRightsWhenLoaded rightsWhenLoaded %d"), rightsWhenLoaded ); |
|
5396 return rightsWhenLoaded; |
|
5397 } |
|
5398 |
|
5399 // --------------------------------------------------------- |
|
5400 // HandleUniObjectEvent from MUniObjectObserver |
|
5401 // --------------------------------------------------------- |
|
5402 // |
|
5403 void CMmsViewerAppUi::HandleUniObjectEvent( CUniObject& aUniObject, |
|
5404 TUniObjectEvent aUniEvent ) |
|
5405 { |
|
5406 LOGTEXT(_L8("CMmsViewerAppUi::HandleUniObjectEvent in ") ); |
|
5407 // SVG is different. Drm rights are not consumed by us at all but external viewer |
|
5408 CMsgMediaControl* control = MediaControlByObject( aUniObject ); |
|
5409 if ( aUniEvent == EUniObjectEventDrmRightsChanged |
|
5410 && control |
|
5411 && !( control == iVideo |
|
5412 && iViewerFlags & EInObjectsView ) |
|
5413 && aUniObject.DrmInfo( ) |
|
5414 && ( |
|
5415 ( IsDrmRightsWhenLoaded( aUniObject ) |
|
5416 && !IsRightsConsumed( aUniObject ) |
|
5417 && !IsRightsNow( aUniObject ) ) |
|
5418 || ( !IsDrmRightsWhenLoaded( aUniObject ) |
|
5419 && !IsRightsConsumed( aUniObject ) |
|
5420 && IsRightsNow( aUniObject ) ) |
|
5421 ) |
|
5422 ) |
|
5423 { |
|
5424 #ifdef RD_SVGT_IN_MESSAGING |
|
5425 if ( control == iSvgt ) |
|
5426 { |
|
5427 // SVG is different. DRM rights are not consumed ever by us but thumbnail may be visible |
|
5428 // Thus, if SVG thumbnail becomes ever visible, don't remove it |
|
5429 if ( IsDrmRightsWhenLoaded( aUniObject ) |
|
5430 && !IsRightsConsumed( aUniObject ) |
|
5431 && !IsRightsNow( aUniObject ) ) |
|
5432 { |
|
5433 return; |
|
5434 } |
|
5435 } |
|
5436 #endif |
|
5437 |
|
5438 // - Rights were initially when slide was loaded |
|
5439 // && - they were not consumed by us |
|
5440 // && - they were consumed by someone else |
|
5441 // or - Rights were not initially when slide was loaded |
|
5442 // && - they are not consumed by us |
|
5443 // && - now there are rights |
|
5444 if ( !iViewerFlags & EInObjectsView |
|
5445 && IsDisplayingDialog() ) |
|
5446 { |
|
5447 TKeyEvent keyEvent; |
|
5448 keyEvent.iCode = EKeyEscape; |
|
5449 keyEvent.iScanCode = EStdKeyEscape; |
|
5450 keyEvent.iModifiers = 0; |
|
5451 keyEvent.iRepeats = 0; |
|
5452 TRAP_IGNORE( iEikonEnv->SimulateKeyEventL(keyEvent,EEventKey) ); |
|
5453 } |
|
5454 TRAP_IGNORE( ReloadControlL( control, aUniObject ) ); |
|
5455 } |
|
5456 LOGTEXT(_L8("CMmsViewerAppUi::HandleUniObjectEvent out ") ); |
|
5457 } |
|
5458 |
|
5459 // --------------------------------------------------------- |
|
5460 // SimulateUniObjectEventL |
|
5461 // --------------------------------------------------------- |
|
5462 // |
|
5463 void CMmsViewerAppUi::SimulateUniObjectEventL( ) |
|
5464 { |
|
5465 iIdle->Cancel(); |
|
5466 TInt j = 4; |
|
5467 CMsgMediaControl* control = NULL; |
|
5468 if ( j == 1 |
|
5469 && iImage ) |
|
5470 control = iImage; |
|
5471 if ( j == 2 |
|
5472 && iAudio ) |
|
5473 control = iAudio; |
|
5474 if ( j == 3 |
|
5475 && iVideo ) |
|
5476 control = iVideo; |
|
5477 #ifdef RD_SVGT_IN_MESSAGING |
|
5478 if ( j == 4 |
|
5479 && iSvgt ) |
|
5480 control = iSvgt; |
|
5481 #endif |
|
5482 if ( control ) |
|
5483 { |
|
5484 CUniObject* uniObject = ObjectByBaseControl( *control ); |
|
5485 if ( uniObject ) |
|
5486 { |
|
5487 ReloadControlL( control, *uniObject ); |
|
5488 } |
|
5489 } |
|
5490 } |
|
5491 |
|
5492 |
|
5493 // --------------------------------------------------------- |
|
5494 // MediaControlByObject |
|
5495 // --------------------------------------------------------- |
|
5496 CMsgMediaControl* CMmsViewerAppUi::MediaControlByObject( CUniObject& aUniObject ) |
|
5497 { |
|
5498 CMsgMediaControl* control = NULL; |
|
5499 switch ( aUniObject.MediaType( ) ) |
|
5500 { |
|
5501 case EMsgMediaImage: |
|
5502 control = iImage; |
|
5503 break; |
|
5504 case EMsgMediaAudio: |
|
5505 control = iAudio; |
|
5506 break; |
|
5507 case EMsgMediaVideo: |
|
5508 control = iVideo; |
|
5509 break; |
|
5510 #ifdef RD_SVGT_IN_MESSAGING |
|
5511 case EMsgMediaSvg: |
|
5512 control = iSvgt; |
|
5513 break; |
|
5514 #endif |
|
5515 default: |
|
5516 break; |
|
5517 } |
|
5518 return control; |
|
5519 |
|
5520 } |
|
5521 |
|
5522 |
|
5523 // --------------------------------------------------------- |
|
5524 // SetTitleIconL |
|
5525 // --------------------------------------------------------- |
|
5526 // |
|
5527 void CMmsViewerAppUi::SetTitleIconL() |
|
5528 { |
|
5529 SetTitleIconSizeL( iAppIcon->Bitmap() ); |
|
5530 // Create duplicates of the icon to be used |
|
5531 CFbsBitmap* bitmap = new( ELeave ) CFbsBitmap(); |
|
5532 CleanupStack::PushL( bitmap ); |
|
5533 |
|
5534 CFbsBitmap* bitmapMask = new( ELeave ) CFbsBitmap(); |
|
5535 CleanupStack::PushL( bitmapMask ); |
|
5536 |
|
5537 User::LeaveIfError( bitmap->Duplicate( iAppIcon->Bitmap()->Handle() ) ); |
|
5538 User::LeaveIfError( bitmapMask->Duplicate( iAppIcon->Mask()->Handle() ) ); |
|
5539 |
|
5540 iTitlePane->SetSmallPicture( bitmap, bitmapMask, ETrue ); |
|
5541 iTitlePane->DrawNow(); |
|
5542 |
|
5543 CleanupStack::Pop( bitmapMask ); |
|
5544 CleanupStack::Pop( bitmap ); |
|
5545 } |
|
5546 // --------------------------------------------------------- |
|
5547 // CMmsViewerAppUi::HandleLongTapEventL |
|
5548 // Function for handling the long tap events |
|
5549 // --------------------------------------------------------- |
|
5550 // |
|
5551 void CMmsViewerAppUi::HandleLongTapEventL(const TPoint& aPenEventLocation, |
|
5552 const TPoint& aPenEventScreenLocation ) |
|
5553 { |
|
5554 CMsgBaseControl* ctrl = iView->FocusedControl(); // ctrl can be NULL. |
|
5555 if ( ctrl && |
|
5556 ( ctrl->ControlId() == EMsgComponentIdAudio || |
|
5557 ctrl->ControlId() == EMsgComponentIdImage || |
|
5558 ctrl->ControlId() == EMsgComponentIdVideo || |
|
5559 ctrl->ControlId() == EMsgComponentIdSvg )&& |
|
5560 ((Document()->SmilType()!=ETemplateSmil)&&(Document()->SmilType()!=E3GPPSmil) )) |
|
5561 { |
|
5562 TRect rect = ctrl->Rect(); |
|
5563 |
|
5564 |
|
5565 |
|
5566 if ((!iTapConsumed)&&rect.Contains(aPenEventLocation)) |
|
5567 { |
|
5568 if (iEmbeddedObjectStylusPopup) |
|
5569 { |
|
5570 delete iEmbeddedObjectStylusPopup; |
|
5571 iEmbeddedObjectStylusPopup = NULL; |
|
5572 } |
|
5573 iEmbeddedObjectStylusPopup = CAknStylusPopUpMenu::NewL(this,aPenEventLocation); |
|
5574 TResourceReader reader; |
|
5575 iCoeEnv->CreateResourceReaderLC(reader,R_MMSVIEWER_EMBEDDED_OBJECT_STYLUS_MENU ); |
|
5576 iEmbeddedObjectStylusPopup->ConstructFromResourceL(reader); |
|
5577 CleanupStack::PopAndDestroy(); |
|
5578 iEmbeddedObjectStylusPopup->SetPosition(aPenEventLocation); |
|
5579 iEmbeddedObjectStylusPopup->ShowMenu(); |
|
5580 iTapConsumed = ETrue; |
|
5581 } |
|
5582 } |
|
5583 } |
|
5584 // --------------------------------------------------------- |
|
5585 // CMmsViewerAppUi::HandleSelectionKeyL |
|
5586 // Function for handling the selection key |
|
5587 // --------------------------------------------------------- |
|
5588 void CMmsViewerAppUi::HandleSelectionKeyL() |
|
5589 { |
|
5590 // Read current MSK resource to get a command id |
|
5591 // to execute. |
|
5592 TResourceReader reader; |
|
5593 iEikonEnv->CreateResourceReaderLC( |
|
5594 reader, iMskId ); |
|
5595 reader.ReadInt8(); // version |
|
5596 HandleCommandL( reader.ReadUint16() ); |
|
5597 CleanupStack::PopAndDestroy(); // resource buffer |
|
5598 } |
|
5599 // End of File |
|
5600 |