|
1 /* |
|
2 * Copyright (c) 2008-2009 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: View Base implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "glxviewbase.h" |
|
22 |
|
23 #include <aknViewAppUi.h> |
|
24 #include <avkon.rsg> |
|
25 #include <data_caging_path_literals.hrh> |
|
26 |
|
27 #include <alf/alfcontrolgroup.h> |
|
28 #include <alf/alfdisplay.h> |
|
29 #include <alf/alfenv.h> |
|
30 #include <alf/alfroster.h> |
|
31 #include <StringLoader.h> |
|
32 #include <akntoolbar.h> |
|
33 #include <glxcommandhandlers.hrh> |
|
34 #include <glxuiutility.h> |
|
35 #include <glxtracer.h> |
|
36 #include <glxlog.h> |
|
37 #include <glxpanic.h> |
|
38 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
|
39 #include <glxuistd.h> |
|
40 #include <glxuiutilities.rsg> |
|
41 #include <mglxanimation.h> |
|
42 #include "glxcommandhandler.h" |
|
43 |
|
44 #include <aknbutton.h> // for getting the button state |
|
45 |
|
46 // For transition effects |
|
47 #include <gfxtranseffect/gfxtranseffect.h> |
|
48 |
|
49 _LIT(KGlxViewBaseResource, "glxviewbase.rsc"); |
|
50 |
|
51 /// Length of time a view-switch animation should take |
|
52 const TInt KGlxViewSwitchAnimationDuration = 1000 * KGlxAnimationSlowDownFactor; |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // Constructor |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CGlxViewBase::CGlxViewBase(TBool aSyncActivation) : |
|
59 iViewAnimationTime(KGlxViewSwitchAnimationDuration), |
|
60 iIsTransEffectStarted(EFalse), |
|
61 iViewAnimationInProgress(EGlxViewAnimationNone), |
|
62 iSyncActivation(aSyncActivation) |
|
63 { |
|
64 TRACER( "CGlxViewBase::CGlxViewBase()" ); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Destructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C CGlxViewBase::~CGlxViewBase() |
|
72 { |
|
73 TRACER( "CGlxViewBase::~CGlxViewBase" ); |
|
74 iCommandHandlerList.ResetAndDestroy(); |
|
75 |
|
76 if ( iUiUtility ) |
|
77 { |
|
78 iUiUtility->Close(); |
|
79 iUiUtility = NULL; |
|
80 } |
|
81 |
|
82 if ( iViewBaseResourceOffset ) |
|
83 { |
|
84 iCoeEnv->DeleteResourceFile( iViewBaseResourceOffset ); |
|
85 } |
|
86 |
|
87 if ( iUiUtilitiesResourceOffset ) |
|
88 { |
|
89 iCoeEnv->DeleteResourceFile( iUiUtilitiesResourceOffset ); |
|
90 } |
|
91 |
|
92 if ( iViewActivateCallback ) |
|
93 { |
|
94 iViewActivateCallback->Cancel(); |
|
95 delete iViewActivateCallback; |
|
96 } |
|
97 |
|
98 delete iCustomMessage; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // ViewBaseConstructL |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 EXPORT_C void CGlxViewBase::ViewBaseConstructL() |
|
106 { |
|
107 TRACER( "CGlxViewBase::ViewBaseConstructL" ); |
|
108 // Load resources |
|
109 TFileName resourceFile(KDC_APP_RESOURCE_DIR); |
|
110 resourceFile.Append(KGlxViewBaseResource); |
|
111 CGlxResourceUtilities::GetResourceFilenameL(resourceFile, |
|
112 iCoeEnv->FsSession()); |
|
113 iViewBaseResourceOffset = iCoeEnv->AddResourceFileL(resourceFile); |
|
114 |
|
115 // Load UiUtilities resources, for wait dialog |
|
116 TFileName uiUtilsResourceFile( KDC_APP_RESOURCE_DIR ); |
|
117 uiUtilsResourceFile.Append( KGlxUiUtilitiesResource ); |
|
118 CGlxResourceUtilities::GetResourceFilenameL(uiUtilsResourceFile, |
|
119 iCoeEnv->FsSession()); |
|
120 iUiUtilitiesResourceOffset = iCoeEnv->AddResourceFileL(uiUtilsResourceFile); |
|
121 |
|
122 iUiUtility = CGlxUiUtility::UtilityL(); |
|
123 |
|
124 iViewActivateCallback = new (ELeave) CAsyncCallBack ( TCallBack ( ViewActivateCallbackL, this ), |
|
125 CActive::EPriorityStandard); |
|
126 iCustomMessage = HBufC8::NewL(0); |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // AddCommandHandlerL |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C void CGlxViewBase::AddCommandHandlerL(CGlxCommandHandler* aCommandHandler) |
|
134 { |
|
135 TRACER( "CGlxViewBase::AddCommandHandlerL" ); |
|
136 if ( aCommandHandler ) |
|
137 { |
|
138 CleanupDeletePushL( aCommandHandler ); |
|
139 if ( KErrNotFound == iCommandHandlerList.Find( aCommandHandler )) |
|
140 { |
|
141 iCommandHandlerList.AppendL(aCommandHandler); |
|
142 DoPrepareCommandHandlerL(aCommandHandler); |
|
143 } |
|
144 CleanupStack::Pop( aCommandHandler ); |
|
145 } |
|
146 else |
|
147 { |
|
148 User::Leave(KErrArgument); |
|
149 } |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // HandleCommandL |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CGlxViewBase::HandleCommandL(TInt aCommand) |
|
157 { |
|
158 TRACER( "CGlxViewBase::HandleCommandL" ); |
|
159 if(iViewActivated) // Act on this Command if view is Activated or Pass to AppUi |
|
160 { |
|
161 if ( EAknSoftkeyBack == aCommand ) |
|
162 { |
|
163 // Pass it to view |
|
164 DoHandleCommandL(aCommand); |
|
165 iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards); |
|
166 } |
|
167 else if ( EAknCmdOpen == aCommand ) |
|
168 { |
|
169 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
|
170 } |
|
171 |
|
172 if ( EAknSoftkeyOptions == aCommand ) |
|
173 { |
|
174 FetchAttributesL(); |
|
175 // Open the options menu properly |
|
176 ProcessCommandL(EAknSoftkeyOptions); |
|
177 } |
|
178 else |
|
179 { |
|
180 // Fetch the attributes required to execute the command provided it is not one of |
|
181 // the state changing commands (EGlxCmdStateView and EGlxCmdStateBrowse) |
|
182 if (aCommand != EGlxCmdStateView && aCommand != EGlxCmdStateBrowse) |
|
183 { |
|
184 FetchAttributesForCommandL(aCommand); |
|
185 } |
|
186 |
|
187 TBool handled = EFalse; |
|
188 |
|
189 // Pass the command to the command handlers |
|
190 TInt count = iCommandHandlerList.Count(); |
|
191 TInt i = count - 1; |
|
192 |
|
193 // Iterating backwards to give last-added handlers chance to override |
|
194 while ( i >= 0 && !handled ) |
|
195 { |
|
196 handled = iCommandHandlerList[i]->ExecuteL( aCommand ); |
|
197 i--; |
|
198 } |
|
199 |
|
200 if ( !handled ) |
|
201 { |
|
202 // Give the implemented view chance at handling the command |
|
203 handled = DoHandleCommandL(aCommand); |
|
204 } |
|
205 |
|
206 if ( !handled ) |
|
207 { |
|
208 // None of the command handlers have handled it, pass it on to the AppUi |
|
209 AppUi()->HandleCommandL(aCommand); |
|
210 } |
|
211 } |
|
212 } |
|
213 else |
|
214 { |
|
215 // Command Not Handled |
|
216 AppUi()->HandleCommandL(aCommand); |
|
217 } |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // DynInitMenuPaneL |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 EXPORT_C void CGlxViewBase::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
225 { |
|
226 TRACER( "CGlxViewBase::DynInitMenuPaneL" ); |
|
227 TInt count = iCommandHandlerList.Count(); |
|
228 |
|
229 // NB Member variable used for loop counter, so if the user interrupts (e.g. Cancels the wait |
|
230 // dialog), we know which command handler we need to stop (see DialogDismissedL) |
|
231 for (TInt i = 0; i < count; i++ ) |
|
232 { |
|
233 iCommandHandlerList[i]->PreDynInitMenuPaneL( aResourceId ); |
|
234 } |
|
235 |
|
236 // Allow implementing view to filter menu first |
|
237 ViewDynInitMenuPaneL(aResourceId, aMenuPane); |
|
238 |
|
239 //Since the toolbar is set only incase of grid view we can assume that |
|
240 //it is in browse mode. |
|
241 TBool isBrowseMode = EFalse; |
|
242 if(iUiUtility->GetGridToolBar()) |
|
243 { |
|
244 isBrowseMode = ETrue; |
|
245 } |
|
246 for (TInt i = 0; i < count; i++ ) |
|
247 { |
|
248 iCommandHandlerList[i]->DynInitMenuPaneL( aResourceId, aMenuPane, isBrowseMode ); |
|
249 } |
|
250 } |
|
251 |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // SetTitleL |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C void CGlxViewBase::SetTitleL(const TDesC& aTitleText) |
|
258 { |
|
259 TRACER( "CGlxViewBase::SetTitleL" ); |
|
260 iTitlePane = GetTitlePaneL(); |
|
261 if(iTitlePane) |
|
262 { |
|
263 iTitlePane->SetTextL(aTitleText); |
|
264 } |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // DisableTitleL |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C void CGlxViewBase::DisableTitle() |
|
272 { |
|
273 TRACER( "CGlxViewBase::DisableTitle" ); |
|
274 } |
|
275 |
|
276 // DoActivateL |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 EXPORT_C void CGlxViewBase::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
280 { |
|
281 TRACER( "CGlxViewBase::DoActivateL" ); |
|
282 // Store view activate values |
|
283 iPrevViewId = aPrevViewId; |
|
284 iCustomMessageId = aCustomMessageId; |
|
285 |
|
286 delete iCustomMessage; |
|
287 iCustomMessage = NULL; |
|
288 iCustomMessage = HBufC8::NewL( aCustomMessage.Length() ); |
|
289 |
|
290 TPtr8 customMessagePtr = iCustomMessage->Des(); |
|
291 customMessagePtr.Copy( aCustomMessage ); |
|
292 |
|
293 // show the view specific toolbar |
|
294 CAknToolbar* toolbar = GetToolBar(); |
|
295 |
|
296 // Get the pointer to the application toolbar |
|
297 // (when there isn't a view specific toolbar) to set it visible |
|
298 if ( !toolbar ) |
|
299 { |
|
300 toolbar = AppUi()->PopupToolbar(); |
|
301 } |
|
302 else |
|
303 { |
|
304 // Deactivate the toolbar untill the view gets activated properly. |
|
305 SetToolbarItemsDimmed(ETrue); |
|
306 } |
|
307 toolbar->SetToolbarVisibility(ETrue); |
|
308 |
|
309 // View should be activated asynchronously, since there can be a lot of processing |
|
310 // that may result in the view being in an indeterminate state if it leaves |
|
311 |
|
312 // HOWEVER, making the view asynchronous breaks the assumptions of the slideshow design |
|
313 // and results in slideshow not functioning correctly |
|
314 // Therefore, we have used the following nasty workaround to make this work, |
|
315 // otherwise, either view activation or slideshow would require considerable refactoring |
|
316 // TODO: This should be refactored whenever the opportunity arises |
|
317 // |
|
318 // The workaround is to have a flag to determine if the view should be activated |
|
319 // synchronously or asynchronously. |
|
320 if ( iSyncActivation ) |
|
321 { |
|
322 ViewActivateL(); |
|
323 } |
|
324 else |
|
325 { |
|
326 if ( !iViewActivateCallback->IsActive() ) |
|
327 { |
|
328 iViewActivateCallback->CallBack(); |
|
329 } |
|
330 } |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // DoDeactivate |
|
335 // ----------------------------------------------------------------------------- |
|
336 // |
|
337 EXPORT_C void CGlxViewBase::DoDeactivate() |
|
338 { |
|
339 TRACER( "CGlxViewBase::DoDeactivate" ); |
|
340 // hide the view specific toolbar |
|
341 CAknToolbar* toolbar = GetToolBar(); |
|
342 |
|
343 // Get the pointer to the application toolbar |
|
344 // (when there isn't a view specific toolbar) to hide it properly |
|
345 if ( !toolbar ) |
|
346 { |
|
347 toolbar = AppUi()->PopupToolbar(); |
|
348 } |
|
349 toolbar->SetToolbarVisibility(EFalse); |
|
350 // Clear the toolbar background as well |
|
351 toolbar->MakeVisible(EFalse); |
|
352 |
|
353 if ( iViewActivateCallback->IsActive() ) |
|
354 { |
|
355 iViewActivateCallback->Cancel(); |
|
356 } |
|
357 |
|
358 CancelViewAnimation(); |
|
359 |
|
360 // Deactivate command handlers |
|
361 TInt count = iCommandHandlerList.Count(); |
|
362 TInt i = 0; |
|
363 |
|
364 while ( i < count ) |
|
365 { |
|
366 iCommandHandlerList[i]->Deactivate(); |
|
367 i++; |
|
368 } |
|
369 |
|
370 TRAP_IGNORE(InitAnimationL(EGlxViewAnimationExit)); |
|
371 } |
|
372 |
|
373 |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CGlxViewBase::FetchAttributesL |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 EXPORT_C void CGlxViewBase::FetchAttributesL() |
|
379 { |
|
380 TRACER( "CGlxViewBase::FetchAttributesL" ); |
|
381 // No implementation required |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // CGlxViewBase::FetchAttributesForCommandL |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 EXPORT_C void CGlxViewBase::FetchAttributesForCommandL(TInt /*aCommand*/) |
|
389 { |
|
390 TRACER( "CGlxViewBase::FetchAttributesForCommandL" ); |
|
391 // No implementation required |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // Handles a view activation event from viewserv. |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 EXPORT_C void CGlxViewBase::ViewActivatedL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
399 { |
|
400 TRACER("CGlxViewBase::ViewActivatedL()"); |
|
401 if ( dynamic_cast<CAknViewAppUi*>( iEikonEnv->EikAppUi() ) ) |
|
402 { |
|
403 CAknView::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
404 } |
|
405 else |
|
406 { |
|
407 GLX_LOG_INFO("Not in CAknViewAppUi -> CAknView::AknViewActivatedL()"); |
|
408 AknViewActivatedL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
409 } |
|
410 } |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // Handles a view deactivation event from viewserv. |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 EXPORT_C void CGlxViewBase::ViewDeactivated() |
|
417 { |
|
418 TRACER("CGlxViewBase::ViewDeactivated()"); |
|
419 if ( dynamic_cast<CAknViewAppUi*>( iEikonEnv->EikAppUi() ) ) |
|
420 { |
|
421 CAknView::ViewDeactivated(); |
|
422 } |
|
423 else |
|
424 { |
|
425 GLX_LOG_INFO("Not in CAknViewAppUi -> DoDeactivate()"); |
|
426 DoDeactivate(); |
|
427 } |
|
428 } |
|
429 |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // HandleViewCommandL |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 EXPORT_C TBool CGlxViewBase::HandleViewCommandL(TInt /*aCommand*/) |
|
436 { |
|
437 TRACER( "CGlxViewBase::HandleViewCommandL" ); |
|
438 return EFalse; |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // ViewDynInitMenuPaneL |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 EXPORT_C void CGlxViewBase::ViewDynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) |
|
446 { |
|
447 TRACER( "CGlxViewBase::ViewDynInitMenuPaneL" ); |
|
448 // No implementation - derived classes may override this |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // ViewAnimationSupported |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 EXPORT_C TBool CGlxViewBase::ViewAnimationSupported(TGlxViewswitchAnimation /*aType*/) |
|
456 { |
|
457 TRACER( "CGlxViewBase::ViewAnimationSupported" ); |
|
458 // Default implementation - may be overridden |
|
459 return EFalse; |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // DoViewAnimationL |
|
464 // ----------------------------------------------------------------------------- |
|
465 // |
|
466 EXPORT_C void CGlxViewBase::DoViewAnimationL(TGlxViewswitchAnimation /*aType*/, TGlxNavigationDirection /*aDirection*/) |
|
467 { |
|
468 TRACER( "CGlxViewBase::DoViewAnimationL" ); |
|
469 // Do nothing by default |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // SetToolbarStateL |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 EXPORT_C void CGlxViewBase::SetToolbarStateL() |
|
477 { |
|
478 TRACER( "CGlxViewBase::SetToolbarStateL" ); |
|
479 // Derived MediaListViewBase has the implementation. |
|
480 } |
|
481 // ----------------------------------------------------------------------------- |
|
482 // SetGridToolBar |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 EXPORT_C void CGlxViewBase::SetGridToolBar(CAknToolbar* aToolbar) |
|
486 { |
|
487 TRACER("CGlxViewBase::SetGridToolBar()"); |
|
488 iToolbar = aToolbar; |
|
489 iUiUtility->SetGridToolBar(aToolbar); |
|
490 } |
|
491 // ----------------------------------------------------------------------------- |
|
492 // GetToolBar |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 EXPORT_C CAknToolbar* CGlxViewBase::GetToolBar() |
|
496 { |
|
497 TRACER("CGlxViewBase::GetToolBar()"); |
|
498 if(iToolbar) |
|
499 { |
|
500 return iToolbar; |
|
501 } |
|
502 return Toolbar(); |
|
503 } |
|
504 // ----------------------------------------------------------------------------- |
|
505 // InitAnimationL |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 void CGlxViewBase::InitAnimationL(TGlxViewswitchAnimation aType) |
|
509 { |
|
510 TRACER( "CGlxViewBase::InitAnimationL" ); |
|
511 if ( ViewAnimationSupported(aType) ) |
|
512 { |
|
513 /*@@ |
|
514 /// @todo : Remove hack when TAlfTimedValue fixed |
|
515 iViewAnimationTimedValue.Now(); // Hack to force reevaluation of internal "interpolating" flag: otherwise |
|
516 // call to RemainingTime() returns a hugely wrong number |
|
517 |
|
518 TInt remainingTime = iViewAnimationTimedValue.RemainingTime(); |
|
519 |
|
520 iViewAnimationTimedValue.Set(1 - iViewAnimationTimedValue.Now()); // In case previous animation is incomplete |
|
521 // Assumes opposite animations happen in sequence: entry - exit - entry etc |
|
522 iViewAnimationTimedValue.Set(1, KGlxViewSwitchAnimationDuration - remainingTime); */ |
|
523 |
|
524 DoViewAnimationL(aType, iUiUtility->ViewNavigationDirection()); |
|
525 iViewAnimationInProgress = aType; |
|
526 } |
|
527 else |
|
528 { |
|
529 // Immediately complete animation |
|
530 ViewAnimationComplete(aType); |
|
531 } |
|
532 } |
|
533 |
|
534 // ----------------------------------------------------------------------------- |
|
535 // AnimationComplete |
|
536 // ----------------------------------------------------------------------------- |
|
537 // |
|
538 EXPORT_C void CGlxViewBase::AnimationComplete(MGlxAnimation* /*aAnimation*/) // From MGlxAnimationObserver |
|
539 { |
|
540 TRACER( "CGlxViewBase::AnimationComplete" ); |
|
541 CancelViewAnimation(); |
|
542 } |
|
543 |
|
544 // ----------------------------------------------------------------------------- |
|
545 // OfferToolbarEventL |
|
546 // ----------------------------------------------------------------------------- |
|
547 // |
|
548 EXPORT_C void CGlxViewBase::OfferToolbarEventL( TInt aCommand ) |
|
549 { |
|
550 TRACER( "CGlxViewBase::OfferToolbarEventL" ); |
|
551 CAknToolbar* toolbar = GetToolBar(); |
|
552 if(toolbar) |
|
553 { |
|
554 CAknButton* slideshowButton = |
|
555 static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdSlideshow)); |
|
556 TBool slideshowdimmed = EFalse; |
|
557 |
|
558 //Here after the toolbar cmd is processed it is enabled |
|
559 //back. For share the toolbar state should be same as it was |
|
560 //earlier, so we take the current state and reset back after |
|
561 //the command is processed. |
|
562 CAknButton* uploadButton = |
|
563 static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdUpload)); |
|
564 TBool uploaddimmed = EFalse; |
|
565 |
|
566 CAknButton* markButton = |
|
567 static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdStartMultipleMarking)); |
|
568 TBool markButtondimmed = EFalse; |
|
569 |
|
570 if(slideshowButton) |
|
571 { |
|
572 // Get current button state |
|
573 CAknButtonState* currentState = slideshowButton->State(); |
|
574 slideshowdimmed = slideshowButton->IsDimmed(); |
|
575 } |
|
576 |
|
577 if(markButton) |
|
578 { |
|
579 // Get current button state |
|
580 CAknButtonState* currentState = markButton->State(); |
|
581 markButtondimmed = markButton->IsDimmed(); |
|
582 } |
|
583 |
|
584 if(uploadButton) |
|
585 { |
|
586 // Get current button state |
|
587 CAknButtonState* currentState = uploadButton->State(); |
|
588 uploaddimmed = uploadButton->IsDimmed(); |
|
589 } |
|
590 |
|
591 // Deactivate the toolbar. Don't accept the toolbar input when the command |
|
592 // execution is already in progress. |
|
593 SetToolbarItemsDimmed(ETrue); |
|
594 |
|
595 // Execute the command recieved. |
|
596 ProcessCommandL(aCommand); |
|
597 |
|
598 // Activate back the toolbar and set it's state properly |
|
599 // after command execution. |
|
600 SetToolbarStateL(); |
|
601 |
|
602 if(!markButtondimmed) |
|
603 { |
|
604 toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, EFalse, ETrue); |
|
605 } |
|
606 |
|
607 if(!slideshowdimmed) |
|
608 { |
|
609 toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, EFalse, ETrue); |
|
610 } |
|
611 |
|
612 if(uploaddimmed || (aCommand == EGlxCmdStartMultipleMarking)) |
|
613 { |
|
614 toolbar->SetItemDimmed(EGlxCmdUpload, ETrue, ETrue); |
|
615 } |
|
616 } |
|
617 } |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // SetToolbarObserver |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 EXPORT_C void CGlxViewBase::SetToolbarObserver(MAknToolbarObserver* aObserver) |
|
624 { |
|
625 TRACER( "CGlxViewBase::SetToolbarObserver" ); |
|
626 //Register the view to recieve toolbar events. ViewBase handles the events |
|
627 if ( GetToolBar() ) |
|
628 { |
|
629 GetToolBar()->SetToolbarObserver( aObserver ); |
|
630 } |
|
631 } |
|
632 |
|
633 // ----------------------------------------------------------------------------- |
|
634 // CancelViewAnimation |
|
635 // ----------------------------------------------------------------------------- |
|
636 // |
|
637 void CGlxViewBase::CancelViewAnimation() |
|
638 { |
|
639 TRACER( "CGlxViewBase::CancelViewAnimation" ); |
|
640 if ( iViewAnimationInProgress != EGlxViewAnimationNone ) |
|
641 { |
|
642 ViewAnimationComplete(iViewAnimationInProgress); |
|
643 iViewAnimationInProgress = EGlxViewAnimationNone; |
|
644 } |
|
645 } |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // ViewAnimationComplete |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CGlxViewBase::ViewAnimationComplete(TGlxViewswitchAnimation aType) |
|
652 { |
|
653 TRACER( "CGlxViewBase::ViewAnimationComplete" ); |
|
654 if ( aType == EGlxViewAnimationExit ) |
|
655 { |
|
656 // Deactivate view |
|
657 DoViewDeactivate(); |
|
658 iViewActivated = EFalse; // View is DeActivated |
|
659 } |
|
660 } |
|
661 |
|
662 //------------------------------------------------------------------------------ |
|
663 // GetTitlePaneControlL |
|
664 //------------------------------------------------------------------------------ |
|
665 // |
|
666 CAknTitlePane* CGlxViewBase::GetTitlePaneL() |
|
667 { |
|
668 TRACER( "CGlxViewBase::GetTitlePaneL" ); |
|
669 |
|
670 return (( CAknTitlePane* )StatusPane()->ControlL |
|
671 (TUid::Uid( EEikStatusPaneUidTitle ))); |
|
672 } |
|
673 |
|
674 // ----------------------------------------------------------------------------- |
|
675 // DoHandleCommandL |
|
676 // ----------------------------------------------------------------------------- |
|
677 // |
|
678 EXPORT_C TInt CGlxViewBase::DoHandleCommandL(TInt /*aCommand*/) |
|
679 { |
|
680 TRACER( "CGlxViewBase::DoHandleCommandL" ); |
|
681 return EFalse; |
|
682 } |
|
683 |
|
684 // ----------------------------------------------------------------------------- |
|
685 // Callback for view activate |
|
686 // ----------------------------------------------------------------------------- |
|
687 // |
|
688 TBool CGlxViewBase::ViewActivateCallbackL(TAny* aPtr) |
|
689 { |
|
690 TRACER( "CGlxViewBase::ViewActivateCallbackL()" ); |
|
691 __ASSERT_DEBUG( aPtr, Panic( EGlxPanicNullPointer ) ); |
|
692 static_cast<CGlxViewBase*>( aPtr )->ViewActivateL(); |
|
693 return EFalse; |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // Perform view activate |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CGlxViewBase::ViewActivateL() |
|
701 { |
|
702 TRACER("CGlxViewBase::ViewActivateL()"); |
|
703 CancelViewAnimation(); |
|
704 |
|
705 // View is Activated |
|
706 iViewActivated = ETrue; |
|
707 DoViewActivateL( iPrevViewId, iCustomMessageId, *iCustomMessage ); |
|
708 |
|
709 TInt count = iCommandHandlerList.Count(); |
|
710 TInt i = 0; |
|
711 |
|
712 while ( i < count ) |
|
713 { |
|
714 iCommandHandlerList[i]->ActivateL(Id().iUid); |
|
715 i++; |
|
716 } |
|
717 |
|
718 //Check if transition effect is already started. |
|
719 //Calling the 'EndFullScreen()' actually starts the FS transition effect. |
|
720 if(iIsTransEffectStarted) |
|
721 { |
|
722 GfxTransEffect::EndFullScreen(); |
|
723 iIsTransEffectStarted = EFalse; |
|
724 } |
|
725 |
|
726 InitAnimationL(EGlxViewAnimationEntry); |
|
727 } |
|
728 |
|
729 // ---------------------------------------------------------------------------- |
|
730 // SetToolbarItemsDimmed |
|
731 // ---------------------------------------------------------------------------- |
|
732 // |
|
733 void CGlxViewBase::SetToolbarItemsDimmed(TBool aDimmed) |
|
734 { |
|
735 TRACER("CGlxViewBase::SetToolbarItemsDimmed()"); |
|
736 CAknToolbar* toolbar = GetToolBar(); |
|
737 if (toolbar) |
|
738 { |
|
739 toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, aDimmed, ETrue); |
|
740 toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, aDimmed, ETrue); |
|
741 toolbar->SetItemDimmed(EGlxCmdUpload, aDimmed, ETrue); |
|
742 } |
|
743 } |
|
744 |
|
745 |