|
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 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 |
|
98 /** |
|
99 * Do the transition effect for the view if effects are enabled. |
|
100 */ |
|
101 void DoTransition( TBool aDirectionOut ); |
|
102 |
|
103 /** |
|
104 * Prepares application exit. This is called by AppUi during cleanup before AppUi's destructor |
|
105 */ |
|
106 virtual void PrepareExitL(); |
|
107 |
|
108 /** |
|
109 * Called when flip state changes. |
|
110 */ |
|
111 virtual void FlipStateChangedL( TBool aKeyboardFlipOpen ); |
|
112 |
|
113 /** |
|
114 * This method is called from the appui when the focus removal timer expires. |
|
115 * Each inherited view should implement own method for focus removal |
|
116 * @param aShow Indicates if focus should become visible or removed |
|
117 */ |
|
118 virtual void HandleTimerFocusStateChange( TBool aShow); |
|
119 |
|
120 protected: // methods |
|
121 |
|
122 /** |
|
123 * Inherited classes may override this to react to FsEmail application |
|
124 * being brougt to foreground while that particular view is active. |
|
125 */ |
|
126 virtual void HandleForegroundEventL(); |
|
127 |
|
128 /** |
|
129 * Inherited classes should override this instead of DoDeactivate() |
|
130 * to do the view deactivation |
|
131 */ |
|
132 virtual void ChildDoDeactivate() = 0; |
|
133 |
|
134 /** |
|
135 * Make control group of the view visible and set to accept input. |
|
136 */ |
|
137 virtual void ActivateControlGroup( TInt aDelay = 0 ); |
|
138 |
|
139 /** |
|
140 * Make control group of the view invisible and set to ignore input. |
|
141 */ |
|
142 virtual void DeactivateControlGroup( TInt aDelay = 0 ); |
|
143 |
|
144 /** |
|
145 * Inheriting Alfred views can override these functions, if they need to do |
|
146 * some special tricks for transition effects |
|
147 */ |
|
148 virtual void DoTransitionEffect( TBool aDirectionOut ); |
|
149 |
|
150 /** |
|
151 * Inheriting Alfred views should override this and return their parent |
|
152 * layout(s) in array given as parameter. Default implementation |
|
153 * does nothing, so then the array is empty. |
|
154 */ |
|
155 virtual void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const; |
|
156 |
|
157 /** |
|
158 * Utility function to fade in/out given visual |
|
159 */ |
|
160 void FadeVisual( CAlfVisual* aVisual, |
|
161 TBool aFadeDirectionOut, |
|
162 TBool aImmediate = EFalse ); |
|
163 |
|
164 /** |
|
165 * Used to indicate that the next out transition effect should be long |
|
166 * (some long opening view is to be opened next) |
|
167 */ |
|
168 void SetNextTransitionOutLong( TBool aLongTransitionOut ); |
|
169 |
|
170 TBool IsNextTransitionOutLong(); |
|
171 |
|
172 /** |
|
173 * Derived classes should call this always when the view is entered with forward navigation. |
|
174 * This is required to make returning from the view work correctly in case of external activation. |
|
175 * It doesn't hurt to call this also from views which cannot be externally activated. |
|
176 */ |
|
177 void ViewEntered( const TVwsViewId& aPrevViewId ); |
|
178 |
|
179 /** |
|
180 * Derived classes should call this to do backwards navigation e.g. when user |
|
181 * presses "Back" button. This returns to the previous view, and in case the view |
|
182 * was activated externally, takes FsEmail to background and brings the previous |
|
183 * application to foreground. |
|
184 */ |
|
185 virtual void NavigateBackL(); |
|
186 |
|
187 /** |
|
188 * Derived classes can call this utility function to set the middle soft key |
|
189 * label and ID from the given resource. |
|
190 */ |
|
191 void ChangeMskCommandL( TInt aLabelResourceId ); |
|
192 |
|
193 // <cmail> Toolbar |
|
194 protected: // toobar changes |
|
195 |
|
196 /** |
|
197 * @see CAknView::DoActivateL |
|
198 */ |
|
199 virtual void ChildDoActivateL( |
|
200 const TVwsViewId& aPrevViewId, |
|
201 TUid aCustomMessageId, |
|
202 const TDesC8& aCustomMessage ) = 0; |
|
203 |
|
204 /** |
|
205 * Return view's toolbar resource id. |
|
206 */ |
|
207 virtual TInt ToolbarResourceId() const; |
|
208 |
|
209 /** |
|
210 * Called when whole toolbar needs to be updated. Creates and sets new |
|
211 * toolbar by calling ToolbarResourceId() method. |
|
212 */ |
|
213 void UpdateToolbarL(); |
|
214 |
|
215 /** |
|
216 * Get array of item IDs that need to be dimmed before toolbar is set for |
|
217 * view. |
|
218 * @param aResourceId Resource ID of the toolbar. |
|
219 * @param aDimmedItems Array of items that will be dimmed. |
|
220 */ |
|
221 virtual void GetInitiallyDimmedItemsL( const TInt aResourceId, |
|
222 RArray<TInt>& aDimmedItems ) const; |
|
223 |
|
224 /** |
|
225 * Replaces single toolbar item with item from resource file. Control |
|
226 * must be of AVKON_BUTTON type. |
|
227 * @param aReaplceId Id of command to be replaced. |
|
228 * @param aResourceId Resource Id of the control that will replace existing |
|
229 * item. |
|
230 * @param aIndex Index in array for new item. Default value is zero. |
|
231 */ |
|
232 void ReplaceToolbarItemL( const TInt aReplaceId, const TInt aResourceId, |
|
233 const TInt aIndex = 0 ); |
|
234 |
|
235 /** |
|
236 * Removes single toolbar item from toolbar. |
|
237 */ |
|
238 void RemoveToolbarItem( const TInt aRemoveId ); |
|
239 |
|
240 /** |
|
241 * Hides toolbar. |
|
242 */ |
|
243 void HideToolbar(); |
|
244 |
|
245 /** |
|
246 * Show toolbar. |
|
247 */ |
|
248 void ShowToolbar(); |
|
249 |
|
250 /** |
|
251 * Dim/undim toolbar item. |
|
252 */ |
|
253 void SetToolbarItemDimmed( const TInt aCommandId, const TBool aDimmed ); |
|
254 |
|
255 /** |
|
256 * Returns ETrue if view has toolbar. |
|
257 */ |
|
258 virtual TBool HasToolbar() const; |
|
259 |
|
260 protected: // Single click changes |
|
261 /** |
|
262 * Return current state of the focus visibility |
|
263 * @return ETrue if the focus should be shown |
|
264 */ |
|
265 virtual TBool IsFocusShown(); |
|
266 |
|
267 /** |
|
268 * Set status bar layout. By default layout is R_AVKON_STATUS_PANE_LAYOUT_USUAL. |
|
269 * Inherited classes can override this and set desired status bar layout. |
|
270 */ |
|
271 virtual void SetStatusBarLayout(); |
|
272 |
|
273 protected: // from MAknToolbarObserver |
|
274 |
|
275 /** |
|
276 * @see MAknToolbarObserver::OfferToolbarEventL |
|
277 */ |
|
278 void OfferToolbarEventL( TInt aCommand ); |
|
279 |
|
280 // </cmail> Toolbar |
|
281 |
|
282 protected: // construction |
|
283 |
|
284 CFsEmailUiViewBase( CAlfControlGroup& aControlGroup, CFreestyleEmailUiAppUi& aAppUi ); |
|
285 |
|
286 /** |
|
287 * Return view active status. ETrue if the view is currently activated, EFalse otherwise. |
|
288 */ |
|
289 TBool IsViewActive() const; |
|
290 |
|
291 private: |
|
292 |
|
293 /** |
|
294 * Sets view's active status. Private to protect calling from inherited classes. |
|
295 */ |
|
296 void SetViewActive( const TBool aActive ); |
|
297 |
|
298 protected: // data |
|
299 |
|
300 CAlfControlGroup& iControlGroup; |
|
301 CFreestyleEmailUiAppUi& iAppUi; |
|
302 |
|
303 // Status of the keyboard flip |
|
304 TBool iKeyboardFlipOpen; |
|
305 |
|
306 // Is focus visible |
|
307 TBool iFocusVisible; |
|
308 |
|
309 private: // data |
|
310 |
|
311 TUid iPreviousAppUid; |
|
312 // ID of the mailbox which was active before this view was activated from an external application |
|
313 TFSMailMsgId iActiveMailboxBeforeExternalActivation; |
|
314 // Flag to indicate if next fade out effect should be longer than normally |
|
315 TBool iIsNextTransitionEffectOutLong; |
|
316 // Flag to indicate that Email app should be sent to background when the current view is deactivated |
|
317 TBool iSendToBackgroundOnDeactivation; |
|
318 // View's active status |
|
319 TBool iViewActive; |
|
320 }; |
|
321 |
|
322 #endif // __FREESTYLEEMAILUI_VIEWBASE_H__ |