|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Post-capture view class for Camera application* |
|
15 */ |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <sendnorm.rsg> |
|
20 #include <sendui.h> |
|
21 #include <SenduiMtmUids.h> |
|
22 #ifndef __WINS__ |
|
23 // #include <SFIUtilsAppInterface.h> |
|
24 #endif |
|
25 #include <eikbtgpc.h> |
|
26 #include <avkon.rsg> |
|
27 #include <cameraapp.rsg> |
|
28 #include <vgacamsettings.rsg> |
|
29 #include <aknradiobuttonsettingpage.h> |
|
30 #include <akntextsettingpage.h> |
|
31 #include <akntitle.h> // CAknTitlePane |
|
32 #include <CMessageData.h> |
|
33 #include "MCamAddToAlbumObserver.h" |
|
34 #include "CamCollectionManagerAo.h" |
|
35 #include <glxmetadataviewutility.h> |
|
36 #include <glxcollectionselectionpopup.h> |
|
37 #include <akntoolbar.h> |
|
38 #include <aknbutton.h> |
|
39 #include <StringLoader.h> |
|
40 |
|
41 |
|
42 #include "Cam.hrh" |
|
43 #include "CamUtility.h" |
|
44 #include "CamPostCaptureViewBase.h" |
|
45 #include "CamAppController.h" |
|
46 #include "CamAppUi.h" |
|
47 #include "CamLogger.h" |
|
48 #include "camactivepalettehandler.h" |
|
49 #include "CamPostCaptureContainer.h" |
|
50 #include "camoneclickuploadutility.h" |
|
51 #include "CameraUiConfigManager.h" |
|
52 |
|
53 |
|
54 |
|
55 //CONSTANTS |
|
56 |
|
57 |
|
58 const TInt KCamSendUiBodySize = 0; |
|
59 const TInt KCamSendUiMessageSize = 0; |
|
60 |
|
61 |
|
62 const TUint KCamSendAsArrayGranularity = 1; |
|
63 |
|
64 |
|
65 // ========================= MEMBER FUNCTIONS ================================ |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CCamPostCaptureViewBase::~CCamPostCaptureViewBase |
|
69 // Destructor |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CCamPostCaptureViewBase::~CCamPostCaptureViewBase() |
|
73 { |
|
74 PRINT( _L("Camera => ~CCamPostCaptureViewBase") ); |
|
75 delete iSendAppUi; |
|
76 delete iSendMtmsToDim; |
|
77 |
|
78 if ( iAiwServiceHandler ) |
|
79 { |
|
80 // unload service provider if any |
|
81 iAiwServiceHandler->Reset(); |
|
82 delete iAiwServiceHandler; |
|
83 } |
|
84 |
|
85 #ifndef __WINS__ |
|
86 iSFIUtils = NULL; // Not owned |
|
87 #endif // __WINS__ |
|
88 |
|
89 |
|
90 if ( iCollectionManagerCallBack ) |
|
91 { |
|
92 delete iCollectionManagerCallBack; |
|
93 iCollectionManagerCallBack = NULL; |
|
94 } |
|
95 delete iOneClickUploadUtility; |
|
96 |
|
97 PRINT( _L("Camera <= ~CCamPostCaptureViewBase") ); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CCamPostCaptureViewBase::HandleCommandL |
|
102 // Handle commands |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CCamPostCaptureViewBase::HandleCommandL( TInt aCommand ) |
|
106 { |
|
107 PRINT1( _L("Camera => CCamPostCaptureViewBase::HandleCommandL (%d)"), aCommand ) |
|
108 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
109 switch ( aCommand ) |
|
110 { |
|
111 case ECamCmdOneClickUpload: |
|
112 { |
|
113 iOneClickUploadUtility->UploadL( |
|
114 iController.CurrentFullFileName() ); |
|
115 break; |
|
116 } |
|
117 case ECamCmdToggleActiveToolbar: |
|
118 { |
|
119 // If in the Landscape mode, MSK event is mapped |
|
120 // like a normal selection key so that AP items |
|
121 // are selected and respective setting pages are launched´ |
|
122 // refer to @ProcessCommandL, since we get here only from there |
|
123 TKeyEvent aKeyEvent; |
|
124 aKeyEvent.iCode = aKeyEvent.iRepeats = aKeyEvent.iModifiers = 0; |
|
125 aKeyEvent.iScanCode = EStdKeyDevice3; |
|
126 static_cast<CCamContainerBase*> |
|
127 ( Container() )->OfferKeyEventL( aKeyEvent, EEventKey ); |
|
128 break; |
|
129 } |
|
130 case EAknSoftkeyBack: |
|
131 { |
|
132 iController.DeepSleepTimerCancel(); |
|
133 appUi->HandleCommandL( aCommand ); |
|
134 } |
|
135 break; |
|
136 |
|
137 case ECamCmdSend: |
|
138 case ECamCmdSendToCallerMultimedia: |
|
139 case ECamCmdQuickSend: |
|
140 { |
|
141 /* TBool inCall = EFalse; |
|
142 #if !defined(__WINS__) && !defined(__WINSCW__) |
|
143 inCall = iSFIUtils->IsCLIValidL(); |
|
144 #endif */ |
|
145 //use both inCall and InCallOrRinging() conditions to make sure if it is in call state |
|
146 if ( /*inCall &&*/ iController.InCallOrRinging() ) |
|
147 { |
|
148 #ifndef __WINS__ |
|
149 DoInCallSendL(); |
|
150 #endif |
|
151 } |
|
152 else |
|
153 { |
|
154 DoSendAsL(); |
|
155 } |
|
156 } |
|
157 break; |
|
158 |
|
159 case ECamCmdExitStandby: |
|
160 { |
|
161 // leave standby mode |
|
162 ExitStandbyModeL(); |
|
163 } |
|
164 break; |
|
165 case ECamCmdToggleCourtesyUI: |
|
166 { |
|
167 /* |
|
168 * EFalse --> We just hide the AP tool bar |
|
169 * ETrue --> We show the AP tool bar |
|
170 * In this case, we dont toggle the UI between Show/Hide icons so |
|
171 * we send EFalse as a parameter to SetAlwaysDrawPostCaptureCourtesyUI method |
|
172 */ |
|
173 if ( appUi ) |
|
174 { |
|
175 appUi->SetAlwaysDrawPostCaptureCourtesyUI( EFalse ); |
|
176 } |
|
177 break; |
|
178 } |
|
179 case ECamCmdProperties: |
|
180 { |
|
181 // Passing the name of the current file |
|
182 // Asking the MetadataViewUtility to lauch an view for us |
|
183 CEikStatusPane* sp = StatusPane(); |
|
184 CAknTitlePane* title = |
|
185 static_cast<CAknTitlePane*>( sp->ControlL( |
|
186 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
187 title->SetTextL( KNullDesC ); |
|
188 sp->MakeVisible( ETrue ); |
|
189 title->MakeVisible( ETrue ); |
|
190 iContainer->SetRect( AppUi()->ClientRect() ); |
|
191 GlxMetadataViewUtility::ActivateViewL( iController.CurrentFullFileName() ); |
|
192 static_cast<CCamContainerBase*>(iContainer)->CheckForFileName( ETrue ); |
|
193 title->MakeVisible( EFalse ); |
|
194 sp->MakeVisible( EFalse ); |
|
195 iContainer->SetRect( AppUi()->ApplicationRect() ); |
|
196 break; |
|
197 } |
|
198 // Add Photo/Video to the album |
|
199 case ECamCmdAddToAlbum: |
|
200 { |
|
201 |
|
202 /* |
|
203 * Status = 0 ( User confirms add to album operation ) |
|
204 * Status = 1 ( User cancels add to album operation ) |
|
205 */ |
|
206 /*TInt status = ShowAddToAlbumConfirmationQueryL(); |
|
207 if ( status == 0 ) |
|
208 { |
|
209 StartAddToAlbumOperationL(); |
|
210 } |
|
211 else |
|
212 { // Lint warnings |
|
213 }*/ |
|
214 StartAddToAlbumOperationL(); |
|
215 } |
|
216 break; |
|
217 default: |
|
218 { |
|
219 CCamViewBase::HandleCommandL( aCommand ); |
|
220 } |
|
221 } |
|
222 |
|
223 PRINT1( _L("Camera <= CCamPostCaptureViewBase::HandleCommandL (%d)"), aCommand ) |
|
224 } |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CCamPostCaptureViewBase::HandleControllerEventL |
|
228 // Handle user menu selections |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 void |
|
232 CCamPostCaptureViewBase::HandleControllerEventL( TCamControllerEvent aEvent, |
|
233 TInt /*aError*/ ) |
|
234 { |
|
235 PRINT( _L("Camera => CCamPostCaptureViewBase::HandleControllerEventL") ); |
|
236 |
|
237 switch( aEvent ) |
|
238 { |
|
239 // ----------------------------------------------------- |
|
240 case ECamEventCallStateChanged: |
|
241 { |
|
242 PRINT( _L("Camera <> case ECamEventCallStateChanged") ); |
|
243 |
|
244 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
245 |
|
246 // Reset the Send and Send to caller items in the active toolbar |
|
247 if ( !iEmbedded ) |
|
248 { |
|
249 CCamActivePaletteHandler* apHandler = appUi->APHandler(); |
|
250 // Hide Send or Send to caller |
|
251 ResetSendAvailabilityL( apHandler ); |
|
252 if ( iController.IsTouchScreenSupported() ) |
|
253 { |
|
254 UpdateToolbarIconsL(); |
|
255 } |
|
256 else |
|
257 { |
|
258 UpdateActivePaletteItemsL(); |
|
259 } |
|
260 } |
|
261 break; |
|
262 } |
|
263 // ----------------------------------------------------- |
|
264 case ECamEventSaveComplete: |
|
265 case ECamEventSnapshotReady: |
|
266 { |
|
267 if ( ECamEventSaveComplete == aEvent && |
|
268 iWaitForImageSave && |
|
269 !iController.IsTouchScreenSupported() ) |
|
270 { |
|
271 UpdateActivePaletteItemsL(); |
|
272 } |
|
273 static_cast<CCamContainerBase*>(iContainer)->CheckForFileName( EFalse ); |
|
274 // Check that the file that has just completed is the one just taken |
|
275 if ( iController.SavedCurrentImage() |
|
276 && iController.IsAppUiAvailable() |
|
277 )//&& iWaitForImageSave ) |
|
278 { |
|
279 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
280 // check whether embedded or not |
|
281 if ( iEmbedded ) |
|
282 { |
|
283 //Do not show postcapture softkeys if we are still capturing or |
|
284 //saving image |
|
285 if ( iController.CurrentOperation() != ECamCapturing && |
|
286 iController.CurrentOperation() != ECamCompleting ) |
|
287 { |
|
288 if ( !appUi->IsSecondCameraEnabled() || appUi->IsQwerty2ndCamera() ) |
|
289 { |
|
290 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT ); |
|
291 } |
|
292 else |
|
293 { |
|
294 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT_SECONDARY ); |
|
295 } |
|
296 } |
|
297 else |
|
298 { |
|
299 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK ); |
|
300 } |
|
301 } |
|
302 else |
|
303 { |
|
304 appUi->RaisePostCaptureCourtesyUI(); |
|
305 if ( appUi->IsSecondCameraEnabled() && !appUi->IsQwerty2ndCamera() ) |
|
306 { |
|
307 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR_PORTRAIT ); |
|
308 } |
|
309 else if ( ECamViewStateBurstThumbnail == appUi ->CurrentViewState() ) |
|
310 { |
|
311 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR_BURST ); |
|
312 } |
|
313 else |
|
314 { |
|
315 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR ); |
|
316 } |
|
317 |
|
318 // image processing complete, enable gallery button |
|
319 if( !iEmbedded ) |
|
320 { |
|
321 // fixed toolbar is used only with touch devices |
|
322 if ( iController.IsTouchScreenSupported() ) |
|
323 { |
|
324 CAknToolbar* fixedToolbar = Toolbar(); |
|
325 if ( fixedToolbar ) |
|
326 { |
|
327 fixedToolbar->SetItemDimmed( ECamCmdPhotos, EFalse, ETrue ); |
|
328 fixedToolbar->SetItemDimmed( ECamCmdDelete, EFalse, ETrue ); |
|
329 fixedToolbar->SetItemDimmed( ECamCmdOneClickUpload, EFalse, ETrue ); |
|
330 fixedToolbar->SetItemDimmed( ECamCmdSend, EFalse, ETrue ); |
|
331 } |
|
332 } |
|
333 } |
|
334 } |
|
335 iWaitForImageSave = EFalse; |
|
336 } |
|
337 break; |
|
338 } |
|
339 |
|
340 case ECamEventSliderClosed: |
|
341 { |
|
342 // if embedded and the slider is closed, close the menu |
|
343 if( iEmbedded ) |
|
344 { |
|
345 PRINT( _L("Camera => CCamPostCaptureViewBase -> ECamEventSliderClosed") ); |
|
346 StopDisplayingMenuBar(); |
|
347 } |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------- |
|
351 default: |
|
352 break; |
|
353 // ----------------------------------------------------- |
|
354 } // switch |
|
355 PRINT( _L("Camera <= CCamPostCaptureViewBase::HandleControllerEventL") ); |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CCamPostCaptureViewBase::HandleForegroundEventL |
|
360 // Handle foreground event |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 void |
|
364 CCamPostCaptureViewBase::HandleForegroundEventL( TBool aForeground ) |
|
365 { |
|
366 PRINT( _L("Camera => CCamPostCaptureViewBase::HandleForegroundEventL") ) |
|
367 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
368 // ------------------------------------------------------- |
|
369 // Coming to foreground |
|
370 if ( aForeground) |
|
371 { |
|
372 PRINT( _L("Camera <> CCamPostCaptureViewBase::HandleForegroundEventL: to foreground") ) |
|
373 if ( static_cast<CCamAppUiBase*>( AppUi() )->IsInPretendExit() ) |
|
374 { |
|
375 PRINT( _L("Camera <> CCamPostCaptureViewBase::HandleForegroundEventL: app in pretend exit so not grabbing the engine") ) |
|
376 // The view can get a foreground event while the application is |
|
377 // actually in a pretend exit situation. This occurs when the view switch |
|
378 // was called before the exit event, but didn't complete until after the |
|
379 // exit event. In this case the view should not register an interest in |
|
380 // the engine as the application is really in the background and the resources |
|
381 // need to be released |
|
382 return; |
|
383 } |
|
384 |
|
385 // set embedded flag here |
|
386 iEmbedded = appUi->IsEmbedded(); |
|
387 // need to update cba according to whether we are embedded or not |
|
388 if ( iEmbedded ) |
|
389 { |
|
390 PRINT( _L("Camera <> CCamPostCaptureViewBase::HandleForegroundEventL: embedded mode") ); |
|
391 //Do not show postcapture softkeys if we are still capturing or |
|
392 //saving image |
|
393 if ( iController.CurrentOperation() != ECamCapturing && |
|
394 iController.CurrentOperation() != ECamCompleting ) |
|
395 { |
|
396 if ( !appUi->IsSecondCameraEnabled() || appUi->IsQwerty2ndCamera() ) |
|
397 { |
|
398 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT ); |
|
399 } |
|
400 else |
|
401 { |
|
402 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT_SECONDARY ); |
|
403 } |
|
404 } |
|
405 else |
|
406 { |
|
407 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK ); |
|
408 } |
|
409 } |
|
410 else |
|
411 { |
|
412 // ensure cba is reset if we're not embedded |
|
413 if ( !iWaitForImageSave ) |
|
414 { |
|
415 if ( static_cast<CCamAppUiBase*>( AppUi() )->IsSecondCameraEnabled() && |
|
416 !static_cast<CCamAppUiBase*>( AppUi() )->IsQwerty2ndCamera() ) |
|
417 { |
|
418 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR_PORTRAIT ); |
|
419 } |
|
420 else if ( ECamViewStateBurstThumbnail == appUi ->CurrentViewState() ) |
|
421 { |
|
422 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR_BURST ); |
|
423 } |
|
424 else |
|
425 { |
|
426 SetSoftKeysL( R_CAM_SOFTKEYS_OPTIONS_BACK_TOGGLETOOLBAR ); |
|
427 } |
|
428 } |
|
429 else |
|
430 { |
|
431 // still image not yet saved |
|
432 // disable Options softkey and cancel post capture timer |
|
433 // softkey will be re-enabled when image has been saved |
|
434 if(appUi->IsSecondCameraEnabled() && !appUi->IsQwerty2ndCamera()) |
|
435 { |
|
436 SetSoftKeysL( R_CAM_SOFTKEYS_BACK_SECONDARY ); |
|
437 } |
|
438 else |
|
439 { |
|
440 SetSoftKeysL( R_CAM_SOFTKEYS_BACK ); |
|
441 } |
|
442 |
|
443 |
|
444 // disable gallery button until image is processed |
|
445 if( !iEmbedded ) |
|
446 { |
|
447 // fixed toolbar is used only with touch devices |
|
448 if ( iController.IsTouchScreenSupported() ) |
|
449 { |
|
450 CAknToolbar* fixedToolbar = Toolbar(); |
|
451 if ( fixedToolbar ) |
|
452 { |
|
453 fixedToolbar->SetItemDimmed( ECamCmdPhotos, ETrue, ETrue ); |
|
454 fixedToolbar->SetItemDimmed( ECamCmdDelete, ETrue, ETrue ); |
|
455 fixedToolbar->SetItemDimmed( ECamCmdOneClickUpload, ETrue, ETrue ); |
|
456 fixedToolbar->SetItemDimmed( ECamCmdSend, ETrue, ETrue ); |
|
457 } |
|
458 } |
|
459 } |
|
460 } |
|
461 } |
|
462 // Register that we still want to use the engine (to receive final snap image) |
|
463 IncrementCameraUsers(); |
|
464 |
|
465 iController.DeepSleepTimerStart(); |
|
466 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
467 |
|
468 if ( appUi && !iSuppressAPUntilCameraReady ) |
|
469 { |
|
470 if(!iPartialBackground) |
|
471 { |
|
472 appUi->RaisePostCaptureCourtesyUI(); |
|
473 } |
|
474 } |
|
475 else if ( iSuppressAPUntilCameraReady ) |
|
476 { |
|
477 iSuppressAPUntilCameraReady = EFalse; |
|
478 } |
|
479 iPartialBackground = EFalse; |
|
480 |
|
481 if ( iController.CameraSwitchQueued() ) |
|
482 { |
|
483 appUi->HandleCommandL( ECamCmdSwitchCamera ); |
|
484 } |
|
485 } |
|
486 // ------------------------------------------------------- |
|
487 // Going to background |
|
488 else |
|
489 { |
|
490 if( iController.IsAppUiAvailable() ) |
|
491 { |
|
492 iPartialBackground = ( (appUi->AppInBackground(ETrue) ) && (!appUi->AppInBackground(EFalse) ) ); |
|
493 } |
|
494 else |
|
495 { |
|
496 iPartialBackground = EFalse; |
|
497 } |
|
498 PRINT( _L("Camera <> CCamPostCaptureViewBase::HandleForegroundEventL: to background") ) |
|
499 iController.DeepSleepTimerCancel(); |
|
500 // Register that we nolonger need the engine. |
|
501 // Checks if we incremented the count. |
|
502 DecrementCameraUsers(); |
|
503 } |
|
504 // ------------------------------------------------------- |
|
505 PRINT( _L("Camera <= CCamPostCaptureViewBase::HandleForegroundEventL") ) |
|
506 } |
|
507 |
|
508 |
|
509 // --------------------------------------------------------------------------- |
|
510 // CCamPostCaptureViewBase::DoActivateL |
|
511 // Activate this view |
|
512 // --------------------------------------------------------------------------- |
|
513 // |
|
514 void CCamPostCaptureViewBase::DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, |
|
515 const TDesC8& aCustomMessage ) |
|
516 { |
|
517 PRINT( _L( "Camera => CCamPostCaptureViewBase::DoActivateL" ) ); |
|
518 |
|
519 CCamAppUi* appui = static_cast<CCamAppUi*>( AppUi() ); |
|
520 |
|
521 CCamViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
522 |
|
523 // fixed toolbar is used only with touch devices |
|
524 if ( iController.IsTouchScreenSupported() ) |
|
525 { |
|
526 CAknToolbar* fixedToolbar = Toolbar(); |
|
527 |
|
528 if ( fixedToolbar ) |
|
529 { |
|
530 if( iEmbedded ) |
|
531 { |
|
532 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
533 } |
|
534 else |
|
535 { |
|
536 fixedToolbar->SetToolbarObserver( this ); |
|
537 fixedToolbar->SetToolbarVisibility( ETrue ); |
|
538 UpdateToolbarIconsL(); |
|
539 } |
|
540 } |
|
541 } |
|
542 |
|
543 |
|
544 // show an empty pane |
|
545 appui->PushDefaultNaviPaneL(); |
|
546 |
|
547 iController.AddControllerObserverL( this ); |
|
548 |
|
549 // if we're embedded use ROID(R_CAM_SOFTKEYS_SELECT_DELETE_ID)softkey labels |
|
550 if ( iEmbedded ) |
|
551 { |
|
552 //Do not show postcapture softkeys if we are still capturing or |
|
553 //saving image |
|
554 if ( iController.CurrentOperation() != ECamCapturing && |
|
555 iController.CurrentOperation() != ECamCompleting ) |
|
556 { |
|
557 if ( !appui->IsSecondCameraEnabled() || appui->IsQwerty2ndCamera() ) |
|
558 { |
|
559 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT ); |
|
560 } |
|
561 else |
|
562 { |
|
563 SetSoftKeysL( R_CAM_SOFTKEYS_SELECT_DELETE__SELECT_SECONDARY ); |
|
564 } |
|
565 } |
|
566 else |
|
567 { |
|
568 SetSoftKeysL( R_CAM_SOFTKEYS_BLANK ); |
|
569 } |
|
570 } |
|
571 |
|
572 iPreviousViewStillPreCapture = ( aPrevViewId.iViewUid.iUid == ECamViewIdStillPreCapture ); |
|
573 |
|
574 // set flag for still and timelapse post capture only |
|
575 // also check if the file has already been saved (possible if, for |
|
576 // example, MMC removal note is displayed |
|
577 if ( iPreviousViewStillPreCapture && appui->CurrentBurstMode() != ECamImageCaptureBurst && |
|
578 !iController.SavedCurrentImage() ) |
|
579 { |
|
580 PRINT( _L( "Camera <> CCamPostCaptureViewBase::DoActivateL .. set iWaitForImageSave true" ) ); |
|
581 iWaitForImageSave = ETrue; |
|
582 } |
|
583 else |
|
584 { |
|
585 PRINT( _L( "Camera <> CCamPostCaptureViewBase::DoActivateL .. set iWaitForImageSave false" ) ); |
|
586 iWaitForImageSave = EFalse; |
|
587 if ( !iController.IsTouchScreenSupported() ) |
|
588 { |
|
589 UpdateActivePaletteItemsL(); |
|
590 } |
|
591 } |
|
592 |
|
593 // Make sure appuis CBA is not visible |
|
594 CEikButtonGroupContainer* cba = AppUi()->Cba(); |
|
595 if( cba ) |
|
596 { |
|
597 cba->MakeVisible( EFalse ); |
|
598 } |
|
599 |
|
600 PRINT( _L( "Camera <= CCamPostCaptureViewBase::DoActivateL" ) ); |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------------------------- |
|
604 // CCamPostCaptureViewBase::DoDeactivate |
|
605 // Deactivate this view |
|
606 // --------------------------------------------------------------------------- |
|
607 // |
|
608 void |
|
609 CCamPostCaptureViewBase::DoDeactivate() |
|
610 { |
|
611 PRINT( _L( "Camera => CCamPostCaptureViewBase::DoDeactivate" ) ); |
|
612 |
|
613 CCamViewBase::DoDeactivate(); |
|
614 |
|
615 iController.RemoveControllerObserver( this ); |
|
616 PRINT( _L( "Camera <= CCamPostCaptureViewBase::DoDeactivate" ) ); |
|
617 } |
|
618 |
|
619 // --------------------------------------------------------------------------- |
|
620 // CCamPostCaptureViewBase::DynInitMenuPaneL |
|
621 // Called when the menu pane is displayed |
|
622 // --------------------------------------------------------------------------- |
|
623 // |
|
624 void CCamPostCaptureViewBase::DynInitMenuPaneL( TInt /*aResourceId*/, |
|
625 CEikMenuPane* aMenuPane ) |
|
626 { |
|
627 TInt itemPos = 0; |
|
628 |
|
629 if( !iController.IsTouchScreenSupported() ) |
|
630 { |
|
631 if( aMenuPane->MenuItemExists(ECamCmdProperties, itemPos) ) |
|
632 { |
|
633 aMenuPane->SetItemDimmed( ECamCmdProperties, ETrue ); |
|
634 } |
|
635 if( aMenuPane->MenuItemExists(ECamCmdAddToAlbum, itemPos) ) |
|
636 { |
|
637 aMenuPane->SetItemDimmed( ECamCmdAddToAlbum, ETrue ); |
|
638 } |
|
639 } |
|
640 } |
|
641 |
|
642 // --------------------------------------------------------------------------- |
|
643 // CCamPostCaptureViewBase::CCamPostCaptureViewBase |
|
644 // C++ constructor |
|
645 // --------------------------------------------------------------------------- |
|
646 // |
|
647 CCamPostCaptureViewBase::CCamPostCaptureViewBase( CCamAppController& aController ) |
|
648 : CCamViewBase( aController ), |
|
649 iSendingCapabilities( KCamSendUiBodySize, |
|
650 KCamSendUiMessageSize, |
|
651 TSendingCapabilities::ESupportsAttachments ) |
|
652 { |
|
653 } |
|
654 |
|
655 // --------------------------------------------------------------------------- |
|
656 // CCamPostCaptureViewBase::ConstructL |
|
657 // Symbian OS 2nd phase constructor |
|
658 // --------------------------------------------------------------------------- |
|
659 // |
|
660 void CCamPostCaptureViewBase::ConstructL() |
|
661 { |
|
662 |
|
663 // create SendAs |
|
664 iSendAppUi = CSendUi::NewL(); |
|
665 |
|
666 iSendMtmsToDim = new (ELeave) CArrayFixFlat<TUid>( KCamSendAsArrayGranularity ); |
|
667 iSendMtmsToDim->AppendL( KSenduiMtmIrUid ); |
|
668 |
|
669 iCollectionManagerCallBack = new (ELeave) |
|
670 CCamCollectionManagerAO( *this ); |
|
671 iAddToAlbumRequestOngoing = EFalse; |
|
672 |
|
673 |
|
674 /*#ifndef __WINS__ |
|
675 // Initialize SFIutils |
|
676 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
677 iSFIUtils = appUi->SFIUtility(); |
|
678 #endif*/ |
|
679 |
|
680 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
681 |
|
682 // In touch screen devices, hide toolbar initially to prevent it from |
|
683 // being briefly visible in embedded mode |
|
684 if ( iController.IsTouchScreenSupported() ) |
|
685 { |
|
686 CAknToolbar* fixedToolbar = Toolbar(); |
|
687 if ( fixedToolbar ) |
|
688 { |
|
689 fixedToolbar->SetToolbarVisibility( EFalse ); |
|
690 } |
|
691 } |
|
692 |
|
693 iOneClickUploadUtility = CCamOneClickUploadUtility::NewL(); |
|
694 } |
|
695 |
|
696 // --------------------------------------------------------------------------- |
|
697 // CCamPostCaptureViewBase::CreateContainerL |
|
698 // Create container control |
|
699 // --------------------------------------------------------------------------- |
|
700 // |
|
701 void CCamPostCaptureViewBase::CreateContainerL() |
|
702 { |
|
703 TRect rect; |
|
704 |
|
705 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
706 TCamOrientation orientation = appUi->CamOrientation(); |
|
707 |
|
708 TRect screen; |
|
709 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
710 |
|
711 iContainer = CCamPostCaptureContainer::NewL( iController, |
|
712 *this, |
|
713 screen ); |
|
714 |
|
715 iContainer->SetMopParent( this ); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // CCamPostCaptureViewBase::DoSendAsL |
|
720 // Use SendUI to create a message containing current image\video clip |
|
721 // --------------------------------------------------------------------------- |
|
722 // |
|
723 void CCamPostCaptureViewBase::DoSendAsL() const |
|
724 { |
|
725 PRINT( _L("Camera => CCamPostCaptureViewBase::DoSendAsL") ) |
|
726 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
727 |
|
728 if( !appUi->SendAsInProgress() ) |
|
729 { |
|
730 appUi->SetSendAsInProgressL( ETrue ); |
|
731 CMessageData* messageData = CMessageData::NewLC(); |
|
732 TRAP_IGNORE( |
|
733 messageData->AppendAttachmentL( iController.CurrentFullFileName() ); |
|
734 iSendAppUi->ShowQueryAndSendL( messageData,iSendingCapabilities ) |
|
735 ) |
|
736 PRINT( _L("Camera <> CCamPostCaptureViewBase::DoSendAsL - finished sending") ) |
|
737 appUi->SetSendAsInProgressL( EFalse ); |
|
738 CleanupStack::PopAndDestroy( messageData ); |
|
739 } |
|
740 |
|
741 PRINT( _L("Camera <= CCamPostCaptureViewBase::DoSendAsL") ) |
|
742 } |
|
743 |
|
744 #ifndef __WINS__ |
|
745 // --------------------------------------------------------------------------- |
|
746 // CCamPostCaptureViewBase::DoInCallSendL |
|
747 // Handle send to caller functionality |
|
748 // --------------------------------------------------------------------------- |
|
749 // |
|
750 void CCamPostCaptureViewBase::DoInCallSendL() const |
|
751 { |
|
752 PRINT( _L("Camera => CCamPostCaptureViewBase::DoInCallSendL()") ) |
|
753 CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( AppUi() ); |
|
754 |
|
755 if( !appUi->SendAsInProgress() ) |
|
756 { |
|
757 appUi->SetSendAsInProgressL( ETrue ); |
|
758 CMessageData* messageData = CMessageData::NewLC(); |
|
759 TRAP_IGNORE( |
|
760 messageData->AppendAttachmentL( iController.CurrentFullFileName() ); |
|
761 iSendAppUi->CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, KNullUid, ETrue ) |
|
762 ) |
|
763 PRINT( _L("Camera <> CCamPostCaptureViewBase::DoInCallSendL() - finished sending") ) |
|
764 appUi->SetSendAsInProgressL( EFalse ); |
|
765 CleanupStack::PopAndDestroy( messageData ); |
|
766 } |
|
767 |
|
768 // SFIUtils replaced by using SendUI interface because |
|
769 // it cannot handle > 600 kB images properly |
|
770 /*if ( iSFIUtils && iSFIUtils->IsCLIValidL() ) |
|
771 { |
|
772 iSFIUtils->SendMediaFileL( iController.CurrentFullFileName() ); |
|
773 }*/ |
|
774 PRINT( _L("Camera <= CCamPostCaptureViewBase::DoInCallSendL()") ) |
|
775 } |
|
776 #endif |
|
777 |
|
778 // --------------------------------------------------------------------------- |
|
779 // CCamPostCaptureViewBase::IsPostCapture |
|
780 // Returns whether the view is a postcapture view |
|
781 // --------------------------------------------------------------------------- |
|
782 // |
|
783 TBool CCamPostCaptureViewBase::IsPostCapture() |
|
784 { |
|
785 return ETrue; |
|
786 } |
|
787 |
|
788 // --------------------------------------------------------------------------- |
|
789 // CCamPostCaptureViewBase::ResetSendAvailabilityL |
|
790 // Hides or shows the 'Send' and 'SendAs' items in the active toolbar |
|
791 // --------------------------------------------------------------------------- |
|
792 // |
|
793 void CCamPostCaptureViewBase::ResetSendAvailabilityL( CCamActivePaletteHandler* aApHandler ) |
|
794 { |
|
795 PRINT( _L("Camera => CCamPostCaptureViewBase::ResetSendAvailabilityL") ); |
|
796 // Hide Send or Send to caller |
|
797 // TBool inCall = EFalse; |
|
798 /*#if !defined(__WINS__) && !defined(__WINSCW__) |
|
799 inCall = iSFIUtils->IsCLIValidL(); |
|
800 #endif */ |
|
801 if ( aApHandler ) |
|
802 { |
|
803 //use both inCall and InCallOrRinging() conditions to make sure if it is in call state |
|
804 aApHandler->SetItemVisible( ECamCmdSend, !( /*inCall &&*/ iController.InCallOrRinging() ) ); |
|
805 aApHandler->SetItemVisible( ECamCmdSendToCallerMultimedia, ( /*inCall &&*/ iController.InCallOrRinging() ) ); |
|
806 |
|
807 TBool uploadSupported = EFalse; |
|
808 if ( iOneClickUploadUtility && |
|
809 iOneClickUploadUtility->OneClickUploadSupported() ) |
|
810 { |
|
811 uploadSupported = ETrue; |
|
812 } |
|
813 |
|
814 aApHandler->SetItemVisible( ECamCmdOneClickUpload, uploadSupported ); |
|
815 } |
|
816 PRINT( _L("Camera <= CCamPostCaptureViewBase::ResetSendAvailabilityL ") ); |
|
817 } |
|
818 |
|
819 |
|
820 // --------------------------------------------------------------------------- |
|
821 // CCamPostCaptureViewBase::StartAddToAlbumOperationL |
|
822 // |
|
823 // Starts calls to PostCapIdleCallBack during processor idle time. The calls |
|
824 // are continued until PostCapIdleCallBack is done. |
|
825 // |
|
826 // --------------------------------------------------------------------------- |
|
827 void CCamPostCaptureViewBase::StartAddToAlbumOperationL() |
|
828 { |
|
829 |
|
830 //Currently we set multiple selection of albums |
|
831 TBool allowMultipleSelection = ETrue; |
|
832 RArray<TUint32> selectedAlbumIds; |
|
833 CleanupClosePushL( selectedAlbumIds ); |
|
834 // Launching the Pop-up menu with the list of albums |
|
835 TRAPD( err, TGlxCollectionSelectionPopup::ShowPopupL( |
|
836 selectedAlbumIds, |
|
837 KGlxCollectionTypeIdAlbum, |
|
838 allowMultipleSelection, |
|
839 ETrue ) ); |
|
840 /* |
|
841 * Use Collection Manager to add the albums and |
|
842 * before that check for the completion of the harvesting |
|
843 */ |
|
844 if ( err == KErrNone && selectedAlbumIds.Count() > 0) |
|
845 { |
|
846 PRINT( _L("Camera => StartAddToAlbumOperationL: Before CCamCollectionManagerAO( *this ); ") ); |
|
847 PRINT( _L("Camera => StartAddToAlbumOperationL: After CCamCollectionManagerAO( *this ); and before calling StartCallBackAddToAlbumL()") ); |
|
848 if ( iCollectionManagerCallBack ) |
|
849 { |
|
850 if ( !iAddToAlbumRequestOngoing ) |
|
851 { |
|
852 // Checking if only one request is being processed |
|
853 iAddToAlbumRequestOngoing = ETrue; |
|
854 iCollectionManagerCallBack->StartCallBackAddToAlbumL( |
|
855 selectedAlbumIds, |
|
856 iController.CurrentFullFileName() ); |
|
857 } |
|
858 } |
|
859 PRINT( _L("Camera => StartAddToAlbumOperationL: After StartCallBackAddToAlbumL() ") ); |
|
860 } |
|
861 CleanupStack::PopAndDestroy( &selectedAlbumIds ); |
|
862 } |
|
863 |
|
864 |
|
865 // --------------------------------------------------------------------------- |
|
866 // CCamPostCaptureViewBase::ShowAddToAlbumConfirmationQueryL |
|
867 // |
|
868 // Opens a radiobutton setting page with "Yes" or "No" options |
|
869 // to actually confirm if we want to add the photo/video |
|
870 // to the albums |
|
871 // |
|
872 // --------------------------------------------------------------------------- |
|
873 TInt CCamPostCaptureViewBase::ShowAddToAlbumConfirmationQueryL() |
|
874 { |
|
875 TInt selectedIndex = 1; // default selection is "No" |
|
876 // Add to Album setting page "Items" |
|
877 CDesCArrayFlat* items = |
|
878 iCoeEnv->ReadDesC16ArrayResourceL( |
|
879 R_CAM_ADDTOALBUM_SETTING_PAGE_LBX ); |
|
880 CleanupStack::PushL( items ); |
|
881 |
|
882 CAknRadioButtonSettingPage* dlg = new (ELeave) |
|
883 CAknRadioButtonSettingPage |
|
884 ( |
|
885 R_CAM_ADDTOALBUM_SETTING_PAGE, |
|
886 selectedIndex, |
|
887 items |
|
888 ); |
|
889 |
|
890 dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
891 CleanupStack::PopAndDestroy( items ); |
|
892 return selectedIndex; |
|
893 } |
|
894 |
|
895 /* |
|
896 * CCamPostCaptureViewBase::AddToAlbumIdOperationComplete() |
|
897 */ |
|
898 void CCamPostCaptureViewBase::AddToAlbumIdOperationComplete() |
|
899 { |
|
900 PRINT( _L("Camera => CCamPostCaptureViewBase::AddToAlbumIdOperationComplete() ... SUCCESS ") ); |
|
901 iAddToAlbumRequestOngoing = EFalse; |
|
902 } |
|
903 |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // CCamPostCaptureViewBase::UpdateToolbarIconsL |
|
907 // Update fixed toolbar icons according to current call state |
|
908 // --------------------------------------------------------------------------- |
|
909 // |
|
910 void CCamPostCaptureViewBase::UpdateToolbarIconsL() |
|
911 { |
|
912 PRINT( _L("Camera => CCamPostCaptureViewBase::UpdateToolbarIconsL") ); |
|
913 // fixed toolbar is used only with touch devices |
|
914 if ( iController.IsTouchScreenSupported() ) |
|
915 { |
|
916 CAknToolbar* toolbar = Toolbar(); |
|
917 if ( toolbar ) |
|
918 { |
|
919 CAknButton* button = dynamic_cast<CAknButton*>( |
|
920 toolbar->ControlOrNull( ECamCmdSend ) ); |
|
921 if ( button ) |
|
922 { |
|
923 CAknButtonState* state = button->State(); |
|
924 if ( state ) |
|
925 { |
|
926 HBufC* tooltipText = |
|
927 StringLoader::LoadLC( R_QTN_LCAM_TT_SEND ); |
|
928 state->SetHelpTextL( *tooltipText ); |
|
929 CleanupStack::PopAndDestroy( tooltipText ); |
|
930 } |
|
931 } |
|
932 button = dynamic_cast<CAknButton*>( |
|
933 toolbar->ControlOrNull( ECamCmdOneClickUpload ) ); |
|
934 if ( button ) |
|
935 { |
|
936 CAknButtonState* state = button->State(); |
|
937 if ( state ) |
|
938 { |
|
939 state->SetHelpTextL( |
|
940 iOneClickUploadUtility->ButtonTooltipL() ); |
|
941 } |
|
942 } |
|
943 } |
|
944 } |
|
945 PRINT( _L("Camera <= CCamPostCaptureViewBase::UpdateToolbarIconsL") ); |
|
946 } |
|
947 |
|
948 // --------------------------------------------------------------------------- |
|
949 // CCamPostCaptureViewBase::OfferToolbarEventL |
|
950 // Handle fixed toolbar events |
|
951 // --------------------------------------------------------------------------- |
|
952 // |
|
953 void CCamPostCaptureViewBase::OfferToolbarEventL( TInt aCommand ) |
|
954 { |
|
955 User::ResetInactivityTime(); |
|
956 HandleCommandL( aCommand ); |
|
957 } |
|
958 |
|
959 // --------------------------------------------------------------------------- |
|
960 // CCamPostCaptureViewBase::UpdateActivePaletteItemsL |
|
961 // --------------------------------------------------------------------------- |
|
962 // |
|
963 void CCamPostCaptureViewBase::UpdateActivePaletteItemsL() |
|
964 { |
|
965 PRINT( _L("Camera => CCamPostCaptureViewBase::UpdateActivePaletteItemsL ") ); |
|
966 CCamAppUi* appUi = static_cast<CCamAppUi*>( AppUi() ); |
|
967 TInt resId = 0; |
|
968 if ( appUi ) |
|
969 { |
|
970 TCamOrientation orientation = appUi->CamOrientation(); |
|
971 CCamActivePaletteHandler* apHandler = appUi->APHandler(); |
|
972 if( apHandler && !iEmbedded && ( orientation == ECamOrientationCamcorder || |
|
973 orientation == ECamOrientationCamcorderLeft || |
|
974 orientation == ECamOrientationDefault || |
|
975 orientation == ECamOrientationPortrait ) ) |
|
976 { |
|
977 iContainer->CreateActivePaletteL(); |
|
978 MActivePalette2UI* activePalette = |
|
979 appUi->APHandler()->ActivePalette(); |
|
980 |
|
981 if( activePalette ) |
|
982 { |
|
983 activePalette->SetGc(); |
|
984 } |
|
985 // Install PostCapture AP items |
|
986 if ( ECamControllerImage == iController.CurrentMode() || |
|
987 iPreviousViewStillPreCapture ) |
|
988 { |
|
989 PRINT( _L("Camera => ECamControllerImage == iController.CurrentMode() ") ); |
|
990 if ( appUi->IsSecondCameraEnabled() ) |
|
991 { |
|
992 resId = R_CAM_STILL_POST_CAPTURE_AP_ITEMS_SECONDARY; |
|
993 } |
|
994 else |
|
995 { |
|
996 resId = R_CAM_STILL_POST_CAPTURE_AP_ITEMS; |
|
997 } |
|
998 } |
|
999 else |
|
1000 { |
|
1001 PRINT( _L("Camera => resId = R_CAM_VIDEO_POST_CAPTURE_AP_ITEMS; ") ); |
|
1002 if ( appUi->IsSecondCameraEnabled() ) |
|
1003 { |
|
1004 resId = R_CAM_VIDEO_POST_CAPTURE_AP_ITEMS_SECONDARY; |
|
1005 } |
|
1006 else |
|
1007 { |
|
1008 resId = R_CAM_VIDEO_POST_CAPTURE_AP_ITEMS; |
|
1009 } |
|
1010 } |
|
1011 |
|
1012 if ( iOneClickUploadUtility && |
|
1013 iOneClickUploadUtility->OneClickUploadSupported() ) |
|
1014 { |
|
1015 apHandler->SetOneClickUploadTooltipL( |
|
1016 iOneClickUploadUtility->ButtonTooltipL() ); |
|
1017 } |
|
1018 |
|
1019 apHandler->InstallAPItemsL( resId ); |
|
1020 // Hide Send or Send to caller |
|
1021 ResetSendAvailabilityL( apHandler ); |
|
1022 apHandler->SetView( this ); |
|
1023 |
|
1024 // Make AP visible. |
|
1025 appUi->SetAlwaysDrawPostCaptureCourtesyUI( ETrue ); |
|
1026 |
|
1027 // if coming from background, in video as target mode |
|
1028 if ( iController.CurrentMode() != iController.TargetMode() && |
|
1029 ( ECamControllerVideo == iController.TargetMode() ) ) |
|
1030 { |
|
1031 apHandler->SetVisibility( EFalse ); |
|
1032 iSuppressAPUntilCameraReady = ETrue; |
|
1033 } |
|
1034 } |
|
1035 } |
|
1036 PRINT( _L("Camera <= CCamPostCaptureViewBase::UpdateActivePaletteItemsL ") ); |
|
1037 } |
|
1038 |
|
1039 // End of File |