|
1 /* |
|
2 * Copyright (c) 2002-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 * Voice Recorder Record View |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <aknViewAppUi.h> |
|
24 #include <AknQueryDialog.h> |
|
25 #include <avkon.hrh> |
|
26 #include <barsread.h> |
|
27 #include <eikbtgpc.h> |
|
28 #include <eikmenub.h> |
|
29 #include <StringLoader.h> |
|
30 #include <apparc.h> |
|
31 #include <eikenv.h> |
|
32 #include <eikappui.h> |
|
33 #include <eikapp.h> |
|
34 #include <CommonContentPolicy.h> |
|
35 #include <vwsdef.h> |
|
36 #include <pathinfo.h> |
|
37 #include <sendui.h> |
|
38 #include <avkon.rsg> |
|
39 #include <featmgr.h> |
|
40 #include <VoiceRecorderUID.h> |
|
41 #include <voicerecorder.rsg> |
|
42 #include <e32property.h> |
|
43 #include <coreapplicationuisdomainpskeys.h> |
|
44 #include <AknLaunchAppService.h> |
|
45 #include <AiwGenericParam.h> |
|
46 |
|
47 #include "voicerecorder.hrh" |
|
48 #include "CVRRecView.h" |
|
49 #include "CVRRecViewContainer.h" |
|
50 #include "CVRRecViewActivationContainer.h" |
|
51 #include "CVRRecViewModel.h" |
|
52 #include "VRUtils.h" |
|
53 |
|
54 // CONSTANTS |
|
55 const TUid KUidMmsEditor = { 0x100058DE }; |
|
56 const TUid KUidMailEditor = { 0x101F4CD6 }; |
|
57 |
|
58 |
|
59 // ================= MEMBER FUNCTIONS ======================================== |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator( |
|
67 CVRRecViewModel* aModel ) |
|
68 : CAsyncOneShot( EPriorityNormal ), iModel( aModel ), |
|
69 iContext( EContextEmptyNormal ) |
|
70 { |
|
71 } |
|
72 |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator |
|
76 // |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator() |
|
80 { |
|
81 Cancel(); |
|
82 } |
|
83 |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CVRRecView::CVRRecViewModelActivator::RunL |
|
87 // |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CVRRecView::CVRRecViewModelActivator::RunL() |
|
91 { |
|
92 // Activate model in correct context |
|
93 iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); |
|
94 iModel->EnterContextL( iContext ); |
|
95 iModel->ActivateL(); |
|
96 |
|
97 // Notify recview |
|
98 iCallback.CallBack(); |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CVRRecView::CVRRecViewModelActivator::Activate |
|
104 // |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 void CVRRecView::CVRRecViewModelActivator::Activate( |
|
108 TVRRecViewContexts aContext, TCallBack aCallback ) |
|
109 { |
|
110 iContext = aContext; |
|
111 iCallback = aCallback; |
|
112 Call(); |
|
113 |
|
114 } |
|
115 |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CVRRecView::CVRRecViewModelActivator::DoCancel |
|
119 // |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CVRRecView::CVRRecViewModelActivator::DoCancel() |
|
123 { |
|
124 } |
|
125 |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CVRRecView::NewLC |
|
129 // |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C CVRRecView* CVRRecView::NewLC( TInt aViewResourceId, |
|
133 TInt aModelResourceId ) |
|
134 { |
|
135 CVRRecView* recview = new( ELeave ) CVRRecView; |
|
136 CleanupStack::PushL( recview ); |
|
137 recview->ConstructL( aViewResourceId, aModelResourceId ); |
|
138 |
|
139 return recview; |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CVRRecView::~CVRRecView |
|
145 // |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 CVRRecView::~CVRRecView() |
|
149 { |
|
150 if ( iContainer ) |
|
151 { |
|
152 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
153 } |
|
154 |
|
155 if ( iActivationContainer ) |
|
156 { |
|
157 AppUi()->RemoveFromViewStack( *this, iActivationContainer ); |
|
158 } |
|
159 |
|
160 delete iContainer; |
|
161 delete iActivationContainer; |
|
162 delete iModel; |
|
163 delete iSendUi; |
|
164 delete iModelActivator; |
|
165 delete iLaunchService; |
|
166 } |
|
167 |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CVRRecView::ConstructL |
|
171 // |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 void CVRRecView::ConstructL( TInt aViewResourceId, TInt aModelResourceId ) |
|
175 { |
|
176 BaseConstructL( aViewResourceId ); |
|
177 |
|
178 iModel = new( ELeave ) CVRRecViewModel; |
|
179 TResourceReader reader; |
|
180 iEikonEnv->CreateResourceReaderLC( reader, aModelResourceId ); |
|
181 iModel->ConstructFromResourceL( reader ); |
|
182 CleanupStack::PopAndDestroy(); // reader; |
|
183 |
|
184 // Create SendUi (Send as MMS, E-Mail, etc...) |
|
185 iSendUi = CSendUi::NewL(); |
|
186 |
|
187 iModelActivator = new(ELeave) CVRRecViewModelActivator( iModel ); |
|
188 // iCommand = 0; |
|
189 } |
|
190 |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // CVRRecView::Id |
|
194 // |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 TUid CVRRecView::Id() const |
|
198 { |
|
199 const TUid KVRRecViewUID = { KVRRecorderViewUID }; |
|
200 |
|
201 return KVRRecViewUID; |
|
202 } |
|
203 |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // CVRRecView::HandleCommandL |
|
207 // |
|
208 // --------------------------------------------------------------------------- |
|
209 // |
|
210 void CVRRecView::HandleCommandL( TInt aCommandId ) |
|
211 { |
|
212 // This command must be acceptable all times. |
|
213 if ( aCommandId == ECmdCancelNote ) |
|
214 { |
|
215 iCommand = aCommandId; |
|
216 if( iModel ) |
|
217 { |
|
218 iModel->HandleCommandL( aCommandId ); |
|
219 } |
|
220 return; |
|
221 } |
|
222 |
|
223 if ( !iModel->CanAcceptCommands() ) |
|
224 { |
|
225 return; |
|
226 } |
|
227 |
|
228 switch ( aCommandId ) |
|
229 { |
|
230 // Don't do anything in case of a Task Swapper command |
|
231 case EAknCmdTaskSwapper: |
|
232 { |
|
233 break; |
|
234 } |
|
235 // No operation |
|
236 case ECmdNOP: |
|
237 { |
|
238 break; |
|
239 } |
|
240 // Go back to voice memo list view |
|
241 case EAknSoftkeyBack: |
|
242 { |
|
243 AppUi()->HandleCommandL( EEikCmdExit ); |
|
244 break; |
|
245 } |
|
246 case ECmdSettings: |
|
247 { |
|
248 // Saving the volume control state before entering settings |
|
249 TBool hasVolumeControl( iModel->HasVolumeControl() ); |
|
250 // Disabling volume control |
|
251 iModel->EnableVolumeControl( EFalse ); |
|
252 iContainer->Update(); |
|
253 |
|
254 AppUi()->HandleCommandL( aCommandId ); |
|
255 |
|
256 // Set volume control as it was before settings dialog |
|
257 iModel->EnableVolumeControl( hasVolumeControl ); |
|
258 iContainer->Update(); |
|
259 break; |
|
260 } |
|
261 case ECmdGoToMyClips: |
|
262 { |
|
263 delete iLaunchService; |
|
264 iLaunchService = NULL; |
|
265 |
|
266 TFileName path; |
|
267 VRUtils::MemoStoreDirectoryL( path ); |
|
268 TInt sortMode = 0; |
|
269 |
|
270 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
|
271 inParams->AppendL(TAiwGenericParam( |
|
272 EGenericParamDir, TAiwVariant( path ) ) ); |
|
273 inParams->AppendL(TAiwGenericParam( |
|
274 EGenericParamDir, TAiwVariant( sortMode ) ) ); |
|
275 iLaunchService = CAknLaunchAppService::NewL( |
|
276 TUid::Uid( 0x101F84EB ), NULL, inParams ); |
|
277 CleanupStack::PopAndDestroy( inParams ); |
|
278 break; |
|
279 } |
|
280 case ECmdSendVia: |
|
281 { |
|
282 iModel->SendViaL( iSendUi ); |
|
283 break; |
|
284 } |
|
285 |
|
286 // Handles Middle SoftKey presses in this view |
|
287 case ECmdMSK: |
|
288 { |
|
289 // Don't forward the command if dimmed button was clicked or |
|
290 // if model can't handle commands |
|
291 if ( iModel->ButtonState( iContainer->FocusedButton() ) == EDimmed || |
|
292 !iModel->CanHandleCommands() ) |
|
293 { |
|
294 break; |
|
295 } |
|
296 |
|
297 // Fetch the command to execute |
|
298 TInt commandId( iModel->CommandId( iContainer->FocusedButton() ) ); |
|
299 |
|
300 iModel->HandleCommandL( commandId ); |
|
301 AppUi()->HandleCommandL( commandId ); |
|
302 |
|
303 iContainer->UpdateButtonPanel( EVRUpdateStateChange ); |
|
304 break; |
|
305 } |
|
306 |
|
307 default: |
|
308 { |
|
309 iModel->HandleCommandL( aCommandId ); |
|
310 AppUi()->HandleCommandL( aCommandId ); |
|
311 break; |
|
312 } |
|
313 } |
|
314 } |
|
315 |
|
316 |
|
317 // --------------------------------------------------------------------------- |
|
318 // CVRRecView::DynInitMenuPaneL |
|
319 // |
|
320 // --------------------------------------------------------------------------- |
|
321 // |
|
322 void CVRRecView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
323 { |
|
324 |
|
325 switch ( aResourceId ) |
|
326 { |
|
327 case R_VR_REC_MENUPANE_DEFAULT: |
|
328 { |
|
329 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
330 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
331 { |
|
332 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
333 } |
|
334 |
|
335 AddSendToMenuL( aResourceId, aMenuPane ); |
|
336 break; |
|
337 } |
|
338 |
|
339 case R_VR_REC_MENUPANE_VIEWER: |
|
340 { |
|
341 TUid appuid( KNullUid ); |
|
342 CEikAppUi* container = iEikonEnv->EikAppUi()->ContainerAppUi(); |
|
343 if ( container ) |
|
344 { |
|
345 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
346 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
347 { |
|
348 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
349 } |
|
350 |
|
351 appuid = container->Application()->AppDllUid(); |
|
352 if ( ( appuid == KUidMmsEditor ) || |
|
353 ( appuid == KUidMailEditor ) ) |
|
354 { |
|
355 aMenuPane->SetItemDimmed( ECmdSaveAttachment, ETrue ); |
|
356 } |
|
357 else |
|
358 { |
|
359 AddSendToMenuL( aResourceId, aMenuPane ); |
|
360 } |
|
361 } |
|
362 |
|
363 break; |
|
364 } |
|
365 case R_VR_SETTINGS_MENUPANE: |
|
366 { |
|
367 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
368 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
369 { |
|
370 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
371 } |
|
372 break; |
|
373 } |
|
374 |
|
375 case R_VR_REC_MENUPANE_DELETED: |
|
376 { |
|
377 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
378 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
379 { |
|
380 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
381 } |
|
382 |
|
383 // if recording already started, not allow to start recording again. |
|
384 if (iModel->GetInRecordingFlag()) |
|
385 { |
|
386 aMenuPane->SetItemDimmed(ECmdRecord, ETrue); |
|
387 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
388 iModel->SetInRecordingFlag(EFalse); |
|
389 } |
|
390 |
|
391 break; |
|
392 } |
|
393 |
|
394 case R_VR_REC_MENUPANE_INCALL_RECORDING_DISABLED: |
|
395 { |
|
396 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
397 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
398 { |
|
399 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
400 } |
|
401 break; |
|
402 } |
|
403 |
|
404 case R_VOREC_GS_SETTINGS_MENUPANE: |
|
405 { |
|
406 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
407 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
408 { |
|
409 aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); |
|
410 } |
|
411 break; |
|
412 } |
|
413 |
|
414 default: |
|
415 { |
|
416 break; |
|
417 } |
|
418 } |
|
419 } |
|
420 |
|
421 |
|
422 // --------------------------------------------------------------------------- |
|
423 // CVRRecView::GetSelectedFilesLC |
|
424 // |
|
425 // --------------------------------------------------------------------------- |
|
426 // |
|
427 MDesCArray* CVRRecView::GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const |
|
428 { |
|
429 aStyle = EFocusedItem; |
|
430 return iModel->GetSelectedFilesLC(); |
|
431 } |
|
432 |
|
433 |
|
434 // --------------------------------------------------------------------------- |
|
435 // CVRRecView::DoActivateL |
|
436 // |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 void CVRRecView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
440 TUid aCustomMessageId, |
|
441 const TDesC8& aCustomMessage ) |
|
442 { |
|
443 TRAP_IGNORE( ReallyDoActivateL( aPrevViewId, |
|
444 aCustomMessageId, |
|
445 aCustomMessage ) ); |
|
446 } |
|
447 |
|
448 |
|
449 // --------------------------------------------------------------------------- |
|
450 // CVRRecView::DoDeactivate |
|
451 // |
|
452 // --------------------------------------------------------------------------- |
|
453 // |
|
454 void CVRRecView::DoDeactivate() |
|
455 { |
|
456 iModel->Deactivate(); |
|
457 |
|
458 iModel->LeaveContext(); |
|
459 |
|
460 CAknViewAppUi* appUi = AppUi(); |
|
461 if ( iContainer ) |
|
462 { |
|
463 appUi->RemoveFromViewStack( *this, iContainer ); |
|
464 delete iContainer; |
|
465 iContainer = NULL; |
|
466 } |
|
467 |
|
468 if ( iActivationContainer ) |
|
469 { |
|
470 appUi->RemoveFromViewStack( *this, iActivationContainer ); |
|
471 delete iActivationContainer; |
|
472 iActivationContainer = NULL; |
|
473 } |
|
474 |
|
475 } |
|
476 |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // CVRRecView::ViewDeactivated |
|
480 // |
|
481 // --------------------------------------------------------------------------- |
|
482 // |
|
483 void CVRRecView::ViewDeactivated() |
|
484 { |
|
485 #ifdef _DEBUG |
|
486 RDebug::Print( _L( "CVRRecView::ViewDeactivated" )); |
|
487 #endif |
|
488 |
|
489 TInt err = 0; |
|
490 |
|
491 if ( !iModel->IncomingCall() && ( iModel->VisualStateId() == EStatePlaying || |
|
492 iModel->VisualStateId() == EStateRecording ) ) |
|
493 { |
|
494 |
|
495 if (iModel->VisualStateId() == EStateRecording && iCommand == ECmdCancelNote ) |
|
496 { |
|
497 TRAP_IGNORE (iModel->HandleCommandL( ECmdSaveAttachment )); |
|
498 } |
|
499 |
|
500 // Is autolock activating? |
|
501 RProperty prop; |
|
502 TInt val; |
|
503 prop.Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val ); |
|
504 |
|
505 if ( val == EAutolockOff && //Do not pause when focus is lost because of autolock |
|
506 !iModel->GetIfStopCalled()) |
|
507 { |
|
508 |
|
509 //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change |
|
510 #ifdef __AAC_ENCODER_PLUGIN |
|
511 if ((iModel->Quality() == EQualityHigh) && (GetStateId() == EStateRecording)) |
|
512 { |
|
513 TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); |
|
514 } |
|
515 else |
|
516 { |
|
517 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
518 } |
|
519 |
|
520 #else |
|
521 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
522 #endif |
|
523 |
|
524 |
|
525 if( err ) |
|
526 { |
|
527 #ifdef _DEBUG |
|
528 RDebug::Print( _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), |
|
529 err ); |
|
530 #endif |
|
531 } |
|
532 } |
|
533 |
|
534 } |
|
535 else |
|
536 { |
|
537 TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); |
|
538 } |
|
539 |
|
540 CAknView::ViewDeactivated(); |
|
541 } |
|
542 |
|
543 |
|
544 // --------------------------------------------------------------------------- |
|
545 // CVRRecView::ViewActivatedL |
|
546 // The model's ActivateL() function is called to invoke any functionality |
|
547 // required when the UI is activated (e.g., for In-call recording diabling |
|
548 // feature) |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 void CVRRecView::ViewActivatedL(const TVwsViewId& aPrevViewId, |
|
552 TUid aCustomMessageId, |
|
553 const TDesC8& aCustomMessage) |
|
554 { |
|
555 iModel->ActivateL(); |
|
556 |
|
557 CAknView::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
558 } |
|
559 |
|
560 |
|
561 // --------------------------------------------------------------------------- |
|
562 // CVRRecView::Cba |
|
563 // |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 CEikButtonGroupContainer* CVRRecView::Cba() const |
|
567 { |
|
568 return CAknView::Cba(); |
|
569 } |
|
570 |
|
571 |
|
572 // --------------------------------------------------------------------------- |
|
573 // CVRRecView::AddSendToMenuL |
|
574 // Use CSendAppUi to display the Send cascade |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 void CVRRecView::AddSendToMenuL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
578 { |
|
579 // If the focused file is closed content (e.g. a DRM file or a protected |
|
580 // MIDI file), the whole Send option mustn't be shown. |
|
581 CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC(); |
|
582 MDesCArray* filenames = iModel->GetSelectedFilesLC(); |
|
583 if ( filenames->MdcaCount() > 0 && |
|
584 !ccp->IsClosedFileL( filenames->MdcaPoint( 0 ) ) ) |
|
585 { |
|
586 // Set proper capabilities |
|
587 TSendingCapabilities capabilities( 0, KVRSendUiMsgSize, |
|
588 TSendingCapabilities::ESupportsAttachments ); |
|
589 |
|
590 // We want the send menuitem after a specific item |
|
591 TInt itemPosForSend( 0 ); |
|
592 if ( aResourceId == R_VR_REC_MENUPANE_DEFAULT ) |
|
593 { |
|
594 aMenuPane->ItemAndPos( ECmdRename, itemPosForSend ); |
|
595 } |
|
596 else if ( aResourceId == R_VR_REC_MENUPANE_VIEWER ) |
|
597 { |
|
598 aMenuPane->ItemAndPos( ECmdSaveAttachment, itemPosForSend ); |
|
599 } |
|
600 itemPosForSend++; |
|
601 |
|
602 iSendUi->AddSendMenuItemL( *aMenuPane, |
|
603 itemPosForSend, |
|
604 ECmdSendVia, |
|
605 capabilities ); |
|
606 } |
|
607 CleanupStack::PopAndDestroy( 2 ); // ccp, filenames |
|
608 } |
|
609 |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // CVRRecView::LayoutChangedL |
|
613 // |
|
614 // --------------------------------------------------------------------------- |
|
615 // |
|
616 void CVRRecView::LayoutChangedL( TInt aType ) |
|
617 { |
|
618 if ( iContainer ) |
|
619 { |
|
620 iContainer->SetRect( ClientRect() ); |
|
621 iContainer->HandleResourceChangeL( aType ); |
|
622 } |
|
623 } |
|
624 |
|
625 |
|
626 // --------------------------------------------------------------------------- |
|
627 // CVRRecView::ReallyDoActivateL |
|
628 // |
|
629 // --------------------------------------------------------------------------- |
|
630 // |
|
631 void CVRRecView::ReallyDoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
632 TUid aCustomMessageId, |
|
633 const TDesC8& /*aCustomMessage*/ ) |
|
634 { |
|
635 // Don't do anything if activation is ongoing |
|
636 if ( iActivationContainer ) |
|
637 { |
|
638 return; |
|
639 } |
|
640 |
|
641 // If container exists, we have already been activated |
|
642 // Deactivate needed before new activation. |
|
643 if ( iContainer ) |
|
644 { |
|
645 DoDeactivate(); |
|
646 } |
|
647 |
|
648 // Display an empty UI container until model has been fully activated |
|
649 iActivationContainer = new( ELeave ) CVRRecViewActivationContainer; |
|
650 iActivationContainer->ConstructL( ClientRect() ); |
|
651 CAknViewAppUi* appUi = AppUi(); |
|
652 appUi->AddToViewStackL( *this, iActivationContainer ); |
|
653 iActivationContainer->ActivateL(); |
|
654 |
|
655 // Activate model in correct context asynchronically. |
|
656 // iContainer will be activated trough callback after model activation |
|
657 TCallBack cb( ActivationCallBack, this ); |
|
658 iModelActivator->Activate( static_cast< TVRRecViewContexts >( |
|
659 aCustomMessageId.iUid ), cb ); |
|
660 |
|
661 // Construct the real container |
|
662 iContainer = new( ELeave ) CVRRecViewContainer; |
|
663 iContainer->ConstructL( ClientRect(), iModel, iModel, iModel, this ); |
|
664 iContainer->SetKeyObserver( iModel ); |
|
665 iContainer->SetVolumeChangeObserver( iModel ); |
|
666 } |
|
667 |
|
668 |
|
669 // --------------------------------------------------------------------------- |
|
670 // CVRRecView::SetFileHandle |
|
671 // |
|
672 // --------------------------------------------------------------------------- |
|
673 // |
|
674 void CVRRecView::SetFileHandle( RFile& aFile ) |
|
675 { |
|
676 iModel->SetFileHandle( aFile ); |
|
677 } |
|
678 |
|
679 |
|
680 // --------------------------------------------------------------------------- |
|
681 // CVRRecView::GetFile |
|
682 // |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 RFile& CVRRecView::GetFile() |
|
686 { |
|
687 return iModel->MemoFileHandle(); |
|
688 } |
|
689 |
|
690 |
|
691 // --------------------------------------------------------------------------- |
|
692 // CVRRecView::ActivationCallBack |
|
693 // |
|
694 // --------------------------------------------------------------------------- |
|
695 // |
|
696 TInt CVRRecView::ActivationCallBack( TAny* aRecView ) |
|
697 { |
|
698 CVRRecView* view = reinterpret_cast< CVRRecView* >( aRecView ); |
|
699 TRAP_IGNORE( view->ActivateContainerL() ); |
|
700 return ETrue; |
|
701 } |
|
702 |
|
703 |
|
704 // --------------------------------------------------------------------------- |
|
705 // CVRRecView::ActivateContainerL |
|
706 // |
|
707 // --------------------------------------------------------------------------- |
|
708 // |
|
709 void CVRRecView::ActivateContainerL() |
|
710 { |
|
711 // Activate the actual container and remove |
|
712 // the one used during model construction |
|
713 CAknViewAppUi* appUi = AppUi(); |
|
714 appUi->AddToViewStackL( *this, iContainer ); |
|
715 iContainer->ActivateL(); |
|
716 |
|
717 // Delete the empty container, it's not needed anymore |
|
718 if ( iActivationContainer ) |
|
719 { |
|
720 appUi->RemoveFromViewStack( *this, iActivationContainer ); |
|
721 delete iActivationContainer; |
|
722 iActivationContainer = NULL; |
|
723 } |
|
724 |
|
725 } |
|
726 |
|
727 TUint CVRRecView::GetStateId() const |
|
728 { |
|
729 // if (iModel) |
|
730 return iModel->VisualStateId(); |
|
731 } |
|
732 |
|
733 |
|
734 // --------------------------------------------------------------------------- |
|
735 // CVRRecView::IsEmbedded |
|
736 // |
|
737 // --------------------------------------------------------------------------- |
|
738 // |
|
739 TBool CVRRecView::IsEmbedded() const |
|
740 { |
|
741 |
|
742 return iModel->IsEmbedded(); |
|
743 |
|
744 } |
|
745 |
|
746 |
|
747 // --------------------------------------------------------------------------- |
|
748 //Returns the active quality setting. |
|
749 //return Quality setting of the active memo |
|
750 // --------------------------------------------------------------------------- |
|
751 TVRQuality CVRRecView::Quality() const |
|
752 { |
|
753 return iModel->Quality(); |
|
754 } |
|
755 |
|
756 // --------------------------------------------------------------------------- |
|
757 // Called by UI Framework when view switches to and from foreground |
|
758 // --------------------------------------------------------------------------- |
|
759 /* |
|
760 void CVRRecView::HandleForegroundEventL( TBool aForeground ) |
|
761 { |
|
762 // If the view is going to background, pause recording for stand alone |
|
763 // application mode |
|
764 if ( !aForeground && !iModel->IsEmbedded() && iCommand != ECmdCancelNote ) |
|
765 { |
|
766 TInt err(0); |
|
767 if ( !iModel->IncomingCall() && ( iModel->VisualStateId() == EStatePlaying ||iModel->VisualStateId() == EStateRecording ) ) |
|
768 { |
|
769 //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change |
|
770 #ifdef __AAC_ENCODER_PLUGIN |
|
771 if ((iModel->Quality() == EQualityHigh) && (GetStateId() == EStateRecording)) |
|
772 { |
|
773 TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); |
|
774 } |
|
775 else |
|
776 { |
|
777 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
778 } |
|
779 |
|
780 #else |
|
781 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
782 #endif |
|
783 |
|
784 if( err ) |
|
785 { |
|
786 #ifdef _DEBUG |
|
787 RDebug::Print( _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), err ); |
|
788 #endif |
|
789 } |
|
790 } |
|
791 else |
|
792 { |
|
793 TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); |
|
794 } |
|
795 } |
|
796 |
|
797 // iCommand = 0; |
|
798 |
|
799 // Forward to handle default event handling. |
|
800 CAknView::HandleForegroundEventL(aForeground); |
|
801 } |
|
802 */ |