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