25
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Definition for the common base class for all FsEmailUi views.
|
|
15 |
* The class is not intended for instantation.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// <cmail> SF
|
|
21 |
#include "emailtrace.h"
|
|
22 |
#include <alf/alfcontrolgroup.h>
|
|
23 |
#include <alf/alfvisual.h>
|
|
24 |
// </cmail>
|
|
25 |
#include <eikbtgpc.h>
|
|
26 |
#include "FreestyleEmailUiViewBase.h"
|
|
27 |
#include "FreestyleEmailUiAppui.h"
|
|
28 |
#include "FreestyleEmailUiLayoutHandler.h"
|
|
29 |
#include "FreestyleEmailUiStatusIndicator.h"
|
|
30 |
#include "FSEmail.pan"
|
|
31 |
|
|
32 |
// <cmail> Toolbar
|
|
33 |
#include <AknUtils.h>
|
|
34 |
#include <akntoolbar.h>
|
|
35 |
#include <FreestyleEmailUi.rsg>
|
|
36 |
|
|
37 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
38 |
#include <layoutmetadata.cdl.h>
|
|
39 |
|
|
40 |
// </cmail> Toolbar
|
|
41 |
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
CFsEmailUiViewBase::CFsEmailUiViewBase( CAlfControlGroup& aControlGroup,
|
|
45 |
CFreestyleEmailUiAppUi& aAppUi )
|
|
46 |
: iControlGroup( aControlGroup ), iAppUi( aAppUi )
|
|
47 |
{
|
|
48 |
FUNC_LOG;
|
|
49 |
// Set control groups to ignore input by default
|
|
50 |
iControlGroup.SetAcceptInput( EFalse );
|
|
51 |
iKeyboardFlipOpen = aAppUi.IsFlipOpen();
|
|
52 |
}
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
TUid CFsEmailUiViewBase::Id() const
|
|
57 |
{
|
|
58 |
FUNC_LOG;
|
|
59 |
// This must be overriden by the inherited class
|
|
60 |
__ASSERT_DEBUG( EFalse, Panic(EFSEmailUiBaseViewMethodNotOverriden) );
|
|
61 |
return TUid::Null();
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
void CFsEmailUiViewBase::DoActivateL( const TVwsViewId& aPrevViewId,
|
|
67 |
TUid aCustomMessageId,
|
|
68 |
const TDesC8& aCustomMessage )
|
|
69 |
{
|
|
70 |
FUNC_LOG;
|
|
71 |
|
|
72 |
SetViewActive( ETrue );
|
|
73 |
StatusPane()->MakeVisible( IsStatusPaneVisible() );
|
|
74 |
SetStatusBarLayout();
|
|
75 |
StatusPane()->DrawNow();
|
|
76 |
iFocusVisible = iAppUi.IsFocusShown();
|
|
77 |
|
|
78 |
// fix view stack in case of external activation
|
|
79 |
if ( aPrevViewId.iAppUid != KFSEmailUiUid )
|
|
80 |
{
|
|
81 |
iActiveMailboxBeforeExternalActivation = iAppUi.GetActiveMailboxId();
|
|
82 |
iAppUi.ViewActivatedExternallyL( Id() );
|
|
83 |
}
|
|
84 |
|
|
85 |
// hide previous view
|
|
86 |
CFsEmailUiViewBase* previousView = iAppUi.PreviousActiveView();
|
|
87 |
TBool pluginSettingsActive = iAppUi.IsPluginSettingsViewActive();
|
|
88 |
if ( pluginSettingsActive )
|
|
89 |
{
|
|
90 |
iAppUi.ReturnFromPluginSettingsView();
|
|
91 |
}
|
|
92 |
else if ( previousView )
|
|
93 |
{
|
|
94 |
// In case of external activation, hide previous control group
|
|
95 |
// before view activation to avoid screen flickering
|
|
96 |
if ( aPrevViewId.iAppUid != KFSEmailUiUid )
|
|
97 |
{
|
|
98 |
previousView->DeactivateControlGroup();
|
|
99 |
}
|
|
100 |
previousView->DoTransition( ETrue ); // fade out prev view
|
|
101 |
}
|
|
102 |
|
|
103 |
// Clear the flag of long transition effect
|
|
104 |
SetNextTransitionOutLong( EFalse );
|
|
105 |
|
|
106 |
// Clear status pane indicators
|
|
107 |
CCustomStatuspaneIndicators* indicators =
|
|
108 |
iAppUi.GetStatusPaneIndicatorContainer();
|
|
109 |
if ( indicators )
|
|
110 |
{
|
|
111 |
indicators->ClearStatusPaneFlags();
|
|
112 |
indicators->HideStatusPaneIndicators();
|
|
113 |
}
|
|
114 |
|
|
115 |
UpdateToolbarL();
|
|
116 |
|
|
117 |
// Make sure Alfred display is of correct size (there is some problems with toolbar)
|
|
118 |
iAppUi.AlfEnv().PrimaryDisplay().ForceSetVisibleArea(iAppUi.ClientRect());
|
|
119 |
|
|
120 |
|
|
121 |
// Finally call child classes activation method
|
|
122 |
TRAPD( error, ChildDoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage) );
|
|
123 |
if ( !error )
|
|
124 |
{
|
|
125 |
//view history have to be updated once again when email is sent to background when in plugin settings and composer is activated externaly
|
|
126 |
//when composer view will be deactivated it wiil call NavigateBack;
|
|
127 |
if (pluginSettingsActive && iAppUi.CurrentActiveView()->Id() == MailEditorId)
|
|
128 |
{
|
|
129 |
iAppUi.ReturnFromPluginSettingsView();
|
|
130 |
}
|
|
131 |
|
|
132 |
// View activated succesfully
|
|
133 |
DoTransition( EFalse );
|
|
134 |
if ( !iAppUi.SwitchingToBackground() )
|
|
135 |
{
|
|
136 |
// Change visible control group
|
|
137 |
// having here DoTransition caused grid transparency when app left from listview
|
|
138 |
ActivateControlGroup();
|
|
139 |
}
|
|
140 |
else
|
|
141 |
{
|
|
142 |
// View activated but Mail application is switching to background.
|
|
143 |
// Mail application was invoked from other app and now we`re going back
|
|
144 |
// to this other app. We have to force, that after going back to Mail
|
|
145 |
// application, ActivateControlGroup will be invoked in
|
|
146 |
// HandleAppForegroundEventL method
|
|
147 |
iWasActiveControlGroup = ETrue;
|
|
148 |
}
|
|
149 |
}
|
|
150 |
else
|
|
151 |
{
|
|
152 |
// In case of error, navigate to the previous view
|
|
153 |
DeactivateControlGroup();
|
|
154 |
NavigateBackL();
|
|
155 |
}
|
|
156 |
}
|
|
157 |
|
|
158 |
// ---------------------------------------------------------------------------
|
|
159 |
//
|
|
160 |
void CFsEmailUiViewBase::UpdateToolbarL()
|
|
161 |
{
|
|
162 |
FUNC_LOG;
|
|
163 |
if (AknLayoutUtils::PenEnabled())
|
|
164 |
{
|
|
165 |
if (HasToolbar())
|
|
166 |
{
|
|
167 |
const TInt resourceId(ToolbarResourceId());
|
|
168 |
RArray<TInt> dimmedItems;
|
|
169 |
CleanupClosePushL(dimmedItems);
|
|
170 |
GetInitiallyDimmedItemsL(resourceId, dimmedItems);
|
|
171 |
CAknToolbar* toolbar(CAknToolbar::NewL(resourceId));
|
|
172 |
for (TInt i = 0; i < dimmedItems.Count(); i++)
|
|
173 |
{
|
|
174 |
toolbar->SetItemDimmed(dimmedItems[i], ETrue, EFalse);
|
|
175 |
}
|
|
176 |
CleanupStack::PopAndDestroy(); // dimmedItems.Close()
|
|
177 |
toolbar->SetToolbarObserver(this);
|
|
178 |
|
|
179 |
TBool toolbarVisible = ( resourceId != R_FREESTYLE_EMAIL_UI_TOOLBAR_FOLDER_LIST );
|
|
180 |
toolbar->SetToolbarVisibility( toolbarVisible );
|
|
181 |
|
|
182 |
SetToolbar(toolbar);
|
|
183 |
ShowToolbar();
|
|
184 |
}
|
|
185 |
else
|
|
186 |
{
|
|
187 |
HideToolbar();
|
|
188 |
}
|
|
189 |
}
|
|
190 |
}
|
|
191 |
|
|
192 |
// ---------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
void CFsEmailUiViewBase::GetInitiallyDimmedItemsL(
|
|
195 |
const TInt /*aResourceId*/, RArray<TInt>& aDimmedItems ) const
|
|
196 |
{
|
|
197 |
FUNC_LOG;
|
|
198 |
aDimmedItems.Reset();
|
|
199 |
}
|
|
200 |
|
|
201 |
// ---------------------------------------------------------------------------
|
|
202 |
//
|
|
203 |
void CFsEmailUiViewBase::HideToolbar()
|
|
204 |
{
|
|
205 |
FUNC_LOG;
|
|
206 |
if (AknLayoutUtils::PenEnabled())
|
|
207 |
{
|
|
208 |
CAknToolbar* toolbar(Toolbar());
|
|
209 |
if (toolbar)
|
|
210 |
{
|
|
211 |
toolbar->MakeVisible(EFalse);
|
|
212 |
}
|
|
213 |
}
|
|
214 |
}
|
|
215 |
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void CFsEmailUiViewBase::ShowToolbar()
|
|
219 |
{
|
|
220 |
FUNC_LOG;
|
|
221 |
if (AknLayoutUtils::PenEnabled())
|
|
222 |
{
|
|
223 |
CAknToolbar* toolbar(Toolbar());
|
|
224 |
if (toolbar)
|
|
225 |
{
|
|
226 |
toolbar->MakeVisible( ETrue );
|
|
227 |
}
|
|
228 |
}
|
|
229 |
}
|
|
230 |
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
void CFsEmailUiViewBase::SetToolbarItemDimmed( const TInt aCommandId, const TBool aDimmed )
|
|
234 |
{
|
|
235 |
FUNC_LOG;
|
|
236 |
if (AknLayoutUtils::PenEnabled())
|
|
237 |
{
|
|
238 |
CAknToolbar* toolbar(Toolbar());
|
|
239 |
if (toolbar)
|
|
240 |
{
|
|
241 |
toolbar->SetItemDimmed(aCommandId, aDimmed, ETrue);
|
|
242 |
}
|
|
243 |
}
|
|
244 |
}
|
|
245 |
|
|
246 |
// ---------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CFsEmailUiViewBase::DoDeactivate()
|
|
249 |
{
|
|
250 |
FUNC_LOG;
|
|
251 |
SetViewActive( EFalse );
|
|
252 |
|
|
253 |
HideToolbar();
|
|
254 |
|
|
255 |
// Make control group ignore input and hide it if it's not already fading out.
|
|
256 |
DeactivateControlGroup();
|
|
257 |
|
|
258 |
// do view specific deactivation
|
|
259 |
ChildDoDeactivate();
|
|
260 |
|
|
261 |
// Return to another app in case this view was activated externally
|
|
262 |
if ( iSendToBackgroundOnDeactivation )
|
|
263 |
{
|
|
264 |
iSendToBackgroundOnDeactivation = EFalse;
|
|
265 |
|
|
266 |
// Try to bring calling external app into foreground if found
|
|
267 |
TApaTaskList taskList( iEikonEnv->WsSession() );
|
|
268 |
TApaTask prevAppTask = taskList.FindApp( iPreviousAppUid );
|
|
269 |
TApaTask fsEmailTask = taskList.FindApp( KFSEmailUiUid );
|
|
270 |
if ( fsEmailTask.Exists() && iPreviousAppUid != KMessageReaderUid )
|
|
271 |
{
|
|
272 |
fsEmailTask.SendToBackground();
|
|
273 |
}
|
|
274 |
if ( prevAppTask.Exists() )
|
|
275 |
{
|
|
276 |
prevAppTask.BringToForeground();
|
|
277 |
}
|
|
278 |
|
|
279 |
iAppUi.SetSwitchingToBackground( EFalse );
|
|
280 |
}
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
// virtual function to hide or show CAlfVisuals ( used for activation or deactivation )
|
|
285 |
//
|
|
286 |
void CFsEmailUiViewBase::FadeOut( TBool /* aDirectionOut */ )
|
|
287 |
{
|
|
288 |
FUNC_LOG;
|
|
289 |
// should be overriden ( if needed ) to use polymorphism
|
|
290 |
// to hide or show CAlfVisuals used in views
|
|
291 |
}
|
|
292 |
|
|
293 |
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
// Check if transition effects are enabled and run the effect if needed.
|
|
296 |
// if not enabled it calls FadeOut virtual methods only
|
|
297 |
//
|
|
298 |
void CFsEmailUiViewBase::DoTransition( TBool aDirectionOut )
|
|
299 |
{
|
|
300 |
FUNC_LOG;
|
|
301 |
if ( iAppUi.LayoutHandler() && iAppUi.LayoutHandler()->ViewFadeEffectActive() )
|
|
302 |
{
|
|
303 |
DoTransitionEffect( aDirectionOut );
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
// FadeOut method should be overridden and use by polymorphism only when needed
|
|
308 |
FadeOut( aDirectionOut ); // used for hide/show visuals without transition time
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
// Inheriting Alfred views can override these functions, if they need to do
|
|
314 |
// some special tricks for transition effects
|
|
315 |
//
|
|
316 |
void CFsEmailUiViewBase::DoTransitionEffect( TBool aDirectionOut )
|
|
317 |
{
|
|
318 |
FUNC_LOG;
|
|
319 |
RPointerArray<CAlfVisual> layoutArray;
|
|
320 |
TRAP_IGNORE( GetParentLayoutsL( layoutArray ) );
|
|
321 |
|
|
322 |
// For views that return valid parent layout(s), use the fade effect,
|
|
323 |
// for all other views, use the showing/hiding of control groups
|
|
324 |
for ( TInt i = 0 ; i < layoutArray.Count() ; i++ )
|
|
325 |
{
|
|
326 |
// Returned parent layout might be NULL, if view construction is not
|
|
327 |
// fully completed
|
|
328 |
if ( layoutArray[i] != NULL )
|
|
329 |
{
|
|
330 |
// Ensure the view is invisible before doing fade in (because views
|
|
331 |
// are automatically visible rigt after construction)
|
|
332 |
if ( !aDirectionOut )
|
|
333 |
{
|
|
334 |
FadeVisual( layoutArray[i], ETrue, ETrue );
|
|
335 |
}
|
|
336 |
|
|
337 |
FadeVisual( layoutArray[i], aDirectionOut );
|
|
338 |
}
|
|
339 |
}
|
|
340 |
|
|
341 |
layoutArray.Close();
|
|
342 |
}
|
|
343 |
|
|
344 |
// ---------------------------------------------------------------------------
|
|
345 |
// Inheriting Alfred views should override this and return their parent
|
|
346 |
// layout(s) in array given as parameter. Default implementation
|
|
347 |
// does nothing, so then the array is empty.
|
|
348 |
//
|
|
349 |
void CFsEmailUiViewBase::GetParentLayoutsL( RPointerArray<CAlfVisual>& /*aLayoutArray*/ ) const
|
|
350 |
{
|
|
351 |
FUNC_LOG;
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// Fade given Alfred visual
|
|
356 |
//
|
|
357 |
void CFsEmailUiViewBase::FadeVisual(
|
|
358 |
CAlfVisual* aVisual,
|
|
359 |
TBool aFadeDirectionOut,
|
|
360 |
TBool aImmediate /*= EFalse*/)
|
|
361 |
{
|
|
362 |
FUNC_LOG;
|
|
363 |
// Check that we are not exiting and is fade effect activated
|
|
364 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
365 |
{
|
|
366 |
TInt effectTime = 0;
|
|
367 |
|
|
368 |
if ( !aImmediate && iAppUi.LayoutHandler() )
|
|
369 |
{
|
|
370 |
if( aFadeDirectionOut )
|
|
371 |
{
|
|
372 |
effectTime = iAppUi.LayoutHandler()->ViewFadeOutEffectTime();
|
|
373 |
}
|
|
374 |
else
|
|
375 |
{
|
|
376 |
effectTime = iAppUi.LayoutHandler()->ViewFadeInEffectTime();
|
|
377 |
}
|
|
378 |
}
|
|
379 |
|
|
380 |
if ( aFadeDirectionOut && IsNextTransitionOutLong() )
|
|
381 |
{
|
|
382 |
effectTime = effectTime * 2;
|
|
383 |
}
|
|
384 |
|
|
385 |
// Initialize for out fading
|
|
386 |
TAlfTimedValue timedValue( 0, effectTime );
|
|
387 |
// Check value and initialze for in fading if set
|
|
388 |
if ( !aFadeDirectionOut )
|
|
389 |
{
|
|
390 |
timedValue.SetTarget( 1, effectTime );
|
|
391 |
}
|
|
392 |
aVisual->SetOpacity( timedValue );
|
|
393 |
}
|
|
394 |
}
|
|
395 |
|
|
396 |
// ---------------------------------------------------------------------------
|
|
397 |
// Used to indicate that the next out transition effect should be long
|
|
398 |
// (some long opening view is opened next)
|
|
399 |
//
|
|
400 |
void CFsEmailUiViewBase::SetNextTransitionOutLong( TBool aLongTransitionOut )
|
|
401 |
{
|
|
402 |
FUNC_LOG;
|
|
403 |
iIsNextTransitionEffectOutLong = aLongTransitionOut;
|
|
404 |
}
|
|
405 |
|
|
406 |
// ---------------------------------------------------------------------------
|
|
407 |
//
|
|
408 |
TBool CFsEmailUiViewBase::IsNextTransitionOutLong()
|
|
409 |
{
|
|
410 |
FUNC_LOG;
|
|
411 |
return iIsNextTransitionEffectOutLong;
|
|
412 |
}
|
|
413 |
|
|
414 |
// ---------------------------------------------------------------------------
|
|
415 |
//
|
|
416 |
void CFsEmailUiViewBase::ActivateControlGroup( TInt aDelay /*= 0*/ )
|
|
417 |
{
|
|
418 |
FUNC_LOG;
|
|
419 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
420 |
{
|
|
421 |
TAlfGroupCommand showCmd( ControlGroup(), EAlfOpShow, &iAppUi.Display() );
|
|
422 |
iAppUi.AlfEnv().Send( showCmd, aDelay );
|
|
423 |
ControlGroup().SetAcceptInput( ETrue );
|
|
424 |
|
|
425 |
// Status indicator is "always on top" while visible
|
|
426 |
/*if ( iAppUi.StatusIndicator() && iAppUi.StatusIndicator()->IsVisible() )
|
|
427 |
{
|
|
428 |
CAlfControlGroup& indicatorGroup = iAppUi.AlfEnv().ControlGroup( KStatusIndicatorDisplayGroup );
|
|
429 |
TAlfGroupCommand indicShowCmd( indicatorGroup, EAlfOpShow, &iAppUi.Display() );
|
|
430 |
iAppUi.AlfEnv().Send( indicShowCmd, 0 );
|
|
431 |
indicatorGroup.SetAcceptInput( EFalse );
|
|
432 |
}*/
|
|
433 |
}
|
|
434 |
}
|
|
435 |
|
|
436 |
// ---------------------------------------------------------------------------
|
|
437 |
//
|
|
438 |
void CFsEmailUiViewBase::DeactivateControlGroup( TInt aDelay /*= 0*/ )
|
|
439 |
{
|
|
440 |
FUNC_LOG;
|
|
441 |
const TReal32 KDelta = 0.01; // floating point comparison tolerance
|
|
442 |
|
|
443 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
444 |
{
|
|
445 |
ControlGroup().SetAcceptInput( EFalse );
|
|
446 |
|
|
447 |
// Hide the control group immediately only if it's not already faded or
|
|
448 |
// fading out. This is to not interfere with the cross fading effect.
|
|
449 |
RPointerArray<CAlfVisual> layoutArray;
|
|
450 |
TRAP_IGNORE( GetParentLayoutsL( layoutArray ) );
|
|
451 |
TInt layoutCount = layoutArray.Count();
|
|
452 |
TInt fadingCount = 0;
|
|
453 |
for ( TInt i = 0 ; i < layoutCount ; ++i )
|
|
454 |
{
|
|
455 |
CAlfVisual* layout = layoutArray[i];
|
|
456 |
if ( layout && layout->Opacity().Target() < KDelta )
|
|
457 |
{
|
|
458 |
fadingCount++;
|
|
459 |
}
|
|
460 |
}
|
|
461 |
layoutArray.Close();
|
|
462 |
|
|
463 |
if ( !layoutCount || fadingCount != layoutCount )
|
|
464 |
{
|
|
465 |
iAppUi.AlfEnv().CancelCommands( &ControlGroup(), EAlfOpShow );
|
|
466 |
TAlfGroupCommand hideCmd( ControlGroup(), EAlfOpHide, &iAppUi.Display() );
|
|
467 |
iAppUi.AlfEnv().Send( hideCmd, aDelay );
|
|
468 |
}
|
|
469 |
}
|
|
470 |
}
|
|
471 |
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
CAlfControlGroup& CFsEmailUiViewBase::ControlGroup()
|
|
475 |
{
|
|
476 |
FUNC_LOG;
|
|
477 |
return iControlGroup;
|
|
478 |
}
|
|
479 |
|
|
480 |
// ---------------------------------------------------------------------------
|
|
481 |
// Handles application foreground events.
|
|
482 |
// ---------------------------------------------------------------------------
|
|
483 |
//
|
|
484 |
void CFsEmailUiViewBase::HandleAppForegroundEventL( TBool aForeground )
|
|
485 |
{
|
|
486 |
FUNC_LOG;
|
|
487 |
HandleForegroundEventL(aForeground);
|
|
488 |
if ( aForeground )
|
|
489 |
{
|
|
490 |
// Activate control group in case the view was activated when
|
|
491 |
// application was being sent to background, and the control group
|
|
492 |
// was left inactive.
|
|
493 |
if( iWasActiveControlGroup )
|
|
494 |
{
|
|
495 |
const TInt KActivationDelay = 200; // ms
|
|
496 |
ActivateControlGroup( KActivationDelay );
|
|
497 |
iWasActiveControlGroup = EFalse;
|
|
498 |
}
|
|
499 |
}
|
|
500 |
else if ( !iWasActiveControlGroup ) // If activation of control group isn`t forced
|
|
501 |
{
|
|
502 |
// Mail application is switching to background.
|
|
503 |
// Remember state of control group to restore it when Mail goes foreground.
|
|
504 |
iWasActiveControlGroup = ControlGroup().AcceptInput();
|
|
505 |
}
|
|
506 |
}
|
|
507 |
|
|
508 |
// ---------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
void CFsEmailUiViewBase::HandleDynamicVariantSwitchL( TDynamicSwitchType aType )
|
|
511 |
{
|
|
512 |
FUNC_LOG;
|
|
513 |
// <cmail> Toolbar
|
|
514 |
switch (aType)
|
|
515 |
{
|
|
516 |
case EScreenLayoutChanged:
|
|
517 |
UpdateToolbarL();
|
|
518 |
break;
|
|
519 |
}
|
|
520 |
// </cmail> Toolbar
|
|
521 |
// Inherited classes should override this to react to skin and layout changes
|
|
522 |
|
|
523 |
#ifdef __WINSCW__
|
|
524 |
// For emulator testing: landscape mode is "flip open"
|
|
525 |
FlipStateChangedL( Layout_Meta_Data::IsLandscapeOrientation() );
|
|
526 |
#endif
|
|
527 |
}
|
|
528 |
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
//
|
|
531 |
void CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( TDynamicSwitchType /*aType*/ )
|
|
532 |
{
|
|
533 |
FUNC_LOG;
|
|
534 |
// Inherited classes should override this to react to skin and layout changes
|
|
535 |
// which happen while the view is on background
|
|
536 |
|
|
537 |
#ifdef __WINSCW__
|
|
538 |
// For emulator testing: landscape mode is "flip open"
|
|
539 |
FlipStateChangedL( Layout_Meta_Data::IsLandscapeOrientation() );
|
|
540 |
#endif
|
|
541 |
}
|
|
542 |
|
|
543 |
// ---------------------------------------------------------------------------
|
|
544 |
//
|
|
545 |
TBool CFsEmailUiViewBase::IsNextMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/,
|
|
546 |
TFSMailMsgId& /*aFoundNextMsgId*/,
|
|
547 |
TFSMailMsgId& /*aFoundNextMsgFolderId*/ ) const
|
|
548 |
{
|
|
549 |
FUNC_LOG;
|
|
550 |
return EFalse;
|
|
551 |
}
|
|
552 |
|
|
553 |
// ---------------------------------------------------------------------------
|
|
554 |
//
|
|
555 |
TBool CFsEmailUiViewBase::IsPreviousMsgAvailable( TFSMailMsgId /*aCurrentMsgId*/,
|
|
556 |
TFSMailMsgId& /*aFoundPreviousMsgId*/,
|
|
557 |
TFSMailMsgId& /*aFoundPrevMsgFolderId*/ ) const
|
|
558 |
{
|
|
559 |
FUNC_LOG;
|
|
560 |
return EFalse;
|
|
561 |
}
|
|
562 |
|
|
563 |
// ---------------------------------------------------------------------------
|
|
564 |
//
|
|
565 |
TInt CFsEmailUiViewBase::MoveToNextMsgL( TFSMailMsgId /*aCurrentMsgId*/,
|
|
566 |
TFSMailMsgId& /*aFoundNextMsgId*/ )
|
|
567 |
{
|
|
568 |
FUNC_LOG;
|
|
569 |
return KErrNotFound;
|
|
570 |
}
|
|
571 |
|
|
572 |
// ---------------------------------------------------------------------------
|
|
573 |
//
|
|
574 |
TInt CFsEmailUiViewBase::MoveToPreviousMsgL( TFSMailMsgId /*aCurrentMsgId*/,
|
|
575 |
TFSMailMsgId& /*aFoundPreviousMsgId*/ )
|
|
576 |
{
|
|
577 |
FUNC_LOG;
|
|
578 |
return KErrNotFound;
|
|
579 |
}
|
|
580 |
|
|
581 |
// ---------------------------------------------------------------------------
|
|
582 |
//
|
|
583 |
TInt CFsEmailUiViewBase::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId /*aFoundPreviousMsgId*/ )
|
|
584 |
{
|
|
585 |
FUNC_LOG;
|
|
586 |
return KErrNotFound;
|
|
587 |
}
|
|
588 |
|
|
589 |
//---------------------------------------------------------------------------
|
|
590 |
// Concrete view class may override
|
|
591 |
//---------------------------------------------------------------------------
|
|
592 |
void CFsEmailUiViewBase::PrepareExitL()
|
|
593 |
{
|
|
594 |
FUNC_LOG;
|
|
595 |
}
|
|
596 |
|
|
597 |
//---------------------------------------------------------------------------
|
|
598 |
// CFsEmailUiViewBase::FlipStateChangedL
|
|
599 |
//---------------------------------------------------------------------------
|
|
600 |
void CFsEmailUiViewBase::FlipStateChangedL( TBool aKeyboardFlipOpen )
|
|
601 |
{
|
|
602 |
FUNC_LOG;
|
|
603 |
iKeyboardFlipOpen = aKeyboardFlipOpen;
|
|
604 |
}
|
|
605 |
|
|
606 |
// ---------------------------------------------------------------------------
|
|
607 |
//
|
|
608 |
void CFsEmailUiViewBase::HandleForegroundEventL( TBool /*aForeground*/ )
|
|
609 |
{
|
|
610 |
FUNC_LOG;
|
|
611 |
}
|
|
612 |
|
|
613 |
// ---------------------------------------------------------------------------
|
|
614 |
//
|
|
615 |
void CFsEmailUiViewBase::ViewEntered( const TVwsViewId& aPrevViewId )
|
|
616 |
{
|
|
617 |
FUNC_LOG;
|
|
618 |
iPreviousAppUid = aPrevViewId.iAppUid;
|
|
619 |
}
|
|
620 |
|
|
621 |
// ---------------------------------------------------------------------------
|
|
622 |
// CFsEmailUiViewBase::NavigateBackL
|
|
623 |
// ---------------------------------------------------------------------------
|
|
624 |
void CFsEmailUiViewBase::NavigateBackL()
|
|
625 |
{
|
|
626 |
FUNC_LOG;
|
|
627 |
if ( !iAppUi.ViewSwitchingOngoing() )
|
|
628 |
{
|
|
629 |
TUid prevView = iAppUi.ReturnToPreviousViewL();
|
|
630 |
|
|
631 |
if ( iPreviousAppUid != KFSEmailUiUid && iPreviousAppUid != KNullUid )
|
|
632 |
{
|
|
633 |
// Email app should be hidden once the view gets deactivated. Note that hiding
|
|
634 |
// should not happen before control group switching is over because that
|
|
635 |
// may cause views of other Alfred apps to get distorted.
|
|
636 |
if( !iAppUi.EmbeddedAppIsPreviousApp() ) // if previous app is embedded app,
|
|
637 |
//do not need hide FSEmail app when previous app view gets deactivated.
|
|
638 |
{
|
|
639 |
iSendToBackgroundOnDeactivation = ETrue;
|
|
640 |
iAppUi.SetSwitchingToBackground( ETrue );
|
|
641 |
}
|
|
642 |
else
|
|
643 |
{
|
|
644 |
// Set flag to false for judging if previous app is embedded when editor exit.
|
|
645 |
iAppUi.SetEmbeddedAppToPreviousApp( EFalse );
|
|
646 |
}
|
|
647 |
|
|
648 |
// Re-activate previously active mailbox if it got changed in the external activation.
|
|
649 |
// As an exception, if previous view is the laucher grid, the previously active
|
|
650 |
// mailbox does not need to be reactivated. This prevents unnecessary mailbox switching
|
|
651 |
// when mailbox is entered from home screen, user returns with Back, and enters the same
|
|
652 |
// mailbox again.
|
|
653 |
if ( prevView != AppGridId &&
|
|
654 |
iActiveMailboxBeforeExternalActivation != iAppUi.GetActiveMailboxId() &&
|
|
655 |
!iActiveMailboxBeforeExternalActivation.IsNullId() )
|
|
656 |
{
|
|
657 |
iAppUi.SetActiveMailboxL( iActiveMailboxBeforeExternalActivation, EFalse );
|
|
658 |
}
|
|
659 |
}
|
|
660 |
}
|
|
661 |
}
|
|
662 |
|
|
663 |
// -----------------------------------------------------------------------------
|
|
664 |
// CFsEmailUiViewBase::ChangeMskCommandL
|
|
665 |
// Utility function to change the command ID and label on the middle soft key
|
|
666 |
// -----------------------------------------------------------------------------
|
|
667 |
void CFsEmailUiViewBase::ChangeMskCommandL( TInt aLabelResourceId )
|
|
668 |
{
|
|
669 |
FUNC_LOG;
|
|
670 |
CEikButtonGroupContainer* cba = Cba();
|
|
671 |
if ( cba )
|
|
672 |
{
|
|
673 |
cba->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
|
|
674 |
aLabelResourceId );
|
|
675 |
cba->DrawDeferred();
|
|
676 |
}
|
|
677 |
}
|
|
678 |
|
|
679 |
// -----------------------------------------------------------------------------
|
|
680 |
// CFsEmailUiViewBase::IsStatusPaneVisible
|
|
681 |
// -----------------------------------------------------------------------------
|
|
682 |
TBool CFsEmailUiViewBase::IsStatusPaneVisible() const
|
|
683 |
{
|
|
684 |
return ETrue;
|
|
685 |
}
|
|
686 |
|
|
687 |
// -----------------------------------------------------------------------------
|
|
688 |
// CFsEmailUiViewBase::HasToolbar
|
|
689 |
// Method to check whether the view has toolbar defined or not.
|
|
690 |
// -----------------------------------------------------------------------------
|
|
691 |
TBool CFsEmailUiViewBase::HasToolbar() const
|
|
692 |
{
|
|
693 |
FUNC_LOG;
|
|
694 |
return ToolbarResourceId() != R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK;
|
|
695 |
}
|
|
696 |
|
|
697 |
// -----------------------------------------------------------------------------
|
|
698 |
// CFsEmailUiViewBase::ToolbarResourceId
|
|
699 |
//
|
|
700 |
// -----------------------------------------------------------------------------
|
|
701 |
TInt CFsEmailUiViewBase::ToolbarResourceId() const
|
|
702 |
{
|
|
703 |
FUNC_LOG;
|
|
704 |
return R_FREESTYLE_EMAIL_UI_TOOLBAR_BLANK;
|
|
705 |
}
|
|
706 |
|
|
707 |
// -----------------------------------------------------------------------------
|
|
708 |
// CFsEmailUiViewBase::OfferToolbarEventL
|
|
709 |
// -----------------------------------------------------------------------------
|
|
710 |
void CFsEmailUiViewBase::OfferToolbarEventL( TInt /*aCommand*/ )
|
|
711 |
{
|
|
712 |
FUNC_LOG;
|
|
713 |
}
|
|
714 |
|
|
715 |
// -----------------------------------------------------------------------------
|
|
716 |
// CFsEmailUiViewBase::SetViewActive
|
|
717 |
// -----------------------------------------------------------------------------
|
|
718 |
void CFsEmailUiViewBase::SetViewActive( const TBool aActive )
|
|
719 |
{
|
|
720 |
FUNC_LOG;
|
|
721 |
iViewActive = aActive;
|
|
722 |
}
|
|
723 |
|
|
724 |
// -----------------------------------------------------------------------------
|
|
725 |
// CFsEmailUiViewBase::IsViewActive
|
|
726 |
// -----------------------------------------------------------------------------
|
|
727 |
TBool CFsEmailUiViewBase::IsViewActive() const
|
|
728 |
{
|
|
729 |
FUNC_LOG;
|
|
730 |
return iViewActive;
|
|
731 |
}
|
|
732 |
|
|
733 |
// -----------------------------------------------------------------------------
|
|
734 |
// CFsEmailUiViewBase::IsFocusShown
|
|
735 |
// -----------------------------------------------------------------------------
|
|
736 |
TBool CFsEmailUiViewBase::IsFocusShown()
|
|
737 |
{
|
|
738 |
return iFocusVisible;
|
|
739 |
}
|
|
740 |
|
|
741 |
// -----------------------------------------------------------------------------
|
|
742 |
// CFsEmailUiViewBase::SetStatusBarLayout
|
|
743 |
// -----------------------------------------------------------------------------
|
|
744 |
void CFsEmailUiViewBase::SetStatusBarLayout()
|
|
745 |
{
|
|
746 |
if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL )
|
|
747 |
{
|
|
748 |
TRAP_IGNORE( StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL));
|
|
749 |
}
|
|
750 |
}
|
|
751 |
|
|
752 |
// -----------------------------------------------------------------------------
|
|
753 |
// CFsEmailUiViewBase::HandleTimerFocusStateChange
|
|
754 |
// -----------------------------------------------------------------------------
|
|
755 |
void CFsEmailUiViewBase::FocusVisibilityChange( TBool aVisible )
|
|
756 |
{
|
|
757 |
iFocusVisible = aVisible;
|
|
758 |
}
|
|
759 |
|
|
760 |
// end of file
|