author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:13:06 +0300 | |
branch | RCL_3 |
changeset 68 | 5b238bc8ffb6 |
parent 60 | 5b3385a43d68 |
child 75 | 01504893d9cb |
permissions | -rw-r--r-- |
60 | 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 |
//Here after the toolbar cmd is processed it is enabled |
|
555 |
//back. For share the toolbar state should be same as it was |
|
556 |
//earlier, so we take the current state and reset back after |
|
557 |
//the command is processed. |
|
558 |
CAknButton* uploadButton = |
|
559 |
static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdUpload)); |
|
560 |
TBool uploaddimmed = EFalse; |
|
561 |
||
562 |
CAknButton* markButton = |
|
563 |
static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdStartMultipleMarking)); |
|
564 |
TBool markButtondimmed = EFalse; |
|
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
565 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
566 |
CAknButton* deleteButton = |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
567 |
static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdDelete)); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
568 |
TBool deleteButtondimmed = EFalse; |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
569 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
570 |
CAknButton* sendButton = |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
571 |
static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdSend)); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
572 |
TBool sendButtondimmed = EFalse; |
60 | 573 |
|
574 |
if(markButton) |
|
575 |
{ |
|
576 |
markButtondimmed = markButton->IsDimmed(); |
|
577 |
} |
|
578 |
||
579 |
if(uploadButton) |
|
580 |
{ |
|
581 |
uploaddimmed = uploadButton->IsDimmed(); |
|
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
582 |
} |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
583 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
584 |
if(deleteButton) |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
585 |
{ |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
586 |
deleteButtondimmed = deleteButton->IsDimmed(); |
60 | 587 |
} |
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
588 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
589 |
if(sendButton) |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
590 |
{ |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
591 |
sendButtondimmed = sendButton->IsDimmed(); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
592 |
} |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
593 |
|
60 | 594 |
// Deactivate the toolbar. Don't accept the toolbar input when the command |
595 |
// execution is already in progress. |
|
596 |
SetToolbarItemsDimmed(ETrue); |
|
597 |
||
598 |
// Execute the command recieved. |
|
599 |
ProcessCommandL(aCommand); |
|
600 |
||
601 |
// Activate back the toolbar and set it's state properly |
|
602 |
// after command execution. |
|
603 |
SetToolbarStateL(); |
|
604 |
||
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
605 |
// Note: Slideshow toolbar item update is done |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
606 |
// at CGlxToolbarController::SetStatusL() |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
607 |
|
60 | 608 |
if(!markButtondimmed) |
609 |
{ |
|
610 |
toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, EFalse, ETrue); |
|
611 |
} |
|
612 |
||
613 |
if(uploaddimmed || (aCommand == EGlxCmdStartMultipleMarking)) |
|
614 |
{ |
|
615 |
toolbar->SetItemDimmed(EGlxCmdUpload, ETrue, ETrue); |
|
616 |
} |
|
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
617 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
618 |
if(!deleteButtondimmed) |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
619 |
{ |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
620 |
toolbar->SetItemDimmed(EGlxCmdDelete, EFalse, ETrue); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
621 |
} |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
622 |
|
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
623 |
if(!sendButtondimmed) |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
624 |
{ |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
625 |
toolbar->SetItemDimmed(EGlxCmdSend, EFalse, ETrue); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
626 |
} |
60 | 627 |
} |
628 |
} |
|
629 |
||
630 |
// ----------------------------------------------------------------------------- |
|
631 |
// SetToolbarObserver |
|
632 |
// ----------------------------------------------------------------------------- |
|
633 |
// |
|
634 |
EXPORT_C void CGlxViewBase::SetToolbarObserver(MAknToolbarObserver* aObserver) |
|
635 |
{ |
|
636 |
TRACER( "CGlxViewBase::SetToolbarObserver" ); |
|
637 |
//Register the view to recieve toolbar events. ViewBase handles the events |
|
638 |
if ( GetToolBar() ) |
|
639 |
{ |
|
640 |
GetToolBar()->SetToolbarObserver( aObserver ); |
|
641 |
} |
|
642 |
} |
|
643 |
||
644 |
// ----------------------------------------------------------------------------- |
|
645 |
// CancelViewAnimation |
|
646 |
// ----------------------------------------------------------------------------- |
|
647 |
// |
|
648 |
void CGlxViewBase::CancelViewAnimation() |
|
649 |
{ |
|
650 |
TRACER( "CGlxViewBase::CancelViewAnimation" ); |
|
651 |
if ( iViewAnimationInProgress != EGlxViewAnimationNone ) |
|
652 |
{ |
|
653 |
ViewAnimationComplete(iViewAnimationInProgress); |
|
654 |
iViewAnimationInProgress = EGlxViewAnimationNone; |
|
655 |
} |
|
656 |
} |
|
657 |
||
658 |
// ----------------------------------------------------------------------------- |
|
659 |
// ViewAnimationComplete |
|
660 |
// ----------------------------------------------------------------------------- |
|
661 |
// |
|
662 |
void CGlxViewBase::ViewAnimationComplete(TGlxViewswitchAnimation aType) |
|
663 |
{ |
|
664 |
TRACER( "CGlxViewBase::ViewAnimationComplete" ); |
|
665 |
if ( aType == EGlxViewAnimationExit ) |
|
666 |
{ |
|
667 |
// Deactivate view |
|
668 |
DoViewDeactivate(); |
|
669 |
iViewActivated = EFalse; // View is DeActivated |
|
670 |
} |
|
671 |
} |
|
672 |
||
673 |
//------------------------------------------------------------------------------ |
|
674 |
// GetTitlePaneControlL |
|
675 |
//------------------------------------------------------------------------------ |
|
676 |
// |
|
677 |
CAknTitlePane* CGlxViewBase::GetTitlePaneL() |
|
678 |
{ |
|
679 |
TRACER( "CGlxViewBase::GetTitlePaneL" ); |
|
680 |
||
681 |
return (( CAknTitlePane* )StatusPane()->ControlL |
|
682 |
(TUid::Uid( EEikStatusPaneUidTitle ))); |
|
683 |
} |
|
684 |
||
685 |
// ----------------------------------------------------------------------------- |
|
686 |
// DoHandleCommandL |
|
687 |
// ----------------------------------------------------------------------------- |
|
688 |
// |
|
689 |
EXPORT_C TInt CGlxViewBase::DoHandleCommandL(TInt /*aCommand*/) |
|
690 |
{ |
|
691 |
TRACER( "CGlxViewBase::DoHandleCommandL" ); |
|
692 |
return EFalse; |
|
693 |
} |
|
694 |
||
695 |
// ----------------------------------------------------------------------------- |
|
696 |
// Callback for view activate |
|
697 |
// ----------------------------------------------------------------------------- |
|
698 |
// |
|
699 |
TBool CGlxViewBase::ViewActivateCallbackL(TAny* aPtr) |
|
700 |
{ |
|
701 |
TRACER( "CGlxViewBase::ViewActivateCallbackL()" ); |
|
702 |
__ASSERT_DEBUG( aPtr, Panic( EGlxPanicNullPointer ) ); |
|
703 |
static_cast<CGlxViewBase*>( aPtr )->ViewActivateL(); |
|
704 |
return EFalse; |
|
705 |
} |
|
706 |
||
707 |
// ----------------------------------------------------------------------------- |
|
708 |
// Perform view activate |
|
709 |
// ----------------------------------------------------------------------------- |
|
710 |
// |
|
711 |
void CGlxViewBase::ViewActivateL() |
|
712 |
{ |
|
713 |
TRACER("CGlxViewBase::ViewActivateL()"); |
|
714 |
CancelViewAnimation(); |
|
715 |
||
716 |
// View is Activated |
|
717 |
iViewActivated = ETrue; |
|
718 |
DoViewActivateL( iPrevViewId, iCustomMessageId, *iCustomMessage ); |
|
719 |
||
720 |
TInt count = iCommandHandlerList.Count(); |
|
721 |
TInt i = 0; |
|
722 |
||
723 |
while ( i < count ) |
|
724 |
{ |
|
725 |
iCommandHandlerList[i]->ActivateL(Id().iUid); |
|
726 |
i++; |
|
727 |
} |
|
728 |
||
729 |
//Check if transition effect is already started. |
|
730 |
//Calling the 'EndFullScreen()' actually starts the FS transition effect. |
|
731 |
if(iIsTransEffectStarted) |
|
732 |
{ |
|
733 |
GfxTransEffect::EndFullScreen(); |
|
734 |
iIsTransEffectStarted = EFalse; |
|
735 |
} |
|
736 |
||
737 |
InitAnimationL(EGlxViewAnimationEntry); |
|
738 |
} |
|
739 |
||
740 |
// ---------------------------------------------------------------------------- |
|
741 |
// SetToolbarItemsDimmed |
|
742 |
// ---------------------------------------------------------------------------- |
|
743 |
// |
|
744 |
void CGlxViewBase::SetToolbarItemsDimmed(TBool aDimmed) |
|
745 |
{ |
|
746 |
TRACER("CGlxViewBase::SetToolbarItemsDimmed()"); |
|
747 |
CAknToolbar* toolbar = GetToolBar(); |
|
748 |
if (toolbar) |
|
749 |
{ |
|
750 |
toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, aDimmed, ETrue); |
|
751 |
toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, aDimmed, ETrue); |
|
752 |
toolbar->SetItemDimmed(EGlxCmdUpload, aDimmed, ETrue); |
|
68
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
753 |
toolbar->SetItemDimmed(EGlxCmdDelete, aDimmed, ETrue); |
5b238bc8ffb6
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
754 |
toolbar->SetItemDimmed(EGlxCmdSend, aDimmed, ETrue); |
60 | 755 |
} |
756 |
} |
|
757 |
||
758 |