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