author | Simon Howkins <simonh@symbian.org> |
Thu, 25 Nov 2010 12:13:04 +0000 | |
branch | RCL_3 |
changeset 83 | 31a5fbf5db1d |
parent 80 | 726fba06891a |
permissions | -rw-r--r-- |
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 grid implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// SYSTEM INCLUDE FILES |
|
20 |
#include "emailtrace.h" |
|
21 |
#include <coemain.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <AknUtils.h> |
|
24 |
#include <AknsUtils.h> |
|
25 |
#include <AknsSkinInstance.h> |
|
26 |
#include <apgcli.h> // RApaLsSession |
|
27 |
#include <e32math.h> |
|
28 |
#include <FreestyleEmailUi.rsg> |
|
29 |
#include <touchlogicalfeedback.h> |
|
30 |
#include <alf/alfutil.h> |
|
31 |
#include <alf/alfenv.h> |
|
32 |
#include <alf/alfevent.h> |
|
33 |
#include <alf/alftextvisual.h> |
|
34 |
#include <aknnotewrappers.h> |
|
35 |
#include <freestyleemailui.mbg> |
|
36 |
#include <gulicon.h> |
|
37 |
#include <akntoolbar.h> |
|
38 |
#include "cfsmailmessage.h" |
|
39 |
#include <alf/alfframebrush.h> |
|
40 |
#include "cfsmailbox.h" |
|
41 |
#include "cfsmailclient.h" |
|
42 |
#include <hlplch.h> |
|
43 |
#include <akntitle.h> |
|
44 |
#include <centralrepository.h> |
|
45 |
#include <alf/alfanchorlayout.h> |
|
46 |
#include <alf/alfbrusharray.h> |
|
47 |
#include <alf/alfstatic.h> |
|
48 |
#include <alf/alfgencomponent.h> |
|
49 |
#include <alf/alfconstants.h> |
|
50 |
#include "fsalfscrollbarlayout.h" |
|
51 |
#include <csxhelp/cmail.hlp.hrh> |
|
52 |
#include <featmgr.h> |
|
53 |
#include <coecntrl.h> |
|
54 |
||
55 |
#include <aknmessagequerydialog.h> |
|
56 |
#include <aknstyluspopupmenu.h> |
|
57 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
58 |
#include <aknlayoutscalable_apps.cdl.h> |
|
59 |
#include <layoutmetadata.cdl.h> |
|
60 |
#include <touchfeedback.h> |
|
61 |
#include <aknphysics.h> |
|
62 |
||
63 |
// INTERNAL INCLUDE FILES |
|
64 |
#include "FSEmailBuildFlags.h" |
|
65 |
#include "FreestyleEmailUiConstants.h" |
|
66 |
#include "FreestyleEmailUiLiterals.h" |
|
67 |
#include "FreestyleEmailUiLauncherGrid.h" |
|
68 |
#include "FreestyleEmailUiLauncherGridVisualiser.h" |
|
69 |
#include "FreestyleEmailUi.hrh" |
|
70 |
#include "FreestyleEmailUiLayoutHandler.h" |
|
71 |
#include "FreestyleEmailUiTextureManager.h" |
|
72 |
#include "FreestyleEmailUiMailListVisualiser.h" |
|
73 |
#include "FreestyleEmailUiShortcutBinding.h" |
|
74 |
#include "FSDelayedLoader.h" |
|
75 |
||
76 |
// Utility clean up function |
|
77 |
void CleanupEComArray( TAny* aArray ); |
|
78 |
||
79 |
// CONSTANT VALUES |
|
80 |
const TReal KDefaultCaptionOpacity = 1.0; |
|
81 |
const TInt KDefaultSelection = 0; |
|
82 |
const TInt KSelectTransitionTimeMs = 300; |
|
83 |
const TInt KIconScalingTransitionTimeMs = 350; |
|
84 |
const TInt KStartupAnimationTime = 0; |
|
85 |
const TReal KScaleSelected = 1.0; |
|
86 |
const TReal KScaleNotSelected = 0.77; |
|
87 |
||
88 |
||
89 |
CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewL(CAlfEnv& aEnv, |
|
90 |
CFSEmailUiLauncherGrid* aControl, |
|
91 |
CFreestyleEmailUiAppUi* aAppUi, |
|
92 |
CAlfControlGroup& aControlGroup, |
|
93 |
TInt aColumns, TInt aRows) |
|
94 |
{ |
|
95 |
FUNC_LOG; |
|
96 |
CFSEmailUiLauncherGridVisualiser* self = CFSEmailUiLauncherGridVisualiser::NewLC(aEnv, aControl, aAppUi, aControlGroup, aRows, aColumns); |
|
97 |
CleanupStack::Pop(self); |
|
98 |
return self; |
|
99 |
} |
|
100 |
||
101 |
CFSEmailUiLauncherGridVisualiser* CFSEmailUiLauncherGridVisualiser::NewLC(CAlfEnv& aEnv, |
|
102 |
CFSEmailUiLauncherGrid* aControl, |
|
103 |
CFreestyleEmailUiAppUi* aAppUi, |
|
104 |
CAlfControlGroup& aControlGroup, |
|
105 |
TInt aColumns, TInt aRows) |
|
106 |
{ |
|
107 |
FUNC_LOG; |
|
108 |
CFSEmailUiLauncherGridVisualiser* self = new (ELeave) CFSEmailUiLauncherGridVisualiser(aEnv, aControl, aAppUi, aControlGroup); |
|
109 |
CleanupStack::PushL(self); |
|
110 |
self->ConstructL(aColumns, aRows); |
|
111 |
return self; |
|
112 |
} |
|
113 |
||
114 |
CFSEmailUiLauncherGridVisualiser::CFSEmailUiLauncherGridVisualiser(CAlfEnv& aEnv, |
|
115 |
CFSEmailUiLauncherGrid* aControl, |
|
116 |
CFreestyleEmailUiAppUi* aAppUi, |
|
117 |
CAlfControlGroup& aControlGroup) |
|
118 |
: CFsEmailUiViewBase(aControlGroup, *aAppUi), |
|
119 |
iEnv( aEnv ), |
|
120 |
iVisibleRows( 0 ), |
|
121 |
iVisibleColumns( 0 ), |
|
122 |
iRowCount( 0 ), |
|
123 |
iFirstVisibleRow( 0 ), |
|
124 |
iRowHeight( 0 ), |
|
125 |
iColumnWidth( 0 ), |
|
126 |
iSelector( 0 ), |
|
127 |
iStartupAnimation( 0 ), |
|
128 |
iStartupEffectStyle( 0 ), |
|
129 |
iWizardWaitnoteShown( EFalse ), |
|
130 |
iPointerAction( EFalse ), |
|
131 |
iIsDragging( EFalse ), |
|
132 |
iScrolled( EFalse ), |
|
133 |
iLaunchWizardExecuted( EFalse ) |
|
134 |
{ |
|
135 |
FUNC_LOG; |
|
136 |
iItemIdInButtonDownEvent.iItemId = KErrNotFound; |
|
137 |
iItemIdInButtonDownEvent.iLaunchSelection = EFalse; |
|
138 |
iControl = aControl; |
|
139 |
} |
|
140 |
||
141 |
void CFSEmailUiLauncherGridVisualiser::ConstructL( TInt aColumns, TInt aRows ) |
|
142 |
{ |
|
143 |
FUNC_LOG; |
|
144 |
BaseConstructL( R_FSEMAILUI_MAINUI_VIEW ); |
|
145 |
iVisibleRows = aRows; |
|
146 |
iVisibleColumns = aColumns; |
|
147 |
iConstructionCompleted = EFalse; |
|
148 |
iDoubleClickLock = EFalse; |
|
149 |
iUiOperationLaunched = EFalse; |
|
150 |
||
151 |
iMailboxDeleter = CFSEmailUiMailboxDeleter::NewL( *iAppUi.GetMailClient(), *this ); |
|
152 |
||
153 |
// Create startup timer |
|
154 |
iStartupCallbackTimer = CFSEmailUiGenericTimer::NewL( this ); |
|
155 |
||
156 |
iCurrentLevel.iParentPos.iY = 0; |
|
157 |
iCurrentLevel.iParentPos.iX = 0; |
|
158 |
||
159 |
if ( CAknPhysics::FeatureEnabled() ) |
|
160 |
{ |
|
161 |
iPhysics = CAknPhysics::NewL(*this, NULL); |
|
162 |
} |
|
163 |
} |
|
164 |
||
165 |
// ---------------------------------------------------------------------------- |
|
166 |
// CFSEmailUiLauncherGridVisualiser::DoFirstStartL() |
|
167 |
// Purpose of this function is to do first start only when grid is really |
|
168 |
// needed to be shown. Implemented to make app startup faster. |
|
169 |
// ---------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
void CFSEmailUiLauncherGridVisualiser::DoFirstStartL() |
|
172 |
{ |
|
173 |
FUNC_LOG; |
|
174 |
iPluginIdIconIdPairs.Reset(); |
|
175 |
||
176 |
TRect mainPaneRect; |
|
177 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
178 |
mainPaneRect ); |
|
179 |
||
180 |
TAknLayoutRect scrollBarRect; |
|
181 |
scrollBarRect.LayoutRect( mainPaneRect, |
|
182 |
AknLayoutScalable_Avkon::aid_size_touch_scroll_bar() ); |
|
183 |
TRect gridRect = mainPaneRect; |
|
184 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
185 |
||
186 |
iVisibleRows = iAppUi.LayoutHandler()->GridRowsInThisResolution(); |
|
187 |
iVisibleColumns = iAppUi.LayoutHandler()->GridColumnsInThisResolution(); |
|
188 |
||
189 |
iStartupAnimation = ETrue; |
|
190 |
iCurrentLevel.iSelected = KDefaultSelection; |
|
191 |
CAlfTextureManager& manager = iEnv.TextureManager(); |
|
192 |
||
193 |
iParentLayout = CAlfDeckLayout::AddNewL( *iControl ); |
|
194 |
iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification ); |
|
195 |
||
196 |
// Widget layout divides the screen between grid and scroll bar |
|
197 |
iWidgetLayout = CAlfAnchorLayout::AddNewL( *iControl, iParentLayout ); |
|
198 |
TSize displaySize = mainPaneRect.Size(); |
|
199 |
iWidgetLayout->SetSize( displaySize ); |
|
200 |
||
201 |
// Constructed here, updated later, #0 item in iWidgetLayout |
|
202 |
ConstructScrollbarL( iWidgetLayout ); |
|
203 |
||
204 |
// Grid layout is constructed here, #1 item in iWidgetLayout |
|
205 |
iCurrentLevel.iGridLayout = |
|
206 |
CAlfGridLayout::AddNewL( *iControl, iVisibleColumns, iVisibleRows, |
|
207 |
iWidgetLayout ); |
|
208 |
iCurrentLevel.iGridLayout->EnableScrollingL( ETrue ); |
|
209 |
iCurrentLevel.iGridLayout->SetFlags( EAlfVisualFlagAutomaticLocaleMirroringEnabled ); |
|
210 |
||
211 |
// Selector is added to iGridLayout |
|
212 |
iSelector = iControl->AppendLayoutL( EAlfLayoutTypeLayout, |
|
213 |
iCurrentLevel.iGridLayout ); |
|
214 |
iSelector->SetFlags( EAlfVisualFlagManualLayout ); |
|
215 |
||
216 |
iRingMovementXFunc = CAlfTableMappingFunction::NewL( iEnv ); |
|
217 |
iRingMovementYFunc = CAlfTableMappingFunction::NewL( iEnv ); |
|
218 |
||
219 |
TAlfTimedPoint selectorPos = iSelector->Pos(); |
|
220 |
selectorPos.iX.SetMappingFunctionIdentifier( iRingMovementXFunc->MappingFunctionIdentifier() ); |
|
221 |
selectorPos.iY.SetMappingFunctionIdentifier( iRingMovementYFunc->MappingFunctionIdentifier() ); |
|
222 |
iSelector->SetPos( selectorPos ); |
|
223 |
||
224 |
UpdateFocusVisibility(); |
|
225 |
iSelectorImageVisual = CAlfImageVisual::AddNewL( *iControl, iSelector ); |
|
226 |
iSelectorImageVisual->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
227 |
||
228 |
const TInt var( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 ); |
|
229 |
||
230 |
// Use layout data instead of hard-coded values |
|
231 |
TAknLayoutRect itemRect; |
|
232 |
itemRect.LayoutRect( gridRect, |
|
233 |
AknLayoutScalable_Apps::cell_cmail_l_pane( var, 0, 0 ) ); |
|
234 |
iSelectorImageVisual->SetSize( itemRect.Rect().Size() ); |
|
235 |
iSelectorImageVisual->EnableBrushesL(); |
|
236 |
CAlfFrameBrush* brush = iAppUi.FsTextureManager()->GridSelectorBrushL(); |
|
237 |
iSelectorImageVisual->Brushes()->AppendL( brush, EAlfDoesNotHaveOwnership ); |
|
238 |
iStartupEffectStyle = EFalse; |
|
239 |
||
240 |
iAiwSHandler = CAiwServiceHandler::NewL(); |
|
241 |
iAiwSHandler->AttachL( R_AIW_INTEREST_LAUNCH_SETUP_WIZARD ); |
|
242 |
||
243 |
if( !iStylusPopUpMenu ) |
|
244 |
{ |
|
245 |
// Construct the long tap pop-up menu. |
|
246 |
TPoint point( 0, 0 ); |
|
247 |
iStylusPopUpMenu = CAknStylusPopUpMenu::NewL( this , point ); |
|
248 |
TResourceReader reader; |
|
249 |
iCoeEnv->CreateResourceReaderLC( reader, |
|
250 |
R_STYLUS_POPUP_MENU_LAUNCHER_GRID_VIEW ); |
|
251 |
iStylusPopUpMenu->ConstructFromResourceL( reader ); |
|
252 |
CleanupStack::PopAndDestroy(); // reader |
|
253 |
} |
|
254 |
||
255 |
iCoeControl = new( ELeave )CCoeControl; |
|
256 |
// Initial visual layout update is done when the view gets activated. |
|
257 |
iRefreshNeeded = ETrue; |
|
258 |
||
259 |
UpdatePhysicsL(); // init sizes for scrooling |
|
260 |
||
261 |
// First start toggle |
|
262 |
iConstructionCompleted = ETrue; |
|
263 |
} |
|
264 |
||
265 |
// --------------------------------------------------------------------------- |
|
266 |
// HandleButtonReleaseEventL is called when Launcher grid visualiser |
|
267 |
// gets pointer event that indicates that button is released. |
|
268 |
// function should decide if focus should still be drawn or not. |
|
269 |
// --------------------------------------------------------------------------- |
|
270 |
// |
|
271 |
void CFSEmailUiLauncherGridVisualiser::HandleButtonReleaseEvent() |
|
272 |
{ |
|
273 |
iItemIdInButtonDownEvent.iItemId = KErrNotFound; |
|
274 |
iItemIdInButtonDownEvent.iLaunchSelection = EFalse; |
|
275 |
||
276 |
UpdateFocusVisibility(); |
|
277 |
||
278 |
if( !IsFocusShown() ) |
|
279 |
{ |
|
280 |
// No items are focused anymore. Shrink the icon. |
|
281 |
ResizeItemIcon( ETrue ); |
|
282 |
} |
|
283 |
else |
|
284 |
{ |
|
285 |
// Reset selected icon size back to normal |
|
286 |
ResizeItemIcon( EFalse ); |
|
287 |
} |
|
288 |
} |
|
289 |
||
290 |
// --------------------------------------------------------------------------- |
|
291 |
// Reduces icon size of seleceted item |
|
292 |
// Called when grag event is made. |
|
293 |
// --------------------------------------------------------------------------- |
|
294 |
// |
|
295 |
void CFSEmailUiLauncherGridVisualiser::ResizeItemIcon( TBool aReduce ) |
|
296 |
{ |
|
297 |
TInt selectedItem( iCurrentLevel.iSelected ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
298 |
|
64 | 299 |
TInt count = iCurrentLevel.iItemVisualData.Count(); |
300 |
if ( selectedItem < 0 || selectedItem >= count ) |
|
301 |
{ |
|
302 |
return; // incorrect index |
|
303 |
} |
|
304 |
if( selectedItem >= 0 ) |
|
305 |
{ |
|
306 |
TReal transition( KScaleNotSelected ); |
|
307 |
if( !aReduce ) |
|
308 |
{ |
|
309 |
transition = KScaleSelected; |
|
310 |
} |
|
311 |
TAlfTimedValue scaleValue; |
|
312 |
scaleValue.SetTarget( transition, KIconScalingTransitionTimeMs * 2 ); |
|
313 |
iCurrentLevel.iItemVisualData[selectedItem].iImage->SetScale( scaleValue ); |
|
314 |
if ( !iScrolled ) |
|
315 |
{ |
|
316 |
HandleRowMovement( EDirectionTouch, selectedItem ); |
|
317 |
} |
|
318 |
} |
|
319 |
} |
|
320 |
||
321 |
CFSEmailUiLauncherGridVisualiser::~CFSEmailUiLauncherGridVisualiser() |
|
322 |
{ |
|
323 |
FUNC_LOG; |
|
324 |
||
325 |
if ( iStartupCallbackTimer ) |
|
326 |
{ |
|
327 |
iStartupCallbackTimer->Cancel(); |
|
328 |
delete iStartupCallbackTimer; |
|
329 |
} |
|
330 |
||
331 |
iPluginIdIconIdPairs.Reset(); |
|
332 |
iIconArray.Close(); |
|
333 |
iMailboxRequestIds.Close(); |
|
334 |
iLauncherItems.ResetAndDestroy(); |
|
335 |
iLauncherItemUids.Close(); |
|
336 |
iCurrentLevel.iItemVisualData.Close(); |
|
337 |
iCurrentLevel.iItems.Close(); |
|
338 |
DetachSelectorMappingFunctions(); |
|
339 |
delete iRingMovementXFunc; |
|
340 |
delete iRingMovementYFunc; |
|
341 |
delete iModel; |
|
342 |
delete iAiwSHandler; |
|
343 |
delete iScrollbar; |
|
344 |
delete iMailboxDeleter; |
|
345 |
delete iStylusPopUpMenu; |
|
346 |
delete iCoeControl; |
|
347 |
delete iPhysics; |
|
348 |
} |
|
349 |
||
350 |
void CFSEmailUiLauncherGridVisualiser::CreateModelL() |
|
351 |
{ |
|
352 |
FUNC_LOG; |
|
353 |
||
354 |
RArray<TBool> itemInModel; |
|
355 |
CleanupClosePushL( itemInModel ); |
|
356 |
iIconArray.Reset(); |
|
357 |
||
358 |
iPluginTextureId = EGridPluginIconFirst; |
|
359 |
iPluginIdIconIdPairs.Reset(); |
|
360 |
||
361 |
delete iModel; |
|
362 |
iModel = NULL; |
|
363 |
iModel = new (ELeave) CFSEmailUiLauncherGridModel(); |
|
364 |
iModel->ConstructL(); |
|
365 |
CAlfTexture* iconTexture = 0; |
|
366 |
||
367 |
// Get item ordering from resources |
|
368 |
TResourceReader reader; |
|
369 |
iEikonEnv->CreateResourceReaderLC( reader, R_FSEMAILUI_LAUNCHER_GRID ); |
|
370 |
||
371 |
UpdateLauncherItemListL(); |
|
372 |
MFSMailBrandManager& brandManager = iAppUi.GetMailClient()->GetBrandManagerL(); |
|
373 |
||
374 |
for ( TInt i = 0; i < iLauncherItems.Count(); i++ ) |
|
375 |
{ |
|
376 |
itemInModel.Append( EFalse ); |
|
377 |
} |
|
378 |
||
379 |
TInt count = reader.ReadInt16(); |
|
380 |
||
381 |
TRect mainPaneRect; |
|
382 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
383 |
||
384 |
TAknLayoutRect scrollBarRect; |
|
385 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
386 |
TRect gridRect = mainPaneRect; |
|
387 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
388 |
||
389 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
390 |
TAknLayoutRect itemRect; |
|
391 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var,0,0)); |
|
392 |
||
393 |
TAknLayoutRect gridIconLRect; |
|
394 |
gridIconLRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
395 |
TSize iconSize = gridIconLRect.Rect().Size(); |
|
396 |
||
397 |
for ( TInt itemIndex = 0; itemIndex < count; itemIndex++ ) |
|
398 |
{ |
|
399 |
TInt itemId = reader.ReadInt16(); |
|
400 |
switch ( itemId ) |
|
401 |
{ |
|
402 |
case EDefaultMailboxItem: |
|
403 |
{ |
|
404 |
||
405 |
RPointerArray<CFSMailBox> mailBoxes; |
|
406 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
407 |
TFSMailMsgId id; |
|
408 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
409 |
id, |
|
410 |
mailBoxes ); |
|
411 |
||
412 |
if ( mailBoxes.Count() > 0 ) |
|
413 |
{ |
|
414 |
// Try to get branded graphic |
|
415 |
CGulIcon* mbIcon(0); |
|
416 |
TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailBoxes[0]->GetId() ) ); |
|
417 |
if ( err == KErrNone && mbIcon ) |
|
418 |
{ |
|
419 |
CleanupStack::PushL( mbIcon ); |
|
420 |
AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize); |
|
421 |
AknIconUtils::SetSize(mbIcon->Mask(), iconSize); |
|
422 |
||
423 |
// Create texture into TextureManager, If not already existing |
|
424 |
// Note: size(0,0) means original icon size |
|
425 |
iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon, |
|
426 |
mailBoxes[0]->GetId().PluginId(), |
|
427 |
mailBoxes[0]->GetId().Id(), |
|
428 |
TSize(0,0)); |
|
429 |
// Get branded mailbox icon |
|
430 |
iconTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( mailBoxes[0]->GetId().PluginId(), |
|
431 |
mailBoxes[0]->GetId().Id(), |
|
432 |
TSize(0,0)); |
|
433 |
||
434 |
CleanupStack::PopAndDestroy( mbIcon ); |
|
435 |
} |
|
436 |
else |
|
437 |
{ |
|
438 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture ); |
|
439 |
} |
|
440 |
||
441 |
iIconArray.AppendL( iconTexture ); |
|
442 |
||
443 |
// Branded mailbox name is nowadays set in new mailbox event |
|
444 |
// handling, so we don't need to use brand manager here anymore. |
|
445 |
iModel->AddL( |
|
446 |
EShortcut, |
|
447 |
EDefaultMailboxItem, |
|
448 |
mailBoxes[0]->GetName(), |
|
449 |
*iconTexture, |
|
450 |
mailBoxes[0]->GetId(), |
|
451 |
mailBoxes[0]->GetStandardFolderId( EFSInbox ) ); |
|
452 |
||
453 |
iAppUi.SubscribeMailboxL( mailBoxes[0]->GetId() ); |
|
454 |
} |
|
455 |
||
456 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
457 |
} |
|
458 |
break; |
|
459 |
case EOtherMailboxItems: |
|
460 |
{ |
|
461 |
RPointerArray<CFSMailBox> mailBoxes; |
|
462 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
463 |
TFSMailMsgId id; |
|
464 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
465 |
id, |
|
466 |
mailBoxes ); |
|
467 |
||
468 |
for ( TInt i = 1; i < mailBoxes.Count(); i++ ) |
|
469 |
{ |
|
470 |
// Try to get branded graphic |
|
471 |
CGulIcon* mbIcon(0); |
|
472 |
TRAPD( err, mbIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailBoxes[i]->GetId() ) ); |
|
473 |
if ( err == KErrNone && mbIcon ) |
|
474 |
{ |
|
475 |
CleanupStack::PushL( mbIcon ); |
|
476 |
AknIconUtils::SetSize(mbIcon->Bitmap(), iconSize); |
|
477 |
AknIconUtils::SetSize(mbIcon->Mask(), iconSize); |
|
478 |
||
479 |
// Create texture into TextureManager, If not already existing |
|
480 |
iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mbIcon, |
|
481 |
mailBoxes[i]->GetId().PluginId(), |
|
482 |
mailBoxes[i]->GetId().Id(), |
|
483 |
TSize(0,0)); |
|
484 |
// Get branded mailbox icon |
|
485 |
iconTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( mailBoxes[i]->GetId().PluginId(), |
|
486 |
mailBoxes[i]->GetId().Id(), |
|
487 |
TSize(0,0)); |
|
488 |
CleanupStack::PopAndDestroy( mbIcon ); |
|
489 |
} |
|
490 |
else |
|
491 |
{ |
|
492 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture ); |
|
493 |
} |
|
494 |
iIconArray.AppendL( iconTexture ); |
|
495 |
// Branded mailbox name is nowadays set in new mailbox event |
|
496 |
// handling, so we don't need to use brand manager here anymore. |
|
497 |
iModel->AddL( |
|
498 |
EShortcut, |
|
499 |
EDefaultMailboxItem, |
|
500 |
mailBoxes[i]->GetName(), |
|
501 |
*iconTexture, |
|
502 |
mailBoxes[i]->GetId(), |
|
503 |
mailBoxes[i]->GetStandardFolderId( EFSInbox ) ); |
|
504 |
||
505 |
iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() ); |
|
506 |
} |
|
507 |
||
508 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
509 |
} |
|
510 |
break; |
|
511 |
case EDirectoryItem: |
|
512 |
{ |
|
513 |
RPointerArray<CFSMailBox> mailBoxes; |
|
514 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
515 |
TFSMailMsgId id; |
|
516 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
517 |
id, |
|
518 |
mailBoxes ); |
|
519 |
||
520 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
521 |
{ |
|
522 |
if ( TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) ) |
|
523 |
{ |
|
524 |
HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_DIRECTORY ); |
|
525 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridDirectoryTexture ); |
|
526 |
iModel->AddL(EShortcut, EDirectoryItem, *text, *iconTexture ); |
|
527 |
CleanupStack::PopAndDestroy( text ); |
|
528 |
iIconArray.AppendL( iconTexture ); |
|
529 |
break; |
|
530 |
} |
|
531 |
} |
|
532 |
||
533 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
534 |
} |
|
535 |
break; |
|
536 |
case ESettingsItem: |
|
537 |
{ |
|
538 |
HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_SETTINGS ); |
|
539 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridSettingsTexture ); |
|
540 |
iModel->AddL(EShortcut, ESettingsItem, *text, *iconTexture ); |
|
541 |
CleanupStack::PopAndDestroy( text ); |
|
542 |
iIconArray.AppendL( iconTexture ); |
|
543 |
} |
|
544 |
break; |
|
545 |
case EAddNewMailboxItem: |
|
546 |
{ |
|
547 |
HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_ADD_NEW_MAILBOX ); |
|
548 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridAddNewBoxTexture ); |
|
549 |
iModel->AddL(EShortcut, EAddNewMailboxItem, *text, *iconTexture ); |
|
550 |
CleanupStack::PopAndDestroy( text ); |
|
551 |
iIconArray.AppendL( iconTexture ); |
|
552 |
} |
|
553 |
break; |
|
554 |
case EHelpItem: |
|
555 |
{ |
|
556 |
// remove help support in pf5250 |
|
557 |
if (! FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
558 |
{ |
|
559 |
HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_GRIDITEM_HELP ); |
|
560 |
iconTexture = &iAppUi.FsTextureManager()->TextureByIndex( EGridHelpTexture ); |
|
561 |
iModel->AddL(EShortcut, EHelpItem, *text, *iconTexture ); |
|
562 |
CleanupStack::PopAndDestroy( text ); |
|
563 |
iIconArray.AppendL( iconTexture ); |
|
564 |
} |
|
565 |
} |
|
566 |
break; |
|
567 |
case EIntellisyncFileSyncItem: |
|
568 |
case EIntellisyncTravelInfoItem: |
|
569 |
case EIntellisyncBackupItem: |
|
570 |
case EIntellisyncRestoreItem: |
|
571 |
case EIntellisyncUpgradeItem: |
|
572 |
case EIntellisyncRemoteControlItem: |
|
573 |
{ |
|
574 |
for ( TInt i = 0; i < iLauncherItems.Count(); i++ ) |
|
575 |
{ |
|
576 |
if ( iLauncherItems[i]->Id() == itemId ) |
|
577 |
{ |
|
578 |
itemInModel[i] = ETrue; |
|
579 |
AddItemToModelL( iLauncherItems[i], i ); |
|
580 |
break; |
|
581 |
} |
|
582 |
} |
|
583 |
} |
|
584 |
break; |
|
585 |
default: |
|
586 |
break; |
|
587 |
} |
|
588 |
} |
|
589 |
||
590 |
CleanupStack::PopAndDestroy(); // reader internal state |
|
591 |
||
592 |
// Rest of the launcher items |
|
593 |
for ( TInt i = 0; i < iLauncherItems.Count(); i++ ) |
|
594 |
{ |
|
595 |
if ( ! itemInModel[i] ) |
|
596 |
{ |
|
597 |
AddItemToModelL( iLauncherItems[i], i ); |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
CleanupStack::PopAndDestroy( &itemInModel ); |
|
602 |
} |
|
603 |
||
604 |
void CFSEmailUiLauncherGridVisualiser::CreateCaptionForApplicationL(TUid aUid, |
|
605 |
TDes& aCaption, |
|
606 |
TBool aShortCaption) |
|
607 |
{ |
|
608 |
FUNC_LOG; |
|
609 |
RApaLsSession ls; |
|
610 |
User::LeaveIfError( ls.Connect() ); |
|
611 |
TApaAppInfo appInfo; |
|
612 |
TInt ret = ls.GetAppInfo( appInfo, aUid ); |
|
613 |
if ( ret == KErrNone ) |
|
614 |
{ |
|
615 |
if ( !aShortCaption ) |
|
616 |
{ |
|
617 |
aCaption = appInfo.iCaption; |
|
618 |
} |
|
619 |
else |
|
620 |
{ |
|
621 |
aCaption = appInfo.iShortCaption; |
|
622 |
} |
|
623 |
} |
|
624 |
ls.Close(); |
|
625 |
} |
|
626 |
||
627 |
||
628 |
TUid CFSEmailUiLauncherGridVisualiser::Id() const |
|
629 |
{ |
|
630 |
FUNC_LOG; |
|
631 |
return AppGridId; |
|
632 |
} |
|
633 |
||
634 |
void CFSEmailUiLauncherGridVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId, |
|
635 |
TUid /*aCustomMessageId*/, |
|
636 |
const TDesC8& /*aCustomMessage*/) |
|
637 |
{ |
|
638 |
FUNC_LOG; |
|
639 |
if ( !iConstructionCompleted ) |
|
640 |
{ |
|
641 |
DoFirstStartL(); |
|
642 |
} |
|
643 |
||
644 |
if( iAppUi.CurrentFixedToolbar() ) |
|
645 |
{ |
|
646 |
iAppUi.CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
|
647 |
} |
|
648 |
||
649 |
// For initial mailbox query |
|
650 |
TBool startedFromOds = EFalse; |
|
651 |
// NULL wizard started parameter every time when activated again. |
|
652 |
iDoubleClickLock = EFalse; |
|
653 |
||
654 |
if ( aPrevViewId.iAppUid.iUid == 0 && |
|
655 |
iAppUi.CurrentActiveView() != this ) |
|
656 |
{ |
|
657 |
// Started from wizard do not show query |
|
658 |
startedFromOds = ETrue; |
|
659 |
// This view activation has not come through according normal view |
|
660 |
// activation procedure, so we should ignore this by activating |
|
661 |
// the currently active view again. This has been made to |
|
662 |
// avoid problems when ODS setup is completed. |
|
663 |
if ( iAppUi.CurrentActiveView()->Id() == MailListId ) |
|
664 |
{ |
|
665 |
TMailListActivationData tmp; |
|
666 |
tmp.iReturnAfterWizard = ETrue; |
|
667 |
const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
|
668 |
iAppUi.EnterFsEmailViewL( MailListId, KStartListReturnToPreviousFolder, pkgOut ); |
|
669 |
} |
|
670 |
else if ( iAppUi.CurrentActiveView()->Id() == MailViewerId ) |
|
671 |
{ |
|
672 |
TMsgViewerActivationData tmp; |
|
673 |
const TPckgBuf<TMsgViewerActivationData> pkgOut( tmp ); |
|
674 |
iAppUi.EnterFsEmailViewL( MailViewerId, KStartViewerReturnToPreviousMsg, pkgOut); |
|
675 |
} |
|
676 |
else |
|
677 |
{ |
|
678 |
iAppUi.EnterFsEmailViewL( iAppUi.CurrentActiveView()->Id() ); |
|
679 |
} |
|
680 |
||
681 |
return; |
|
682 |
} |
|
683 |
||
684 |
if ( iRefreshNeeded ) |
|
685 |
{ |
|
686 |
CreateModelL(); |
|
687 |
RescaleIconsL(); |
|
688 |
VisualLayoutUpdatedL(); |
|
689 |
} |
|
690 |
else |
|
691 |
{ |
|
692 |
// scroll bar needs to be updated manually anyway |
|
693 |
UpdateScrollBarRangeL(); |
|
694 |
} |
|
695 |
||
696 |
SetDefaultStatusPaneTextL(); |
|
697 |
||
698 |
// Mailbox query is called here but shown only once in appui if needed |
|
699 |
// doNotshowQuery is ETrue when started from wizard |
|
700 |
if ( !iFirstStartComplete ) |
|
701 |
{ |
|
702 |
iFirstStartComplete = ETrue; |
|
703 |
iAppUi.GridStarted( startedFromOds ); |
|
704 |
iAppUi.ShowMailboxQueryL(); |
|
705 |
} |
|
706 |
else |
|
707 |
{ |
|
708 |
// Ensure that FSMailServer is running, but don't do it on first |
|
709 |
// activation, as it's done anyway in AppUi's ConstructL |
|
710 |
TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() ); |
|
711 |
} |
|
712 |
||
713 |
if( iRowCount > iVisibleRows ) |
|
714 |
{ |
|
715 |
iScrollbar->MakeVisible(ETrue); |
|
716 |
} |
|
717 |
else |
|
718 |
{ |
|
719 |
iScrollbar->MakeVisible(EFalse); |
|
720 |
} |
|
721 |
||
722 |
iAppUi.HideTitlePaneConnectionStatus(); |
|
723 |
||
724 |
// Erase the navigation history when main grid activated. This is the default view |
|
725 |
// of the application and back navigation is never possible from here. The view stack |
|
726 |
// might be in inconsistent state because of some unexpected error in view switching. |
|
727 |
// Erasing the history helps recovering from such situations. |
|
728 |
iAppUi.EraseViewHistory(); |
|
729 |
FocusVisibilityChange( iAppUi.IsFocusShown() ); |
|
730 |
UpdateFocusVisibility(); |
|
731 |
} |
|
732 |
||
733 |
void CFSEmailUiLauncherGridVisualiser::ChildDoDeactivate() |
|
734 |
{ |
|
735 |
FUNC_LOG; |
|
736 |
iScrollbar->MakeVisible(EFalse); |
|
737 |
} |
|
738 |
||
739 |
void CFSEmailUiLauncherGridVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
740 |
{ |
|
741 |
FUNC_LOG; |
|
742 |
||
743 |
if ( aResourceId == R_FSEMAILUI_MAINUIGRID_MENUPANE ) |
|
744 |
{ |
|
745 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
746 |
{ |
|
747 |
// remove help support in pf5250 |
|
748 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
749 |
} |
|
750 |
||
751 |
TFSLauncherGridMailboxStatus mbStatus = CheckMailboxStatusL(); |
|
752 |
||
753 |
// Checks if a device has a keyboard or not. |
|
754 |
if( !IsFocusShown() ) |
|
755 |
{ |
|
756 |
if( mbStatus.iMailboxCount <= 0 ) |
|
757 |
{ |
|
758 |
// If no mailboxes configured, dim all mailbox related items. |
|
759 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue ); |
|
760 |
} |
|
761 |
||
762 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdOpen, ETrue ); |
|
763 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
764 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue ); |
|
765 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue ); |
|
766 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue ); |
|
767 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOfflineAll, ETrue ); |
|
768 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue ); |
|
769 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue ); |
|
770 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue ); |
|
771 |
} |
|
772 |
else |
|
773 |
{ |
|
774 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdAbout, ETrue ); |
|
775 |
||
776 |
if( mbStatus.iMailboxCount <= 0 ) |
|
777 |
{ |
|
778 |
// If no mailboxes configured, dimm all mailbox related items |
|
779 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdDeleteMailbox, ETrue ); |
|
780 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue); |
|
781 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
782 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue ); |
|
783 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue ); |
|
784 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue ); |
|
785 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue ); |
|
786 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOfflineAll, ETrue ); |
|
787 |
} |
|
788 |
else |
|
789 |
{ |
|
790 |
// Handle items related to sync cancelling |
|
791 |
if( mbStatus.iMailboxesSyncing == 0 ) |
|
792 |
{ |
|
793 |
// All mailboxes are already not syncing |
|
794 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue ); |
|
795 |
} |
|
796 |
||
797 |
// Handle items related to sync starting |
|
798 |
if( mbStatus.iMailboxesSyncing == mbStatus.iMailboxCount ) |
|
799 |
{ |
|
800 |
// All mailboxes are already syncing |
|
801 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
802 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue ); |
|
803 |
} |
|
804 |
else if( mbStatus.iMailboxCount == 1 ) |
|
805 |
{ |
|
806 |
// Only one mailbox configured, dimm "Synchronise all" |
|
807 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue ); |
|
808 |
} |
|
809 |
else |
|
810 |
{ |
|
811 |
// Several mailboxes configured, dimm "Synchronise" |
|
812 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
813 |
} |
|
814 |
||
815 |
// Handle items related to online |
|
816 |
if( mbStatus.iMailboxesOnline == mbStatus.iMailboxCount ) |
|
817 |
{ |
|
818 |
// All mailboxes are already online |
|
819 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue ); |
|
820 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue ); |
|
821 |
} |
|
822 |
else if( mbStatus.iMailboxCount == 1 ) |
|
823 |
{ |
|
824 |
// Only one mailbox configured, dimm "Connect all" |
|
825 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnlineAll, ETrue ); |
|
826 |
} |
|
827 |
else |
|
828 |
{ |
|
829 |
// Several mailboxes configured, dimm "Connect" |
|
830 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOnline, ETrue ); |
|
831 |
} |
|
832 |
||
833 |
// Handle pop accounts that can't sync |
|
834 |
RPointerArray<CFSMailBox> mailBoxes; |
|
835 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
836 |
TFSMailMsgId id; |
|
837 |
bool onlyPop = true; |
|
838 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
839 |
id, |
|
840 |
mailBoxes ); |
|
841 |
||
842 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
843 |
{ |
|
844 |
if (mailBoxes[i]->HasCapability( EFSMBoxCapaSupportsSync )) |
|
845 |
{ |
|
846 |
onlyPop = false; |
|
847 |
} |
|
848 |
} |
|
849 |
||
850 |
if (onlyPop) |
|
851 |
{ |
|
852 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
853 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSyncAll, ETrue ); |
|
854 |
} |
|
855 |
||
856 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
857 |
||
858 |
// Handle items related to offline |
|
859 |
if( mbStatus.iMailboxesOffline == mbStatus.iMailboxCount ) |
|
860 |
{ |
|
861 |
// All mailboxes are already offline |
|
862 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue ); |
|
863 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOfflineAll, ETrue ); |
|
864 |
} |
|
865 |
else if( mbStatus.iMailboxCount == 1 ) |
|
866 |
{ |
|
867 |
// Only one mailbox configured, dimm "Disconnect all" |
|
868 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOfflineAll, ETrue ); |
|
869 |
} |
|
870 |
else |
|
871 |
{ |
|
872 |
// Several mailboxes configured, dimm "Disconnect" |
|
873 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdGoOffline, ETrue ); |
|
874 |
} |
|
875 |
} |
|
876 |
||
877 |
// Add shortcut hints |
|
878 |
iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
|
879 |
CFSEmailUiShortcutBinding::EContextMainGrid ); |
|
880 |
} |
|
881 |
} |
|
882 |
} |
|
883 |
||
884 |
void CFSEmailUiLauncherGridVisualiser::HandleCommandL( TInt aCommand ) |
|
885 |
{ |
|
886 |
FUNC_LOG; |
|
887 |
||
888 |
switch ( aCommand ) |
|
889 |
{ |
|
890 |
case EAknSoftkeyOpen: |
|
891 |
{ |
|
892 |
if( !iAppUi.IsFocusShown() ) |
|
893 |
{ |
|
894 |
// No need to handle return value |
|
895 |
iAppUi.SetFocusVisibility( ETrue ); |
|
896 |
UpdateFocusVisibility(); |
|
897 |
ResizeItemIcon( EFalse ); |
|
898 |
break; |
|
899 |
} |
|
900 |
} |
|
901 |
case EFsEmailUiCmdOpen: |
|
902 |
{ |
|
903 |
SelectL(); |
|
904 |
break; |
|
905 |
} |
|
906 |
case EFsEmailUiCmdDeleteMailbox: |
|
907 |
{ |
|
908 |
// Deletion by using the option menu. |
|
909 |
iMailboxDeleter->DeleteMailboxL(); |
|
910 |
break; |
|
911 |
} |
|
912 |
case EFsEmailUiCmdDeleteSelectedMailbox: |
|
913 |
{ |
|
914 |
// Deletion by using the long tap pop-up menu. |
|
915 |
iMailboxDeleter->DeleteMailboxL( iMailboxToDelete ); |
|
916 |
||
917 |
// Hide the focus. |
|
918 |
iAppUi.SetFocusVisibility( EFalse ); |
|
919 |
HandleButtonReleaseEvent(); // Finishes the focus removal. |
|
920 |
iStylusPopUpMenuLaunched = EFalse; |
|
921 |
UpdateGridOffset(); |
|
922 |
break; |
|
923 |
} |
|
924 |
case EFsEmailUiCmdSync: |
|
925 |
case EFsEmailUiCmdSyncAll: |
|
926 |
{ |
|
927 |
RPointerArray<CFSMailBox> mailBoxes; |
|
928 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
929 |
TFSMailMsgId id; |
|
930 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
931 |
id, |
|
932 |
mailBoxes ); |
|
933 |
||
934 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
935 |
{ |
|
936 |
iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() ); |
|
937 |
mailBoxes[i]->GetMailBoxStatus(); |
|
938 |
mailBoxes[i]->RefreshNowL( iAppUi ); |
|
939 |
} |
|
940 |
||
941 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
942 |
} |
|
943 |
break; |
|
944 |
case EFsEmailUiCmdCancelSync: |
|
945 |
{ |
|
946 |
RPointerArray<CFSMailBox> mailBoxes; |
|
947 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
948 |
TFSMailMsgId id; |
|
949 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
950 |
id, |
|
951 |
mailBoxes ); |
|
952 |
||
953 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
954 |
{ |
|
955 |
iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() ); |
|
956 |
mailBoxes[i]->CancelSyncL(); |
|
957 |
} |
|
958 |
||
959 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
960 |
} |
|
961 |
break; |
|
962 |
||
963 |
case EFsEmailUiCmdGoOffline: |
|
964 |
case EFsEmailUiCmdGoOfflineAll: |
|
965 |
{ |
|
966 |
if (aCommand == EFsEmailUiCmdGoOfflineAll) |
|
967 |
{ |
|
968 |
iAppUi.ManualMailBoxDisconnectAll(ETrue); |
|
969 |
} |
|
970 |
RPointerArray<CFSMailBox> mailBoxes; |
|
971 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
972 |
TFSMailMsgId id; |
|
973 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
974 |
id, |
|
975 |
mailBoxes ); |
|
976 |
||
977 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
978 |
{ |
|
979 |
iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() ); |
|
980 |
mailBoxes[i]->GoOfflineL(); |
|
981 |
} |
|
982 |
||
983 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
984 |
} |
|
985 |
break; |
|
986 |
case EFsEmailUiCmdGoOnline: |
|
987 |
case EFsEmailUiCmdGoOnlineAll: |
|
988 |
{ |
|
989 |
if (aCommand == EFsEmailUiCmdGoOnlineAll) |
|
990 |
{ |
|
991 |
iAppUi.ManualMailBoxConnectAll(ETrue); |
|
992 |
} |
|
993 |
RPointerArray<CFSMailBox> mailBoxes; |
|
994 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
995 |
TFSMailMsgId id; |
|
996 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
997 |
id, |
|
998 |
mailBoxes ); |
|
999 |
||
1000 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
1001 |
{ |
|
1002 |
iAppUi.SubscribeMailboxL( mailBoxes[i]->GetId() ); |
|
1003 |
mailBoxes[i]->GoOnlineL(); |
|
1004 |
} |
|
1005 |
||
1006 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
1007 |
} |
|
1008 |
break; |
|
1009 |
case EFsEmailUiCmdAbout: |
|
1010 |
{ |
|
1011 |
DisplayProductInfoL(); |
|
1012 |
} |
|
1013 |
break; |
|
1014 |
case EFsEmailUiCmdHelp: |
|
1015 |
{ |
|
1016 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
1017 |
} |
|
1018 |
break; |
|
1019 |
case KErrCancel: |
|
1020 |
{ |
|
1021 |
// The pop-up menu was closed. Hide the focus. |
|
1022 |
iAppUi.SetFocusVisibility( EFalse ); |
|
1023 |
HandleButtonReleaseEvent(); // Finishes the focus removal. |
|
1024 |
iStylusPopUpMenuLaunched = EFalse; |
|
1025 |
break; |
|
1026 |
} |
|
1027 |
case EFsEmailUiCmdHide: |
|
1028 |
case EEikCmdExit: |
|
1029 |
case EAknSoftkeyExit: |
|
1030 |
case EFsEmailUiCmdExit: |
|
1031 |
{ |
|
1032 |
iAppUi.Exit(); |
|
1033 |
} |
|
1034 |
break; |
|
1035 |
default: |
|
1036 |
break; |
|
1037 |
} // switch ( aCommand ) |
|
1038 |
} |
|
1039 |
||
1040 |
TBool CFSEmailUiLauncherGridVisualiser::OfferEventL(const TAlfEvent& aEvent) |
|
1041 |
{ |
|
1042 |
FUNC_LOG; |
|
1043 |
if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
|
1044 |
{ |
|
1045 |
// If wait note is being shown while a mailbox is being created, |
|
1046 |
// then do not react to key presses. |
|
1047 |
if ( iWizardWaitnoteShown ) |
|
1048 |
{ |
|
1049 |
return ETrue; // key consumed |
|
1050 |
} |
|
1051 |
||
1052 |
// Swap right and left controls in mirrored layout |
|
1053 |
TInt scanCode = aEvent.KeyEvent().iScanCode; |
|
1054 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
1055 |
{ |
|
1056 |
if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow; |
|
1057 |
else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow; |
|
1058 |
} |
|
1059 |
||
1060 |
if ((scanCode == EStdKeyRightArrow) |
|
1061 |
|| (scanCode == EStdKeyLeftArrow) |
|
1062 |
|| (scanCode == EStdKeyUpArrow) |
|
1063 |
|| (scanCode == EStdKeyDownArrow) |
|
1064 |
|| (scanCode == EStdKeyEnter) |
|
1065 |
|| (scanCode == EStdKeyDeviceA) |
|
1066 |
|| (scanCode ==EStdKeyDevice3)) |
|
1067 |
{ |
|
1068 |
TBool scrolled = iScrolled; |
|
1069 |
if ( iScrolled ) |
|
1070 |
{ |
|
1071 |
iScrolled = EFalse; |
|
1072 |
SetFocusedItemL( iFirstVisibleRow * iVisibleColumns ); |
|
1073 |
} |
|
1074 |
||
1075 |
//iCurrentLevel.iSelected = |
|
1076 |
if ( !iAppUi.SetFocusVisibility( ETrue ) || |
|
1077 |
scrolled ) |
|
1078 |
{ |
|
1079 |
// focus is now activated. ignore key press. |
|
1080 |
UpdateFocusVisibility(); |
|
1081 |
ResizeItemIcon( EFalse ); |
|
1082 |
return ETrue; |
|
1083 |
} |
|
1084 |
} |
|
1085 |
||
1086 |
switch(scanCode) |
|
1087 |
{ |
|
1088 |
case EStdKeyRightArrow: |
|
1089 |
MoveSelection(EDirectionRight); |
|
1090 |
return ETrue; |
|
1091 |
case EStdKeyLeftArrow: |
|
1092 |
MoveSelection(EDirectionLeft); |
|
1093 |
return ETrue; |
|
1094 |
case EStdKeyUpArrow: |
|
1095 |
MoveSelection(EDirectionUp); |
|
1096 |
return ETrue; |
|
1097 |
case EStdKeyDownArrow: |
|
1098 |
MoveSelection(EDirectionDown); |
|
1099 |
return ETrue; |
|
1100 |
case EStdKeyEnter: |
|
1101 |
case EStdKeyDeviceA: |
|
1102 |
case EStdKeyDevice3: |
|
1103 |
HandleButtonReleaseEvent(); |
|
1104 |
SelectL(); |
|
1105 |
return ETrue; |
|
1106 |
default: |
|
1107 |
// Check keyboard shortcuts. |
|
1108 |
TInt shortcutCommand = |
|
1109 |
iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
1110 |
CFSEmailUiShortcutBinding::EContextMainGrid ); |
|
1111 |
if ( shortcutCommand != KErrNotFound ) |
|
1112 |
{ |
|
1113 |
HandleCommandL( shortcutCommand ); |
|
1114 |
return ETrue; |
|
1115 |
} |
|
1116 |
return EFalse; |
|
1117 |
} |
|
1118 |
} |
|
1119 |
return EFalse; // was not consumed |
|
1120 |
} |
|
1121 |
||
1122 |
||
1123 |
// --------------------------------------------------------------------------- |
|
1124 |
// CFSEmailUiLauncherGridVisualiser::HandlePointerEventL |
|
1125 |
// |
|
1126 |
// --------------------------------------------------------------------------- |
|
1127 |
// |
|
1128 |
TBool CFSEmailUiLauncherGridVisualiser::HandlePointerEventL( |
|
1129 |
const TAlfEvent& aEvent ) |
|
1130 |
{ |
|
1131 |
FUNC_LOG; |
|
1132 |
if( !IsViewActive() ) |
|
1133 |
{ |
|
1134 |
return EFalse; |
|
1135 |
} |
|
1136 |
TPointerEvent::TType type = aEvent.PointerEvent().iType; |
|
1137 |
TInt id = FindPointedItem( aEvent ); |
|
1138 |
||
1139 |
switch( type ) |
|
1140 |
{ |
|
1141 |
case TPointerEvent::EButton1Down: |
|
1142 |
{ |
|
1143 |
iPreviousPosition = iOriginalPosition = aEvent.PointerEvent().iParentPosition; |
|
1144 |
iPointerAction = ETrue; |
|
1145 |
iIsDragging = EFalse; |
|
1146 |
||
1147 |
if( iPhysics ) |
|
1148 |
{ |
|
1149 |
iPhysics->StopPhysics(); |
|
1150 |
iPhysics->ResetFriction(); |
|
1151 |
iStartTime.HomeTime(); |
|
1152 |
UpdatePhysicsL(); |
|
1153 |
iTotalDragging = 0; |
|
1154 |
} |
|
1155 |
if ( id != KErrNotFound) |
|
1156 |
{ |
|
1157 |
// tactile feedback |
|
1158 |
MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
1159 |
if ( feedback ) |
|
1160 |
{ |
|
1161 |
feedback->InstantFeedback( ETouchFeedbackBasic ); |
|
1162 |
} |
|
1163 |
||
1164 |
iItemIdInButtonDownEvent.iItemId = id; |
|
1165 |
iItemIdInButtonDownEvent.iLaunchSelection = ETrue; |
|
1166 |
SetFocusedItemL( id ); |
|
1167 |
UpdateFocusVisibility(); |
|
1168 |
} |
|
1169 |
break; |
|
1170 |
} |
|
1171 |
case TPointerEvent::EButton1Up: |
|
1172 |
{ |
|
1173 |
if( iIsDragging && iPhysics ) |
|
1174 |
{ |
|
1175 |
TPoint drag( iOriginalPosition - aEvent.PointerEvent().iParentPosition ); |
|
1176 |
iPhysics->StartPhysics( drag, iStartTime ); |
|
1177 |
iIsDragging = EFalse; |
|
1178 |
iPointerAction = EFalse; |
|
1179 |
iTotalDragging = 0; |
|
1180 |
} |
|
1181 |
else if ( id != KErrNotFound ) |
|
1182 |
{ |
|
1183 |
if ( iStylusPopUpMenuLaunched ) |
|
1184 |
{ |
|
1185 |
// A pop-up menu was launched. Do not open the selected |
|
1186 |
// item. |
|
1187 |
iItemIdInButtonDownEvent.iLaunchSelection = EFalse; |
|
1188 |
break; |
|
1189 |
} |
|
1190 |
||
1191 |
// Hide focus always after pointer up event. |
|
1192 |
iAppUi.SetFocusVisibility( EFalse ); |
|
1193 |
||
1194 |
// If key was released on item that had focus |
|
1195 |
// trigger selection. |
|
1196 |
if( iItemIdInButtonDownEvent.iItemId == id && |
|
1197 |
iItemIdInButtonDownEvent.iLaunchSelection ) |
|
1198 |
{ |
|
1199 |
HandleButtonReleaseEvent(); |
|
1200 |
// LAUNCH OPENING. This may leave if user cancels the |
|
1201 |
// operation |
|
1202 |
SelectL(); |
|
1203 |
} |
|
1204 |
else |
|
1205 |
{ |
|
1206 |
HandleButtonReleaseEvent(); |
|
1207 |
} |
|
1208 |
} |
|
1209 |
else if( iItemIdInButtonDownEvent.iItemId != KErrNotFound ) |
|
1210 |
{ |
|
1211 |
iItemIdInButtonDownEvent.iLaunchSelection = EFalse; |
|
1212 |
ResizeItemIcon( ETrue ); |
|
1213 |
||
1214 |
// Hide focus always after pointer up event. |
|
1215 |
iAppUi.SetFocusVisibility( EFalse ); |
|
1216 |
iItemIdInButtonDownEvent.iItemId = KErrNotFound; |
|
1217 |
HandleButtonReleaseEvent(); |
|
1218 |
} |
|
1219 |
else |
|
1220 |
{ |
|
1221 |
iAppUi.SetFocusVisibility( EFalse ); |
|
1222 |
} |
|
1223 |
break; |
|
1224 |
} |
|
1225 |
case TPointerEvent::EDrag: |
|
1226 |
{ |
|
1227 |
if( iPhysics ) |
|
1228 |
{ |
|
1229 |
TPoint position = aEvent.PointerEvent().iParentPosition; |
|
1230 |
TPoint delta( 0, iPreviousPosition.iY - position.iY ); |
|
1231 |
iTotalDragging = iTotalDragging + delta.iY; |
|
1232 |
if (Abs(iTotalDragging) >= iPhysics->DragThreshold() || iIsDragging ) |
|
1233 |
{ |
|
1234 |
// Hide focus always when dragging. |
|
1235 |
HandleButtonReleaseEvent(); |
|
1236 |
iIsDragging = ETrue; |
|
1237 |
||
1238 |
iPhysics->RegisterPanningPosition( delta ); |
|
1239 |
iScrolled = ETrue; |
|
1240 |
} |
|
1241 |
// Save current position as previous pos for future calculations |
|
1242 |
iPreviousPosition = position; |
|
1243 |
} |
|
1244 |
break; |
|
1245 |
} |
|
1246 |
case TPointerEvent::EButtonRepeat: |
|
1247 |
{ |
|
1248 |
if (!iIsDragging && id != KErrNotFound ) |
|
1249 |
{ |
|
1250 |
// Check the type of the currently selected item. |
|
1251 |
TInt itemType = iCurrentLevel.iItems[id].iId; |
|
1252 |
||
1253 |
if ( itemType == EDefaultMailboxItem || |
|
1254 |
itemType == EOtherMailboxItems ) |
|
1255 |
{ |
|
1256 |
// The selected item is a mail box. Launch the pop-up |
|
1257 |
// menu. |
|
1258 |
LaunchStylusPopupMenu( id ); |
|
1259 |
} |
|
1260 |
} |
|
1261 |
break; |
|
1262 |
} |
|
1263 |
default: |
|
1264 |
{ |
|
1265 |
break; |
|
1266 |
} |
|
1267 |
} |
|
1268 |
return ETrue; |
|
1269 |
} |
|
1270 |
||
1271 |
// --------------------------------------------------------------------------- |
|
1272 |
// CFSEmailUiLauncherGridVisualiser::FindPointedItem |
|
1273 |
// |
|
1274 |
// --------------------------------------------------------------------------- |
|
1275 |
// |
|
1276 |
TInt CFSEmailUiLauncherGridVisualiser::FindPointedItem( const TAlfEvent& aEvent ) |
|
1277 |
{ |
|
1278 |
FUNC_LOG; |
|
1279 |
TInt result = KErrNotFound; |
|
1280 |
||
1281 |
TInt count = iCurrentLevel.iItemVisualData.Count(); |
|
1282 |
const TPoint pos = aEvent.PointerEvent().iParentPosition; |
|
1283 |
||
1284 |
for ( TInt a = 0; count > a; a++ ) |
|
1285 |
{ |
|
1286 |
const TRect rect( iCurrentLevel.iItemVisualData[a].iBase->DisplayRect() ); |
|
1287 |
if ( rect.Contains( pos ) ) |
|
1288 |
{ |
|
1289 |
result = a; |
|
1290 |
break; |
|
1291 |
} |
|
1292 |
} |
|
1293 |
||
1294 |
return result; |
|
1295 |
} |
|
1296 |
||
1297 |
// --------------------------------------------------------------------------- |
|
1298 |
// CFSEmailUiLauncherGridVisualiser::SetFocusedItemL |
|
1299 |
// |
|
1300 |
// --------------------------------------------------------------------------- |
|
1301 |
// |
|
1302 |
void CFSEmailUiLauncherGridVisualiser::SetFocusedItemL( TInt aId ) |
|
1303 |
{ |
|
1304 |
FUNC_LOG; |
|
1305 |
TInt oldSelection = iCurrentLevel.iSelected; |
|
1306 |
||
1307 |
HandleRowMovement( EDirectionTouch, aId ); |
|
1308 |
||
1309 |
FocusItem( EFalse, oldSelection ); |
|
1310 |
FocusItem( ETrue, iCurrentLevel.iSelected ); |
|
1311 |
MoveSelectorToCurrentItem( EDirectionTouch ); |
|
1312 |
} |
|
1313 |
||
1314 |
void CFSEmailUiLauncherGridVisualiser::MoveSelection( TDirection aDir ) |
|
1315 |
{ |
|
1316 |
FUNC_LOG; |
|
1317 |
// NULL double click flag just be sure that the UI does not |
|
1318 |
// go into state that wizard cannot be started. |
|
1319 |
iDoubleClickLock = EFalse; |
|
1320 |
// Store old selection |
|
1321 |
TInt oldSelection = iCurrentLevel.iSelected; |
|
1322 |
TInt itemCount = iCurrentLevel.iItemVisualData.Count(); |
|
1323 |
||
1324 |
HandleRowMovement( aDir, iCurrentLevel.iSelected ); |
|
1325 |
||
1326 |
// Set the correct icon focuses (i.e. enlarged) |
|
1327 |
if ( aDir != EDirectionNone && oldSelection >= 0 && oldSelection < itemCount ) |
|
1328 |
{ |
|
1329 |
FocusItem( EFalse, oldSelection ); |
|
1330 |
} |
|
1331 |
FocusItem( ETrue, iCurrentLevel.iSelected ); |
|
1332 |
||
1333 |
// Move the selector over the newly focused icon |
|
1334 |
MoveSelectorToCurrentItem( aDir ); |
|
1335 |
UpdateFocusVisibility(); |
|
1336 |
} |
|
1337 |
||
1338 |
||
1339 |
void CFSEmailUiLauncherGridVisualiser::HandleRowMovement( TDirection aDir, TInt aSelected ) |
|
1340 |
{ |
|
1341 |
FUNC_LOG; |
|
1342 |
// NULL double click flag just be sure that the UI does not |
|
1343 |
// go into state that wizard cannot be started. |
|
1344 |
iDoubleClickLock = EFalse; |
|
1345 |
// Store old selection |
|
1346 |
TInt oldSelection = iCurrentLevel.iSelected; |
|
1347 |
TInt itemCount = iCurrentLevel.iItemVisualData.Count(); |
|
1348 |
TInt oldX = 0; |
|
1349 |
TInt oldY = 0; |
|
1350 |
if (itemCount <= 1) |
|
1351 |
{ |
|
1352 |
iCurrentLevel.iSelected = 0; |
|
1353 |
} |
|
1354 |
else |
|
1355 |
{ |
|
1356 |
oldX = oldSelection % iVisibleColumns; |
|
1357 |
oldY = (oldSelection-oldX) / iVisibleColumns; |
|
1358 |
||
1359 |
switch( aDir ) |
|
1360 |
{ |
|
1361 |
case EDirectionRight: |
|
1362 |
iCurrentLevel.iSelected++; |
|
1363 |
if ( iCurrentLevel.iSelected >= itemCount ) |
|
1364 |
{ |
|
1365 |
iCurrentLevel.iSelected = 0; |
|
1366 |
} |
|
1367 |
break; |
|
1368 |
||
1369 |
case EDirectionLeft: |
|
1370 |
iCurrentLevel.iSelected--; |
|
1371 |
if ( iCurrentLevel.iSelected < 0 ) |
|
1372 |
{ |
|
1373 |
iCurrentLevel.iSelected = itemCount-1; |
|
1374 |
} |
|
1375 |
break; |
|
1376 |
||
1377 |
case EDirectionUp: |
|
1378 |
iCurrentLevel.iSelected -= iVisibleColumns; // one row up |
|
1379 |
if ( iCurrentLevel.iSelected < 0 ) |
|
1380 |
{ |
|
1381 |
iCurrentLevel.iSelected += (iRowCount*iVisibleColumns); |
|
1382 |
if ( iCurrentLevel.iSelected >= itemCount ) |
|
1383 |
{ |
|
1384 |
// Wrapping is about to move the cursor on empty spot. |
|
1385 |
// To be consistent with S60 app grid, move selection to the last item. |
|
1386 |
iCurrentLevel.iSelected = itemCount-1; |
|
1387 |
} |
|
1388 |
} |
|
1389 |
break; |
|
1390 |
||
1391 |
case EDirectionDown: |
|
1392 |
iCurrentLevel.iSelected += iVisibleColumns; // one row down |
|
1393 |
if ( iCurrentLevel.iSelected >= itemCount ) |
|
1394 |
{ |
|
1395 |
if ( oldY < iRowCount-1 ) |
|
1396 |
{ |
|
1397 |
iCurrentLevel.iSelected = itemCount-1; |
|
1398 |
} |
|
1399 |
else |
|
1400 |
{ |
|
1401 |
iCurrentLevel.iSelected %= (iRowCount*iVisibleColumns); |
|
1402 |
} |
|
1403 |
} |
|
1404 |
break; |
|
1405 |
||
1406 |
case EDirectionReset: |
|
1407 |
iCurrentLevel.iSelected = KDefaultSelection; |
|
1408 |
break; |
|
1409 |
||
1410 |
case EDirectionNone: |
|
1411 |
break; |
|
1412 |
||
1413 |
case EDirectionTouch: |
|
1414 |
iCurrentLevel.iSelected = aSelected; |
|
1415 |
break; |
|
1416 |
||
1417 |
} |
|
1418 |
||
1419 |
if ( iCurrentLevel.iSelected < 0 ) |
|
1420 |
{ |
|
1421 |
iCurrentLevel.iSelected = 0; |
|
1422 |
} |
|
1423 |
if ( iCurrentLevel.iSelected >= itemCount ) |
|
1424 |
{ |
|
1425 |
iCurrentLevel.iSelected = itemCount - 1; |
|
1426 |
} |
|
1427 |
} |
|
1428 |
if (!iPointerAction) |
|
1429 |
{ |
|
1430 |
TInt x = iCurrentLevel.iSelected % iVisibleColumns; |
|
1431 |
TInt y = (iCurrentLevel.iSelected-x) / iVisibleColumns; |
|
1432 |
ScrollToRow( y ); |
|
1433 |
} |
|
1434 |
} |
|
1435 |
||
1436 |
||
1437 |
void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir ) |
|
1438 |
{ |
|
1439 |
FUNC_LOG; |
|
1440 |
TInt count = iCurrentLevel.iItemVisualData.Count(); |
|
1441 |
if ( iCurrentLevel.iSelected < 0 || iCurrentLevel.iSelected >= count ) |
|
1442 |
{ |
|
1443 |
return; // incorrect index |
|
1444 |
} |
|
1445 |
||
1446 |
TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position |
|
1447 |
iSelector->SetPos( curPos, 0 ); // wrap position now |
|
1448 |
||
1449 |
// Calculate where are we heading |
|
1450 |
CAlfVisual* selectedBase = iCurrentLevel.iItemVisualData[iCurrentLevel.iSelected].iBase; |
|
1451 |
TPoint displayPos = selectedBase->LocalToDisplay( selectedBase->Pos().Target() ); |
|
1452 |
TPoint targetPos = iSelector->DisplayToLocal( displayPos ); |
|
1453 |
||
1454 |
// Check if we need to wrap the selector over the edge of the screen |
|
1455 |
TPoint ringWrapOffset( 0, 0 ); |
|
1456 |
const TInt KGridWrapWidth = (iVisibleColumns+2)*iColumnWidth; |
|
1457 |
const TInt KGridWrapHeight = (iRowCount+2)*iRowHeight; |
|
1458 |
||
1459 |
if ( aDir == EDirectionRight && ( targetPos.iX <= curPos.iX || iCurrentLevel.iSelected == 0 ) ) |
|
1460 |
{ |
|
1461 |
ringWrapOffset.iX = KGridWrapWidth; |
|
1462 |
} |
|
1463 |
else if ( aDir == EDirectionLeft && ( targetPos.iX >= curPos.iX || iCurrentLevel.iSelected == iCurrentLevel.iItems.Count()-1 ) ) |
|
1464 |
{ |
|
1465 |
ringWrapOffset.iX = -KGridWrapWidth; |
|
1466 |
} |
|
1467 |
else if ( aDir == EDirectionUp && targetPos.iY > curPos.iY ) |
|
1468 |
{ |
|
1469 |
ringWrapOffset.iY = -KGridWrapHeight; |
|
1470 |
} |
|
1471 |
else if ( aDir == EDirectionDown && targetPos.iY < curPos.iY ) |
|
1472 |
{ |
|
1473 |
ringWrapOffset.iY = KGridWrapHeight; |
|
1474 |
} |
|
1475 |
targetPos += ringWrapOffset; |
|
1476 |
||
1477 |
// Animate the movement to the new position |
|
1478 |
TInt animTime = KSelectTransitionTimeMs; |
|
1479 |
if ( aDir == EDirectionReset || aDir == EDirectionNone || aDir == EDirectionTouch ) |
|
1480 |
{ |
|
1481 |
animTime = KStartupAnimationTime; |
|
1482 |
} |
|
1483 |
iSelector->SetPos( targetPos, animTime ); |
|
1484 |
} |
|
1485 |
||
1486 |
void CFSEmailUiLauncherGridVisualiser::FocusItem( TBool aHasFocus, TInt aItem ) |
|
1487 |
{ |
|
1488 |
FUNC_LOG; |
|
1489 |
if ( iCurrentLevel.iItemVisualData.Count() <= aItem || |
|
1490 |
aItem < 0 ) |
|
1491 |
{ |
|
1492 |
// Invalid item index |
|
1493 |
return; |
|
1494 |
} |
|
1495 |
||
1496 |
if( aHasFocus && ( IsFocusShown() || iItemIdInButtonDownEvent.iItemId >= 0 ) ) |
|
1497 |
{ |
|
1498 |
TAlfTimedValue scaleValue; |
|
1499 |
scaleValue.SetTarget( KScaleSelected, KIconScalingTransitionTimeMs ); |
|
1500 |
iCurrentLevel.iItemVisualData[aItem].iImage->SetScale( scaleValue ); |
|
1501 |
} |
|
1502 |
else |
|
1503 |
{ |
|
1504 |
TAlfTimedValue scaleValue; |
|
1505 |
scaleValue.SetTarget( KScaleNotSelected, KIconScalingTransitionTimeMs * 2 ); |
|
1506 |
iCurrentLevel.iItemVisualData[aItem].iImage->SetScale( scaleValue ); |
|
1507 |
} |
|
1508 |
} |
|
1509 |
||
1510 |
||
1511 |
void CFSEmailUiLauncherGridVisualiser::ScrollToRow( TInt aRow ) |
|
1512 |
{ |
|
1513 |
FUNC_LOG; |
|
1514 |
const TInt KScrollTransitionTimeMs = KSelectTransitionTimeMs; |
|
1515 |
TReal offset( 0.0 ); |
|
1516 |
||
1517 |
if ( aRow >= iRowCount || aRow < 0 ) |
|
1518 |
{ |
|
1519 |
// Invalid row |
|
1520 |
return; |
|
1521 |
} |
|
1522 |
||
1523 |
if ( iFirstVisibleRow + iVisibleRows - 1 < aRow ) |
|
1524 |
{ |
|
1525 |
// Scroll downwards |
|
1526 |
iFirstVisibleRow = aRow - iVisibleRows + 1 ; |
|
1527 |
} |
|
1528 |
else if ( iFirstVisibleRow > aRow ) |
|
1529 |
{ |
|
1530 |
// Scroll upwards |
|
1531 |
if ( aRow == 0 ) |
|
1532 |
{ |
|
1533 |
iFirstVisibleRow = 0; |
|
1534 |
} |
|
1535 |
else |
|
1536 |
{ |
|
1537 |
iFirstVisibleRow = aRow; |
|
1538 |
} |
|
1539 |
} |
|
1540 |
||
1541 |
||
1542 |
offset = iFirstVisibleRow * iRowHeight; |
|
1543 |
||
1544 |
TAlfTimedPoint alfScrollOffset; |
|
1545 |
alfScrollOffset.iY.SetTarget( offset , KScrollTransitionTimeMs ); |
|
1546 |
iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset); |
|
1547 |
iScrollbarModel.SetFocusPosition(offset); |
|
1548 |
TRAP_IGNORE( iScrollbar->SetModelL(&iScrollbarModel) ); |
|
1549 |
iScrollbar->DrawNow(); |
|
1550 |
} |
|
1551 |
||
1552 |
void CFSEmailUiLauncherGridVisualiser::RefreshLauncherViewL() |
|
1553 |
{ |
|
1554 |
FUNC_LOG; |
|
1555 |
if ( iConstructionCompleted ) |
|
1556 |
{ |
|
1557 |
iDoubleClickLock = EFalse; |
|
1558 |
TInt count = iCurrentLevel.iItemVisualData.Count(); |
|
1559 |
||
1560 |
CreateModelL(); |
|
1561 |
PopulateL( iCurrentLevel ); |
|
1562 |
SetRingWrapLimits(); |
|
1563 |
if ( count != iCurrentLevel.iItemVisualData.Count() ) |
|
1564 |
{ |
|
1565 |
MoveSelection( EDirectionReset ); |
|
1566 |
} |
|
1567 |
else |
|
1568 |
{ |
|
1569 |
FocusItem( ETrue, iCurrentLevel.iSelected ); |
|
1570 |
} |
|
1571 |
UpdateScrollBarRangeL(); |
|
1572 |
} |
|
1573 |
} |
|
1574 |
||
1575 |
TBool CFSEmailUiLauncherGridVisualiser::UiOperationLaunched() |
|
1576 |
{ |
|
1577 |
FUNC_LOG; |
|
1578 |
return iUiOperationLaunched; |
|
1579 |
} |
|
1580 |
||
1581 |
void CFSEmailUiLauncherGridVisualiser::PopulateL( TLevel& aLevel ) |
|
1582 |
{ |
|
1583 |
FUNC_LOG; |
|
1584 |
||
1585 |
if ( iConstructionCompleted ) |
|
1586 |
{ |
|
1587 |
for( TInt i = 0; i < aLevel.iItemVisualData.Count(); i++ ) |
|
1588 |
{ |
|
1589 |
aLevel.iItemVisualData[i].iBase->RemoveAndDestroyAllD(); |
|
1590 |
} |
|
1591 |
||
1592 |
aLevel.iItemVisualData.Reset(); |
|
1593 |
aLevel.iItems.Reset(); |
|
1594 |
||
1595 |
TRect mainPaneRect; |
|
1596 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
1597 |
||
1598 |
TAknLayoutRect scrollBarRect; |
|
1599 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
1600 |
TRect gridRect = mainPaneRect; |
|
1601 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
1602 |
||
1603 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
1604 |
||
1605 |
TAknLayoutRect itemRect; |
|
1606 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0)); |
|
1607 |
||
1608 |
TRect itemrc = itemRect.Rect(); |
|
1609 |
itemrc.SetRect(TPoint(0,0), itemRect.Rect().Size()); |
|
1610 |
||
1611 |
TAknLayoutRect gridIconRect; |
|
1612 |
gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
1613 |
||
1614 |
TAknLayoutText gridText; |
|
1615 |
gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(0)); |
|
1616 |
||
1617 |
if ( aLevel.iParent >= 0 ) |
|
1618 |
{ |
|
1619 |
iModel->FindChildren( aLevel.iParent, aLevel.iItems ); |
|
1620 |
||
1621 |
for ( TInt i = 0; i < aLevel.iItems.Count(); i++ ) |
|
1622 |
{ |
|
1623 |
TItemVisualData newItem; |
|
1624 |
||
1625 |
newItem.iBase = CAlfAnchorLayout::AddNewL( *iControl, aLevel.iGridLayout ); |
|
1626 |
newItem.iBase->SetTactileFeedbackL( ETouchEventStylusDown, ETouchFeedbackBasic ); |
|
1627 |
||
1628 |
// Set anchors for text. |
|
1629 |
newItem.iBase->SetAnchor( |
|
1630 |
EAlfAnchorTopLeft, |
|
1631 |
0, |
|
1632 |
EAlfAnchorOriginLeft, |
|
1633 |
EAlfAnchorOriginTop, |
|
1634 |
EAlfAnchorMetricAbsolute, |
|
1635 |
EAlfAnchorMetricAbsolute, |
|
1636 |
TAlfTimedPoint( gridText.TextRect().iTl.iX, gridText.TextRect().iTl.iY ) );// 0, gridIconSize+KTopMargin ) ); |
|
1637 |
newItem.iBase->SetAnchor( |
|
1638 |
EAlfAnchorBottomRight, |
|
1639 |
0, |
|
1640 |
EAlfAnchorOriginLeft, |
|
1641 |
EAlfAnchorOriginTop, |
|
1642 |
EAlfAnchorMetricAbsolute, |
|
1643 |
EAlfAnchorMetricAbsolute, |
|
1644 |
TAlfTimedPoint( gridText.TextRect().iBr.iX, gridText.TextRect().iBr.iY ) );//0, iRowHeight ) ); |
|
1645 |
||
1646 |
// Set anchors for image |
|
1647 |
newItem.iBase->SetAnchor( |
|
1648 |
EAlfAnchorTopLeft, |
|
1649 |
1, |
|
1650 |
EAlfAnchorOriginLeft, |
|
1651 |
EAlfAnchorOriginTop, |
|
1652 |
EAlfAnchorMetricAbsolute, |
|
1653 |
EAlfAnchorMetricAbsolute, |
|
1654 |
TAlfTimedPoint( gridIconRect.Rect().iTl.iX, gridIconRect.Rect().iTl.iY ) ); //-gridIconSize/2, KTopMargin ) ); |
|
1655 |
newItem.iBase->SetAnchor( |
|
1656 |
EAlfAnchorBottomRight, |
|
1657 |
1, |
|
1658 |
EAlfAnchorOriginLeft, |
|
1659 |
EAlfAnchorOriginTop, |
|
1660 |
EAlfAnchorMetricAbsolute, |
|
1661 |
EAlfAnchorMetricAbsolute, |
|
1662 |
TAlfTimedPoint( gridIconRect.Rect().iBr.iX, gridIconRect.Rect().iBr.iY ) ); //gridIconSize/2, gridIconSize+KTopMargin ) ); |
|
1663 |
||
1664 |
newItem.iText = CAlfTextVisual::AddNewL( *iControl, newItem.iBase ); |
|
1665 |
newItem.iText->EnableShadow( EFalse ); |
|
1666 |
||
1667 |
TRgb itemColor( KRgbGray ); |
|
1668 |
||
1669 |
// text #9 application grid unfocused application title texts #215 |
|
1670 |
if( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
|
1671 |
itemColor, KAknsIIDQsnTextColors, |
|
1672 |
EAknsCIQsnTextColorsCG9 ) != KErrNone ) |
|
1673 |
{ |
|
1674 |
itemColor = gridText.Color(); |
|
1675 |
} |
|
1676 |
||
1677 |
newItem.iText->SetColor( itemColor ); |
|
1678 |
newItem.iText->SetTextL( *aLevel.iItems[i].iCaption ); |
|
1679 |
||
1680 |
TAlfTimedValue opacity; |
|
1681 |
opacity.SetValueNow ( KDefaultCaptionOpacity ); |
|
1682 |
newItem.iText->SetOpacity( opacity ); |
|
1683 |
||
1684 |
newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() ); |
|
1685 |
newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
1686 |
TAlfAlignHorizontal alfAlign; |
|
1687 |
switch( gridText.Align() ) |
|
1688 |
{ |
|
1689 |
case ELeft: |
|
1690 |
alfAlign = EAlfAlignHLeft; |
|
1691 |
break; |
|
1692 |
case ECenter: |
|
1693 |
alfAlign = EAlfAlignHCenter; |
|
1694 |
break; |
|
1695 |
case ERight: |
|
1696 |
alfAlign = EAlfAlignHRight; |
|
1697 |
break; |
|
1698 |
default: |
|
1699 |
alfAlign = EAlfAlignHCenter; |
|
1700 |
} |
|
1701 |
newItem.iText->SetAlign( alfAlign, EAlfAlignVCenter ); |
|
1702 |
||
1703 |
newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase ); |
|
1704 |
newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
1705 |
newItem.iImage->SetImage( TAlfImage( *aLevel.iItems[i].iIconTexture ) ); |
|
1706 |
newItem.iImage->SetFlag( EAlfVisualFlagManualSize ); |
|
1707 |
||
1708 |
newItem.iImage->SetSize( gridIconRect.Rect().Size() ); |
|
1709 |
newItem.iImage->SetScale( KScaleNotSelected ); |
|
1710 |
||
1711 |
User::LeaveIfError( aLevel.iItemVisualData.Append( newItem ) ); |
|
1712 |
} |
|
1713 |
} |
|
1714 |
||
1715 |
// Set columns and rows |
|
1716 |
iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1; |
|
1717 |
iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1; |
|
1718 |
||
1719 |
iRowCount = ( iCurrentLevel.iItemVisualData.Count() + iVisibleColumns - 1 ) / iVisibleColumns; |
|
1720 |
||
1721 |
aLevel.iGridLayout->MoveToFront(); |
|
1722 |
} |
|
1723 |
} |
|
1724 |
||
1725 |
void CFSEmailUiLauncherGridVisualiser::SelectL() |
|
1726 |
{ |
|
1727 |
FUNC_LOG; |
|
1728 |
if ( !iAppUi.ViewSwitchingOngoing() ) |
|
1729 |
{ |
|
1730 |
iPointerAction = EFalse; |
|
1731 |
iItemIdInButtonDownEvent.iItemId = KErrNotFound; |
|
1732 |
UpdateFocusVisibility(); |
|
1733 |
||
1734 |
CFSEmailLauncherItem* launcherItem = |
|
1735 |
iCurrentLevel.iItems[iCurrentLevel.iSelected].iLauncherItem; |
|
1736 |
if ( launcherItem ) |
|
1737 |
{ |
|
1738 |
launcherItem->ExecuteActionL(); |
|
1739 |
} |
|
1740 |
else |
|
1741 |
{ |
|
1742 |
iUiOperationLaunched = ETrue; |
|
1743 |
switch ( iCurrentLevel.iItems[iCurrentLevel.iSelected].iId ) |
|
1744 |
{ |
|
1745 |
case EDefaultMailboxItem: |
|
1746 |
case EOtherMailboxItems: |
|
1747 |
{ |
|
1748 |
TMailListActivationData tmp; |
|
1749 |
tmp.iFolderId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxInboxId; |
|
1750 |
tmp.iMailBoxId = iCurrentLevel.iItems[iCurrentLevel.iSelected].iMailBoxId; |
|
1751 |
const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
|
1752 |
iAppUi.ShowTitlePaneConnectionStatus(); |
|
1753 |
iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut ); |
|
1754 |
} |
|
1755 |
break; |
|
1756 |
case EDirectoryItem: |
|
1757 |
{ |
|
1758 |
// TO prevent accidental double clicks of the directory item, |
|
1759 |
// prevents multiple RCL windows to be seen |
|
1760 |
if ( !iDoubleClickLock ) |
|
1761 |
{ |
|
1762 |
// Lock to make sure that wizard is not started twice in a row |
|
1763 |
iDoubleClickLock = ETrue; |
|
1764 |
RPointerArray<CFSMailBox> mailBoxes; |
|
1765 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
1766 |
TFSMailMsgId id; |
|
1767 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
1768 |
id, |
|
1769 |
mailBoxes ); |
|
1770 |
||
1771 |
// Remove mailboxes that doesn't support RCL |
|
1772 |
for ( TInt i = mailBoxes.Count()-1; i >= 0 ; i-- ) |
|
1773 |
{ |
|
1774 |
if ( !TFsEmailUiUtility::IsRemoteLookupSupported( *mailBoxes[i] ) ) |
|
1775 |
{ |
|
1776 |
delete mailBoxes[i]; |
|
1777 |
mailBoxes.Remove( i ); |
|
1778 |
} |
|
1779 |
} |
|
1780 |
||
1781 |
CFSMailBox* mailBox = NULL; |
|
1782 |
if( mailBoxes.Count() == 1 ) |
|
1783 |
{ |
|
1784 |
// Only one mailbox with RCL support so we use that |
|
1785 |
mailBox = mailBoxes[0]; |
|
1786 |
} |
|
1787 |
else if( mailBoxes.Count() > 1 ) |
|
1788 |
{ |
|
1789 |
// Several mailboxes that support RCL so we need to |
|
1790 |
// ask the user which one to use |
|
1791 |
mailBox = ShowMailboxSelectionQueryL( mailBoxes ); |
|
1792 |
} |
|
1793 |
||
1794 |
if ( mailBox ) |
|
1795 |
{ |
|
1796 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupL( *mailBox ); |
|
1797 |
} |
|
1798 |
iDoubleClickLock = EFalse; |
|
1799 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
1800 |
} |
|
1801 |
} |
|
1802 |
break; |
|
1803 |
case ESettingsItem: |
|
1804 |
{ |
|
1805 |
TInt tmp = 0; |
|
1806 |
const TPckgBuf<TInt> pkgBuf( tmp ); |
|
1807 |
iAppUi.EnterFsEmailViewL( |
|
1808 |
SettingsViewId, |
|
1809 |
TUid::Uid(KMailSettingsOpenMainList), |
|
1810 |
pkgBuf ); |
|
1811 |
} |
|
1812 |
break; |
|
1813 |
case EAddNewMailboxItem: |
|
1814 |
{ |
|
1815 |
// To prevent accidental double clicks of the wizard item |
|
1816 |
// wizard would crash without this - moved to function |
|
1817 |
LaunchWizardL(); |
|
1818 |
} |
|
1819 |
break; |
|
1820 |
case EHelpItem: |
|
1821 |
{ |
|
1822 |
// To prevent accidental double clicks of the help item |
|
1823 |
// Help app might crash without this |
|
1824 |
if ( !iDoubleClickLock ) |
|
1825 |
{ |
|
1826 |
iDoubleClickLock = ETrue; |
|
1827 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
1828 |
} |
|
1829 |
} |
|
1830 |
break; |
|
1831 |
default: |
|
1832 |
return; |
|
1833 |
} |
|
1834 |
} |
|
1835 |
} |
|
1836 |
} |
|
1837 |
||
1838 |
||
1839 |
void CFSEmailUiLauncherGridVisualiser::HandleForegroundEventL( TBool aForeground ) |
|
1840 |
{ |
|
1841 |
FUNC_LOG; |
|
1842 |
||
1843 |
UpdateFocusVisibility(); |
|
1844 |
||
1845 |
// Toggle safety lock always when receiving foreground back. |
|
1846 |
if ( aForeground && iDoubleClickLock && iFirstStartComplete ) |
|
1847 |
{ |
|
1848 |
iDoubleClickLock = EFalse; |
|
1849 |
} |
|
1850 |
UpdateGridOffset(); |
|
1851 |
} |
|
1852 |
||
1853 |
void CFSEmailUiLauncherGridVisualiser::GetParentLayoutsL( |
|
1854 |
RPointerArray<CAlfVisual>& aLayoutArray ) const |
|
1855 |
{ |
|
1856 |
aLayoutArray.AppendL( iParentLayout ); |
|
1857 |
} |
|
1858 |
||
1859 |
// hide or show CAlfVisuals ( used for activation or deactivation ) |
|
1860 |
void CFSEmailUiLauncherGridVisualiser::FadeOut(TBool aDirectionOut) |
|
1861 |
{ |
|
1862 |
if ( iParentLayout != NULL ) |
|
1863 |
{ |
|
1864 |
TAlfTimedValue timedValue( 0, 0 ); |
|
1865 |
if ( !aDirectionOut ) |
|
1866 |
{ |
|
1867 |
timedValue.SetTarget( 1, 0 ); |
|
1868 |
} |
|
1869 |
iParentLayout->SetOpacity( timedValue ); |
|
1870 |
} |
|
1871 |
} |
|
1872 |
||
1873 |
// ----------------------------------------------------------------------------- |
|
1874 |
// CFSEmailUiLauncherGridVisualiser::ShowMailboxSelectionQueryL |
|
1875 |
// ----------------------------------------------------------------------------- |
|
1876 |
CFSMailBox* CFSEmailUiLauncherGridVisualiser::ShowMailboxSelectionQueryL( |
|
1877 |
const RPointerArray<CFSMailBox>& aMailBoxes ) |
|
1878 |
{ |
|
1879 |
FUNC_LOG; |
|
1880 |
CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat( 2 ); |
|
1881 |
CleanupStack::PushL( array ); |
|
1882 |
||
1883 |
for( TInt i = 0; i < aMailBoxes.Count(); i++ ) |
|
1884 |
{ |
|
1885 |
array->AppendL( aMailBoxes[i]->GetName() ); |
|
1886 |
} |
|
1887 |
||
1888 |
TInt selectedOption; |
|
1889 |
CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedOption ); |
|
1890 |
dlg->PrepareLC( R_FSEMAILUI_LAUNCHER_GRID_MAILBOX_SELECTION_DIALOG ); |
|
1891 |
||
1892 |
dlg->SetItemTextArray( array ); |
|
1893 |
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
1894 |
||
1895 |
CFSMailBox* mailbox = NULL; |
|
1896 |
if( dlg->RunLD() ) |
|
1897 |
{ |
|
1898 |
// safety check. |
|
1899 |
if( selectedOption >= 0 && |
|
1900 |
selectedOption < aMailBoxes.Count() ) |
|
1901 |
{ |
|
1902 |
mailbox = aMailBoxes[selectedOption]; |
|
1903 |
} |
|
1904 |
} |
|
1905 |
||
1906 |
CleanupStack::PopAndDestroy( array ); |
|
1907 |
return mailbox; |
|
1908 |
} |
|
1909 |
||
1910 |
void CFSEmailUiLauncherGridVisualiser::LaunchWizardL() |
|
1911 |
{ |
|
1912 |
FUNC_LOG; |
|
1913 |
// Start wizard. |
|
1914 |
||
1915 |
// Make sure that FSMailServer is running, so that the mailbox is added |
|
1916 |
// also to MCE. It should be enough to do it here, because it takes some |
|
1917 |
// time from wizard startup until the actual mailbox is created, so the |
|
1918 |
// serve has some time to get itself up and running before that. |
|
1919 |
TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() ); |
|
1920 |
//we are calling DoFirstStarL() method because in case User goes to GeneralSettings->Email |
|
1921 |
//iAiwSHandler isnt constructed and in that case EmailUi panics |
|
1922 |
if ( !iConstructionCompleted ) |
|
1923 |
{ |
|
1924 |
DoFirstStartL(); |
|
1925 |
} |
|
1926 |
||
1927 |
if ( ! iLaunchWizardExecuted ) // prevent reentrant calling |
|
1928 |
{ |
|
1929 |
iLaunchWizardExecuted = ETrue; |
|
1930 |
TRAPD( err, iAiwSHandler->ExecuteServiceCmdL( KAiwCmdSettingWizardFsEmail.iUid, |
|
1931 |
iAiwSHandler->InParamListL(), |
|
1932 |
iAiwSHandler->OutParamListL() ) ); |
|
1933 |
// ExecuteServiceCmdL is synchronous - uses CActiveSchedulerWait |
|
1934 |
iLaunchWizardExecuted = EFalse; |
|
1935 |
User::LeaveIfError( err ); |
|
1936 |
} |
|
1937 |
||
1938 |
} |
|
1939 |
||
1940 |
void CFSEmailUiLauncherGridVisualiser::GoToInboxL( TFSMailMsgId& aMailboxId, TFSMailMsgId& aMailboxInboxId ) |
|
1941 |
{ |
|
1942 |
FUNC_LOG; |
|
1943 |
TMailListActivationData tmp; |
|
1944 |
||
1945 |
tmp.iMailBoxId = aMailboxId; |
|
1946 |
tmp.iFolderId = aMailboxInboxId; |
|
1947 |
||
1948 |
const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
|
1949 |
||
1950 |
iAppUi.EnterFsEmailViewL( MailListId, KStartListWithFolderId, pkgOut ); |
|
1951 |
} |
|
1952 |
||
1953 |
void CFSEmailUiLauncherGridVisualiser::RescaleIconsL() |
|
1954 |
{ |
|
1955 |
FUNC_LOG; |
|
1956 |
if ( iConstructionCompleted ) |
|
1957 |
{ |
|
1958 |
TRect mainPaneRect; |
|
1959 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
1960 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
1961 |
||
1962 |
TAknLayoutRect scrollBarRect; |
|
1963 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
1964 |
TRect gridRect = mainPaneRect; |
|
1965 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
1966 |
||
1967 |
TAknLayoutRect itemRect; |
|
1968 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0)); |
|
1969 |
||
1970 |
TAknLayoutRect gridIconRect; |
|
1971 |
gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
1972 |
||
1973 |
//TInt gridIconSize = iAppUi.LayoutHandler()->GridIconSize(); |
|
1974 |
TSize iconSize = gridIconRect.Rect().Size(); |
|
1975 |
//iconSize.SetSize( gridIconSize, gridIconSize ); |
|
1976 |
||
1977 |
// Scale bitmaps |
|
1978 |
for( TInt i = 0 ; i < iIconArray.Count() ; i++ ) |
|
1979 |
{ |
|
1980 |
iIconArray[i]->Size().SetSize( iconSize.iWidth, iconSize.iHeight ); |
|
1981 |
} |
|
1982 |
// Scale visuals |
|
1983 |
for ( TInt item = 0; item < iCurrentLevel.iItemVisualData.Count() ; item++ ) |
|
1984 |
{ |
|
1985 |
iCurrentLevel.iItemVisualData[item].iImage->SetSize( iconSize ); |
|
1986 |
} |
|
1987 |
} |
|
1988 |
} |
|
1989 |
||
1990 |
void CFSEmailUiLauncherGridVisualiser::AddItemToModelL( CFSEmailLauncherItem* aItem, TInt aPluginArrayIndex ) |
|
1991 |
{ |
|
1992 |
FUNC_LOG; |
|
1993 |
if ( iConstructionCompleted && aItem->IsVisible() ) |
|
1994 |
{ |
|
1995 |
HBufC* launcherItemText = aItem->Caption( EFalse ).AllocLC(); |
|
1996 |
CAknIcon* launcherItemIcon = aItem->Icon(); |
|
1997 |
||
1998 |
if ( launcherItemIcon ) |
|
1999 |
{ |
|
2000 |
TRect mainPaneRect; |
|
2001 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2002 |
||
2003 |
TAknLayoutRect scrollBarRect; |
|
2004 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
2005 |
TRect gridRect = mainPaneRect; |
|
2006 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
2007 |
||
2008 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
2009 |
||
2010 |
TAknLayoutRect itemRect; |
|
2011 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0)); |
|
2012 |
||
2013 |
TAknLayoutRect gridIconRect; |
|
2014 |
gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
2015 |
||
2016 |
TSize iconSize = gridIconRect.Rect().Size(); |
|
2017 |
||
2018 |
const CFbsBitmap* bitmap = launcherItemIcon->Bitmap(); |
|
2019 |
const CFbsBitmap* mask = launcherItemIcon->Mask(); |
|
2020 |
||
2021 |
// First add plugin id and icon id pair to array, needed in provide bitmap |
|
2022 |
TPluginIdIconIdPair idPair; |
|
2023 |
idPair.iPluginArrayIndex = aPluginArrayIndex; |
|
2024 |
idPair.iIconId = iPluginTextureId; |
|
2025 |
iPluginIdIconIdPairs.Append( idPair ); |
|
2026 |
||
2027 |
// Create texture, goes to provide bitmap |
|
2028 |
CAlfTexture* texture = &CAlfStatic::Env().TextureManager().CreateTextureL( iPluginTextureId, this, EAlfTextureFlagDefault ); |
|
2029 |
// Update texture id |
|
2030 |
iPluginTextureId++; // Id is updated dynamically |
|
2031 |
// Set initial size |
|
2032 |
texture->Size().SetSize( iconSize.iHeight, iconSize.iWidth ); |
|
2033 |
iModel->AddL( |
|
2034 |
EShortcut, |
|
2035 |
aItem->Id(), |
|
2036 |
*launcherItemText, |
|
2037 |
*texture, |
|
2038 |
0, |
|
2039 |
aItem ); |
|
2040 |
iIconArray.AppendL( texture ); |
|
2041 |
} |
|
2042 |
else |
|
2043 |
{ |
|
2044 |
CAlfTexture* texture = &iAppUi.FsTextureManager()->TextureByIndex( EGridInboxTexture ); |
|
2045 |
||
2046 |
iModel->AddL( |
|
2047 |
EShortcut, |
|
2048 |
aItem->Id(), |
|
2049 |
*launcherItemText, |
|
2050 |
*texture, |
|
2051 |
0, |
|
2052 |
aItem ); |
|
2053 |
iIconArray.AppendL( texture ); |
|
2054 |
} |
|
2055 |
||
2056 |
CleanupStack::PopAndDestroy( launcherItemText ); |
|
2057 |
} |
|
2058 |
} |
|
2059 |
||
2060 |
void CFSEmailUiLauncherGridVisualiser::VisualLayoutUpdatedL() |
|
2061 |
{ |
|
2062 |
FUNC_LOG; |
|
2063 |
if ( iConstructionCompleted ) |
|
2064 |
{ |
|
2065 |
iCurrentLevel.iParent = 0; |
|
2066 |
||
2067 |
TRect mainPaneRect; |
|
2068 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2069 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
2070 |
||
2071 |
TAknLayoutRect scrollBarRect; |
|
2072 |
||
2073 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Apps::scroll_pane_cp03()); |
|
2074 |
||
2075 |
TRect gridRect = mainPaneRect; |
|
2076 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
2077 |
||
2078 |
TAknLayoutRect cellRect; |
|
2079 |
cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0)); |
|
2080 |
||
2081 |
TAknLayoutRect itemRect; |
|
2082 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0)); |
|
2083 |
||
2084 |
TAknLayoutRect gridIconRect; |
|
2085 |
gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
2086 |
||
2087 |
TAknLayoutRect selectorRect; |
|
2088 |
selectorRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::grid_highlight_pane_cp018(var)); |
|
2089 |
||
2090 |
CFSEmailUiLayoutHandler* layoutHandler = iAppUi.LayoutHandler(); |
|
2091 |
iSelectorImageVisual->SetSize( selectorRect.Rect().Size() ); |
|
2092 |
||
2093 |
TSize displaySize = mainPaneRect.Size(); |
|
2094 |
||
2095 |
TInt columns = iVisibleColumns = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastColumn() + 1; |
|
2096 |
TInt rows = iVisibleRows = AknLayoutScalable_Apps::cell_cmail_l_pane_ParamLimits(var).LastRow() + 1; |
|
2097 |
||
2098 |
iCurrentLevel.iGridLayout->SetSize( gridRect.Size() ); |
|
2099 |
iCurrentLevel.iGridLayout->SetColumnsL( columns ); |
|
2100 |
iCurrentLevel.iGridLayout->SetRowsL( rows ); |
|
2101 |
||
2102 |
PopulateL( iCurrentLevel ); |
|
2103 |
UpdateScrollBarRangeL(); |
|
2104 |
||
2105 |
TInt scrollbarWidth = scrollBarRect.Rect().Width(); |
|
2106 |
if( iRowCount > iVisibleRows ) |
|
2107 |
{ |
|
2108 |
iScrollbar->MakeVisible(ETrue); |
|
2109 |
} |
|
2110 |
else |
|
2111 |
{ |
|
2112 |
iScrollbar->MakeVisible(EFalse); |
|
2113 |
} |
|
2114 |
||
2115 |
TInt scrollbarTopLeftX = displaySize.iWidth - scrollbarWidth; |
|
2116 |
TInt scrollbarTopLeftY = 0; |
|
2117 |
TInt scrollbarBottomRightX = displaySize.iWidth; |
|
2118 |
TInt scrollbarBottomRightY = displaySize.iHeight; |
|
2119 |
TInt gridTopLeftX = 0; |
|
2120 |
TInt gridTopLeftY = 0; |
|
2121 |
TInt gridBottomRightX = displaySize.iWidth - scrollbarWidth; |
|
2122 |
TInt gridBottomRightY = displaySize.iHeight; |
|
2123 |
||
2124 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
2125 |
{ |
|
2126 |
// Mirrored layout |
|
2127 |
scrollbarTopLeftX = 0; |
|
2128 |
scrollbarTopLeftY = 0; |
|
2129 |
scrollbarBottomRightX = scrollbarWidth; |
|
2130 |
scrollbarBottomRightY = displaySize.iHeight; |
|
2131 |
gridTopLeftX = scrollbarWidth; |
|
2132 |
gridTopLeftY = 0; |
|
2133 |
gridBottomRightX = displaySize.iWidth; |
|
2134 |
gridBottomRightY = displaySize.iHeight; |
|
2135 |
} |
|
2136 |
||
2137 |
// Set anchors for the scroll bar |
|
2138 |
iWidgetLayout->SetAnchor( |
|
2139 |
EAlfAnchorTopLeft, |
|
2140 |
0, |
|
2141 |
EAlfAnchorOriginLeft, |
|
2142 |
EAlfAnchorOriginTop, |
|
2143 |
EAlfAnchorMetricAbsolute, |
|
2144 |
EAlfAnchorMetricAbsolute, |
|
2145 |
TAlfTimedPoint( scrollbarTopLeftX, scrollbarTopLeftY ) ); |
|
2146 |
iWidgetLayout->SetAnchor( |
|
2147 |
EAlfAnchorBottomRight, |
|
2148 |
0, |
|
2149 |
EAlfAnchorOriginLeft, |
|
2150 |
EAlfAnchorOriginTop, |
|
2151 |
EAlfAnchorMetricAbsolute, |
|
2152 |
EAlfAnchorMetricAbsolute, |
|
2153 |
TAlfTimedPoint( scrollbarBottomRightX, scrollbarBottomRightY ) ); |
|
2154 |
||
2155 |
// Set anchors for the grid |
|
2156 |
iWidgetLayout->SetAnchor( |
|
2157 |
EAlfAnchorTopLeft, |
|
2158 |
1, |
|
2159 |
EAlfAnchorOriginLeft, |
|
2160 |
EAlfAnchorOriginTop, |
|
2161 |
EAlfAnchorMetricAbsolute, |
|
2162 |
EAlfAnchorMetricAbsolute, |
|
2163 |
TAlfTimedPoint( gridTopLeftX, gridTopLeftY ) ); |
|
2164 |
iWidgetLayout->SetAnchor( |
|
2165 |
EAlfAnchorBottomRight, |
|
2166 |
1, |
|
2167 |
EAlfAnchorOriginLeft, |
|
2168 |
EAlfAnchorOriginTop, |
|
2169 |
EAlfAnchorMetricAbsolute, |
|
2170 |
EAlfAnchorMetricAbsolute, |
|
2171 |
TAlfTimedPoint( gridBottomRightX, gridBottomRightY ) ); |
|
2172 |
||
2173 |
iParentLayout->UpdateChildrenLayout(); |
|
2174 |
||
2175 |
TSize gridSize = iCurrentLevel.iGridLayout->Size().IntTarget().AsSize(); |
|
2176 |
iColumnWidth = gridSize.iWidth / iVisibleColumns; |
|
2177 |
iRowHeight = gridSize.iHeight / iVisibleRows; |
|
2178 |
||
2179 |
// Selector ring wrap limits can be calculated when row and column sizes are known. |
|
2180 |
SetRingWrapLimits(); |
|
2181 |
MoveSelection( EDirectionNone ); |
|
2182 |
||
2183 |
TRect scrollbarRect; |
|
2184 |
scrollbarRect.SetRect(scrollbarTopLeftX, scrollbarTopLeftY, scrollbarBottomRightX, scrollbarBottomRightY); |
|
2185 |
scrollbarRect.Move(mainPaneRect.iTl); |
|
2186 |
iScrollbar->SetRect(scrollbarRect); |
|
2187 |
iScrollbar->DrawDeferred(); |
|
2188 |
iRefreshNeeded = EFalse; |
|
2189 |
} |
|
2190 |
} |
|
2191 |
||
2192 |
void CFSEmailUiLauncherGridVisualiser::SetRingWrapLimits() |
|
2193 |
{ |
|
2194 |
FUNC_LOG; |
|
2195 |
if ( iConstructionCompleted ) |
|
2196 |
{ |
|
2197 |
iRingMovementXFuncMappingDataProvider.SetStart(-iColumnWidth); |
|
2198 |
iRingMovementXFuncMappingDataProvider.SetEnd((iVisibleColumns+1)*iColumnWidth); |
|
2199 |
iRingMovementYFuncMappingDataProvider.SetStart(-iRowHeight); |
|
2200 |
iRingMovementYFuncMappingDataProvider.SetEnd((iRowCount+1)*iRowHeight); |
|
2201 |
||
2202 |
iRingMovementXFunc->SetMappingTableValues( -(iVisibleColumns+2)*iColumnWidth, (iVisibleColumns*2+2)*iColumnWidth, &iRingMovementXFuncMappingDataProvider ); |
|
2203 |
iRingMovementYFunc->SetMappingTableValues( -(iRowCount+2)*iRowHeight, (iRowCount*2+2)*iRowHeight, &iRingMovementYFuncMappingDataProvider ); |
|
2204 |
} |
|
2205 |
} |
|
2206 |
||
2207 |
void CFSEmailUiLauncherGridVisualiser::DisplayProductInfoL() |
|
2208 |
{ |
|
2209 |
FUNC_LOG; |
|
2210 |
//Load the texts from resource |
|
2211 |
HBufC* text_1 = StringLoader::LoadLC( R_DISCLAIMER_PART_1 ); |
|
2212 |
HBufC* text_2 = StringLoader::LoadLC( R_DISCLAIMER_PART_2 ); |
|
2213 |
HBufC* text_3 = StringLoader::LoadLC( R_DISCLAIMER_PART_3 ); |
|
2214 |
HBufC* text_4 = StringLoader::LoadLC( R_DISCLAIMER_PART_4 ); |
|
2215 |
HBufC* text_5 = StringLoader::LoadLC( R_DISCLAIMER_PART_5 ); |
|
2216 |
HBufC* text_6 = StringLoader::LoadLC( R_DISCLAIMER_PART_6 ); |
|
2217 |
HBufC* text_7 = StringLoader::LoadLC( R_DISCLAIMER_PART_7 ); |
|
2218 |
HBufC* text_8 = StringLoader::LoadLC( R_DISCLAIMER_PART_8 ); |
|
2219 |
HBufC* text_9 = StringLoader::LoadLC( R_DISCLAIMER_PART_9 ); |
|
2220 |
HBufC* text_10 = StringLoader::LoadLC( R_DISCLAIMER_PART_10 ); |
|
2221 |
HBufC* text_11 = StringLoader::LoadLC( R_DISCLAIMER_PART_11 ); |
|
2222 |
||
2223 |
//Create a buffer for dialog content |
|
2224 |
HBufC* text = HBufC::NewLC( text_1->Length() + text_2->Length() + text_3->Length() + |
|
2225 |
text_4->Length() + text_5->Length() + text_6->Length() + |
|
2226 |
text_7->Length() + text_8->Length() + text_9->Length() + |
|
2227 |
text_10->Length() + text_11->Length() ); |
|
2228 |
//Copy the disclaimer text parts to dialog content |
|
2229 |
text->Des() += *text_1; |
|
2230 |
text->Des() += *text_2; |
|
2231 |
text->Des() += *text_3; |
|
2232 |
text->Des() += *text_4; |
|
2233 |
text->Des() += *text_5; |
|
2234 |
text->Des() += *text_6; |
|
2235 |
text->Des() += *text_7; |
|
2236 |
text->Des() += *text_8; |
|
2237 |
text->Des() += *text_9; |
|
2238 |
text->Des() += *text_10; |
|
2239 |
text->Des() += *text_11; |
|
2240 |
||
2241 |
CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *text ); |
|
2242 |
CleanupStack::PopAndDestroy( text ); |
|
2243 |
CleanupStack::PopAndDestroy( text_11 ); |
|
2244 |
CleanupStack::PopAndDestroy( text_10 ); |
|
2245 |
CleanupStack::PopAndDestroy( text_9 ); |
|
2246 |
CleanupStack::PopAndDestroy( text_8 ); |
|
2247 |
CleanupStack::PopAndDestroy( text_7 ); |
|
2248 |
CleanupStack::PopAndDestroy( text_6 ); |
|
2249 |
CleanupStack::PopAndDestroy( text_5 ); |
|
2250 |
CleanupStack::PopAndDestroy( text_4 ); |
|
2251 |
CleanupStack::PopAndDestroy( text_3 ); |
|
2252 |
CleanupStack::PopAndDestroy( text_2 ); |
|
2253 |
CleanupStack::PopAndDestroy( text_1 ); |
|
2254 |
dlg->PrepareLC( R_DISCLAIMER_MESSAGE ); |
|
2255 |
||
2256 |
//Create heading for the dialog, load and create the heading text |
|
2257 |
CAknPopupHeadingPane* headingPane = dlg->Heading(); |
|
2258 |
HBufC* appName = StringLoader::LoadLC(R_FSEMAIL_APP_NAME ); |
|
2259 |
HBufC* version = StringLoader::LoadLC( R_DISCLAIMER_FSEMAIL_VERSION ); |
|
2260 |
HBufC* title = HBufC::NewLC(version->Length() + appName->Length() + 1); |
|
2261 |
title->Des() += *appName; |
|
2262 |
title->Des() += KSpace; |
|
2263 |
title->Des() += *version; |
|
2264 |
headingPane->SetTextL( *title ); |
|
2265 |
CleanupStack::PopAndDestroy( title ); |
|
2266 |
CleanupStack::PopAndDestroy( version ); |
|
2267 |
CleanupStack::PopAndDestroy( appName ); |
|
2268 |
dlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
2269 |
//show dialog |
|
2270 |
TInt ret = dlg->RunLD(); |
|
2271 |
} |
|
2272 |
||
2273 |
void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
|
2274 |
{ |
|
2275 |
FUNC_LOG; |
|
2276 |
||
2277 |
CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType ); |
|
2278 |
||
2279 |
if ( iConstructionCompleted ) |
|
2280 |
{ |
|
2281 |
iItemIdInButtonDownEvent.iItemId = KErrNotFound; |
|
2282 |
||
2283 |
TRect mainPaneRect; |
|
2284 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2285 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
2286 |
||
2287 |
TAknLayoutRect scrollBarRect; |
|
2288 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
2289 |
TRect gridRect = mainPaneRect; |
|
2290 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
2291 |
||
2292 |
TAknLayoutRect cellRect; |
|
2293 |
cellRect.LayoutRect(gridRect, AknLayoutScalable_Apps::aid_size_cell_cmail_l(var, 0, 0)); |
|
2294 |
||
2295 |
TSize displaySize = cellRect.Rect().Size(); |
|
2296 |
iParentLayout->SetSize( displaySize ); |
|
2297 |
RescaleIconsL(); |
|
2298 |
VisualLayoutUpdatedL(); |
|
2299 |
||
2300 |
UpdateFocusVisibility(); |
|
2301 |
||
2302 |
// Stylus pop-up menu is closed during Layout switching |
|
2303 |
if( iStylusPopUpMenuLaunched ) |
|
2304 |
{ |
|
2305 |
TRAP_IGNORE(iStylusPopUpMenu->HandleControlEventL(iCoeControl, |
|
2306 |
MCoeControlObserver::EEventRequestExit )); |
|
2307 |
||
2308 |
iStylusPopUpMenuLaunched = EFalse; |
|
2309 |
} |
|
2310 |
||
2311 |
} |
|
2312 |
} |
|
2313 |
||
2314 |
void CFSEmailUiLauncherGridVisualiser::HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
|
2315 |
{ |
|
2316 |
FUNC_LOG; |
|
2317 |
iRefreshNeeded = ETrue; |
|
2318 |
||
2319 |
CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType ); |
|
2320 |
} |
|
2321 |
||
2322 |
void CFSEmailUiLauncherGridVisualiser::HandleContentChangeL() |
|
2323 |
{ |
|
2324 |
FUNC_LOG; |
|
2325 |
if ( iConstructionCompleted ) |
|
2326 |
{ |
|
2327 |
CreateModelL(); |
|
2328 |
if ( iAppUi.CurrentActiveView() == this ) |
|
2329 |
{ |
|
2330 |
VisualLayoutUpdatedL(); |
|
2331 |
} |
|
2332 |
else |
|
2333 |
{ |
|
2334 |
iRefreshNeeded = ETrue; |
|
2335 |
} |
|
2336 |
} |
|
2337 |
} |
|
2338 |
||
2339 |
void CFSEmailUiLauncherGridVisualiser::ConstructScrollbarL( CAlfLayout* aParent ) |
|
2340 |
{ |
|
2341 |
FUNC_LOG; |
|
2342 |
CAlfLayout::AddNewL(*iControl, aParent); |
|
2343 |
iScrollbar = new (ELeave) CAknDoubleSpanScrollBar(0); |
|
2344 |
iScrollbar->ConstructL(ETrue, this, 0, CEikScrollBar::EVertical, 1000); |
|
2345 |
TRect mainPaneRect; |
|
2346 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2347 |
TRect scrollbarRect = aParent->DisplayRectTarget(); |
|
2348 |
scrollbarRect.Move(mainPaneRect.iTl); |
|
2349 |
iScrollbar->SetRect(scrollbarRect); |
|
2350 |
||
2351 |
iScrollbar->MakeVisible(EFalse); |
|
2352 |
iScrollbar->SetModelL(&iScrollbarModel); |
|
2353 |
} |
|
2354 |
||
2355 |
void CFSEmailUiLauncherGridVisualiser::UpdateScrollBarRangeL() |
|
2356 |
{ |
|
2357 |
FUNC_LOG; |
|
2358 |
||
2359 |
TRect mainPaneRect; |
|
2360 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2361 |
TAknLayoutRect scrollBarRect; |
|
2362 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
2363 |
||
2364 |
iScrollbarModel.SetScrollSpan(iRowCount * (scrollBarRect.Rect().Height() / iVisibleRows)); |
|
2365 |
iScrollbarModel.SetWindowSize(scrollBarRect.Rect().Height()); |
|
2366 |
iScrollbarModel.SetFocusPosition(iFirstVisibleRow); |
|
2367 |
iScrollbar->SetModelL(&iScrollbarModel); |
|
2368 |
iScrollbar->DrawNow(); |
|
2369 |
} |
|
2370 |
||
2371 |
void CFSEmailUiLauncherGridVisualiser::HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType) |
|
2372 |
{ |
|
2373 |
FUNC_LOG; |
|
2374 |
if( iPhysics ) |
|
2375 |
{ |
|
2376 |
iPhysics->StopPhysics(); |
|
2377 |
iPhysics->ResetFriction(); |
|
2378 |
} |
|
2379 |
||
2380 |
if (aScrollBar == iScrollbar) |
|
2381 |
{ |
|
2382 |
switch( aEventType ) |
|
2383 |
{ |
|
2384 |
case EEikScrollHome : |
|
2385 |
//Jump to beginning |
|
2386 |
break; |
|
2387 |
case EEikScrollEnd : |
|
2388 |
//Jump to end |
|
2389 |
break; |
|
2390 |
default: |
|
2391 |
iScrolled = ETrue; |
|
2392 |
iAppUi.SetFocusVisibility( EFalse ); |
|
2393 |
if ( iSelector ) |
|
2394 |
{ |
|
2395 |
TAlfTimedValue selectorOpacity; |
|
2396 |
selectorOpacity.SetValueNow( 0 ); |
|
2397 |
iSelector->SetOpacity( selectorOpacity ); |
|
2398 |
} |
|
2399 |
iFirstVisibleRow = iCurrentLevel.iParentPos.iY/iRowHeight; |
|
2400 |
TReal offset = aScrollBar->ThumbPosition() + 1; |
|
2401 |
TAlfTimedPoint alfScrollOffset; |
|
2402 |
alfScrollOffset.iY.SetTarget( offset , 0); |
|
2403 |
iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset); |
|
2404 |
iCurrentLevel.iParentPos.iY = offset; |
|
2405 |
break; |
|
2406 |
} |
|
2407 |
} |
|
2408 |
} |
|
2409 |
||
2410 |
void CFSEmailUiLauncherGridVisualiser::UpdateLauncherItemListL() |
|
2411 |
{ |
|
2412 |
FUNC_LOG; |
|
2413 |
||
2414 |
// Read info about all implementations into infoArray |
|
2415 |
RImplInfoPtrArray infoArray; |
|
2416 |
CleanupResetAndDestroyClosePushL( infoArray ); |
|
2417 |
CFSEmailLauncherItem::ListAllImplementationsL( infoArray ); |
|
2418 |
||
2419 |
RArray<TBool> itemsFoundArray; |
|
2420 |
CleanupClosePushL( itemsFoundArray ); |
|
2421 |
||
2422 |
itemsFoundArray.ReserveL( iLauncherItemUids.Count() ); |
|
2423 |
for ( TInt i = 0; i < iLauncherItemUids.Count(); i++ ) |
|
2424 |
{ |
|
2425 |
itemsFoundArray.Append( EFalse ); |
|
2426 |
} |
|
2427 |
||
2428 |
// Iterate through all launcher item implementations in info array |
|
2429 |
TInt const infoCount = infoArray.Count(); |
|
2430 |
for ( TInt infoIndex = 0; infoIndex < infoCount; infoIndex++ ) |
|
2431 |
{ |
|
2432 |
TUid implementationUid = infoArray[infoIndex]->ImplementationUid(); |
|
2433 |
||
2434 |
// Check whether item can be found from current laucher items |
|
2435 |
TBool itemFound = EFalse; |
|
2436 |
for ( TInt itemIndex = 0; itemIndex < iLauncherItemUids.Count(); itemIndex++ ) |
|
2437 |
{ |
|
2438 |
if ( iLauncherItemUids[itemIndex] == implementationUid ) |
|
2439 |
{ |
|
2440 |
itemsFoundArray[itemIndex] = ETrue; |
|
2441 |
itemFound = ETrue; |
|
2442 |
break; |
|
2443 |
} |
|
2444 |
} |
|
2445 |
||
2446 |
if ( !itemFound ) |
|
2447 |
{ |
|
2448 |
// Add new item to the end of the laucher item array |
|
2449 |
CFSEmailLauncherItem* launcherItem = NULL; |
|
2450 |
TRAPD( error, launcherItem = CFSEmailLauncherItem::NewL( implementationUid, this ) ); |
|
2451 |
if ( error == KErrNone ) |
|
2452 |
{ |
|
2453 |
iLauncherItems.Append( launcherItem ); |
|
2454 |
iLauncherItemUids.Append( implementationUid ); |
|
2455 |
} |
|
2456 |
} |
|
2457 |
} |
|
2458 |
||
2459 |
// Remove all launcher items not found from the info array |
|
2460 |
for ( TInt i = itemsFoundArray.Count() - 1 ; i >= 0; --i ) |
|
2461 |
{ |
|
2462 |
if ( !itemsFoundArray[i] ) |
|
2463 |
{ |
|
2464 |
delete iLauncherItems[i]; |
|
2465 |
iLauncherItems.Remove( i ); |
|
2466 |
iLauncherItemUids.Remove( i ); |
|
2467 |
} |
|
2468 |
} |
|
2469 |
||
2470 |
// Clean up |
|
2471 |
CleanupStack::Pop( &itemsFoundArray ); |
|
2472 |
itemsFoundArray.Close(); |
|
2473 |
CleanupStack::PopAndDestroy( &infoArray ); |
|
2474 |
} |
|
2475 |
||
2476 |
/** |
|
2477 |
* Sets application title when leaving this view |
|
2478 |
*/ |
|
2479 |
void CFSEmailUiLauncherGridVisualiser::SetDefaultStatusPaneTextL() |
|
2480 |
{ |
|
2481 |
FUNC_LOG; |
|
2482 |
iAppUi.ResetTitlePaneTextL(); |
|
2483 |
} |
|
2484 |
||
2485 |
void CFSEmailUiLauncherGridVisualiser::SetWizardWaitnoteShown( TBool aWaitnoteShown ) |
|
2486 |
{ |
|
2487 |
FUNC_LOG; |
|
2488 |
iWizardWaitnoteShown = aWaitnoteShown; |
|
2489 |
} |
|
2490 |
||
2491 |
/** |
|
2492 |
* Check status of all configured mailboxes |
|
2493 |
*/ |
|
2494 |
TFSLauncherGridMailboxStatus CFSEmailUiLauncherGridVisualiser::CheckMailboxStatusL() |
|
2495 |
{ |
|
2496 |
FUNC_LOG; |
|
2497 |
RPointerArray<CFSMailBox> mailBoxes; |
|
2498 |
CleanupResetAndDestroyClosePushL( mailBoxes ); |
|
2499 |
TFSMailMsgId id; |
|
2500 |
TInt err = iAppUi.GetMailClient()->ListMailBoxes( |
|
2501 |
id, |
|
2502 |
mailBoxes ); |
|
2503 |
||
2504 |
TFSLauncherGridMailboxStatus returnStatus; |
|
2505 |
returnStatus.iMailboxCount = mailBoxes.Count(); |
|
2506 |
// Reset counters |
|
2507 |
returnStatus.iMailboxesOnline = returnStatus.iMailboxesOffline = returnStatus.iMailboxesSyncing = 0; |
|
2508 |
||
2509 |
for ( TInt i = 0; i < mailBoxes.Count(); i++ ) |
|
2510 |
{ |
|
2511 |
// First check online/offline status |
|
2512 |
TFSMailBoxStatus onOffStatus = mailBoxes[i]->GetMailBoxStatus(); |
|
2513 |
if( onOffStatus == EFSMailBoxOffline ) |
|
2514 |
{ |
|
2515 |
returnStatus.iMailboxesOffline++; |
|
2516 |
} |
|
2517 |
else if( onOffStatus == EFSMailBoxOnline ) |
|
2518 |
{ |
|
2519 |
returnStatus.iMailboxesOnline++; |
|
2520 |
} |
|
2521 |
||
2522 |
// Then check sync state |
|
2523 |
TSSMailSyncState latestSyncstate = mailBoxes[i]->CurrentSyncState(); |
|
2524 |
if( latestSyncstate == InboxSyncing || |
|
2525 |
latestSyncstate == StartingSync || |
|
2526 |
latestSyncstate == EmailSyncing ) |
|
2527 |
{ |
|
2528 |
returnStatus.iMailboxesSyncing++; |
|
2529 |
} |
|
2530 |
} |
|
2531 |
||
2532 |
CleanupStack::PopAndDestroy( &mailBoxes ); |
|
2533 |
return returnStatus; |
|
2534 |
} |
|
2535 |
||
2536 |
// Bitmap provider for grid ecom plugins icons |
|
2537 |
void CFSEmailUiLauncherGridVisualiser::ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap) |
|
2538 |
{ |
|
2539 |
FUNC_LOG; |
|
2540 |
TRect mainPaneRect; |
|
2541 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2542 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
2543 |
||
2544 |
TAknLayoutRect scrollBarRect; |
|
2545 |
scrollBarRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::aid_size_touch_scroll_bar()); |
|
2546 |
TRect gridRect = mainPaneRect; |
|
2547 |
gridRect.iBr.iX -= scrollBarRect.Rect().Width(); |
|
2548 |
||
2549 |
TAknLayoutRect itemRect; |
|
2550 |
itemRect.LayoutRect(gridRect, AknLayoutScalable_Apps::cell_cmail_l_pane(var, 0, 0)); |
|
2551 |
||
2552 |
TAknLayoutRect gridIconRect; |
|
2553 |
gridIconRect.LayoutRect(itemRect.Rect(), AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var)); |
|
2554 |
||
2555 |
CAknIcon* launcherItemIcon(0); |
|
2556 |
for ( TInt i=0; i<iPluginIdIconIdPairs.Count(); i++ ) |
|
2557 |
{ |
|
2558 |
if ( aId == iPluginIdIconIdPairs[i].iIconId ) |
|
2559 |
{ |
|
2560 |
launcherItemIcon = iLauncherItems[iPluginIdIconIdPairs[i].iPluginArrayIndex]->Icon(); |
|
2561 |
} |
|
2562 |
} |
|
2563 |
||
2564 |
if ( launcherItemIcon ) |
|
2565 |
{ |
|
2566 |
// Set bitmap size |
|
2567 |
TSize iconSize = gridIconRect.Rect().Size(); |
|
2568 |
if( launcherItemIcon->Bitmap() ) |
|
2569 |
{ |
|
2570 |
AknIconUtils::DisableCompression( launcherItemIcon->Bitmap() ); |
|
2571 |
AknIconUtils::SetSize( launcherItemIcon->Bitmap(), iconSize, EAspectRatioPreserved ); |
|
2572 |
} |
|
2573 |
if( launcherItemIcon->Mask() ) |
|
2574 |
{ |
|
2575 |
AknIconUtils::DisableCompression( launcherItemIcon->Mask()); |
|
2576 |
AknIconUtils::SetSize( launcherItemIcon->Mask(), iconSize, EAspectRatioPreserved ); |
|
2577 |
} |
|
2578 |
// Create duplicate sof original for alf |
|
2579 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
2580 |
bitmap->Duplicate( launcherItemIcon->Bitmap()->Handle() ); |
|
2581 |
CFbsBitmap* mask = new (ELeave) CFbsBitmap; |
|
2582 |
mask->Duplicate( launcherItemIcon->Mask()->Handle() ); |
|
2583 |
||
2584 |
aBitmap = bitmap; |
|
2585 |
aMaskBitmap = mask; |
|
2586 |
} |
|
2587 |
else |
|
2588 |
{ |
|
2589 |
User::Leave(KErrNotFound); // Leave as icon is not found, should not go here |
|
2590 |
} |
|
2591 |
} |
|
2592 |
||
2593 |
void CFSEmailUiLauncherGridVisualiser::SetRefreshNeeded() |
|
2594 |
{ |
|
2595 |
FUNC_LOG; |
|
2596 |
iRefreshNeeded = ETrue; |
|
2597 |
iDoubleClickLock = EFalse; |
|
2598 |
} |
|
2599 |
||
2600 |
TReal32 CFSEmailUiLauncherGridVisualiser::TRingMovementFuncMappingDataProvider::MapValue(TReal32 aValue, TInt /*aMode*/) const |
|
2601 |
{ |
|
2602 |
FUNC_LOG; |
|
2603 |
AlfUtil::WrapValue(aValue, iStart, iEnd); |
|
2604 |
return aValue; |
|
2605 |
} |
|
2606 |
||
2607 |
void CFSEmailUiLauncherGridVisualiser::DetachSelectorMappingFunctions() |
|
2608 |
{ |
|
2609 |
FUNC_LOG; |
|
2610 |
if ( iSelector ) |
|
2611 |
{ |
|
2612 |
TAlfTimedPoint selectorPos; |
|
2613 |
selectorPos.iX.SetMappingFunctionIdentifier( 0 ); |
|
2614 |
selectorPos.iY.SetMappingFunctionIdentifier( 0 ); |
|
2615 |
iSelector->SetPos( selectorPos ); |
|
2616 |
} |
|
2617 |
} |
|
2618 |
||
2619 |
||
2620 |
// ----------------------------------------------------------------------------- |
|
2621 |
// CFSEmailUiLauncherGridVisualiser::UpdateFocusVisibility() |
|
2622 |
// Updates the selector and the text color of a focused item. |
|
2623 |
// ----------------------------------------------------------------------------- |
|
2624 |
// |
|
2625 |
void CFSEmailUiLauncherGridVisualiser::UpdateFocusVisibility() |
|
2626 |
{ |
|
2627 |
const TBool showFocus = ( IsFocusShown() || |
|
2628 |
iItemIdInButtonDownEvent.iItemId >= 0 ); |
|
2629 |
||
2630 |
// Update the selector. |
|
2631 |
if ( iSelector ) |
|
2632 |
{ |
|
2633 |
TAlfTimedValue selectorOpacity; |
|
2634 |
||
2635 |
if ( showFocus ) |
|
2636 |
{ |
|
2637 |
selectorOpacity.SetValueNow( 1 ); |
|
2638 |
} |
|
2639 |
else |
|
2640 |
{ |
|
2641 |
selectorOpacity.SetValueNow( 0 ); |
|
2642 |
} |
|
2643 |
||
2644 |
iSelector->SetOpacity( selectorOpacity ); |
|
2645 |
} |
|
2646 |
||
2647 |
// Update the text color of the previously and newly selected items. |
|
2648 |
TRgb normalColor( KRgbGray ); |
|
2649 |
TRgb focusedColor( KRgbGray ); |
|
2650 |
||
2651 |
if ( ( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), normalColor, |
|
2652 |
KAknsIIDQsnTextColors, |
|
2653 |
EAknsCIQsnTextColorsCG9 ) != KErrNone ) || |
|
2654 |
( AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), focusedColor, |
|
2655 |
KAknsIIDQsnTextColors, |
|
2656 |
EAknsCIQsnTextColorsCG11 ) != KErrNone ) ) |
|
2657 |
{ |
|
2658 |
// No colors available. |
|
2659 |
return; |
|
2660 |
} |
|
2661 |
||
2662 |
CAlfTextVisual* textVisual = NULL; |
|
2663 |
const TInt itemCount( iCurrentLevel.iItemVisualData.Count() ); |
|
2664 |
||
2665 |
// Set the colors of the captions not focused to normal and if an item is |
|
2666 |
// focused, set the color of its caption using the highlighted theme color. |
|
2667 |
for ( TInt i = 0; i < itemCount; ++i ) |
|
2668 |
{ |
|
2669 |
textVisual = iCurrentLevel.iItemVisualData[i].iText; |
|
2670 |
||
2671 |
if ( textVisual ) |
|
2672 |
{ |
|
2673 |
if ( showFocus && iCurrentLevel.iSelected == i ) |
|
2674 |
{ |
|
2675 |
textVisual->SetColor( focusedColor ); |
|
2676 |
} |
|
2677 |
else |
|
2678 |
{ |
|
2679 |
textVisual->SetColor( normalColor ); |
|
2680 |
} |
|
2681 |
} |
|
2682 |
} |
|
2683 |
} |
|
2684 |
||
2685 |
||
2686 |
void CFSEmailUiLauncherGridVisualiser::FlipStateChangedL( TBool aKeyboardFlipOpen ) |
|
2687 |
{ |
|
2688 |
CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen ); |
|
2689 |
UpdateFocusVisibility(); |
|
2690 |
} |
|
2691 |
||
2692 |
void CFSEmailUiLauncherGridVisualiser::MailboxDeletionComplete() |
|
2693 |
{ |
|
2694 |
TRAP_IGNORE( HandleContentChangeL() ); |
|
2695 |
} |
|
2696 |
||
2697 |
void CFSEmailUiLauncherGridVisualiser::FocusVisibilityChange( TBool aVisible ) |
|
2698 |
{ |
|
2699 |
CFsEmailUiViewBase::FocusVisibilityChange( aVisible ); |
|
2700 |
UpdateFocusVisibility(); |
|
2701 |
ResizeItemIcon( !aVisible ); |
|
2702 |
} |
|
2703 |
||
2704 |
// ----------------------------------------------------------------------------- |
|
2705 |
// CFSEmailUiLauncherGridVisualiser::ViewPositionChanged |
|
2706 |
// From MAknPhysicsObserver |
|
2707 |
// ----------------------------------------------------------------------------- |
|
2708 |
// |
|
2709 |
void CFSEmailUiLauncherGridVisualiser::ViewPositionChanged( |
|
2710 |
const TPoint& aNewPosition, |
|
2711 |
TBool /*aDrawNow*/, |
|
2712 |
TUint /*aFlags*/ ) |
|
2713 |
{ |
|
2714 |
FUNC_LOG; |
|
2715 |
||
2716 |
// controls must be created first |
|
2717 |
if ( !iConstructionCompleted ) |
|
2718 |
{ |
|
2719 |
return; |
|
2720 |
} |
|
2721 |
||
2722 |
TRect mainPaneRect; |
|
2723 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2724 |
iCurrentLevel.iParentPos.iY = aNewPosition.iY - mainPaneRect.Height()/2; |
|
2725 |
TAlfTimedPoint alfScrollOffset; |
|
2726 |
alfScrollOffset.iY.SetTarget( iCurrentLevel.iParentPos.iY , 0 ); |
|
2727 |
iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset); |
|
2728 |
iScrollbarModel.SetFocusPosition( iCurrentLevel.iParentPos.iY ); |
|
2729 |
TRAP_IGNORE( iScrollbar->SetModelL(&iScrollbarModel) ); |
|
2730 |
iScrollbar->DrawNow(); |
|
2731 |
iFirstVisibleRow = iCurrentLevel.iParentPos.iY/iRowHeight; |
|
2732 |
if ( iFirstVisibleRow < 0 ) |
|
2733 |
{ |
|
2734 |
iFirstVisibleRow = 0; |
|
2735 |
} |
|
2736 |
else if ( iFirstVisibleRow > iRowCount ) |
|
2737 |
{ |
|
2738 |
iFirstVisibleRow = iRowCount; |
|
2739 |
} |
|
2740 |
} |
|
2741 |
||
2742 |
// ----------------------------------------------------------------------------- |
|
2743 |
// CNcsComposeViewContainer::PhysicEmulationEnded |
|
2744 |
// From MAknPhysicsObserver |
|
2745 |
// ----------------------------------------------------------------------------- |
|
2746 |
// |
|
2747 |
void CFSEmailUiLauncherGridVisualiser::PhysicEmulationEnded() |
|
2748 |
{ |
|
2749 |
FUNC_LOG; |
|
2750 |
} |
|
2751 |
||
2752 |
// ----------------------------------------------------------------------------- |
|
2753 |
// CNcsComposeViewContainer::ViewPosition |
|
2754 |
// From MAknPhysicsObserver |
|
2755 |
// ----------------------------------------------------------------------------- |
|
2756 |
// |
|
2757 |
TPoint CFSEmailUiLauncherGridVisualiser::ViewPosition() const |
|
2758 |
{ |
|
2759 |
FUNC_LOG; |
|
2760 |
TRect mainPaneRect; |
|
2761 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
2762 |
TInt current = iCurrentLevel.iParentPos.iY; |
|
2763 |
TInt viewCentre = mainPaneRect.Size().iHeight / 2; |
|
2764 |
TPoint point( 0, current + viewCentre ); |
|
2765 |
return point; |
|
2766 |
} |
|
2767 |
||
2768 |
// ---------------------------------------------------------------------------- |
|
2769 |
// LaunchStylusPopupMenuL() |
|
2770 |
// Launches and displays the pop-up menu invoked by a long tap event. |
|
2771 |
// ---------------------------------------------------------------------------- |
|
2772 |
// |
|
2773 |
void CFSEmailUiLauncherGridVisualiser::LaunchStylusPopupMenu( |
|
2774 |
const TInt aItemId ) |
|
2775 |
{ |
|
2776 |
TInt count = iCurrentLevel.iItemVisualData.Count(); |
|
2777 |
if ( aItemId < 0 || aItemId >= count ) |
|
2778 |
{ |
|
2779 |
return; // incorrect index |
|
2780 |
} |
|
2781 |
||
2782 |
count = iCurrentLevel.iItems.Count(); |
|
2783 |
if ( aItemId < 0 || aItemId >= count ) |
|
2784 |
{ |
|
2785 |
return; // incorrect index |
|
2786 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
2787 |
|
64 | 2788 |
// Get the ID of the mailbox in case the user wants to delete it. |
2789 |
iMailboxToDelete = iCurrentLevel.iItems[aItemId].iMailBoxId; |
|
2790 |
||
2791 |
// Get the item position and use it to determine the position of the menu. |
|
2792 |
const TRect rect( |
|
2793 |
iCurrentLevel.iItemVisualData[aItemId].iBase->DisplayRect() ); |
|
2794 |
TPoint position( rect.iTl.iX + rect.Width() / 2, |
|
2795 |
rect.iTl.iY + rect.Height() / 2 ); |
|
2796 |
iStylusPopUpMenu->SetPosition( position ); |
|
2797 |
||
2798 |
// Display the menu. |
|
2799 |
iStylusPopUpMenu->ShowMenu(); |
|
2800 |
iStylusPopUpMenuLaunched = ETrue; |
|
2801 |
} |
|
2802 |
||
2803 |
void CFSEmailUiLauncherGridVisualiser::HandleAppForegroundEventL( TBool aForeground ) |
|
2804 |
{ |
|
2805 |
FUNC_LOG; |
|
2806 |
||
2807 |
// If the view is not visible try to visualise it after a while |
|
2808 |
if ( aForeground && !iWasActiveControlGroup ) |
|
2809 |
{ |
|
2810 |
iStartupCallbackTimer->Cancel(); // just in case |
|
2811 |
iStartupCallbackTimer->SetPriority( CActive::EPriorityIdle ); |
|
2812 |
iStartupCallbackTimer->Start( 200 ); |
|
2813 |
} |
|
2814 |
||
2815 |
UpdateGridOffset(); |
|
2816 |
CFsEmailUiViewBase::HandleAppForegroundEventL( aForeground ); |
|
2817 |
} |
|
2818 |
||
2819 |
// ---------------------------------------------------------------------------- |
|
2820 |
// CFSEmailUiLauncherGridVisualiser::TimerEventL() |
|
2821 |
// Fire timer callback |
|
2822 |
// ---------------------------------------------------------------------------- |
|
2823 |
void CFSEmailUiLauncherGridVisualiser::TimerEventL( CFSEmailUiGenericTimer* /* aTriggeredTimer */ ) |
|
2824 |
{ |
|
2825 |
FUNC_LOG; |
|
2826 |
||
2827 |
// if view is still active then |
|
2828 |
if ( iAppUi.CurrentActiveView() && iAppUi.CurrentActiveView()->Id() == Id() ) |
|
2829 |
{ |
|
2830 |
iWasActiveControlGroup = ETrue; |
|
2831 |
CFsEmailUiViewBase::HandleAppForegroundEventL( ETrue ); |
|
2832 |
} |
|
2833 |
||
2834 |
iStartupCallbackTimer->Cancel(); |
|
2835 |
} |
|
2836 |
||
2837 |
// --------------------------------------------------------------------------- |
|
2838 |
// CFSEmailUiLauncherGridVisualiser::UpdatePhysicsL() |
|
2839 |
// --------------------------------------------------------------------------- |
|
2840 |
// |
|
2841 |
void CFSEmailUiLauncherGridVisualiser::UpdatePhysicsL() |
|
2842 |
{ |
|
2843 |
FUNC_LOG; |
|
2844 |
if ( iPhysics ) |
|
2845 |
{ |
|
2846 |
TRect mainPaneRect; |
|
2847 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
2848 |
const TSize viewSize( mainPaneRect.Size() ); |
|
2849 |
const TSize worldSize( 0, iRowCount * iRowHeight ); |
|
2850 |
iPhysics->InitPhysicsL( worldSize, viewSize, EFalse ); |
|
2851 |
} |
|
2852 |
} |
|
2853 |
||
2854 |
// --------------------------------------------------------------------------- |
|
2855 |
// CFSEmailUiLauncherGridVisualiser::UpdateGridOffset() |
|
2856 |
// --------------------------------------------------------------------------- |
|
2857 |
// |
|
2858 |
void CFSEmailUiLauncherGridVisualiser::UpdateGridOffset() |
|
2859 |
{ |
|
2860 |
if ( iConstructionCompleted ) |
|
2861 |
{ |
|
2862 |
TAlfTimedPoint alfScrollOffset; |
|
2863 |
alfScrollOffset.iY.SetTarget( 1.0 , 0); |
|
2864 |
iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset); |
|
2865 |
iCurrentLevel.iParentPos.iY = 1.0; |
|
2866 |
} |
|
2867 |
} |
|
2868 |