64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2010 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: FreestyleEmailUi main UI grid definition.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef __FREESTYLEEMAILUI_MAINGRIDUIVISUALISER_H__
|
|
21 |
#define __FREESTYLEEMAILUI_MAINGRIDUIVISUALISER_H__
|
|
22 |
|
|
23 |
// SYSTEM INCLUDE FILES
|
|
24 |
#include <alf/alfcontrol.h>
|
|
25 |
#include <AiwServiceHandler.h>
|
|
26 |
#include <alf/alfdecklayout.h>
|
|
27 |
#include <alf/alfgridlayout.h>
|
|
28 |
#include <alf/alfmappingfunctions.h>
|
|
29 |
#include <alf/alfbitmapprovider.h>
|
|
30 |
#include <aknphysicsobserveriface.h>
|
|
31 |
|
|
32 |
// INTERNAL INCLUDE FILES
|
|
33 |
#include "FreestyleEmailUiViewBase.h"
|
|
34 |
#include "FreestyleEmailUiLauncherGridModel.h"
|
|
35 |
#include "FreestyleEmailUiAppui.h"
|
|
36 |
|
|
37 |
#include "FSEmailLauncherItem.h"
|
|
38 |
#include "freestyleemailuimailboxdeleter.h"
|
|
39 |
#include "FreestyleEmailUiUtilities.h"
|
|
40 |
|
|
41 |
// FORWARD DECLARATIONS
|
|
42 |
class CBrushAnimation;
|
|
43 |
class CFsAlfScrollbarLayout;
|
|
44 |
class CAknStylusPopUpMenu;
|
|
45 |
class CCoeControl;
|
|
46 |
class CAknPhysics;
|
|
47 |
|
|
48 |
class TFSLauncherGridMailboxStatus
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
TInt iMailboxCount;
|
|
52 |
TInt iMailboxesOnline;
|
|
53 |
TInt iMailboxesOffline;
|
|
54 |
TInt iMailboxesSyncing;
|
|
55 |
};
|
|
56 |
|
|
57 |
|
|
58 |
// Grid visualiser
|
|
59 |
class CFSEmailUiLauncherGridVisualiser : public CFsEmailUiViewBase,
|
|
60 |
public MAlfBitmapProvider,
|
|
61 |
public MFSEmailLauncherItemObserver,
|
|
62 |
public MEikScrollBarObserver,
|
|
63 |
public MFSEmailUiMailboxDeleteObserver,
|
|
64 |
public MFSEmailUiGenericTimerCallback,
|
|
65 |
public MAknPhysicsObserver
|
|
66 |
{
|
|
67 |
public:
|
|
68 |
enum TDirection
|
|
69 |
{
|
|
70 |
EDirectionRight=0,
|
|
71 |
EDirectionLeft,
|
|
72 |
EDirectionUp,
|
|
73 |
EDirectionDown,
|
|
74 |
EDirectionReset,
|
|
75 |
EDirectionNone,
|
|
76 |
// <cmail>
|
|
77 |
EDirectionTouch
|
|
78 |
// </cmail>
|
|
79 |
};
|
|
80 |
|
|
81 |
static CFSEmailUiLauncherGridVisualiser* NewL(CAlfEnv& aEnv,
|
|
82 |
CFSEmailUiLauncherGrid* aControl,
|
|
83 |
CFreestyleEmailUiAppUi* aAppUi,
|
|
84 |
CAlfControlGroup& aControlGroup,
|
|
85 |
TInt aColumns,
|
|
86 |
TInt aRows);
|
|
87 |
|
|
88 |
static CFSEmailUiLauncherGridVisualiser* NewLC(CAlfEnv& aEnv,
|
|
89 |
CFSEmailUiLauncherGrid* aControl,
|
|
90 |
CFreestyleEmailUiAppUi* aAppUi,
|
|
91 |
CAlfControlGroup& aControlGroup,
|
|
92 |
TInt aColumns,
|
|
93 |
TInt aRows);
|
|
94 |
|
|
95 |
void AddMenuItemL(TUid aUid);
|
|
96 |
void SelectL();
|
|
97 |
// Menu pane init and command handling
|
|
98 |
void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
|
|
99 |
void HandleCommandL(TInt aCommand);
|
|
100 |
|
|
101 |
TBool OfferEventL(const TAlfEvent& aEvent);
|
|
102 |
// <cmail>
|
|
103 |
/**
|
|
104 |
* Handler for touch related events
|
|
105 |
* @param aEvent, event type
|
|
106 |
* @return ETrue if event was used
|
|
107 |
*/
|
|
108 |
TBool HandlePointerEventL(const TAlfEvent& aEvent);
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Function for searching right item when pointer event occurs
|
|
112 |
* @param aEvent, event type
|
|
113 |
* @return KErrnone if item was not found, else index to founded item
|
|
114 |
*/
|
|
115 |
TInt FindPointedItem( const TAlfEvent& aEvent );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Function for setting focus to item
|
|
119 |
* @param aId, id of item where focus is going to be changed
|
|
120 |
*/
|
|
121 |
void SetFocusedItemL( TInt aId );
|
|
122 |
|
|
123 |
void HandleRowMovement( TDirection aDir, TInt aSelected );
|
|
124 |
// </cmail>
|
|
125 |
TUid Id() const;
|
|
126 |
// <cmail> Toolbar
|
|
127 |
/*
|
|
128 |
void DoActivateL(const TVwsViewId& aPrevViewId,
|
|
129 |
TUid aCustomMessageId,
|
|
130 |
const TDesC8& aCustomMessage);
|
|
131 |
*/
|
|
132 |
void ChildDoDeactivate();
|
|
133 |
|
|
134 |
void VisualLayoutUpdatedL();
|
|
135 |
|
|
136 |
// Dynamic switch handling
|
|
137 |
void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType );
|
|
138 |
void HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType );
|
|
139 |
|
|
140 |
// React to changes in grid contents
|
|
141 |
void HandleContentChangeL();
|
|
142 |
|
|
143 |
void LaunchWizardL();
|
|
144 |
void GoToInboxL( TFSMailMsgId& mailboxId,
|
|
145 |
TFSMailMsgId& mailboxInboxId );
|
|
146 |
|
|
147 |
// From MFSEmailLauncherItemObserver
|
|
148 |
void RefreshLauncherViewL();
|
|
149 |
|
|
150 |
TBool UiOperationLaunched();
|
|
151 |
|
|
152 |
// Modifies the value of iWizardWaitnoteShown
|
|
153 |
void SetWizardWaitnoteShown( TBool aWaitnoteShown );
|
|
154 |
|
|
155 |
// Bitmap provider for grid ecom plugins icons
|
|
156 |
void ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap);
|
|
157 |
|
|
158 |
// Set refresh needed flag
|
|
159 |
void SetRefreshNeeded();
|
|
160 |
// <cmail>
|
|
161 |
// Handling of foreground events
|
|
162 |
void HandleForegroundEventL( TBool aForeground );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* From MEikScrollBarObserver
|
|
166 |
*
|
|
167 |
* Callback method for scroll bar events
|
|
168 |
*
|
|
169 |
* Scroll bar observer should implement this method to get scroll bar events.
|
|
170 |
*
|
|
171 |
* @since S60 0.9
|
|
172 |
* @param aScrollBar A pointer to scrollbar which created the event
|
|
173 |
* @param aEventType The event occured on the scroll bar
|
|
174 |
*/
|
|
175 |
void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
|
|
176 |
// </cmail>
|
|
177 |
|
|
178 |
// From base class CFsEmailUiViewBase
|
|
179 |
void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const;
|
|
180 |
|
|
181 |
void FadeOut(TBool aDirectionOut);
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Called when flip state changes.
|
|
185 |
*/
|
|
186 |
void FlipStateChangedL( TBool aKeyboardFlipOpen );
|
|
187 |
|
|
188 |
/**
|
|
189 |
* Handles application foreground events. When applcation is brought to
|
|
190 |
* foreground, calls the virtual HandleForegroundEventL() method, which
|
|
191 |
* can be implemented by subclasses.
|
|
192 |
*/
|
|
193 |
virtual void HandleAppForegroundEventL( TBool aForeground );
|
|
194 |
|
|
195 |
// Fire timer callback
|
|
196 |
void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer );
|
|
197 |
|
|
198 |
|
|
199 |
// <cmail> Toolbar
|
|
200 |
private: // from
|
|
201 |
|
|
202 |
/**
|
|
203 |
* @see CFsEmailUiViewBase::ChildDoActivateL
|
|
204 |
*/
|
|
205 |
void ChildDoActivateL( const TVwsViewId& aPrevViewId,
|
|
206 |
TUid aCustomMessageId,
|
|
207 |
const TDesC8& aCustomMessage );
|
|
208 |
// </cmail> Toolbar
|
|
209 |
|
|
210 |
private: // from MFSEmailUiMailboxDeleteObserver
|
|
211 |
|
|
212 |
void MailboxDeletionComplete();
|
|
213 |
|
|
214 |
private: // from MAknPhysicsObserver
|
|
215 |
|
|
216 |
/**
|
|
217 |
* @see MAknPhysicsObserver::ViewPositionChanged
|
|
218 |
*/
|
|
219 |
virtual void ViewPositionChanged( const TPoint& aNewPosition,
|
|
220 |
TBool aDrawNow, TUint aFlags );
|
|
221 |
|
|
222 |
/**
|
|
223 |
* @see MAknPhysicsObserver::PhysicEmulationEnded
|
|
224 |
*/
|
|
225 |
virtual void PhysicEmulationEnded();
|
|
226 |
|
|
227 |
/**
|
|
228 |
* @see MAknPhysicsObserver::ViewPosition
|
|
229 |
*/
|
|
230 |
virtual TPoint ViewPosition() const;
|
|
231 |
|
|
232 |
private: // New methods.
|
|
233 |
|
|
234 |
CFSEmailUiLauncherGridVisualiser(CAlfEnv& aEnv,
|
|
235 |
CFSEmailUiLauncherGrid* aControl,
|
|
236 |
CFreestyleEmailUiAppUi* aAppUi,
|
|
237 |
CAlfControlGroup& aControlGroup);
|
|
238 |
void ConstructL(TInt aColumns, TInt aRows);
|
|
239 |
virtual ~CFSEmailUiLauncherGridVisualiser();
|
|
240 |
void CreateModelL();
|
|
241 |
void MoveSelection( TDirection aDir );
|
|
242 |
void MoveSelectorToCurrentItem( TDirection aDir );
|
|
243 |
void Select();
|
|
244 |
void DisplayProductInfoL();
|
|
245 |
void RescaleIconsL();
|
|
246 |
void SetRingWrapLimits();
|
|
247 |
void AddItemToModelL( CFSEmailLauncherItem* aItem, TInt aPluginArrayIndex );
|
|
248 |
|
|
249 |
void ConstructScrollbarL( CAlfLayout* aParent );
|
|
250 |
void UpdateScrollBarRangeL();
|
|
251 |
CFSMailBox* ShowMailboxSelectionQueryL( const RPointerArray<CFSMailBox>& aMailBoxes );
|
|
252 |
|
|
253 |
// Check status of all configured mailboxes
|
|
254 |
TFSLauncherGridMailboxStatus CheckMailboxStatusL();
|
|
255 |
|
|
256 |
void DoFirstStartL();
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Funciton should decide if item focus should still be drawn dispite of
|
|
260 |
* releasing button.
|
|
261 |
*/
|
|
262 |
void HandleButtonReleaseEvent();
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Reduces item's icon size.
|
|
266 |
*/
|
|
267 |
void ResizeItemIcon( TBool aReduce );
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Handles the focus state changes of CFSEmailUiLauncherGridVisualiser
|
|
271 |
* @param aVisible Indicates if focus should become visible or removed
|
|
272 |
*/
|
|
273 |
void FocusVisibilityChange( TBool aVisible );
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Launches and displays the pop-up menu invoked by a long tap event.
|
|
277 |
* @param aItemId The ID of the item for which to open the menu.
|
|
278 |
*/
|
|
279 |
void LaunchStylusPopupMenu( const TInt aItemId );
|
|
280 |
|
|
281 |
|
|
282 |
private: // data types
|
|
283 |
|
|
284 |
struct TItemVisualData
|
|
285 |
{
|
|
286 |
CAlfAnchorLayout* iBase;
|
|
287 |
CAlfImageVisual* iImage;
|
|
288 |
CAlfTextVisual* iText;
|
|
289 |
};
|
|
290 |
|
|
291 |
struct TLevel
|
|
292 |
{
|
|
293 |
CAlfGridLayout* iGridLayout;
|
|
294 |
RArray<TItemVisualData> iItemVisualData;
|
|
295 |
TInt iSelected;
|
|
296 |
TInt iParent;
|
|
297 |
TPoint iParentPos;
|
|
298 |
RArray<TMenuItem> iItems;
|
|
299 |
};
|
|
300 |
|
|
301 |
struct TPluginIdIconIdPair
|
|
302 |
{
|
|
303 |
TInt iPluginArrayIndex;
|
|
304 |
TInt iIconId;
|
|
305 |
};
|
|
306 |
|
|
307 |
class TRingMovementFuncMappingDataProvider: public MAlfTableMappingFunctionDataProvider
|
|
308 |
{
|
|
309 |
public:
|
|
310 |
inline TRingMovementFuncMappingDataProvider() : iStart(0), iEnd(0) { }
|
|
311 |
// From MAlfTableMappingFunctionDataProvider
|
|
312 |
TReal32 MapValue( TReal32 aValue, TInt aMode ) const;
|
|
313 |
inline void SetStart( TReal32 aStart ) { iStart = aStart; }
|
|
314 |
inline void SetEnd( TReal32 aEnd ) { iEnd = aEnd; }
|
|
315 |
private:
|
|
316 |
TReal32 iStart;
|
|
317 |
TReal32 iEnd;
|
|
318 |
};
|
|
319 |
|
|
320 |
/**
|
|
321 |
* Structure for passing button down events
|
|
322 |
*/
|
|
323 |
struct TItemIdInButtonDownEvent
|
|
324 |
{
|
|
325 |
TInt iItemId;
|
|
326 |
TBool iLaunchSelection;
|
|
327 |
};
|
|
328 |
|
|
329 |
private: // methods
|
|
330 |
void ConstructRingL();
|
|
331 |
|
|
332 |
void CreateCaptionForApplicationL(TUid aUid, TDes& aCaption, TBool aShortCaption);
|
|
333 |
void FocusItem(TBool aHasFocus, TInt aItem);
|
|
334 |
void ScrollToRow(TInt row);
|
|
335 |
void PopulateL(TLevel& aLevel);
|
|
336 |
void UpdateLauncherItemListL();
|
|
337 |
void UpdateGridOffset();
|
|
338 |
void SetDefaultStatusPaneTextL();
|
|
339 |
|
|
340 |
void DetachSelectorMappingFunctions();
|
|
341 |
void UpdateFocusVisibility();
|
|
342 |
void UpdatePhysicsL();
|
|
343 |
|
|
344 |
private: // data
|
|
345 |
CAlfEnv& iEnv;
|
|
346 |
CAlfControl* iControl;
|
|
347 |
TLevel iCurrentLevel;
|
|
348 |
CFSEmailUiLauncherGridModel* iModel;
|
|
349 |
TInt iVisibleRows;
|
|
350 |
TInt iVisibleColumns;
|
|
351 |
TInt iRowCount;
|
|
352 |
TInt iFirstVisibleRow;
|
|
353 |
TReal iRowHeight;
|
|
354 |
TReal iColumnWidth;
|
|
355 |
// Selector layout. Not own.
|
|
356 |
CAlfLayout* iSelector;
|
|
357 |
// Mapping function for selector horizontal position. Own.
|
|
358 |
CAlfTableMappingFunction* iRingMovementXFunc;
|
|
359 |
// Mapping function for selector vertical position. Own.
|
|
360 |
CAlfTableMappingFunction* iRingMovementYFunc;
|
|
361 |
TRingMovementFuncMappingDataProvider iRingMovementXFuncMappingDataProvider;
|
|
362 |
TRingMovementFuncMappingDataProvider iRingMovementYFuncMappingDataProvider;
|
|
363 |
|
|
364 |
TBool iStartupAnimation;
|
|
365 |
CAlfAnchorLayout* iWaterMarkBackgroundImageLayout;
|
|
366 |
TInt iStartupEffectStyle;
|
|
367 |
TInt iNewEmailCount;
|
|
368 |
CAlfTextVisual* iNewMailTextVisual;
|
|
369 |
CAlfImageVisual* iNewMailBgVisual;
|
|
370 |
CAlfAnchorLayout* iTopTextLayout;
|
|
371 |
CAlfTextVisual* iTimeTitle;
|
|
372 |
CAlfImageVisual *iSelectorImageVisual;
|
|
373 |
RPointerArray<CAlfTexture> iIconArray;
|
|
374 |
RArray<TInt> iMailboxRequestIds;
|
|
375 |
TBool iSynchronizingMailbox;
|
|
376 |
TBool iMailboxOnline;
|
|
377 |
RPointerArray<CFSEmailLauncherItem> iLauncherItems;
|
|
378 |
RArray<TUid> iLauncherItemUids;
|
|
379 |
|
|
380 |
CAlfDeckLayout* iParentLayout;
|
|
381 |
CAlfAnchorLayout* iWidgetLayout;
|
|
382 |
// <cmail>
|
|
383 |
CAknDoubleSpanScrollBar* iScrollbar;
|
|
384 |
TAknDoubleSpanScrollBarModel iScrollbarModel;
|
|
385 |
// </cmail>
|
|
386 |
CAlfImageVisual* iBgImageVisual;
|
|
387 |
|
|
388 |
CAiwServiceHandler* iAiwSHandler;
|
|
389 |
|
|
390 |
/**
|
|
391 |
* ETrue if "Creating mailbox" wait note is shown.
|
|
392 |
* Then the key presses are ignored.
|
|
393 |
*/
|
|
394 |
TBool iWizardWaitnoteShown;
|
|
395 |
|
|
396 |
/**
|
|
397 |
* ETrue indicates that the grid contents and layout must be updated next time when the
|
|
398 |
* grid is activated.
|
|
399 |
*/
|
|
400 |
TBool iRefreshNeeded;
|
|
401 |
|
|
402 |
// Array holding pairs of plugin id's vs icon id's
|
|
403 |
RArray<TPluginIdIconIdPair> iPluginIdIconIdPairs;
|
|
404 |
|
|
405 |
// Plugin texture count, also serves as index when adding items to array
|
|
406 |
// and if for bitmap provider
|
|
407 |
TInt iPluginTextureId;
|
|
408 |
|
|
409 |
// Boolean value indicating that construction has completed.
|
|
410 |
TBool iConstructionCompleted;
|
|
411 |
|
|
412 |
// To indicate whether grid has started, for ODS, IAD and
|
|
413 |
// "create mailbox query" interoperability
|
|
414 |
TBool iFirstStartComplete;
|
|
415 |
|
|
416 |
// Boolean value to prevent wizard/help crash when double-clicking.
|
|
417 |
TBool iDoubleClickLock;
|
|
418 |
|
|
419 |
// Item id that was seleceted in button down event
|
|
420 |
TItemIdInButtonDownEvent iItemIdInButtonDownEvent;
|
|
421 |
|
|
422 |
// Boolean value - true is user has launched any operation from UI.
|
|
423 |
TBool iUiOperationLaunched;
|
|
424 |
|
|
425 |
// Mailbox deleter - handles deletion of one or more mailboxes.
|
|
426 |
CFSEmailUiMailboxDeleter* iMailboxDeleter;
|
|
427 |
|
|
428 |
// A pop-up menu that is invoked by long tap events. Used for e.g.
|
|
429 |
// deleting mail boxes.
|
|
430 |
CAknStylusPopUpMenu* iStylusPopUpMenu;
|
|
431 |
TBool iStylusPopUpMenuLaunched;
|
|
432 |
|
|
433 |
// Contains the ID of a selected mailbox. Used for deleting mailboxes
|
|
434 |
// with long tap pop-up menu.
|
|
435 |
TFSMailMsgId iMailboxToDelete;
|
|
436 |
|
|
437 |
CCoeControl* iCoeControl;
|
|
438 |
|
|
439 |
// Timer to postpone the Drawing
|
|
440 |
CFSEmailUiGenericTimer* iStartupCallbackTimer;
|
|
441 |
|
|
442 |
CAknPhysics* iPhysics;
|
|
443 |
TBool iPointerAction;
|
|
444 |
TBool iIsDragging;
|
|
445 |
TPoint iPreviousPosition;
|
|
446 |
TPoint iOriginalPosition;
|
|
447 |
TTime iStartTime;
|
|
448 |
TBool iScrolled;
|
|
449 |
TInt iTotalDragging;
|
|
450 |
TBool iLaunchWizardExecuted; // prevents reentrant Wizard calling
|
|
451 |
}; // class CFSEmailUiLauncherGridVisualiser
|
|
452 |
|
|
453 |
#endif // __FREESTYLEEMAILUI_MAINGRIDUIVISUALISER_H__
|