64
|
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: Declaration for the common base class for all FsEmailUi views.
|
|
15 |
* The class is not intended for instantation.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef __FREESTYLEEMAILUI_VIEWBASE_H__
|
|
21 |
#define __FREESTYLEEMAILUI_VIEWBASE_H__
|
|
22 |
|
|
23 |
#include <aknview.h>
|
|
24 |
//<cmail>
|
|
25 |
#include "cfsmailcommon.h"
|
|
26 |
//</cmail>
|
|
27 |
// <cmail> Toolbar
|
|
28 |
#include "akntoolbarobserver.h"
|
|
29 |
// </cmail> Toolbar
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class CAlfControlGroup;
|
|
33 |
class CFreestyleEmailUiAppUi;
|
|
34 |
class CAlfVisual;
|
|
35 |
|
|
36 |
class CFsEmailUiViewBase: public CAknView, public MAknToolbarObserver
|
|
37 |
{
|
|
38 |
public: // types
|
|
39 |
enum TDynamicSwitchType
|
|
40 |
{
|
|
41 |
ESkinChanged,
|
|
42 |
EScreenLayoutChanged,
|
|
43 |
EOther
|
|
44 |
};
|
|
45 |
|
|
46 |
public: // from CAknView
|
|
47 |
// dummy implementation for the base class abstact functions are needed to be able to define a constructor
|
|
48 |
TUid Id() const;
|
|
49 |
|
|
50 |
|
|
51 |
// <cmail> Toolbar
|
|
52 |
private:
|
|
53 |
|
|
54 |
virtual void DoActivateL( const TVwsViewId& aPrevViewId,
|
|
55 |
TUid aCustomMessageId,
|
|
56 |
const TDesC8& aCustomMessage );
|
|
57 |
// </cmail> Toolbar
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Inherited classes should NOT override this. The should override ChildDoDeactivate() instead.
|
|
61 |
*/
|
|
62 |
void DoDeactivate();
|
|
63 |
|
|
64 |
public: // new functions
|
|
65 |
/**
|
|
66 |
* Returns a handle to the control group assosiated to this view, as given in the class constructor.
|
|
67 |
*/
|
|
68 |
CAlfControlGroup& ControlGroup();
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Handles application foreground events. When applcation is brought to
|
|
72 |
* foreground, calls the virtual HandleForegroundEventL() method, which
|
|
73 |
* can be implemented by subclasses.
|
|
74 |
*/
|
|
75 |
virtual void HandleAppForegroundEventL( TBool aForeground );
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Inherited classes should override this to react to skin or layout changes
|
|
79 |
* happening while the view is active.
|
|
80 |
*/
|
|
81 |
virtual void HandleDynamicVariantSwitchL( TDynamicSwitchType aType );
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Inherited classes should override this to react to skin or layout changes
|
|
85 |
* which happen when the view is not active.
|
|
86 |
*/
|
|
87 |
virtual void HandleDynamicVariantSwitchOnBackgroundL( TDynamicSwitchType aType );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Mail list type views should override these to enable next/previous message
|
|
91 |
* functionality in the mail viewer which has been launched from this list view.
|
|
92 |
*/
|
|
93 |
virtual TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const;
|
|
94 |
virtual TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const;
|
|
95 |
virtual TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId );
|
|
96 |
virtual TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId );
|
|
97 |
virtual TInt MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId );
|
|
98 |
/**
|
|
99 |
* Do the transition effect for the view if effects are enabled.
|
|
100 |
*/
|
|
101 |
void DoTransition( TBool aDirectionOut );
|
|
102 |
|
|
103 |
virtual void FadeOut(TBool aDirectionOut);
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Prepares application exit. This is called by AppUi during cleanup before AppUi's destructor
|
|
107 |
*/
|
|
108 |
virtual void PrepareExitL();
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Called when flip state changes.
|
|
112 |
*/
|
|
113 |
virtual void FlipStateChangedL( TBool aKeyboardFlipOpen );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* This method is called from the appui when the focus state is changed.
|
|
117 |
* Each inherited view should implement own method for focus handling
|
|
118 |
* @param aVisible Indicates if focus should become visible or removed
|
|
119 |
*/
|
|
120 |
virtual void FocusVisibilityChange( TBool aVisible );
|
|
121 |
|
|
122 |
protected: // methods
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Inherited classes may override this to react to FsEmail application
|
|
126 |
* being brougt to foreground while that particular view is active.
|
|
127 |
*/
|
|
128 |
virtual void HandleForegroundEventL( TBool aForeground );
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Inherited classes should override this instead of DoDeactivate()
|
|
132 |
* to do the view deactivation
|
|
133 |
*/
|
|
134 |
virtual void ChildDoDeactivate() = 0;
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Make control group of the view visible and set to accept input.
|
|
138 |
*/
|
|
139 |
virtual void ActivateControlGroup( TInt aDelay = 0 );
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Make control group of the view invisible and set to ignore input.
|
|
143 |
*/
|
|
144 |
virtual void DeactivateControlGroup( TInt aDelay = 0 );
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Inheriting Alfred views can override these functions, if they need to do
|
|
148 |
* some special tricks for transition effects
|
|
149 |
*/
|
|
150 |
virtual void DoTransitionEffect( TBool aDirectionOut );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Inheriting Alfred views should override this and return their parent
|
|
154 |
* layout(s) in array given as parameter. Default implementation
|
|
155 |
* does nothing, so then the array is empty.
|
|
156 |
*/
|
|
157 |
virtual void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const;
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Utility function to fade in/out given visual
|
|
161 |
*/
|
|
162 |
void FadeVisual( CAlfVisual* aVisual,
|
|
163 |
TBool aFadeDirectionOut,
|
|
164 |
TBool aImmediate = EFalse );
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Used to indicate that the next out transition effect should be long
|
|
168 |
* (some long opening view is to be opened next)
|
|
169 |
*/
|
|
170 |
void SetNextTransitionOutLong( TBool aLongTransitionOut );
|
|
171 |
|
|
172 |
TBool IsNextTransitionOutLong();
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Derived classes should call this always when the view is entered with forward navigation.
|
|
176 |
* This is required to make returning from the view work correctly in case of external activation.
|
|
177 |
* It doesn't hurt to call this also from views which cannot be externally activated.
|
|
178 |
*/
|
|
179 |
void ViewEntered( const TVwsViewId& aPrevViewId );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Derived classes should call this to do backwards navigation e.g. when user
|
|
183 |
* presses "Back" button. This returns to the previous view, and in case the view
|
|
184 |
* was activated externally, takes FsEmail to background and brings the previous
|
|
185 |
* application to foreground.
|
|
186 |
*/
|
|
187 |
virtual void NavigateBackL();
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Derived classes can call this utility function to set the middle soft key
|
|
191 |
* label and ID from the given resource.
|
|
192 |
*/
|
|
193 |
virtual void ChangeMskCommandL( TInt aLabelResourceId );
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Derived classes can overwrite this method to control status pane
|
|
197 |
* visibility.
|
|
198 |
*/
|
|
199 |
virtual TBool IsStatusPaneVisible() const;
|
|
200 |
|
|
201 |
// <cmail> Toolbar
|
|
202 |
protected: // toobar changes
|
|
203 |
|
|
204 |
/**
|
|
205 |
* @see CAknView::DoActivateL
|
|
206 |
*/
|
|
207 |
virtual void ChildDoActivateL(
|
|
208 |
const TVwsViewId& aPrevViewId,
|
|
209 |
TUid aCustomMessageId,
|
|
210 |
const TDesC8& aCustomMessage ) = 0;
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Return view's toolbar resource id.
|
|
214 |
*/
|
|
215 |
virtual TInt ToolbarResourceId() const;
|
|
216 |
|
|
217 |
/**
|
|
218 |
* Called when whole toolbar needs to be updated. Creates and sets new
|
|
219 |
* toolbar by calling ToolbarResourceId() method.
|
|
220 |
*/
|
|
221 |
void UpdateToolbarL();
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Get array of item IDs that need to be dimmed before toolbar is set for
|
|
225 |
* view.
|
|
226 |
* @param aResourceId Resource ID of the toolbar.
|
|
227 |
* @param aDimmedItems Array of items that will be dimmed.
|
|
228 |
*/
|
|
229 |
virtual void GetInitiallyDimmedItemsL( const TInt aResourceId,
|
|
230 |
RArray<TInt>& aDimmedItems ) const;
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Replaces single toolbar item with item from resource file. Control
|
|
234 |
* must be of AVKON_BUTTON type.
|
|
235 |
* @param aReaplceId Id of command to be replaced.
|
|
236 |
* @param aResourceId Resource Id of the control that will replace existing
|
|
237 |
* item.
|
|
238 |
* @param aIndex Index in array for new item. Default value is zero.
|
|
239 |
*/
|
|
240 |
void ReplaceToolbarItemL( const TInt aReplaceId, const TInt aResourceId,
|
|
241 |
const TInt aIndex = 0 );
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Removes single toolbar item from toolbar.
|
|
245 |
*/
|
|
246 |
void RemoveToolbarItem( const TInt aRemoveId );
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Hides toolbar.
|
|
250 |
*/
|
|
251 |
void HideToolbar();
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Show toolbar.
|
|
255 |
*/
|
|
256 |
void ShowToolbar();
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Dim/undim toolbar item.
|
|
260 |
*/
|
|
261 |
void SetToolbarItemDimmed( const TInt aCommandId, const TBool aDimmed );
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Returns ETrue if view has toolbar.
|
|
265 |
*/
|
|
266 |
virtual TBool HasToolbar() const;
|
|
267 |
|
|
268 |
protected: // Single click changes
|
|
269 |
/**
|
|
270 |
* Return current state of the focus visibility
|
|
271 |
* @return ETrue if the focus should be shown
|
|
272 |
*/
|
|
273 |
virtual TBool IsFocusShown();
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Set status bar layout. By default layout is R_AVKON_STATUS_PANE_LAYOUT_USUAL.
|
|
277 |
* Inherited classes can override this and set desired status bar layout.
|
|
278 |
*/
|
|
279 |
virtual void SetStatusBarLayout();
|
|
280 |
|
|
281 |
protected: // from MAknToolbarObserver
|
|
282 |
|
|
283 |
/**
|
|
284 |
* @see MAknToolbarObserver::OfferToolbarEventL
|
|
285 |
*/
|
|
286 |
void OfferToolbarEventL( TInt aCommand );
|
|
287 |
|
|
288 |
// </cmail> Toolbar
|
|
289 |
|
|
290 |
protected: // construction
|
|
291 |
|
|
292 |
CFsEmailUiViewBase( CAlfControlGroup& aControlGroup, CFreestyleEmailUiAppUi& aAppUi );
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Return view active status. ETrue if the view is currently activated, EFalse otherwise.
|
|
296 |
*/
|
|
297 |
TBool IsViewActive() const;
|
|
298 |
|
|
299 |
private:
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Sets view's active status. Private to protect calling from inherited classes.
|
|
303 |
*/
|
|
304 |
void SetViewActive( const TBool aActive );
|
|
305 |
|
|
306 |
protected: // data
|
|
307 |
|
|
308 |
CAlfControlGroup& iControlGroup;
|
|
309 |
CFreestyleEmailUiAppUi& iAppUi;
|
|
310 |
|
|
311 |
// Status of the keyboard flip
|
|
312 |
TBool iKeyboardFlipOpen;
|
|
313 |
|
|
314 |
// Is focus visible
|
|
315 |
TBool iFocusVisible;
|
|
316 |
|
|
317 |
private: // data
|
|
318 |
|
|
319 |
TUid iPreviousAppUid;
|
|
320 |
// ID of the mailbox which was active before this view was activated from an external application
|
|
321 |
TFSMailMsgId iActiveMailboxBeforeExternalActivation;
|
|
322 |
// Flag to indicate if next fade out effect should be longer than normally
|
|
323 |
TBool iIsNextTransitionEffectOutLong;
|
|
324 |
// Flag to indicate that Email app should be sent to background when the current view is deactivated
|
|
325 |
TBool iSendToBackgroundOnDeactivation;
|
|
326 |
// View's active status
|
|
327 |
TBool iViewActive;
|
|
328 |
protected: // to enable overridning
|
|
329 |
TBool iWasActiveControlGroup;
|
|
330 |
};
|
|
331 |
|
|
332 |
#endif // __FREESTYLEEMAILUI_VIEWBASE_H__
|