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 #include <sysutil.h> |
|
47 #include <aknnotewrappers.h> |
|
48 |
|
49 #include "voicerecorder.hrh" |
|
50 #include "CVRRecView.h" |
|
51 #include "CVRRecViewContainer.h" |
|
52 #include "CVRRecViewActivationContainer.h" |
|
53 #include "CVRRecViewModel.h" |
|
54 #include "VRUtils.h" |
|
55 #include "VRUSBStateHanlder.h" |
|
56 |
|
57 // CONSTANTS |
|
58 const TUid KUidMmsEditor = |
|
59 { |
|
60 0x100058DE |
|
61 }; |
|
62 const TUid KUidMailEditor = |
|
63 { |
|
64 0x101F4CD6 |
|
65 }; |
|
66 |
|
67 inline TBool ShowDialogForWaitUSBPluggingOutL() |
|
68 { |
|
69 HBufC* text = StringLoader::LoadLC(R_QTN_USB_MODE_NOTE_MODE); |
|
70 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
71 TInt result(dlg->ExecuteLD(R_INSERT_F_USB_PLUG_IN_DIALOG, *text)); |
|
72 CleanupStack::PopAndDestroy(text); |
|
73 if (result) |
|
74 { |
|
75 return ETrue; |
|
76 } |
|
77 return EFalse; |
|
78 } |
|
79 |
|
80 inline TInt WaitDialogForUSBPluggingOut(CAknWaitDialog*& aDialog) |
|
81 { |
|
82 aDialog = new (ELeave) CAknWaitDialog( |
|
83 (REINTERPRET_CAST(CEikDialog**,&aDialog))); |
|
84 aDialog->SetTone(CAknNoteDialog::EConfirmationTone); |
|
85 return aDialog->ExecuteLD(R_VOREC_USB_CONNECTED_DIALOG); |
|
86 } |
|
87 |
|
88 // ================= MEMBER FUNCTIONS ======================================== |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator |
|
92 // |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator( |
|
96 CVRRecViewModel* aModel) : |
|
97 CAsyncOneShot(EPriorityNormal), iModel(aModel), iContext( |
|
98 EContextEmptyNormal) |
|
99 { |
|
100 } |
|
101 |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator |
|
105 // |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator() |
|
109 { |
|
110 Cancel(); |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CVRRecView::CVRRecViewModelActivator::RunL |
|
116 // |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CVRRecView::CVRRecViewModelActivator::RunL() |
|
120 { |
|
121 if(iModel->GetIsDriveReady()) |
|
122 { |
|
123 // Activate model in correct context |
|
124 iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); |
|
125 iModel->EnterContextL( iContext ); |
|
126 iModel->ActivateL(); |
|
127 } |
|
128 |
|
129 // Notify recview |
|
130 iCallback.CallBack(); |
|
131 } |
|
132 |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CVRRecView::CVRRecViewModelActivator::Activate |
|
136 // |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 void CVRRecView::CVRRecViewModelActivator::Activate( |
|
140 TVRRecViewContexts aContext, TCallBack aCallback ) |
|
141 { |
|
142 iContext = aContext; |
|
143 iCallback = aCallback; |
|
144 Call(); |
|
145 |
|
146 } |
|
147 |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CVRRecView::CVRRecViewModelActivator::DoCancel |
|
151 // |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 void CVRRecView::CVRRecViewModelActivator::DoCancel() |
|
155 { |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator |
|
160 // |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator( CVRRecViewModel* aModel) |
|
164 :CAsyncOneShot(EPriorityNormal), iModel(aModel) |
|
165 { |
|
166 |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator |
|
171 // |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator() |
|
175 { |
|
176 Cancel(); |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator |
|
181 // |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 void CVRRecView::CVRRecViewDialogActivator::SetDialogType(TDialogTypeID aType) |
|
185 { |
|
186 iType = aType; |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CVRRecView::CVRRecViewDialogActivator::SetViewContexts |
|
191 // |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CVRRecView::CVRRecViewDialogActivator::SetViewContexts(TVRRecViewContexts aContext) |
|
195 { |
|
196 iContext = aContext; |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CVRRecView::CVRRecViewDialogActivator::DoCancel |
|
201 // |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 void CVRRecView::CVRRecViewDialogActivator::DoCancel() |
|
205 { |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // CVRRecView::CVRRecViewNoteActivator::RunL |
|
210 // |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 void CVRRecView::CVRRecViewDialogActivator::RunL() |
|
214 { |
|
215 if(iType == EDialogForWaitStorageCard) |
|
216 { |
|
217 TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); |
|
218 while ( !VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) |
|
219 { |
|
220 if (!ShowDialogForWaitStorageCardL()) |
|
221 { |
|
222 iModel->SendExitEvent(); |
|
223 } |
|
224 } |
|
225 // Come to here when driveRemovableMassStorage is valid |
|
226 VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); |
|
227 |
|
228 /***** check if memory is below min value, if yes, close app*****/ |
|
229 RFs& fs(CEikonEnv::Static()->FsSession()); |
|
230 if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) |
|
231 { |
|
232 HBufC* errorText = StringLoader::LoadLC( |
|
233 R_VR_MEMORY_LOW_STOP_WARNING); |
|
234 CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); |
|
235 dlg->ExecuteLD(*errorText); |
|
236 CleanupStack::PopAndDestroy(errorText); |
|
237 iModel->SendExitEvent(); |
|
238 } |
|
239 // check memory size end |
|
240 |
|
241 // To activate view model |
|
242 iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); |
|
243 iModel->SetIsDriveReady(ETrue); |
|
244 iModel->EnterContextL( iContext ); |
|
245 iModel->ActivateL(); |
|
246 } |
|
247 else if(iType == EDialogForWaitUSBPluggingOut) |
|
248 { |
|
249 ShowDialogForWaitUSBPluggingOutL(); |
|
250 iModel->SendExitEvent(); |
|
251 } |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CVRRecView::NewLC |
|
256 // |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 EXPORT_C CVRRecView* CVRRecView::NewLC( TInt aViewResourceId, |
|
260 TInt aModelResourceId ) |
|
261 { |
|
262 CVRRecView* recview = new( ELeave ) CVRRecView; |
|
263 CleanupStack::PushL( recview ); |
|
264 recview->ConstructL( aViewResourceId, aModelResourceId ); |
|
265 |
|
266 return recview; |
|
267 } |
|
268 |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // CVRRecView::~CVRRecView |
|
272 // |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 CVRRecView::~CVRRecView() |
|
276 { |
|
277 if ( iContainer ) |
|
278 { |
|
279 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
280 } |
|
281 |
|
282 if ( iActivationContainer ) |
|
283 { |
|
284 AppUi()->RemoveFromViewStack( *this, iActivationContainer ); |
|
285 } |
|
286 |
|
287 delete iContainer; |
|
288 delete iActivationContainer; |
|
289 delete iDialogActivator; |
|
290 delete iModel; |
|
291 delete iSendUi; |
|
292 delete iModelActivator; |
|
293 delete iLaunchService; |
|
294 delete iUSBStateHandler; |
|
295 |
|
296 if (iUsbWaitDialog) |
|
297 { |
|
298 TRAP_IGNORE(iUsbWaitDialog->ProcessFinishedL()); |
|
299 } |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------------------------- |
|
303 // CVRRecView::ConstructL |
|
304 // |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 void CVRRecView::ConstructL( TInt aViewResourceId, TInt aModelResourceId ) |
|
308 { |
|
309 BaseConstructL( aViewResourceId ); |
|
310 |
|
311 iModel = new( ELeave ) CVRRecViewModel; |
|
312 TResourceReader reader; |
|
313 iEikonEnv->CreateResourceReaderLC( reader, aModelResourceId ); |
|
314 iModel->ConstructFromResourceL( reader ); |
|
315 CleanupStack::PopAndDestroy(); // reader; |
|
316 |
|
317 // Create SendUi (Send as MMS, E-Mail, etc...) |
|
318 iSendUi = CSendUi::NewL(); |
|
319 |
|
320 iModelActivator = new (ELeave) CVRRecViewModelActivator(iModel); |
|
321 |
|
322 iUSBStateHandler = CVRUSBStateHanlder::NewL(this); |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CVRRecView::Id |
|
327 // |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 TUid CVRRecView::Id() const |
|
331 { |
|
332 const TUid KVRRecViewUID = |
|
333 { |
|
334 KVRRecorderViewUID |
|
335 }; |
|
336 |
|
337 return KVRRecViewUID; |
|
338 } |
|
339 |
|
340 |
|
341 // --------------------------------------------------------------------------- |
|
342 // CVRRecView::HandleCommandL |
|
343 // |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 void CVRRecView::HandleCommandL( TInt aCommandId ) |
|
347 { |
|
348 // This command must be acceptable all times. |
|
349 if ( aCommandId == ECmdCancelNote ) |
|
350 { |
|
351 iCommand = aCommandId; |
|
352 if( iModel ) |
|
353 { |
|
354 iModel->HandleCommandL( aCommandId ); |
|
355 } |
|
356 return; |
|
357 } |
|
358 |
|
359 if ( !iModel->CanAcceptCommands() ) |
|
360 { |
|
361 return; |
|
362 } |
|
363 |
|
364 switch ( aCommandId ) |
|
365 { |
|
366 // Don't do anything in case of a Task Swapper command |
|
367 case EAknCmdTaskSwapper: |
|
368 { |
|
369 break; |
|
370 } |
|
371 // No operation |
|
372 case ECmdNOP: |
|
373 { |
|
374 break; |
|
375 } |
|
376 // Go back to voice memo list view |
|
377 case EAknSoftkeyBack: |
|
378 { |
|
379 AppUi()->HandleCommandL( EEikCmdExit ); |
|
380 break; |
|
381 } |
|
382 case ECmdSettings: |
|
383 { |
|
384 // Saving the volume control state before entering settings |
|
385 TBool hasVolumeControl( iModel->HasVolumeControl() ); |
|
386 // Disabling volume control |
|
387 iModel->EnableVolumeControl( EFalse ); |
|
388 iContainer->Update(); |
|
389 |
|
390 AppUi()->HandleCommandL( aCommandId ); |
|
391 |
|
392 // Set volume control as it was before settings dialog |
|
393 iModel->EnableVolumeControl( hasVolumeControl ); |
|
394 iContainer->Update(); |
|
395 break; |
|
396 } |
|
397 case ECmdGoToMyClips: |
|
398 { |
|
399 delete iLaunchService; |
|
400 iLaunchService = NULL; |
|
401 |
|
402 TFileName path; |
|
403 VRUtils::MemoStoreDirectoryL( path ); |
|
404 TInt sortMode = 0; |
|
405 |
|
406 CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); |
|
407 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( |
|
408 path))); |
|
409 inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( |
|
410 sortMode))); |
|
411 iLaunchService = CAknLaunchAppService::NewL( |
|
412 TUid::Uid(0x101F84EB), NULL, inParams); |
|
413 CleanupStack::PopAndDestroy(inParams); |
|
414 break; |
|
415 } |
|
416 case ECmdSendVia: |
|
417 { |
|
418 iModel->SendViaL(iSendUi); |
|
419 break; |
|
420 } |
|
421 |
|
422 // Handles Middle SoftKey presses in this view |
|
423 case ECmdMSK: |
|
424 { |
|
425 // Don't forward the command if dimmed button was clicked or |
|
426 // if model can't handle commands |
|
427 if (iModel->ButtonState(iContainer->FocusedButton()) == EDimmed |
|
428 || !iModel->CanHandleCommands()) |
|
429 { |
|
430 break; |
|
431 } |
|
432 |
|
433 // Fetch the command to execute |
|
434 TInt commandId(iModel->CommandId(iContainer->FocusedButton())); |
|
435 |
|
436 iModel->HandleCommandL(commandId); |
|
437 AppUi()->HandleCommandL(commandId); |
|
438 |
|
439 iContainer->UpdateButtonPanel(EVRUpdateStateChange); |
|
440 break; |
|
441 } |
|
442 case ECmdUSBChange: |
|
443 if (iUsbWaitDialog) |
|
444 { |
|
445 iUsbWaitDialog->ProcessFinishedL(); |
|
446 } |
|
447 iContainer->UpdateButtonPanel(EVRUpdateStateChange); |
|
448 break; |
|
449 default: |
|
450 { |
|
451 iModel->HandleCommandL(aCommandId); |
|
452 AppUi()->HandleCommandL(aCommandId); |
|
453 break; |
|
454 } |
|
455 } |
|
456 } |
|
457 |
|
458 // --------------------------------------------------------------------------- |
|
459 // CVRRecView::DynInitMenuPaneL |
|
460 // |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 void CVRRecView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
464 { |
|
465 |
|
466 switch ( aResourceId ) |
|
467 { |
|
468 case R_VR_REC_MENUPANE_DEFAULT: |
|
469 { |
|
470 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
471 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
472 { |
|
473 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
474 } |
|
475 if (CVRUSBStateHanlder::IsUsbActive()) |
|
476 { |
|
477 aMenuPane->SetItemDimmed(ECmdRecord, ETrue); |
|
478 aMenuPane->SetItemDimmed(ECmdDelete, ETrue); |
|
479 aMenuPane->SetItemDimmed(ECmdRename, ETrue); |
|
480 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); |
|
481 } |
|
482 |
|
483 TRAP_IGNORE(AddSendToMenuL( aResourceId, aMenuPane )); |
|
484 |
|
485 break; |
|
486 } |
|
487 |
|
488 case R_VR_REC_MENUPANE_VIEWER: |
|
489 { |
|
490 TUid appuid( KNullUid ); |
|
491 CEikAppUi* container = iEikonEnv->EikAppUi()->ContainerAppUi(); |
|
492 if ( container ) |
|
493 { |
|
494 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
495 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
496 { |
|
497 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
498 } |
|
499 |
|
500 if (CVRUSBStateHanlder::IsUsbActive()) |
|
501 { |
|
502 aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue); |
|
503 } |
|
504 |
|
505 appuid = container->Application()->AppDllUid(); |
|
506 if ((appuid == KUidMmsEditor) || (appuid == KUidMailEditor)) |
|
507 { |
|
508 aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue); |
|
509 } |
|
510 else |
|
511 { |
|
512 TRAP_IGNORE(AddSendToMenuL(aResourceId, aMenuPane)); |
|
513 } |
|
514 } |
|
515 |
|
516 break; |
|
517 } |
|
518 case R_VR_SETTINGS_MENUPANE: |
|
519 { |
|
520 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
521 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
522 { |
|
523 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
524 } |
|
525 break; |
|
526 } |
|
527 |
|
528 case R_VR_REC_MENUPANE_DELETED: |
|
529 { |
|
530 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
531 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
532 { |
|
533 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
534 } |
|
535 |
|
536 if (CVRUSBStateHanlder::IsUsbActive()) |
|
537 { |
|
538 aMenuPane->SetItemDimmed(ECmdRecord, ETrue); |
|
539 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); |
|
540 |
|
541 } |
|
542 |
|
543 // if recording already started, not allow to start recording again. |
|
544 if (iModel->GetInRecordingFlag()) |
|
545 { |
|
546 aMenuPane->SetItemDimmed(ECmdRecord, ETrue); |
|
547 aMenuPane->SetItemDimmed(ECmdSettings, ETrue); |
|
548 iModel->SetInRecordingFlag(EFalse); |
|
549 } |
|
550 |
|
551 if (CVRUSBStateHanlder::IsUsbActive()) |
|
552 { |
|
553 aMenuPane->SetItemDimmed(ECmdRecord, ETrue); |
|
554 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); |
|
555 } |
|
556 |
|
557 break; |
|
558 } |
|
559 |
|
560 case R_VR_REC_MENUPANE_INCALL_RECORDING_DISABLED: |
|
561 { |
|
562 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
563 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
564 { |
|
565 aMenuPane->SetItemDimmed(ECmdHelp, ETrue); |
|
566 } |
|
567 |
|
568 if (CVRUSBStateHanlder::IsUsbActive()) |
|
569 { |
|
570 aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); |
|
571 } |
|
572 break; |
|
573 } |
|
574 |
|
575 case R_VOREC_GS_SETTINGS_MENUPANE: |
|
576 { |
|
577 // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item |
|
578 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
579 { |
|
580 aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); |
|
581 } |
|
582 break; |
|
583 } |
|
584 |
|
585 default: |
|
586 { |
|
587 break; |
|
588 } |
|
589 } |
|
590 } |
|
591 |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // CVRRecView::GetSelectedFilesLC |
|
595 // |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 MDesCArray* CVRRecView::GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const |
|
599 { |
|
600 aStyle = EFocusedItem; |
|
601 return iModel->GetSelectedFilesLC(); |
|
602 } |
|
603 |
|
604 |
|
605 // --------------------------------------------------------------------------- |
|
606 // CVRRecView::DoActivateL |
|
607 // |
|
608 // --------------------------------------------------------------------------- |
|
609 // |
|
610 void CVRRecView::DoActivateL(const TVwsViewId& aPrevViewId, |
|
611 TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
612 { |
|
613 TRAP_IGNORE( ReallyDoActivateL( aPrevViewId, |
|
614 aCustomMessageId, |
|
615 aCustomMessage ) ); |
|
616 |
|
617 } |
|
618 |
|
619 // --------------------------------------------------------------------------- |
|
620 // CVRRecView::DoDeactivate |
|
621 // |
|
622 // --------------------------------------------------------------------------- |
|
623 // |
|
624 void CVRRecView::DoDeactivate() |
|
625 { |
|
626 iModel->Deactivate(); |
|
627 |
|
628 iModel->LeaveContext(); |
|
629 |
|
630 CAknViewAppUi* appUi = AppUi(); |
|
631 if ( iContainer ) |
|
632 { |
|
633 appUi->RemoveFromViewStack( *this, iContainer ); |
|
634 delete iContainer; |
|
635 iContainer = NULL; |
|
636 } |
|
637 |
|
638 if ( iActivationContainer ) |
|
639 { |
|
640 appUi->RemoveFromViewStack( *this, iActivationContainer ); |
|
641 delete iActivationContainer; |
|
642 iActivationContainer = NULL; |
|
643 } |
|
644 |
|
645 } |
|
646 |
|
647 |
|
648 // --------------------------------------------------------------------------- |
|
649 // CVRRecView::ViewDeactivated |
|
650 // |
|
651 // --------------------------------------------------------------------------- |
|
652 // |
|
653 void CVRRecView::ViewDeactivated() |
|
654 { |
|
655 #ifdef _DEBUG |
|
656 RDebug::Print( _L( "CVRRecView::ViewDeactivated" )); |
|
657 #endif |
|
658 |
|
659 TInt err = 0; |
|
660 |
|
661 if (!iModel->IncomingCall() && (iModel->VisualStateId() == EStatePlaying |
|
662 || iModel->VisualStateId() == EStateRecording)) |
|
663 { |
|
664 |
|
665 if (iModel->VisualStateId() == EStateRecording && iCommand |
|
666 == ECmdCancelNote) |
|
667 { |
|
668 TRAP_IGNORE (iModel->HandleCommandL( ECmdSaveAttachment )); |
|
669 } |
|
670 |
|
671 // Is autolock activating? |
|
672 RProperty prop; |
|
673 TInt val; |
|
674 prop.Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val ); |
|
675 |
|
676 if ( val == EAutolockOff && //Do not pause when focus is lost because of autolock |
|
677 !iModel->GetIfStopCalled()) |
|
678 { |
|
679 |
|
680 //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change |
|
681 #ifdef __AAC_ENCODER_PLUGIN |
|
682 if ((iModel->Quality() == EQualityHigh) && (GetStateId() |
|
683 == EStateRecording)) |
|
684 { |
|
685 TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); |
|
686 } |
|
687 else |
|
688 { |
|
689 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
690 } |
|
691 |
|
692 #else |
|
693 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
694 #endif |
|
695 |
|
696 |
|
697 if( err ) |
|
698 { |
|
699 #ifdef _DEBUG |
|
700 RDebug::Print( |
|
701 _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), |
|
702 err); |
|
703 #endif |
|
704 } |
|
705 } |
|
706 |
|
707 } |
|
708 else |
|
709 { |
|
710 TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); |
|
711 } |
|
712 |
|
713 CAknView::ViewDeactivated(); |
|
714 } |
|
715 |
|
716 |
|
717 // --------------------------------------------------------------------------- |
|
718 // CVRRecView::ViewActivatedL |
|
719 // The model's ActivateL() function is called to invoke any functionality |
|
720 // required when the UI is activated (e.g., for In-call recording diabling |
|
721 // feature) |
|
722 // --------------------------------------------------------------------------- |
|
723 // |
|
724 void CVRRecView::ViewActivatedL(const TVwsViewId& aPrevViewId, |
|
725 TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
726 { |
|
727 // dismiss sound player / file manager if it was active so that recording |
|
728 // view becomes visible |
|
729 delete iLaunchService; |
|
730 iLaunchService = NULL; |
|
731 |
|
732 iModel->ActivateL(); |
|
733 |
|
734 CAknView::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
735 } |
|
736 |
|
737 |
|
738 // --------------------------------------------------------------------------- |
|
739 // CVRRecView::Cba |
|
740 // |
|
741 // --------------------------------------------------------------------------- |
|
742 // |
|
743 CEikButtonGroupContainer* CVRRecView::Cba() const |
|
744 { |
|
745 return CAknView::Cba(); |
|
746 } |
|
747 |
|
748 |
|
749 // --------------------------------------------------------------------------- |
|
750 // CVRRecView::AddSendToMenuL |
|
751 // Use CSendAppUi to display the Send cascade |
|
752 // --------------------------------------------------------------------------- |
|
753 // |
|
754 void CVRRecView::AddSendToMenuL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
755 { |
|
756 // If the focused file is closed content (e.g. a DRM file or a protected |
|
757 // MIDI file), the whole Send option mustn't be shown. |
|
758 CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC(); |
|
759 MDesCArray* filenames = iModel->GetSelectedFilesLC(); |
|
760 if (filenames->MdcaCount() > 0 && !ccp->IsClosedFileL( |
|
761 filenames->MdcaPoint(0))) |
|
762 { |
|
763 // Set proper capabilities |
|
764 TSendingCapabilities capabilities(0, KVRSendUiMsgSize, |
|
765 TSendingCapabilities::ESupportsAttachments); |
|
766 |
|
767 // We want the send menuitem after a specific item |
|
768 TInt itemPosForSend(0); |
|
769 if (aResourceId == R_VR_REC_MENUPANE_DEFAULT) |
|
770 { |
|
771 aMenuPane->ItemAndPos(ECmdRename, itemPosForSend); |
|
772 } |
|
773 else if (aResourceId == R_VR_REC_MENUPANE_VIEWER) |
|
774 { |
|
775 aMenuPane->ItemAndPos(ECmdSaveAttachment, itemPosForSend); |
|
776 } |
|
777 itemPosForSend++; |
|
778 if (!CVRUSBStateHanlder::IsUsbActive()) |
|
779 { |
|
780 iSendUi->AddSendMenuItemL(*aMenuPane, itemPosForSend, |
|
781 ECmdSendVia, capabilities); |
|
782 } |
|
783 } |
|
784 CleanupStack::PopAndDestroy(2); // ccp, filenames |
|
785 } |
|
786 |
|
787 // --------------------------------------------------------------------------- |
|
788 // CVRRecView::LayoutChangedL |
|
789 // |
|
790 // --------------------------------------------------------------------------- |
|
791 // |
|
792 void CVRRecView::LayoutChangedL( TInt aType ) |
|
793 { |
|
794 if ( iContainer ) |
|
795 { |
|
796 iContainer->SetRect( ClientRect() ); |
|
797 iContainer->HandleResourceChangeL( aType ); |
|
798 } |
|
799 } |
|
800 |
|
801 |
|
802 // --------------------------------------------------------------------------- |
|
803 // CVRRecView::ReallyDoActivateL |
|
804 // |
|
805 // --------------------------------------------------------------------------- |
|
806 // |
|
807 void CVRRecView::ReallyDoActivateL(const TVwsViewId& /*aPrevViewId*/, |
|
808 TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/) |
|
809 { |
|
810 // Don't do anything if activation is ongoing |
|
811 if (iActivationContainer) |
|
812 { |
|
813 return; |
|
814 } |
|
815 |
|
816 // If container exists, we have already been activated |
|
817 // Deactivate needed before new activation. |
|
818 if (iContainer) |
|
819 { |
|
820 DoDeactivate(); |
|
821 } |
|
822 |
|
823 // Display an empty UI container until model has been fully activated |
|
824 iActivationContainer = new( ELeave ) CVRRecViewActivationContainer; |
|
825 iActivationContainer->ConstructL( ClientRect() ); |
|
826 CAknViewAppUi* appUi = AppUi(); |
|
827 appUi->AddToViewStackL( *this, iActivationContainer ); |
|
828 iActivationContainer->ActivateL(); |
|
829 |
|
830 iDialogActivator = new( ELeave ) CVRRecViewDialogActivator(iModel); |
|
831 CheckDriveState(); |
|
832 |
|
833 // Activate model in correct context asynchronically. |
|
834 // iContainer will be activated trough callback after model activation |
|
835 TCallBack cb(ActivationCallBack, this); |
|
836 iContext = static_cast<TVRRecViewContexts> (aCustomMessageId.iUid); |
|
837 iDialogActivator->SetViewContexts(iContext); |
|
838 iModelActivator->Activate(iContext , cb); |
|
839 |
|
840 // Construct the real container |
|
841 iContainer = new (ELeave) CVRRecViewContainer; |
|
842 iContainer->ConstructL(ClientRect(), iModel, iModel, iModel, this); |
|
843 iContainer->SetKeyObserver(iModel); |
|
844 iContainer->SetVolumeChangeObserver(iModel); |
|
845 } |
|
846 |
|
847 // --------------------------------------------------------------------------- |
|
848 // CVRRecView::CheckDriveState |
|
849 // |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CVRRecView::CheckDriveState() |
|
853 { |
|
854 TInt memoDrive = VRUtils::MemoDriveL(); |
|
855 if (VRUtils::DriveValid(memoDrive)) |
|
856 { |
|
857 VRUtils::SetMemoDriveL((TDriveNumber) memoDrive); |
|
858 } |
|
859 else |
|
860 { |
|
861 TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC |
|
862 if (defaultDrive == memoDrive) |
|
863 { |
|
864 SetDriveL(); |
|
865 } |
|
866 else |
|
867 { |
|
868 if (VRUtils::DriveValid(defaultDrive)) |
|
869 { |
|
870 VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive); |
|
871 } |
|
872 else |
|
873 { |
|
874 SetDriveL(); |
|
875 } |
|
876 } |
|
877 } |
|
878 |
|
879 |
|
880 if (iModel->GetIsDriveReady() && CVRUSBStateHanlder::IsUsbActive()) |
|
881 { |
|
882 iModel->SetIsDriveReady(EFalse); |
|
883 iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); |
|
884 iDialogActivator->Call(); |
|
885 } |
|
886 |
|
887 |
|
888 if(iModel->GetIsDriveReady()) |
|
889 { |
|
890 /***** check if memory is below min value, if yes, close app*****/ |
|
891 RFs& fs(CEikonEnv::Static()->FsSession()); |
|
892 if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) |
|
893 { |
|
894 HBufC* errorText = StringLoader::LoadLC( |
|
895 R_VR_MEMORY_LOW_STOP_WARNING); |
|
896 CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); |
|
897 dlg->ExecuteLD(*errorText); |
|
898 CleanupStack::PopAndDestroy(errorText); |
|
899 iModel->SendExitEvent(); |
|
900 } |
|
901 // check memory size end |
|
902 } |
|
903 } |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // Make user insert the SD card, and choose SD card as the memo storage |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 void CVRRecView::SetDriveL() |
|
910 { |
|
911 TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); |
|
912 if ( VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) |
|
913 { |
|
914 VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); |
|
915 } |
|
916 else |
|
917 { |
|
918 iModel->SetIsDriveReady(EFalse); |
|
919 if (CVRUSBStateHanlder::IsUsbActive()) |
|
920 { |
|
921 iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); |
|
922 iDialogActivator->Call(); |
|
923 } |
|
924 else |
|
925 { |
|
926 iDialogActivator->SetDialogType(EDialogForWaitStorageCard); |
|
927 iDialogActivator->Call(); |
|
928 } |
|
929 } |
|
930 } |
|
931 |
|
932 // --------------------------------------------------------------------------- |
|
933 // This method show a dialog to warn user to insert the SD card. |
|
934 // --------------------------------------------------------------------------- |
|
935 // |
|
936 TBool CVRRecView::ShowDialogForWaitStorageCardL() |
|
937 { |
|
938 HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC ); |
|
939 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
940 TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) ); |
|
941 CleanupStack::PopAndDestroy( text ); |
|
942 |
|
943 if ( result ) |
|
944 { |
|
945 return ETrue; |
|
946 } |
|
947 return EFalse; |
|
948 } |
|
949 |
|
950 // --------------------------------------------------------------------------- |
|
951 // CVRRecView::SetFileHandle |
|
952 // |
|
953 // --------------------------------------------------------------------------- |
|
954 // |
|
955 void CVRRecView::SetFileHandle( RFile& aFile ) |
|
956 { |
|
957 iModel->SetFileHandle( aFile ); |
|
958 } |
|
959 |
|
960 |
|
961 // --------------------------------------------------------------------------- |
|
962 // CVRRecView::GetFile |
|
963 // |
|
964 // --------------------------------------------------------------------------- |
|
965 // |
|
966 RFile& CVRRecView::GetFile() |
|
967 { |
|
968 return iModel->MemoFileHandle(); |
|
969 } |
|
970 |
|
971 |
|
972 // --------------------------------------------------------------------------- |
|
973 // CVRRecView::ActivationCallBack |
|
974 // |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 TInt CVRRecView::ActivationCallBack( TAny* aRecView ) |
|
978 { |
|
979 CVRRecView* view = reinterpret_cast< CVRRecView* >( aRecView ); |
|
980 TRAP_IGNORE( view->ActivateContainerL() ); |
|
981 return ETrue; |
|
982 } |
|
983 |
|
984 |
|
985 // --------------------------------------------------------------------------- |
|
986 // CVRRecView::ActivateContainerL |
|
987 // |
|
988 // --------------------------------------------------------------------------- |
|
989 // |
|
990 void CVRRecView::ActivateContainerL() |
|
991 { |
|
992 // Activate the actual container and remove |
|
993 // the one used during model construction |
|
994 CAknViewAppUi* appUi = AppUi(); |
|
995 appUi->AddToViewStackL( *this, iContainer ); |
|
996 iContainer->ActivateL(); |
|
997 |
|
998 // Delete the empty container, it's not needed anymore |
|
999 if ( iActivationContainer ) |
|
1000 { |
|
1001 appUi->RemoveFromViewStack( *this, iActivationContainer ); |
|
1002 delete iActivationContainer; |
|
1003 iActivationContainer = NULL; |
|
1004 } |
|
1005 |
|
1006 } |
|
1007 |
|
1008 TUint CVRRecView::GetStateId() const |
|
1009 { |
|
1010 // if (iModel) |
|
1011 return iModel->VisualStateId(); |
|
1012 } |
|
1013 |
|
1014 |
|
1015 // --------------------------------------------------------------------------- |
|
1016 // CVRRecView::IsEmbedded |
|
1017 // |
|
1018 // --------------------------------------------------------------------------- |
|
1019 // |
|
1020 TBool CVRRecView::IsEmbedded() const |
|
1021 { |
|
1022 |
|
1023 return iModel->IsEmbedded(); |
|
1024 |
|
1025 } |
|
1026 |
|
1027 |
|
1028 // --------------------------------------------------------------------------- |
|
1029 //Returns the active quality setting. |
|
1030 //return Quality setting of the active memo |
|
1031 // --------------------------------------------------------------------------- |
|
1032 TVRQuality CVRRecView::Quality() const |
|
1033 { |
|
1034 return iModel->Quality(); |
|
1035 } |
|
1036 |
|
1037 TInt CVRRecView::HandleUsbPlugInL() |
|
1038 { |
|
1039 if(MenuBar()->IsDisplayed()) |
|
1040 { |
|
1041 MenuBar()->StopDisplayingMenuBar(); |
|
1042 MenuBar()->TryDisplayMenuBarL(); |
|
1043 } |
|
1044 |
|
1045 if (EStateRecording == iModel->VisualStateId() || EStateRecordingPaused |
|
1046 == iModel->VisualStateId() || EStatePlaying |
|
1047 == iModel->VisualStateId() || EStatePlayingPaused |
|
1048 == iModel->VisualStateId()) |
|
1049 { |
|
1050 HandleCommandL(ECmdStop); |
|
1051 } |
|
1052 |
|
1053 if (EStateIdleEmbedded == iModel->VisualStateId() || EStateRecordEmbedded |
|
1054 == iModel->VisualStateId() || EStateIdleRecordEmbedded |
|
1055 == iModel->VisualStateId()) |
|
1056 { |
|
1057 ShowDialogForWaitUSBPluggingOutL(); |
|
1058 AppUi()->Exit(); |
|
1059 } |
|
1060 |
|
1061 HandleCommandL(ECmdUSBChange); |
|
1062 if(iUsbWaitDialog == NULL) |
|
1063 WaitDialogForUSBPluggingOut(iUsbWaitDialog); |
|
1064 return KErrNone; |
|
1065 } |
|
1066 |
|
1067 TInt CVRRecView::HandleUsbPlugOutL() |
|
1068 { |
|
1069 if(MenuBar()->IsDisplayed()) |
|
1070 { |
|
1071 MenuBar()->StopDisplayingMenuBar(); |
|
1072 MenuBar()->TryDisplayMenuBarL(); |
|
1073 } |
|
1074 |
|
1075 |
|
1076 HandleCommandL(ECmdUSBChange); |
|
1077 |
|
1078 if(!VRUtils::DriveValid(VRUtils::MemoDriveL())) |
|
1079 { |
|
1080 iModel->SendExitEvent(); |
|
1081 } |
|
1082 return KErrNone; |
|
1083 } |
|
1084 |
|
1085 void CVRRecView::DialogDismissedL(TInt /*aButtonId*/) |
|
1086 { |
|
1087 HandleCommandL(ECmdUSBChange); |
|
1088 } |
|
1089 |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // Called by UI Framework when view switches to and from foreground |
|
1092 // --------------------------------------------------------------------------- |
|
1093 /* |
|
1094 void CVRRecView::HandleForegroundEventL( TBool aForeground ) |
|
1095 { |
|
1096 // If the view is going to background, pause recording for stand alone |
|
1097 // application mode |
|
1098 if ( !aForeground && !iModel->IsEmbedded() && iCommand != ECmdCancelNote ) |
|
1099 { |
|
1100 TInt err(0); |
|
1101 if ( !iModel->IncomingCall() && ( iModel->VisualStateId() == EStatePlaying ||iModel->VisualStateId() == EStateRecording ) ) |
|
1102 { |
|
1103 //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change |
|
1104 #ifdef __AAC_ENCODER_PLUGIN |
|
1105 if ((iModel->Quality() == EQualityHigh) && (GetStateId() == EStateRecording)) |
|
1106 { |
|
1107 TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); |
|
1108 } |
|
1109 else |
|
1110 { |
|
1111 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
1112 } |
|
1113 |
|
1114 #else |
|
1115 TRAP( err, iModel->HandleCommandL( ECmdPause ) ); |
|
1116 #endif |
|
1117 |
|
1118 if( err ) |
|
1119 { |
|
1120 #ifdef _DEBUG |
|
1121 RDebug::Print( _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), err ); |
|
1122 #endif |
|
1123 } |
|
1124 } |
|
1125 else |
|
1126 { |
|
1127 TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); |
|
1128 } |
|
1129 } |
|
1130 |
|
1131 // iCommand = 0; |
|
1132 |
|
1133 // Forward to handle default event handling. |
|
1134 CAknView::HandleForegroundEventL(aForeground); |
|
1135 } |
|
1136 */ |
|