25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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 folder list view implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// SYSTEM INCLUDES
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include <AknUtils.h>
|
|
21 |
#include <StringLoader.h>
|
|
22 |
#include <AknBidiTextUtils.h>
|
|
23 |
#include <gulicon.h>
|
|
24 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
25 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
26 |
#include <layoutmetadata.cdl.h>
|
|
27 |
#include <AknStatuspaneUtils.h>
|
|
28 |
#include <akntoolbar.h>
|
|
29 |
#include <eikcolib.h>
|
|
30 |
#include <alf/alfdecklayout.h>
|
|
31 |
#include <alf/alftextvisual.h>
|
|
32 |
#include <alf/alfcontrolgroup.h>
|
|
33 |
#include <alf/alfbrusharray.h>
|
|
34 |
#include <alf/alfshadowborderbrush.h>
|
|
35 |
#include <alf/alfevent.h>
|
|
36 |
#include <alf/alfframebrush.h>
|
|
37 |
#include <alf/alfstatic.h>
|
|
38 |
|
|
39 |
// GENERIC LIST COMPONENT INCLUDES
|
|
40 |
#include "fstreelist.h"
|
|
41 |
#include "fstreevisualizerbase.h"
|
|
42 |
#include "fstreeplainonelineitemdata.h"
|
|
43 |
#include "fstreeplainonelineitemvisualizer.h"
|
|
44 |
#include "fstreeplaintwolineitemdata.h"
|
|
45 |
#include "fstreeplaintwolineitemvisualizer.h"
|
|
46 |
#include "fstreeplainonelinenodedata.h"
|
|
47 |
#include "fstreeplainonelinenodevisualizer.h"
|
|
48 |
#include "fscontrolbuttoninterface.h"
|
|
49 |
#include "fsseparatordata.h"
|
|
50 |
#include "fsseparatorvisualizer.h"
|
|
51 |
|
|
52 |
// FREESTYLE EMAIL FRAMEWORK INCLUDES
|
|
53 |
#include "cfsmailcommon.h"
|
|
54 |
#include "cfsmailclient.h"
|
|
55 |
#include "cfsmailbox.h"
|
|
56 |
#include "cfsmailfolder.h"
|
|
57 |
#include <csxhelp/cmail.hlp.hrh>
|
|
58 |
#include <featmgr.h>
|
|
59 |
|
|
60 |
// INTERNAL INCLUDES
|
|
61 |
#include <freestyleemailui.mbg>
|
|
62 |
#include <FreestyleEmailUi.rsg>
|
|
63 |
|
|
64 |
#include "FreestyleEmailUiAppui.h"
|
|
65 |
#include "FreestyleEmailUiFolderListControl.h"
|
|
66 |
#include "FreestyleEmailUiFolderListModel.h"
|
|
67 |
#include "FreestyleEmailUiFolderListVisualiser.h"
|
|
68 |
#include "FreestyleEmailUi.hrh"
|
|
69 |
#include "FreestyleEmailUiLayoutHandler.h"
|
|
70 |
#include "FreestyleEmailUiTextureManager.h"
|
|
71 |
#include "FreestyleEmailUiControlBarCallback.h"
|
|
72 |
#include "FreestyleEmailUiUtilities.h"
|
|
73 |
#include "FreestyleEmailUiLayoutData.h"
|
|
74 |
#include "FreestyleEmailUiShortcutBinding.h"
|
|
75 |
#include "esmailsettingsplugin.h"
|
|
76 |
#include "FreestyleEmailUiStatusIndicator.h"
|
|
77 |
#include <alf/alfborderbrush.h>
|
|
78 |
|
|
79 |
// Defines the order of the folders in UI
|
|
80 |
enum TFSEmailUiFolderListPriorities
|
|
81 |
{
|
|
82 |
EFolderListPriorityInbox = 1,
|
|
83 |
EFolderListPriorityDrafts,
|
|
84 |
EFolderListPrioritySent,
|
|
85 |
EFolderListPriorityOutbox,
|
|
86 |
EFolderListPriorityDeleted,
|
|
87 |
EFolderListPriorityOtherFolder
|
|
88 |
};
|
|
89 |
|
|
90 |
// Defines the order of the list icons in the icon array
|
|
91 |
enum TFsEmailUiFolderListIcons
|
|
92 |
{
|
|
93 |
EFolderListIconInbox = 0,
|
|
94 |
EFolderListIconInboxSubfolders,
|
|
95 |
EFolderListIconOutbox,
|
|
96 |
EFolderListIconDrafts,
|
|
97 |
EFolderListIconSent,
|
|
98 |
EFolderListIconDeleted,
|
|
99 |
EFolderListIconServerFolders,
|
|
100 |
EFolderListIconMoreFolders,
|
|
101 |
EFolderListIconEmailAccount
|
|
102 |
};
|
|
103 |
|
|
104 |
// Defines the order of the sort list icons in the sort icon array
|
|
105 |
enum TFsEmailUiSortListIcons
|
|
106 |
{
|
|
107 |
ESortListAttachmentAscIcon = 0,
|
|
108 |
ESortListAttachmentDescIcon,
|
|
109 |
ESortListDateAscIcon,
|
|
110 |
ESortListDateDescIcon,
|
|
111 |
ESortListFollowAscIcon,
|
|
112 |
ESortListFollowDescIcon,
|
|
113 |
ESortListPriorityAscIcon,
|
|
114 |
ESortListPriorityDescIcon,
|
|
115 |
ESortListSenderAscIcon,
|
|
116 |
ESortListSenderDescIcon,
|
|
117 |
ESortListSubjectAscIcon,
|
|
118 |
ESortListSubjectDescIcon,
|
|
119 |
ESortListUnreadAscIcon,
|
|
120 |
ESortListUnreadDescIcon
|
|
121 |
};
|
|
122 |
|
|
123 |
// List level for the root folders
|
|
124 |
static const TInt KListRootLevel( 1 );
|
|
125 |
// List supports three levels, so basically root folder + two levels of subfolders
|
|
126 |
static const TInt KListLastBasicLevel( KListRootLevel + 2 );
|
|
127 |
|
|
128 |
const TInt KDefaultShadowBorderWidth( 15 );
|
|
129 |
const TReal KShadowBorderOpacity( 0.08 );
|
|
130 |
|
|
131 |
// Constants for drawing header text
|
|
132 |
const TReal KFSHeaderTextBackgroundOpacity = 0.3f;
|
|
133 |
const TAlfTimedValue KFSVisible( 1 );
|
|
134 |
const TAlfTimedValue KFSInvisible( 0 );
|
|
135 |
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// NewL
|
|
138 |
// ---------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
CFSEmailUiFolderListVisualiser* CFSEmailUiFolderListVisualiser::NewL( CAlfEnv& aEnv,
|
|
141 |
CAlfControlGroup& aControlGroup,
|
|
142 |
CFreestyleEmailUiAppUi& aAppUi )
|
|
143 |
{
|
|
144 |
FUNC_LOG;
|
|
145 |
CFSEmailUiFolderListVisualiser* self = CFSEmailUiFolderListVisualiser::NewLC(aEnv, aControlGroup, aAppUi );
|
|
146 |
CleanupStack::Pop(self);
|
|
147 |
return self;
|
|
148 |
}
|
|
149 |
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
// NewLC
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
CFSEmailUiFolderListVisualiser* CFSEmailUiFolderListVisualiser::NewLC( CAlfEnv& aEnv,
|
|
155 |
CAlfControlGroup& aControlGroup,
|
|
156 |
CFreestyleEmailUiAppUi& aAppUi )
|
|
157 |
{
|
|
158 |
FUNC_LOG;
|
|
159 |
CFSEmailUiFolderListVisualiser* self = new (ELeave) CFSEmailUiFolderListVisualiser( aEnv, aAppUi, aControlGroup );
|
|
160 |
CleanupStack::PushL(self);
|
|
161 |
self->ConstructL();
|
|
162 |
return self;
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
// Constructor
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
CFSEmailUiFolderListVisualiser::CFSEmailUiFolderListVisualiser( CAlfEnv& aEnv,
|
|
170 |
CFreestyleEmailUiAppUi& aAppUi,
|
|
171 |
CAlfControlGroup& aControlGroup )
|
|
172 |
: CFsEmailUiViewBase( aControlGroup, aAppUi ),
|
|
173 |
iEnv( aEnv ),
|
|
174 |
iFullScreen( ETrue ),
|
|
175 |
iPreviousListLevel( KListRootLevel ),
|
|
176 |
iMoveOrCopyInitiated(EFalse),
|
|
177 |
iWaitingToGoOnline(EFalse),
|
|
178 |
iNoConnectNeeded(ETrue)
|
|
179 |
{
|
|
180 |
FUNC_LOG;
|
|
181 |
}
|
|
182 |
|
|
183 |
// ---------------------------------------------------------------------------
|
|
184 |
// Destructor
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
//
|
|
187 |
CFSEmailUiFolderListVisualiser::~CFSEmailUiFolderListVisualiser()
|
|
188 |
{
|
|
189 |
FUNC_LOG;
|
|
190 |
delete iModel;
|
|
191 |
iModel = NULL;
|
|
192 |
|
|
193 |
delete iBackgroundBrush;
|
|
194 |
iBackgroundBrush = NULL;
|
|
195 |
|
|
196 |
delete iShadowBrush;
|
|
197 |
|
|
198 |
// No need for ResetAndDestroy because list items are owned by generic list
|
|
199 |
iListItemVisulizers.Close();
|
|
200 |
|
|
201 |
//delete iNotifierTest;
|
|
202 |
|
|
203 |
delete iTreeList;
|
|
204 |
iTreeList = NULL;
|
|
205 |
|
|
206 |
iIconArray.Close();
|
|
207 |
iSortIconArray.Close();
|
|
208 |
|
|
209 |
if ( iAsyncCallback )
|
|
210 |
{
|
|
211 |
iAsyncCallback->Cancel();
|
|
212 |
delete iAsyncCallback;
|
|
213 |
}
|
|
214 |
|
|
215 |
iListItemDatas.Close();
|
|
216 |
}
|
|
217 |
|
|
218 |
// ---------------------------------------------------------------------------
|
|
219 |
// Second phase constructor
|
|
220 |
// ---------------------------------------------------------------------------
|
|
221 |
//
|
|
222 |
void CFSEmailUiFolderListVisualiser::ConstructL()
|
|
223 |
{
|
|
224 |
FUNC_LOG;
|
|
225 |
|
|
226 |
BaseConstructL( R_FSEMAILUI_FOLDER_LIST_VIEW );
|
|
227 |
this->HideToolbar();
|
|
228 |
iFirstStartCompleted = EFalse;
|
|
229 |
}
|
|
230 |
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
// CFSEmailUiFolderListVisualiser::DoFirstStartL
|
|
233 |
// Purpose of this function is to do first start things only when list is
|
|
234 |
// really needed to be shown. Implemented to make app startuo faster.
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
void CFSEmailUiFolderListVisualiser::DoFirstStartL()
|
|
238 |
{
|
|
239 |
FUNC_LOG;
|
|
240 |
HideToolbar();
|
|
241 |
|
|
242 |
iControl = CFSEmailUiFolderListControl::NewL( iEnv, *this );
|
|
243 |
iModel = new (ELeave) CFSEmailUiFolderListModel();
|
|
244 |
|
|
245 |
UpdateListSizeAttributes();
|
|
246 |
//LoadIconsL();
|
|
247 |
|
|
248 |
TRect mainPaneRect;
|
|
249 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
|
|
250 |
iFaderLayout = CAlfDeckLayout::AddNewL( *iControl );
|
|
251 |
iFaderLayout->SetRect( mainPaneRect );
|
|
252 |
// It is not possible to get PointerEvent from iFaderLayout
|
|
253 |
// unless it has got something to draw (even if it is not visible)
|
|
254 |
iFaderLayout->EnableBrushesL();
|
|
255 |
CAlfBorderBrush* borderfader = CAlfBorderBrush::NewL( iEnv, 1, 1, 1, 1 );
|
|
256 |
borderfader->SetOpacity(KFSInvisible);
|
|
257 |
iFaderLayout->Brushes()->AppendL( borderfader, EAlfHasOwnership );
|
|
258 |
|
|
259 |
iParentLayout = CAlfAnchorLayout::AddNewL( *iControl );
|
|
260 |
iParentLayout->SetRect( iScreenRect );
|
|
261 |
iParentLayout->SetFlags( EAlfVisualFlagManualLayout );
|
|
262 |
|
|
263 |
iParentLayout->EnableBrushesL();
|
|
264 |
SetAnchors();
|
|
265 |
|
|
266 |
iFaderVisual = CAlfImageVisual::AddNewL( *iControl, iParentLayout );
|
|
267 |
|
|
268 |
iHeaderLayout = CAlfDeckLayout::AddNewL( *iControl, iParentLayout );
|
|
269 |
iHeaderLayout->SetFlags( EAlfVisualFlagAutomaticLocaleMirroringEnabled );
|
|
270 |
|
|
271 |
iHeaderTextVisual = CAlfTextVisual::AddNewL( *iControl, iHeaderLayout );
|
|
272 |
iHeaderTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
|
|
273 |
iHeaderTextVisual->SetTextL( KNullDesC );
|
|
274 |
|
|
275 |
TRgb headerTextColor( KRgbBlack );
|
|
276 |
AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
|
|
277 |
headerTextColor, KAknsIIDFsTextColors, EAknsCIFsTextColorsCG10 );
|
|
278 |
iHeaderTextVisual->SetColor( headerTextColor );
|
|
279 |
iHeaderTextVisual->SetTextStyle( iAppUi.LayoutHandler()->
|
|
280 |
FSTextStyleFromLayoutL( AknLayoutScalable_Apps::main_sp_fs_ctrlbar_pane_t1( 0 ) ).Id() );
|
|
281 |
|
|
282 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
283 |
{
|
|
284 |
iHeaderTextVisual->SetAlign( EAlfAlignHRight, EAlfAlignVCenter );
|
|
285 |
}
|
|
286 |
else
|
|
287 |
{
|
|
288 |
iHeaderTextVisual->SetAlign( EAlfAlignHLeft, EAlfAlignVCenter );
|
|
289 |
}
|
|
290 |
|
|
291 |
iHeaderTextVisual->SetOpacity( KFSInvisible );
|
|
292 |
iHeaderLayout->SetOpacity( KFSInvisible );
|
|
293 |
|
|
294 |
iListLayout = CAlfDeckLayout::AddNewL( *iControl, iParentLayout );
|
|
295 |
iListLayout->SetFlags(EAlfVisualFlagLayoutUpdateNotification|EAlfVisualFlagAutomaticLocaleMirroringEnabled);
|
|
296 |
|
|
297 |
iTreeVisualizer = CFsTreeVisualizerBase::NewL( iControl, *iListLayout );
|
|
298 |
iTreeVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() );
|
|
299 |
iTreeVisualizer->SetScrollTime( iAppUi.LayoutHandler()->ListScrollingTime() );
|
|
300 |
iTreeVisualizer->SetFadeInEffectTime( iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
301 |
iTreeVisualizer->SetFadeOutEffectTime( iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
302 |
iTreeVisualizer->SetItemSeparatorSize( TSize(0, 0) );
|
|
303 |
iTreeVisualizer->SetExpandCollapseAllOnLongTap( EFalse );
|
|
304 |
|
|
305 |
iTreeList = CFsTreeList::NewL( *iTreeVisualizer, iEnv );
|
|
306 |
|
|
307 |
// Compared to S60 3.2.3 in S60 5.0 Alf offers the key events in
|
|
308 |
// opposite order.
|
|
309 |
ControlGroup().AppendL( iControl );
|
|
310 |
ControlGroup().AppendL( iTreeList->TreeControl() );
|
|
311 |
|
|
312 |
iTreeList->AddObserverL(*this);
|
|
313 |
|
|
314 |
iTreeList->SetLoopingType( EFsTreeListLoopingJumpToFirstLast );
|
|
315 |
iTreeList->SetScrollbarVisibilityL( EFsScrollbarAuto );
|
|
316 |
iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iTreeList );
|
|
317 |
iTreeList->HideListL();
|
|
318 |
|
|
319 |
// Set page up and page down keys
|
|
320 |
iTreeVisualizer->AddCustomPageUpKey( EStdKeyPageUp );
|
|
321 |
iTreeVisualizer->AddCustomPageDownKey( EStdKeyPageDown );
|
|
322 |
iTreeVisualizer->SetIndentationL(
|
|
323 |
iAppUi.LayoutHandler()->FolderListIndentation(iScreenRect) );
|
|
324 |
|
|
325 |
iTreeVisualizer->SetSelectorPropertiesL(
|
|
326 |
iAppUi.FsTextureManager()->NewListSelectorBrushL(), 1.0,
|
|
327 |
CFsTreeVisualizerBase::EFsSelectorMoveSmoothly );
|
|
328 |
|
|
329 |
iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard );
|
|
330 |
|
|
331 |
//iNotifierTest = CSimpleAOTest::NewL();
|
|
332 |
iFirstStartCompleted = ETrue;
|
|
333 |
}
|
|
334 |
|
|
335 |
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
// CFSEmailUiFolderListVisualiser::Id
|
|
338 |
// ---------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
TUid CFSEmailUiFolderListVisualiser::Id() const
|
|
341 |
{
|
|
342 |
FUNC_LOG;
|
|
343 |
return FolderListId;
|
|
344 |
}
|
|
345 |
|
|
346 |
// ---------------------------------------------------------------------------
|
|
347 |
// CFSEmailUiFolderListVisualiser::PrepareFolderListL
|
|
348 |
// ---------------------------------------------------------------------------
|
|
349 |
//
|
|
350 |
void CFSEmailUiFolderListVisualiser::PrepareFolderListL()
|
|
351 |
{
|
|
352 |
FUNC_LOG;
|
|
353 |
iTreeList->RemoveAllL();
|
|
354 |
iListItemVisulizers.Reset();
|
|
355 |
iModel->RemoveAll();
|
|
356 |
iMoreFoldersItemId = KFsTreeNoneID;
|
|
357 |
|
|
358 |
// SetRect need to be called twice for the parent layout (before and after
|
|
359 |
// list construction), otherwise the layout is incorrect in some cases.
|
|
360 |
UpdateListSizeAttributes();
|
|
361 |
iParentLayout->SetRect( iScreenRect );
|
|
362 |
SetAnchors();
|
|
363 |
ResizeListIcons();
|
|
364 |
|
|
365 |
// Show empty screen when offline
|
|
366 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
367 |
|
|
368 |
if( iModel->Count() == 0 )
|
|
369 |
{
|
|
370 |
cba->SetCommandSetL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK );
|
|
371 |
}
|
|
372 |
|
|
373 |
if( iMoveOrCopyInitiated )
|
|
374 |
{
|
|
375 |
iTreeVisualizer->SetEmptyListTextL( KNullDesC );
|
|
376 |
iTreeVisualizer->RefreshListViewL();
|
|
377 |
}
|
|
378 |
}
|
|
379 |
|
|
380 |
// ---------------------------------------------------------------------------
|
|
381 |
// CFSEmailUiFolderListVisualiser::PopulateFolderListL
|
|
382 |
// ---------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
void CFSEmailUiFolderListVisualiser::PopulateFolderListL()
|
|
385 |
{
|
|
386 |
FUNC_LOG;
|
|
387 |
if ( !iFullScreen && iSortListCallback )
|
|
388 |
{
|
|
389 |
UpdateSortListL();
|
|
390 |
SetFocusToCurrentSortItemL();
|
|
391 |
}
|
|
392 |
else
|
|
393 |
{
|
|
394 |
UpdateFolderListL();
|
|
395 |
if( !iFullScreen )
|
|
396 |
{
|
|
397 |
SetFocusToCurrentFolderL();
|
|
398 |
}
|
|
399 |
}
|
|
400 |
|
|
401 |
if( !iFullScreen )
|
|
402 |
{
|
|
403 |
AdaptScreenRectToListContent();
|
|
404 |
}
|
|
405 |
|
|
406 |
iParentLayout->SetRect(iScreenRect);
|
|
407 |
|
|
408 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
409 |
|
|
410 |
if( iModel->Count() > 0 )
|
|
411 |
{
|
|
412 |
cba->SetCommandSetL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK__SELECT );
|
|
413 |
}
|
|
414 |
|
|
415 |
if( iMoveOrCopyInitiated )
|
|
416 |
{
|
|
417 |
HBufC* emptyListText = StringLoader::LoadLC(
|
|
418 |
R_FREESTYLE_EMAIL_UI_FOLDER_LIST_NO_FOLDERS_AVAILABLE );
|
|
419 |
iTreeVisualizer->SetEmptyListTextL( *emptyListText );
|
|
420 |
CleanupStack::PopAndDestroy( emptyListText );
|
|
421 |
|
|
422 |
iTreeVisualizer->RefreshListViewL();
|
|
423 |
}
|
|
424 |
|
|
425 |
if ( iFullScreen )
|
|
426 |
{
|
|
427 |
StartScrollingListItemsL();
|
|
428 |
}
|
|
429 |
}
|
|
430 |
|
|
431 |
// ---------------------------------------------------------------------------
|
|
432 |
// CFSEmailUiFolderListVisualiser::PopulateFolderListDeferred
|
|
433 |
// ---------------------------------------------------------------------------
|
|
434 |
//
|
|
435 |
void CFSEmailUiFolderListVisualiser::PopulateFolderListDeferred()
|
|
436 |
{
|
|
437 |
FUNC_LOG;
|
|
438 |
if ( iAsyncCallback )
|
|
439 |
{
|
|
440 |
iAsyncCallback->Cancel();
|
|
441 |
iAsyncCallback->Set( TCallBack( DoPopulateFolderList, this ) );
|
|
442 |
iAsyncCallback->CallBack();
|
|
443 |
}
|
|
444 |
}
|
|
445 |
|
|
446 |
// ---------------------------------------------------------------------------
|
|
447 |
// CFSEmailUiFolderListVisualiser::DoPopulateFolderList
|
|
448 |
// ---------------------------------------------------------------------------
|
|
449 |
//
|
|
450 |
TInt CFSEmailUiFolderListVisualiser::DoPopulateFolderList( TAny* aSelfPtr )
|
|
451 |
{
|
|
452 |
FUNC_LOG;
|
|
453 |
CFSEmailUiFolderListVisualiser* self =
|
|
454 |
static_cast< CFSEmailUiFolderListVisualiser* >( aSelfPtr );
|
|
455 |
TRAPD( err,
|
|
456 |
self->PopulateFolderListL();
|
|
457 |
if ( self->iCustomMessageId == KFolderListMoveMessage ||
|
|
458 |
self->iCustomMessageId == KFolderListMoveMessages ||
|
|
459 |
self->iCustomMessageId == KFolderListCopyMessage ||
|
|
460 |
self->iCustomMessageId == KFolderListCopyMessages )
|
|
461 |
{
|
|
462 |
self->SetFocusToLatestMovedFolderL();
|
|
463 |
}
|
|
464 |
self->iTreeList->SetFocusedL( ETrue );
|
|
465 |
);
|
|
466 |
return err;
|
|
467 |
}
|
|
468 |
|
|
469 |
// ---------------------------------------------------------------------------
|
|
470 |
// CFSEmailUiFolderListVisualiser::IsPopupShown
|
|
471 |
// ---------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
TBool CFSEmailUiFolderListVisualiser::IsPopupShown()
|
|
474 |
{
|
|
475 |
return iPopupListShown;
|
|
476 |
}
|
|
477 |
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
// CFSEmailUiFolderListVisualiser::HidePopupL
|
|
480 |
// ---------------------------------------------------------------------------
|
|
481 |
//
|
|
482 |
void CFSEmailUiFolderListVisualiser::HidePopupL()
|
|
483 |
{
|
|
484 |
FUNC_LOG;
|
|
485 |
|
|
486 |
iParentLayout->SetRect( iCtrlButtonRect, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
487 |
|
|
488 |
TAlfTimedValue bgOpacity;
|
|
489 |
|
|
490 |
// Hiding delay was removed to get rid of flickering if changing between
|
|
491 |
// folderlist / sortlist popups. If delay is used in SetTarget,
|
|
492 |
// folderlistview would be quickly drawn as fullscreen after HideListL
|
|
493 |
// call, effecting ugly flickering
|
|
494 |
bgOpacity.SetTarget( 0, 0 );
|
|
495 |
iParentLayout->SetOpacity( bgOpacity );
|
|
496 |
iTreeList->HideListL();
|
|
497 |
//iTreeList->DisableKineticScrolling( EFalse );
|
|
498 |
ClearPopupSoftkeys();
|
|
499 |
iPopupListShown = EFalse;
|
|
500 |
}
|
|
501 |
|
|
502 |
// ---------------------------------------------------------------------------
|
|
503 |
// CFSEmailUiFolderListVisualiser::SetPopupSoftkeysL
|
|
504 |
// ---------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CFSEmailUiFolderListVisualiser::SetPopupSoftkeysL()
|
|
507 |
{
|
|
508 |
FUNC_LOG;
|
|
509 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
510 |
cba->AddCommandSetToStackL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT );
|
|
511 |
cba->UpdateCommandObserverL( cba->PositionById( EAknSoftkeySelect ), *this );
|
|
512 |
cba->MakeCommandVisible( EAknSoftkeySelect , EFalse );
|
|
513 |
cba->UpdateCommandObserverL( cba->PositionById( EEikBidCancel ), *this );
|
|
514 |
cba->DrawNow();
|
|
515 |
}
|
|
516 |
|
|
517 |
// ---------------------------------------------------------------------------
|
|
518 |
// CFSEmailUiFolderListVisualiser::ClearPopupSoftkeys
|
|
519 |
// ---------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
void CFSEmailUiFolderListVisualiser::ClearPopupSoftkeys()
|
|
522 |
{
|
|
523 |
FUNC_LOG;
|
|
524 |
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
|
|
525 |
cba->MakeCommandVisible( EAknSoftkeySelect , ETrue );
|
|
526 |
if (cba->UpdatedCommandObserverExists(CEikButtonGroupContainer::ELeftSoftkeyPosition))
|
|
527 |
{
|
|
528 |
cba->RemoveCommandObserver( cba->PositionById( EAknSoftkeySelect ) );
|
|
529 |
}
|
|
530 |
if (cba->UpdatedCommandObserverExists(CEikButtonGroupContainer::ERightSoftkeyPosition))
|
|
531 |
{
|
|
532 |
cba->RemoveCommandObserver( cba->PositionById( EEikBidCancel ) );
|
|
533 |
}
|
|
534 |
TInt pos = -1;
|
|
535 |
|
|
536 |
if ((pos = cba->PositionById( EAknSoftkeySelect )) >= 0)
|
|
537 |
{
|
|
538 |
cba->RemoveCommandFromStack( pos, EAknSoftkeySelect );
|
|
539 |
}
|
|
540 |
|
|
541 |
if ((pos = cba->PositionById( EEikBidCancel )) >= 0)
|
|
542 |
{
|
|
543 |
cba->RemoveCommandFromStack( pos, EEikBidCancel );
|
|
544 |
}
|
|
545 |
}
|
|
546 |
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
// CFSEmailUiFolderListVisualiser::DoShowInPopupL
|
|
549 |
// ---------------------------------------------------------------------------
|
|
550 |
//
|
|
551 |
void CFSEmailUiFolderListVisualiser::DoShowInPopupL(
|
|
552 |
MFsControlButtonInterface* aButton,
|
|
553 |
MFSEmailUiFolderListCallback* aFolderCallback,
|
|
554 |
MFSEmailUiSortListCallback* aSortCallback )
|
|
555 |
{
|
|
556 |
FUNC_LOG;
|
|
557 |
|
|
558 |
if ( ( aFolderCallback == NULL && aSortCallback == NULL ) ||
|
|
559 |
aButton == NULL )
|
|
560 |
{
|
|
561 |
return;
|
|
562 |
}
|
|
563 |
|
|
564 |
// In case of popup we are not moving or copying messages,
|
|
565 |
// so there's no need to connect the mailbox
|
|
566 |
iNoConnectNeeded = ETrue;
|
|
567 |
|
|
568 |
iCallback = aFolderCallback;
|
|
569 |
iSortListCallback = aSortCallback;
|
|
570 |
const TPoint buttonPos( aButton->Pos().Target() );
|
|
571 |
const TSize buttonSize( aButton->Size().Target().AsSize() );
|
|
572 |
|
|
573 |
// TRect from where to start the transformation effect
|
|
574 |
TRect cbr = iAppUi.LayoutHandler()->GetControlBarRect();
|
|
575 |
iCtrlButtonRect.SetRect( buttonPos + cbr.iTl, buttonSize );
|
|
576 |
|
|
577 |
iFullScreen = EFalse;
|
|
578 |
|
|
579 |
LoadIconsL();
|
|
580 |
|
|
581 |
if ( !iFirstStartCompleted )
|
|
582 |
{
|
|
583 |
DoFirstStartL();
|
|
584 |
}
|
|
585 |
|
|
586 |
// Make parent layout invisible to avoid any flashes in display
|
|
587 |
// during the construction of the list. Hide header also, not used.
|
|
588 |
TAlfTimedValue opacity;
|
|
589 |
opacity.SetValueNow( 0 );
|
|
590 |
iHeaderLayout->SetOpacity( opacity );
|
|
591 |
iParentLayout->SetOpacity( opacity );
|
|
592 |
|
|
593 |
if( iListBgImageVisual )
|
|
594 |
{
|
|
595 |
iListBgImageVisual->SetOpacity( opacity );
|
|
596 |
}
|
|
597 |
|
|
598 |
PrepareFolderListL();
|
|
599 |
PopulateFolderListL();
|
|
600 |
|
|
601 |
const TInt paddingValue(
|
|
602 |
iAppUi.LayoutHandler()->DropDownMenuListPadding() );
|
|
603 |
const TAlfMetric paddingMetric( paddingValue );
|
|
604 |
iParentLayout->SetPadding( paddingMetric );
|
|
605 |
|
|
606 |
// Set list background
|
|
607 |
TRect outerRect( iScreenRect );
|
|
608 |
outerRect.Shrink( paddingValue, paddingValue );
|
|
609 |
if ( !iBackgroundBrush )
|
|
610 |
{
|
|
611 |
iBackgroundBrush = CAlfFrameBrush::NewL( iEnv, KAknsIIDQsnFrPopup, 1, 1 );
|
|
612 |
iBackgroundBrush->SetFrameRectsL( outerRect, iScreenRect );
|
|
613 |
iParentLayout->Brushes()->InsertL( 0, iBackgroundBrush, EAlfDoesNotHaveOwnership );
|
|
614 |
}
|
|
615 |
else
|
|
616 |
{
|
|
617 |
// this prevents transparent popuplist background in portrait layout
|
|
618 |
// when sw keyboard in landscape layout was called between popups
|
|
619 |
iBackgroundBrush->SetFrameRectsL( outerRect, iScreenRect );
|
|
620 |
}
|
|
621 |
|
|
622 |
if( !iShadowBrush )
|
|
623 |
{
|
|
624 |
iShadowBrush = CAlfShadowBorderBrush::NewL(
|
|
625 |
iEnv, TAlfMetric( KDefaultShadowBorderWidth ) );
|
|
626 |
iShadowBrush->SetOpacity( KShadowBorderOpacity );
|
|
627 |
iShadowBrush->SetLayer( EAlfBrushLayerBackground );
|
|
628 |
iParentLayout->Brushes()->AppendL( iShadowBrush,
|
|
629 |
EAlfDoesNotHaveOwnership );
|
|
630 |
}
|
|
631 |
|
|
632 |
// Append brush if it's not yet appended.
|
|
633 |
switch ( iParentLayout->Brushes()->Count() )
|
|
634 |
{
|
|
635 |
case 0 :
|
|
636 |
// Keep the ownership of the brush to avoid unneeded object deletion / reconstruction
|
|
637 |
iParentLayout->Brushes()->InsertL( 0, iBackgroundBrush, EAlfDoesNotHaveOwnership );
|
|
638 |
iParentLayout->Brushes()->AppendL( iShadowBrush, EAlfDoesNotHaveOwnership );
|
|
639 |
break;
|
|
640 |
case 1 :
|
|
641 |
if ( static_cast<CAlfBrush *>(iBackgroundBrush) == & ( iParentLayout->Brushes()->At(0)) )
|
|
642 |
{
|
|
643 |
iParentLayout->Brushes()->AppendL( iShadowBrush, EAlfDoesNotHaveOwnership );
|
|
644 |
}
|
|
645 |
else
|
|
646 |
{
|
|
647 |
iParentLayout->Brushes()->InsertL( 0, iBackgroundBrush, EAlfDoesNotHaveOwnership );
|
|
648 |
}
|
|
649 |
break;
|
|
650 |
default: // 2: it's ok no need to add brush
|
|
651 |
break;
|
|
652 |
} // switch
|
|
653 |
|
|
654 |
SetPopupSoftkeysL();
|
|
655 |
// SetRect need to be called also here, otherwise the list layout might
|
|
656 |
// be wrong in mirrored layout
|
|
657 |
iParentLayout->SetRect( iCtrlButtonRect );
|
|
658 |
|
|
659 |
opacity.SetValueNow( 1 );
|
|
660 |
//opacity.SetTarget( 1, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
661 |
iParentLayout->SetOpacity( opacity );
|
|
662 |
iParentLayout->SetRect( iScreenRect, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
663 |
iParentLayout->UpdateChildrenLayout();
|
|
664 |
//iTreeList->DisableKineticScrolling( ETrue );
|
|
665 |
iTreeList->ShowListL( ETrue );
|
|
666 |
iTreeList->SetFocusedL( ETrue );
|
|
667 |
iFocusVisible = iAppUi.IsFocusShown();
|
|
668 |
iTreeVisualizer->SetFocusVisibility( iFocusVisible );
|
|
669 |
iPopupListShown = ETrue;
|
|
670 |
}
|
|
671 |
|
|
672 |
// ---------------------------------------------------------------------------
|
|
673 |
// CFSEmailUiFolderListVisualiser::ShowInPopupL
|
|
674 |
// ---------------------------------------------------------------------------
|
|
675 |
//
|
|
676 |
void CFSEmailUiFolderListVisualiser::ShowInPopupL(
|
|
677 |
const TFSMailMsgId aFolderId,
|
|
678 |
MFSEmailUiFolderListCallback* aCallback,
|
|
679 |
MFsControlButtonInterface* aButton )
|
|
680 |
{
|
|
681 |
FUNC_LOG;
|
|
682 |
iCustomMessageId = KFolderListSelectFolder;
|
|
683 |
iCurrentFolderId = aFolderId;
|
|
684 |
DoShowInPopupL( aButton, aCallback, NULL );
|
|
685 |
|
|
686 |
StartScrollingListItemsL();
|
|
687 |
}
|
|
688 |
|
|
689 |
// ---------------------------------------------------------------------------
|
|
690 |
// CFSEmailUiFolderListVisualiser::ShowSortListPopupL
|
|
691 |
// ---------------------------------------------------------------------------
|
|
692 |
//
|
|
693 |
void CFSEmailUiFolderListVisualiser::ShowSortListPopupL(
|
|
694 |
const TFSMailSortCriteria aCurrentSortCriteria,
|
|
695 |
const TFSFolderType aFolderType,
|
|
696 |
MFSEmailUiSortListCallback* aCallback,
|
|
697 |
MFsControlButtonInterface* aButton )
|
|
698 |
{
|
|
699 |
FUNC_LOG;
|
|
700 |
iCurrentSortCriteria = aCurrentSortCriteria;
|
|
701 |
iCurrentFolderType = aFolderType;
|
|
702 |
DoShowInPopupL( aButton, NULL, aCallback );
|
|
703 |
}
|
|
704 |
|
|
705 |
// ---------------------------------------------------------------------------
|
|
706 |
// Activate this view
|
|
707 |
// ---------------------------------------------------------------------------
|
|
708 |
//
|
|
709 |
void CFSEmailUiFolderListVisualiser::ChildDoActivateL(const TVwsViewId& /*aPrevViewId*/,
|
|
710 |
TUid aCustomMessageId,
|
|
711 |
const TDesC8& aCustomMessage)
|
|
712 |
{
|
|
713 |
FUNC_LOG;
|
|
714 |
iFullScreen = ETrue;
|
|
715 |
|
|
716 |
LoadIconsL();
|
|
717 |
|
|
718 |
if ( !iFirstStartCompleted )
|
|
719 |
{
|
|
720 |
DoFirstStartL();
|
|
721 |
}
|
|
722 |
|
|
723 |
// Set title pane text
|
|
724 |
iAppUi.SetActiveMailboxNameToStatusPaneL();
|
|
725 |
|
|
726 |
// Different effect is used when opening folder selection list
|
|
727 |
iAnimateNextActivation = ( aCustomMessageId == KFolderListSelectFolder );
|
|
728 |
|
|
729 |
// Create header image visual if not yet created
|
|
730 |
if( !iHeaderImageVisual )
|
|
731 |
{
|
|
732 |
iHeaderImageVisual = CAlfImageVisual::AddNewL( *iControl, iHeaderLayout );
|
|
733 |
CAlfTexture& headerBgTexture = iAppUi.FsTextureManager()->TextureByIndex( EMailListBarBgIcon );
|
|
734 |
headerBgTexture.Size().SetSize( iScreenRect.Width(), iListHeaderHeight );
|
|
735 |
iHeaderImageVisual->SetImage( TAlfImage( headerBgTexture ) );
|
|
736 |
|
|
737 |
TAlfTimedValue headerImageOpacity;
|
|
738 |
headerImageOpacity.SetValueNow( 0 );
|
|
739 |
iHeaderImageVisual->SetOpacity( headerImageOpacity );
|
|
740 |
|
|
741 |
// Make header text visible by moving it on front of the header background image
|
|
742 |
iHeaderTextVisual->MoveToFront();
|
|
743 |
}
|
|
744 |
|
|
745 |
// Create list background image if not yet created
|
|
746 |
if( !iListBgImageVisual )
|
|
747 |
{
|
|
748 |
iListBgImageVisual = CAlfImageVisual::AddNewL( *iControl, iListLayout );
|
|
749 |
|
|
750 |
TAlfTimedValue bgImageVisualOpacity;
|
|
751 |
bgImageVisualOpacity.SetValueNow( 0 );
|
|
752 |
iListBgImageVisual->SetOpacity( bgImageVisualOpacity );
|
|
753 |
// Move to background to make the list visible
|
|
754 |
iListLayout->MoveVisualToBack( *iListBgImageVisual );
|
|
755 |
}
|
|
756 |
|
|
757 |
// Returning from the settings view needs to handled as special case where
|
|
758 |
// the previous state of the folder list is preserved.
|
|
759 |
if ( aCustomMessageId.iUid == KMailSettingsReturnFromPluginSettings )
|
|
760 |
{
|
|
761 |
iTreeList->HideListL();
|
|
762 |
|
|
763 |
// Then just refresh the list as in dynamic variant switch,
|
|
764 |
// because screen orientation might have changed
|
|
765 |
HandleDynamicVariantSwitchL( EScreenLayoutChanged );
|
|
766 |
|
|
767 |
// Set flag for moving or copying
|
|
768 |
iMoveOrCopyInitiated = (iCustomMessageId == KFolderListMoveMessage ||
|
|
769 |
iCustomMessageId == KFolderListMoveMessages ||
|
|
770 |
iCustomMessageId == KFolderListCopyMessage ||
|
|
771 |
iCustomMessageId == KFolderListCopyMessages);
|
|
772 |
// Update toolbar button statuses.
|
|
773 |
UpdateToolbarButtons();
|
|
774 |
}
|
|
775 |
|
|
776 |
// Normal case of entering the folder list. Set the header text and callback function
|
|
777 |
// according the view activation parameters.
|
|
778 |
else
|
|
779 |
{
|
|
780 |
iCustomMessageId = aCustomMessageId;
|
|
781 |
iTitleCaptionVisible = ETrue;
|
|
782 |
|
|
783 |
// No header in folders list if not moving or copying messages
|
|
784 |
if( aCustomMessageId == KFolderListMoveMessage )
|
|
785 |
{
|
|
786 |
SetHeaderTextByResourceIdL( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_MOVE_ONE_HEADING );
|
|
787 |
}
|
|
788 |
else if( aCustomMessageId == KFolderListMoveMessages )
|
|
789 |
{
|
|
790 |
SetHeaderTextByResourceIdL( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_MOVE_MORE_HEADING );
|
|
791 |
}
|
|
792 |
else if( aCustomMessageId == KFolderListCopyMessage )
|
|
793 |
{
|
|
794 |
SetHeaderTextByResourceIdL( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_COPY_ONE_HEADING );
|
|
795 |
}
|
|
796 |
else if( aCustomMessageId == KFolderListCopyMessages )
|
|
797 |
{
|
|
798 |
SetHeaderTextByResourceIdL( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_COPY_MORE_HEADING );
|
|
799 |
}
|
|
800 |
else
|
|
801 |
{
|
|
802 |
// Hide text visual
|
|
803 |
iTitleCaptionVisible = EFalse;
|
|
804 |
iHeaderTextVisual->SetOpacity( KFSInvisible );
|
|
805 |
}
|
|
806 |
|
|
807 |
// Set flag for moving or copying
|
|
808 |
iMoveOrCopyInitiated = (aCustomMessageId == KFolderListMoveMessage ||
|
|
809 |
aCustomMessageId == KFolderListMoveMessages ||
|
|
810 |
aCustomMessageId == KFolderListCopyMessage ||
|
|
811 |
aCustomMessageId == KFolderListCopyMessages);
|
|
812 |
|
|
813 |
// Set callback function
|
|
814 |
TFolderListActivationData subView;
|
|
815 |
TPckgBuf<TFolderListActivationData> viewData( subView );
|
|
816 |
viewData.Copy( aCustomMessage );
|
|
817 |
iCallback = viewData().iCallback;
|
|
818 |
iCurrentFolderType = viewData().iSourceFolderType;
|
|
819 |
|
|
820 |
iTreeList->HideListL();
|
|
821 |
|
|
822 |
// Clear padding when shown in full screen
|
|
823 |
const TAlfMetric padding( 0 );
|
|
824 |
iParentLayout->SetPadding( padding );
|
|
825 |
iListLayout->SetPadding( padding );
|
|
826 |
|
|
827 |
PrepareFolderListL();
|
|
828 |
|
|
829 |
// Remove need to be called for all brushes before Reset, otherwise the
|
|
830 |
// brush resources are not completely freed from server side -> brushes
|
|
831 |
// keep "hanging" there and make future drawing slower.
|
|
832 |
while( iParentLayout->Brushes()->Count() > 0 )
|
|
833 |
{
|
|
834 |
iParentLayout->Brushes()->Remove( 0 );
|
|
835 |
}
|
|
836 |
iParentLayout->Brushes()->Reset();
|
|
837 |
|
|
838 |
TAlfTimedValue layoutOpacity = iHeaderLayout->Opacity();
|
|
839 |
layoutOpacity.SetTarget( 1, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime()/2 );
|
|
840 |
iHeaderLayout->SetOpacity( layoutOpacity );
|
|
841 |
|
|
842 |
TAlfTimedValue bgImageOpacity = iListBgImageVisual->Opacity();
|
|
843 |
bgImageOpacity.SetTarget( 1, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime()/2 );
|
|
844 |
iListBgImageVisual->SetOpacity( bgImageOpacity );
|
|
845 |
|
|
846 |
// Reset the variables used in horizontal scrolling
|
|
847 |
iPreviousListRect = iListLayout->DisplayRectTarget();
|
|
848 |
iPreviousListLevel = KListRootLevel;
|
|
849 |
|
|
850 |
iParentLayout->SetRect( iScreenRect );
|
|
851 |
iTreeList->ShowListL();
|
|
852 |
|
|
853 |
TAlfTimedValue opacity;
|
|
854 |
opacity.SetValueNow( 1 );
|
|
855 |
iParentLayout->SetOpacity( opacity );
|
|
856 |
}
|
|
857 |
|
|
858 |
// See if we are already connected
|
|
859 |
CFSMailBox* mb = iAppUi.GetActiveMailbox();
|
|
860 |
// Just in case, shouldn't happen
|
|
861 |
User::LeaveIfNull( mb );
|
|
862 |
|
|
863 |
TFSMailBoxStatus onlineStatus = mb->GetMailBoxStatus();
|
|
864 |
|
|
865 |
// If we are not moving or copying messages, there's no need to connect
|
|
866 |
// the mailbox. In case of move/copy we need to check the mailbox
|
|
867 |
// capability to see if we need to connect the mailbox before showing the
|
|
868 |
// folder list.
|
|
869 |
iNoConnectNeeded = ETrue;
|
|
870 |
if( iMoveOrCopyInitiated )
|
|
871 |
{
|
|
872 |
iNoConnectNeeded = mb->HasCapability( EFSMBoxCapaMoveMessageNoConnectNeeded );
|
|
873 |
}
|
|
874 |
|
|
875 |
iWaitingToGoOnline = EFalse;
|
|
876 |
// If we are already online or we don't need to be online for
|
|
877 |
// this operation, then we can show the list immediately
|
|
878 |
if( onlineStatus == EFSMailBoxOnline || iNoConnectNeeded )
|
|
879 |
{
|
|
880 |
if( aCustomMessageId.iUid != KMailSettingsReturnFromPluginSettings )
|
|
881 |
{
|
|
882 |
// Populate list after it has been made visible. List should not
|
|
883 |
// be focused before it's fully populated to prevent jumping of the
|
|
884 |
// highlight.
|
|
885 |
iTreeList->SetFocusedL( EFalse );
|
|
886 |
PopulateFolderListDeferred();
|
|
887 |
}
|
|
888 |
}
|
|
889 |
else
|
|
890 |
{
|
|
891 |
// If we come here it means that the mailbox is offline but connection
|
|
892 |
// is needed for this operation, so we need to connect first
|
|
893 |
ConnectToMailboxL();
|
|
894 |
}
|
|
895 |
FocusVisibilityChange( iAppUi.IsFocusShown() );
|
|
896 |
}
|
|
897 |
|
|
898 |
// ---------------------------------------------------------------------------
|
|
899 |
// CFSEmailUiFolderListVisualiser::OfferToolbarEventL
|
|
900 |
// ---------------------------------------------------------------------------
|
|
901 |
//
|
|
902 |
void CFSEmailUiFolderListVisualiser::OfferToolbarEventL( TInt aCommand )
|
|
903 |
{
|
|
904 |
switch( aCommand )
|
|
905 |
{
|
|
906 |
/*case EFsEmailUiTbCmdSelect:
|
|
907 |
HandleCommandL( EFsEmailUiCmdSelect );
|
|
908 |
break;*/
|
|
909 |
case EFsEmailUiTbCmdCollapseAll:
|
|
910 |
HandleCommandL( EFsEmailUiCmdActionsCollapseAll );
|
|
911 |
break;
|
|
912 |
case EFsEmailUiTbCmdExpandAll:
|
|
913 |
HandleCommandL( EFsEmailUiCmdActionsExpandAll );
|
|
914 |
break;
|
|
915 |
|
|
916 |
default:
|
|
917 |
break;
|
|
918 |
}
|
|
919 |
}
|
|
920 |
|
|
921 |
// ---------------------------------------------------------------------------
|
|
922 |
// CFSEmailUiFolderListVisualiser::ToolbarResourceId
|
|
923 |
// ---------------------------------------------------------------------------
|
|
924 |
//
|
|
925 |
TInt CFSEmailUiFolderListVisualiser::ToolbarResourceId() const
|
|
926 |
{
|
|
927 |
return R_FREESTYLE_EMAIL_UI_TOOLBAR_FOLDER_LIST;
|
|
928 |
}
|
|
929 |
|
|
930 |
// ---------------------------------------------------------------------------
|
|
931 |
// Deactivate this view
|
|
932 |
// ---------------------------------------------------------------------------
|
|
933 |
//
|
|
934 |
void CFSEmailUiFolderListVisualiser::ChildDoDeactivate()
|
|
935 |
{
|
|
936 |
FUNC_LOG;
|
|
937 |
iMoveOrCopyInitiated = EFalse;
|
|
938 |
iWaitingToGoOnline = EFalse;
|
|
939 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
940 |
{
|
|
941 |
iTreeVisualizer->NotifyControlVisibilityChange( EFalse );
|
|
942 |
}
|
|
943 |
}
|
|
944 |
|
|
945 |
// ---------------------------------------------------------------------------
|
|
946 |
// In case of sort list, this function sets focus to current sort item
|
|
947 |
// ---------------------------------------------------------------------------
|
|
948 |
//
|
|
949 |
void CFSEmailUiFolderListVisualiser::SetFocusToCurrentSortItemL()
|
|
950 |
{
|
|
951 |
FUNC_LOG;
|
|
952 |
if ( iFirstStartCompleted ) // Safety
|
|
953 |
{
|
|
954 |
for ( TInt i = 0; i < iModel->Count(); i++ )
|
|
955 |
{
|
|
956 |
CFSEmailUiFolderListItem* modelItem = iModel->ItemByIndex( i );
|
|
957 |
if ( modelItem && ( modelItem->iSortField == iCurrentSortCriteria.iField ) )
|
|
958 |
{
|
|
959 |
iTreeVisualizer->SetFocusedItemL( modelItem->iListId, EFalse );
|
|
960 |
break;
|
|
961 |
}
|
|
962 |
}
|
|
963 |
|
|
964 |
// Bold the focused item's text
|
|
965 |
TInt arraySize = iListItemVisulizers.Count();
|
|
966 |
for( TInt i = 0; i < arraySize; i++ )
|
|
967 |
{
|
|
968 |
TFsTreeItemId id = iTreeList->FocusedItem();
|
|
969 |
if ( iListItemVisulizers[ i ] == &( iTreeList->ItemVisualizer( id ) ) )
|
|
970 |
{
|
|
971 |
iListItemVisulizers[i]->SetTextBold( ETrue );
|
|
972 |
break;
|
|
973 |
}
|
|
974 |
}
|
|
975 |
}
|
|
976 |
}
|
|
977 |
|
|
978 |
// ---------------------------------------------------------------------------
|
|
979 |
// In case of folder list popup, this function sets focus to current folder,
|
|
980 |
// if that folder can be found from the list. If current folder is not found
|
|
981 |
// from the list, then move focus to "More folders" item.
|
|
982 |
// ---------------------------------------------------------------------------
|
|
983 |
//
|
|
984 |
void CFSEmailUiFolderListVisualiser::SetFocusToCurrentFolderL()
|
|
985 |
{
|
|
986 |
FUNC_LOG;
|
|
987 |
if ( iFirstStartCompleted ) // Safety
|
|
988 |
{
|
|
989 |
TFsTreeItemId itemToFocus = iMoreFoldersItemId;
|
|
990 |
for ( TInt i=0; i < iModel->Count() ; i++ )
|
|
991 |
{
|
|
992 |
CFSEmailUiFolderListItem* modelItem = iModel->ItemByIndex( i );
|
|
993 |
if ( modelItem && ( modelItem->iFolderId == iCurrentFolderId ) )
|
|
994 |
{
|
|
995 |
itemToFocus = modelItem->iListId;
|
|
996 |
break;
|
|
997 |
}
|
|
998 |
}
|
|
999 |
iTreeVisualizer->SetFocusedItemL( itemToFocus, EFalse );
|
|
1000 |
}
|
|
1001 |
}
|
|
1002 |
|
|
1003 |
// ---------------------------------------------------------------------------
|
|
1004 |
// In case of move, this function sets focus to latest selected item
|
|
1005 |
// ---------------------------------------------------------------------------
|
|
1006 |
//
|
|
1007 |
void CFSEmailUiFolderListVisualiser::SetFocusToLatestMovedFolderL()
|
|
1008 |
{
|
|
1009 |
FUNC_LOG;
|
|
1010 |
if ( iFirstStartCompleted ) // Safety
|
|
1011 |
{
|
|
1012 |
TBool match( EFalse );
|
|
1013 |
for ( TInt i=0; i < iModel->Count() ; i++ )
|
|
1014 |
{
|
|
1015 |
CFSEmailUiFolderListItem* modelItem = iModel->ItemByIndex( i );
|
|
1016 |
if ( modelItem && // Safety check
|
|
1017 |
!modelItem->iFolderId.IsNullId() && // Filter mailbox and sort items
|
|
1018 |
modelItem->iFolderId == iLatestSelectedMoveFolderId )
|
|
1019 |
{
|
|
1020 |
match = ETrue;
|
|
1021 |
iTreeVisualizer->SetFocusedItemL( modelItem->iListId );
|
|
1022 |
break;
|
|
1023 |
}
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
if ( match )
|
|
1027 |
{
|
|
1028 |
// Make sure that the horizontal position is recalculated
|
|
1029 |
DoHorizontalScrollL( ETrue );
|
|
1030 |
}
|
|
1031 |
else
|
|
1032 |
{
|
|
1033 |
iLatestSelectedMoveFolderId.SetId( 0 );
|
|
1034 |
iLatestSelectedMoveFolderId.SetNullId();
|
|
1035 |
}
|
|
1036 |
}
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
// ---------------------------------------------------------------------------
|
|
1040 |
// Handle events
|
|
1041 |
// ---------------------------------------------------------------------------
|
|
1042 |
//
|
|
1043 |
TBool CFSEmailUiFolderListVisualiser::OfferEventL(const TAlfEvent& aEvent)
|
|
1044 |
{
|
|
1045 |
FUNC_LOG;
|
|
1046 |
TBool result( EFalse );
|
|
1047 |
if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey )
|
|
1048 |
{
|
|
1049 |
// Swap left and right with mirrored layout
|
|
1050 |
TInt scanCode( aEvent.KeyEvent().iScanCode );
|
|
1051 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
1052 |
{
|
|
1053 |
if( scanCode == EStdKeyLeftArrow )
|
|
1054 |
{
|
|
1055 |
scanCode = EStdKeyRightArrow;
|
|
1056 |
}
|
|
1057 |
else if( scanCode == EStdKeyRightArrow )
|
|
1058 |
{
|
|
1059 |
scanCode = EStdKeyLeftArrow;
|
|
1060 |
}
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
// Handle possible focus visibility change
|
|
1064 |
if( ( scanCode == EStdKeyRightArrow ) ||
|
|
1065 |
( scanCode == EStdKeyLeftArrow ) ||
|
|
1066 |
( scanCode == EStdKeyUpArrow ) ||
|
|
1067 |
( scanCode == EStdKeyDownArrow ) ||
|
|
1068 |
( scanCode == EStdKeyEnter ) ||
|
|
1069 |
( scanCode == EStdKeyDeviceA ) ||
|
|
1070 |
( scanCode == EStdKeyDevice3 ) )
|
|
1071 |
{
|
|
1072 |
// If the focus was not active already, ignore the key press
|
|
1073 |
if( !iAppUi.SetFocusVisibility( ETrue ) )
|
|
1074 |
{
|
|
1075 |
return ETrue;
|
|
1076 |
}
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
switch ( scanCode )
|
|
1080 |
{
|
|
1081 |
case EStdKeyDevice3: // CENTER CLICK
|
|
1082 |
case EStdKeyEnter: // ENTER
|
|
1083 |
{
|
|
1084 |
// Handle center click and enter as selection
|
|
1085 |
HandleCommandL( EAknSoftkeySelect );
|
|
1086 |
result = ETrue;
|
|
1087 |
}
|
|
1088 |
break;
|
|
1089 |
|
|
1090 |
case EStdKeyLeftArrow:
|
|
1091 |
{
|
|
1092 |
// Check is the folder list open
|
|
1093 |
if( !iFullScreen && iCallback )
|
|
1094 |
{
|
|
1095 |
HandleSelectionL( EFSEmailUiCtrlBarResponseCancel );
|
|
1096 |
}
|
|
1097 |
// Check is the sort list open
|
|
1098 |
else if( !iFullScreen && iSortListCallback )
|
|
1099 |
{
|
|
1100 |
HandleSelectionL( EFSEmailUiCtrlBarResponseSwitchList );
|
|
1101 |
}
|
|
1102 |
}
|
|
1103 |
break;
|
|
1104 |
|
|
1105 |
case EStdKeyRightArrow:
|
|
1106 |
{
|
|
1107 |
// Check is the folder list open
|
|
1108 |
if( !iFullScreen && iCallback )
|
|
1109 |
{
|
|
1110 |
HandleSelectionL( EFSEmailUiCtrlBarResponseSwitchList );
|
|
1111 |
}
|
|
1112 |
// Check is the sort list open
|
|
1113 |
else if( !iFullScreen && iSortListCallback )
|
|
1114 |
{
|
|
1115 |
HandleSelectionL( EFSEmailUiCtrlBarResponseCancel );
|
|
1116 |
}
|
|
1117 |
}
|
|
1118 |
break;
|
|
1119 |
|
|
1120 |
default:
|
|
1121 |
// Check keyboard shortcuts.
|
|
1122 |
TInt shortcutCommand =
|
|
1123 |
iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(),
|
|
1124 |
CFSEmailUiShortcutBinding::EContextFolderList );
|
|
1125 |
if ( shortcutCommand != KErrNotFound )
|
|
1126 |
{
|
|
1127 |
HandleCommandL( shortcutCommand );
|
|
1128 |
result = ETrue;
|
|
1129 |
}
|
|
1130 |
break;
|
|
1131 |
}
|
|
1132 |
}
|
|
1133 |
return result;
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
// ---------------------------------------------------------------------------
|
|
1137 |
// CFSEmailUiFolderListVisualiser::HandlePointerEventL
|
|
1138 |
// ---------------------------------------------------------------------------
|
|
1139 |
//
|
|
1140 |
TBool CFSEmailUiFolderListVisualiser::HandlePointerEventL(const TAlfEvent& aEvent)
|
|
1141 |
{
|
|
1142 |
TBool eventHandled( EFalse );
|
|
1143 |
|
|
1144 |
if( ( aEvent.Visual() == iFaderVisual || aEvent.Visual() == iFaderLayout ) &&
|
|
1145 |
( aEvent.PointerEvent().iType == TPointerEvent::EButton1Down ) &&
|
|
1146 |
( iPopupListShown ) )
|
|
1147 |
{
|
|
1148 |
iAppUi.SetFocusVisibility( EFalse );
|
|
1149 |
HandleSelectionL( EFSEmailUiCtrlBarResponseCancel );
|
|
1150 |
eventHandled = ETrue;
|
|
1151 |
}
|
|
1152 |
else
|
|
1153 |
{
|
|
1154 |
// Handle pointer events to fadervisual. If the list is shown in popup,
|
|
1155 |
// then the popup will be closed.
|
|
1156 |
if( ( aEvent.IsPointerEvent() ) &&
|
|
1157 |
( aEvent.PointerEvent().iType == TPointerEvent::EButton1Up ) )
|
|
1158 |
{
|
|
1159 |
eventHandled = iTreeList->TreeControl()->OfferEventL(aEvent);
|
|
1160 |
// Hide focus visibility always after pointer up event.
|
|
1161 |
iAppUi.SetFocusVisibility( EFalse );
|
|
1162 |
}
|
|
1163 |
else
|
|
1164 |
{
|
|
1165 |
eventHandled = ETrue;
|
|
1166 |
}
|
|
1167 |
}
|
|
1168 |
return eventHandled;
|
|
1169 |
}
|
|
1170 |
|
|
1171 |
// ---------------------------------------------------------------------------
|
|
1172 |
// CFSEmailUiFolderListVisualiser::DynInitMenuPaneL
|
|
1173 |
// ---------------------------------------------------------------------------
|
|
1174 |
//
|
|
1175 |
void CFSEmailUiFolderListVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
|
|
1176 |
{
|
|
1177 |
FUNC_LOG;
|
|
1178 |
if ( iFirstStartCompleted ) // Safety
|
|
1179 |
{
|
|
1180 |
// Hide expand/collapse all if not needed
|
|
1181 |
if ( aResourceId == R_FSEMAILUI_FOLDERLIST_MENUPANE )
|
|
1182 |
{
|
|
1183 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
|
|
1184 |
{
|
|
1185 |
// remove help support in pf5250
|
|
1186 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
|
|
1187 |
}
|
|
1188 |
}
|
|
1189 |
|
|
1190 |
// Add shortcut hints
|
|
1191 |
iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane,
|
|
1192 |
CFSEmailUiShortcutBinding::EContextFolderList );
|
|
1193 |
}
|
|
1194 |
}
|
|
1195 |
|
|
1196 |
|
|
1197 |
// ---------------------------------------------------------------------------
|
|
1198 |
//
|
|
1199 |
// ---------------------------------------------------------------------------
|
|
1200 |
//
|
|
1201 |
void CFSEmailUiFolderListVisualiser::HandleSelectionL( TFSEmailUiCtrlBarResponse aSelection )
|
|
1202 |
{
|
|
1203 |
FUNC_LOG;
|
|
1204 |
// If popup is not open or the view is not active, then do nothing
|
|
1205 |
if ( !(iPopupListShown || IsViewActive()) )
|
|
1206 |
{
|
|
1207 |
return;
|
|
1208 |
}
|
|
1209 |
|
|
1210 |
TBool popupHiddenAlready(EFalse);
|
|
1211 |
switch( aSelection )
|
|
1212 |
{
|
|
1213 |
case EFSEmailUiCtrlBarResponseSelect:
|
|
1214 |
{
|
|
1215 |
TFsTreeItemId focusedItem = iTreeList->FocusedItem();
|
|
1216 |
if (focusedItem != KFsTreeNoneID)
|
|
1217 |
{
|
|
1218 |
if ( !iFullScreen && iTreeList->ItemData(focusedItem).Type() != KFsSeparatorDataType)
|
|
1219 |
{
|
|
1220 |
HidePopupL();
|
|
1221 |
popupHiddenAlready = ETrue;
|
|
1222 |
}
|
|
1223 |
}
|
|
1224 |
if( !HandleCallbackL() )
|
|
1225 |
{
|
|
1226 |
break;
|
|
1227 |
}
|
|
1228 |
}
|
|
1229 |
// fall through
|
|
1230 |
case EFSEmailUiCtrlBarResponseSwitchList:
|
|
1231 |
case EFSEmailUiCtrlBarResponseCancel:
|
|
1232 |
{
|
|
1233 |
if ( IsFullScreen() )
|
|
1234 |
{
|
|
1235 |
iAppUi.ReturnToPreviousViewL();
|
|
1236 |
}
|
|
1237 |
else
|
|
1238 |
{
|
|
1239 |
if ( !popupHiddenAlready )
|
|
1240 |
{
|
|
1241 |
HidePopupL();
|
|
1242 |
}
|
|
1243 |
|
|
1244 |
iAppUi.FolderPopupClosed();
|
|
1245 |
}
|
|
1246 |
|
|
1247 |
if ( !iFullScreen && iSortListCallback )
|
|
1248 |
{
|
|
1249 |
iSortListCallback->SortOrderChangedL( EFSMailDontCare, aSelection );
|
|
1250 |
iSortListCallback = NULL;
|
|
1251 |
}
|
|
1252 |
else if ( iCallback )
|
|
1253 |
{
|
|
1254 |
iCallback->FolderSelectedL( TFSMailMsgId(), aSelection );
|
|
1255 |
iCallback = NULL;
|
|
1256 |
}
|
|
1257 |
}
|
|
1258 |
break;
|
|
1259 |
|
|
1260 |
default:
|
|
1261 |
break;
|
|
1262 |
}
|
|
1263 |
}
|
|
1264 |
|
|
1265 |
// ---------------------------------------------------------------------------
|
|
1266 |
// Recursive function to get the root parent of given item
|
|
1267 |
// ---------------------------------------------------------------------------
|
|
1268 |
//
|
|
1269 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::GetRootParent( const TFsTreeItemId aItemId ) const
|
|
1270 |
{
|
|
1271 |
FUNC_LOG;
|
|
1272 |
TFsTreeItemId parentId = iTreeList->Parent( aItemId );
|
|
1273 |
// If current item's parent is KFsTreeRootID, return its id
|
|
1274 |
if( parentId == KFsTreeRootID || parentId == KFsTreeNoneID )
|
|
1275 |
{
|
|
1276 |
return aItemId;
|
|
1277 |
}
|
|
1278 |
else
|
|
1279 |
{
|
|
1280 |
// Get the root parent recursively
|
|
1281 |
return GetRootParent( parentId );
|
|
1282 |
}
|
|
1283 |
}
|
|
1284 |
|
|
1285 |
// ---------------------------------------------------------------------------
|
|
1286 |
// Override the default transition effect in case full screen mode is launched
|
|
1287 |
// from popup mode.
|
|
1288 |
// ---------------------------------------------------------------------------
|
|
1289 |
//
|
|
1290 |
void CFSEmailUiFolderListVisualiser::DoTransitionEffect( TBool aDirectionOut )
|
|
1291 |
{
|
|
1292 |
FUNC_LOG;
|
|
1293 |
if ( !aDirectionOut && IsFullScreen() && iAnimateNextActivation )
|
|
1294 |
{
|
|
1295 |
TInt rectTransitionTime = iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime();
|
|
1296 |
TInt opacityTransitionTime = iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() / 2;
|
|
1297 |
|
|
1298 |
TAlfTimedValue opacity;
|
|
1299 |
opacity.SetValueNow( 0 );
|
|
1300 |
opacity.SetTarget( 1, opacityTransitionTime );
|
|
1301 |
iParentLayout->SetOpacity( opacity );
|
|
1302 |
|
|
1303 |
// Do animated enlargening from popup window rect to full screen rect
|
|
1304 |
iParentLayout->SetRect( FolderListRectInThisResolution() );
|
|
1305 |
iParentLayout->SetRect( iScreenRect, rectTransitionTime );
|
|
1306 |
}
|
|
1307 |
else
|
|
1308 |
{
|
|
1309 |
// Use generic transition effect in all other cases
|
|
1310 |
CFsEmailUiViewBase::DoTransitionEffect( aDirectionOut );
|
|
1311 |
}
|
|
1312 |
}
|
|
1313 |
|
|
1314 |
// ---------------------------------------------------------------------------
|
|
1315 |
// Gets the parent layout holding all the visials of this view
|
|
1316 |
// ---------------------------------------------------------------------------
|
|
1317 |
//
|
|
1318 |
void CFSEmailUiFolderListVisualiser::GetParentLayoutsL(
|
|
1319 |
RPointerArray<CAlfVisual>& aLayoutArray ) const
|
|
1320 |
{
|
|
1321 |
FUNC_LOG;
|
|
1322 |
aLayoutArray.AppendL( iParentLayout );
|
|
1323 |
}
|
|
1324 |
|
|
1325 |
// ---------------------------------------------------------------------------
|
|
1326 |
// Hide or show CAlfVisuals ( used for activation or deactivation )
|
|
1327 |
// ---------------------------------------------------------------------------
|
|
1328 |
//
|
|
1329 |
void CFSEmailUiFolderListVisualiser::FadeOut( TBool aDirectionOut )
|
|
1330 |
{
|
|
1331 |
FUNC_LOG;
|
|
1332 |
if ( aDirectionOut )
|
|
1333 |
{
|
|
1334 |
if ( iTreeVisualizer != NULL )
|
|
1335 |
{
|
|
1336 |
iTreeVisualizer->HideList();
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
if ( iTitleCaptionVisible && iHeaderTextVisual )
|
|
1340 |
{
|
|
1341 |
iTitleCaptionVisible = EFalse;
|
|
1342 |
iHeaderTextVisual->SetOpacity( KFSInvisible );
|
|
1343 |
}
|
|
1344 |
}
|
|
1345 |
}
|
|
1346 |
|
|
1347 |
// ---------------------------------------------------------------------------
|
|
1348 |
// Handle commands
|
|
1349 |
// ---------------------------------------------------------------------------
|
|
1350 |
//
|
|
1351 |
void CFSEmailUiFolderListVisualiser::HandleCommandL( TInt aCommand )
|
|
1352 |
{
|
|
1353 |
FUNC_LOG;
|
|
1354 |
if ( iFirstStartCompleted ) // Safety
|
|
1355 |
{
|
|
1356 |
switch(aCommand)
|
|
1357 |
{
|
|
1358 |
// Key presses
|
|
1359 |
case EAknSoftkeySelect:
|
|
1360 |
{
|
|
1361 |
// If focus is not visible, make it visible
|
|
1362 |
// otherwise fall through ( call HandleSelectionL )
|
|
1363 |
if( !iFocusVisible )
|
|
1364 |
{
|
|
1365 |
iAppUi.SetFocusVisibility( ETrue );
|
|
1366 |
break;
|
|
1367 |
}
|
|
1368 |
}
|
|
1369 |
case EAknSoftkeyOpen:
|
|
1370 |
case EFsEmailUiCmdOpen:
|
|
1371 |
{
|
|
1372 |
HandleSelectionL( EFSEmailUiCtrlBarResponseSelect );
|
|
1373 |
}
|
|
1374 |
break;
|
|
1375 |
|
|
1376 |
case EAknSoftkeyBack:
|
|
1377 |
case EEikBidCancel:
|
|
1378 |
{
|
|
1379 |
HandleSelectionL( EFSEmailUiCtrlBarResponseCancel );
|
|
1380 |
}
|
|
1381 |
break;
|
|
1382 |
|
|
1383 |
// Options menu commands
|
|
1384 |
case EFsEmailUiCmdGoOnline:
|
|
1385 |
{
|
|
1386 |
if( iMoveOrCopyInitiated )
|
|
1387 |
{
|
|
1388 |
ConnectToMailboxL();
|
|
1389 |
}
|
|
1390 |
}
|
|
1391 |
break;
|
|
1392 |
case EFsEmailUiCmdGoOffline:
|
|
1393 |
{
|
|
1394 |
if( iMoveOrCopyInitiated )
|
|
1395 |
{
|
|
1396 |
DisconnectFromMailboxL();
|
|
1397 |
}
|
|
1398 |
}
|
|
1399 |
break;
|
|
1400 |
case EFsEmailUiCmdActionsCollapseAll:
|
|
1401 |
{
|
|
1402 |
TFsTreeItemId prevId = iTreeList->FocusedItem();
|
|
1403 |
prevId = GetRootParent( prevId );
|
|
1404 |
iTreeVisualizer->CollapseAllL();
|
|
1405 |
if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID )
|
|
1406 |
{
|
|
1407 |
iTreeVisualizer->SetFocusedItemL( prevId );
|
|
1408 |
}
|
|
1409 |
}
|
|
1410 |
break;
|
|
1411 |
|
|
1412 |
case EFsEmailUiCmdActionsExpandAll:
|
|
1413 |
{
|
|
1414 |
TFsTreeItemId prevId = iTreeList->FocusedItem();
|
|
1415 |
iTreeVisualizer->ExpandAllL();
|
|
1416 |
if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID )
|
|
1417 |
{
|
|
1418 |
iTreeVisualizer->SetFocusedItemL( prevId );
|
|
1419 |
}
|
|
1420 |
}
|
|
1421 |
break;
|
|
1422 |
|
|
1423 |
case EFsEmailUiCmdSettings:
|
|
1424 |
{
|
|
1425 |
CESMailSettingsPlugin::TSubViewActivationData activationData;
|
|
1426 |
activationData.iAccount = iAppUi.GetActiveMailbox()->GetId();
|
|
1427 |
activationData.iSubviewId = 1;
|
|
1428 |
activationData.iLaunchFolderSettings = ETrue;
|
|
1429 |
|
|
1430 |
TUid pluginUid = iAppUi.GetActiveMailbox()->GetSettingsUid();
|
|
1431 |
// register plugin view if not exists so that activation can be made
|
|
1432 |
if ( !iAppUi.View( pluginUid ) )
|
|
1433 |
{
|
|
1434 |
CESMailSettingsPlugin* plugin = CESMailSettingsPlugin::NewL( pluginUid );
|
|
1435 |
CleanupStack::PushL( plugin );
|
|
1436 |
iAppUi.AddViewL( plugin );
|
|
1437 |
CleanupStack::Pop( plugin );
|
|
1438 |
}
|
|
1439 |
TUid messageId = TUid::Uid( CESMailSettingsPlugin::EActivateMailSettingsSubview );
|
|
1440 |
const TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> pluginMessagePkg( activationData );
|
|
1441 |
iAppUi.EnterPluginSettingsViewL( pluginUid, messageId, pluginMessagePkg );
|
|
1442 |
|
|
1443 |
// Hide list to avoid it flashing when returning back
|
|
1444 |
iTreeList->HideListL();
|
|
1445 |
}
|
|
1446 |
break;
|
|
1447 |
|
|
1448 |
case EFsEmailUiCmdHelp:
|
|
1449 |
{
|
|
1450 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
|
|
1451 |
}
|
|
1452 |
break;
|
|
1453 |
|
|
1454 |
case EFsEmailUiCmdExit:
|
|
1455 |
{
|
|
1456 |
iAppUi.Exit();
|
|
1457 |
}
|
|
1458 |
break;
|
|
1459 |
|
|
1460 |
case EFsEmailUiCmdGoToTop:
|
|
1461 |
{
|
|
1462 |
GoToTopL();
|
|
1463 |
}
|
|
1464 |
break;
|
|
1465 |
|
|
1466 |
case EFsEmailUiCmdGoToBottom:
|
|
1467 |
{
|
|
1468 |
GoToBottomL();
|
|
1469 |
}
|
|
1470 |
break;
|
|
1471 |
|
|
1472 |
case EFsEmailUiCmdPageUp:
|
|
1473 |
{
|
|
1474 |
TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 };
|
|
1475 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
|
|
1476 |
}
|
|
1477 |
break;
|
|
1478 |
|
|
1479 |
case EFsEmailUiCmdPageDown:
|
|
1480 |
{
|
|
1481 |
TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 };
|
|
1482 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
|
|
1483 |
}
|
|
1484 |
break;
|
|
1485 |
|
|
1486 |
case EFsEmailUiCmdActionsCollapseExpandAllToggle:
|
|
1487 |
{
|
|
1488 |
if ( !AllNodesCollapsed() )
|
|
1489 |
{
|
|
1490 |
HandleCommandL( EFsEmailUiCmdActionsCollapseAll );
|
|
1491 |
}
|
|
1492 |
else
|
|
1493 |
{
|
|
1494 |
HandleCommandL( EFsEmailUiCmdActionsExpandAll );
|
|
1495 |
}
|
|
1496 |
}
|
|
1497 |
break;
|
|
1498 |
|
|
1499 |
default:
|
|
1500 |
break;
|
|
1501 |
}
|
|
1502 |
}
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
// ---------------------------------------------------------------------------
|
|
1506 |
// Handle call to callback function
|
|
1507 |
// ---------------------------------------------------------------------------
|
|
1508 |
//
|
|
1509 |
TBool CFSEmailUiFolderListVisualiser::HandleCallbackL()
|
|
1510 |
{
|
|
1511 |
FUNC_LOG;
|
|
1512 |
TFsTreeItemId focusedItem = iTreeList->FocusedItem();
|
|
1513 |
|
|
1514 |
if( focusedItem == KFsTreeNoneID )
|
|
1515 |
{
|
|
1516 |
return ETrue;
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
if( focusedItem == iMoreFoldersItemId )
|
|
1520 |
{
|
|
1521 |
//HidePopupL();
|
|
1522 |
iFullScreen = ETrue;
|
|
1523 |
|
|
1524 |
TFolderListActivationData tmp;
|
|
1525 |
tmp.iCallback = iCallback;
|
|
1526 |
const TPckgBuf<TFolderListActivationData> pkgOut( tmp );
|
|
1527 |
|
|
1528 |
iAppUi.EnterFsEmailViewL( FolderListId, KFolderListSelectFolder, pkgOut );
|
|
1529 |
|
|
1530 |
return EFalse;
|
|
1531 |
}
|
|
1532 |
|
|
1533 |
CFSEmailUiFolderListItem* modelItem = iModel->ItemByListId( focusedItem );
|
|
1534 |
if( !modelItem ) // Safety check, shouldn't be possible
|
|
1535 |
{
|
|
1536 |
return EFalse;
|
|
1537 |
}
|
|
1538 |
|
|
1539 |
if( iCallback )
|
|
1540 |
{
|
|
1541 |
const TFSMailMsgId& selectedFolderId = modelItem->iFolderId;
|
|
1542 |
const TFSMailMsgId& selectedMailboxId = modelItem->iMailboxId;
|
|
1543 |
if( !selectedFolderId.IsNullId() )
|
|
1544 |
{
|
|
1545 |
if ( iCustomMessageId == KFolderListMoveMessage ||
|
|
1546 |
iCustomMessageId == KFolderListMoveMessages ||
|
|
1547 |
iCustomMessageId == KFolderListCopyMessage ||
|
|
1548 |
iCustomMessageId == KFolderListCopyMessages )
|
|
1549 |
{
|
|
1550 |
iLatestSelectedMoveFolderId = selectedFolderId;
|
|
1551 |
}
|
|
1552 |
iCallback->FolderSelectedL( selectedFolderId, EFSEmailUiCtrlBarResponseSelect );
|
|
1553 |
}
|
|
1554 |
else if( !selectedMailboxId.IsNullId() )
|
|
1555 |
{
|
|
1556 |
iCallback->MailboxSelectedL( selectedMailboxId );
|
|
1557 |
}
|
|
1558 |
// Set callback to NULL after callback is called so that the
|
|
1559 |
// same callback is not reused unintentionally.
|
|
1560 |
iCallback = NULL;
|
|
1561 |
}
|
|
1562 |
else if( iSortListCallback )
|
|
1563 |
{
|
|
1564 |
iSortListCallback->SortOrderChangedL( modelItem->iSortField, EFSEmailUiCtrlBarResponseSelect );
|
|
1565 |
// Set callback to NULL after callback is called so that the
|
|
1566 |
// same callback is not reused unintentionally.
|
|
1567 |
iSortListCallback = NULL;
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
return ETrue;
|
|
1571 |
}
|
|
1572 |
|
|
1573 |
|
|
1574 |
// ---------------------------------------------------------------------------
|
|
1575 |
// Append node to list by getting the item data from resource
|
|
1576 |
// ---------------------------------------------------------------------------
|
|
1577 |
//
|
|
1578 |
void CFSEmailUiFolderListVisualiser::SetHeaderTextByResourceIdL(
|
|
1579 |
TInt aResourceId )
|
|
1580 |
{
|
|
1581 |
FUNC_LOG;
|
|
1582 |
if ( iFirstStartCompleted ) // Safety
|
|
1583 |
{
|
|
1584 |
HBufC* headingText = StringLoader::LoadLC( aResourceId );
|
|
1585 |
SetHeaderTextAttributesL();
|
|
1586 |
iHeaderTextVisual->SetTextL( *headingText );
|
|
1587 |
CleanupStack::PopAndDestroy( headingText );
|
|
1588 |
}
|
|
1589 |
}
|
|
1590 |
|
|
1591 |
// ---------------------------------------------------------------------------
|
|
1592 |
// CFSEmailUiFolderListVisualiser::SetHeaderTextAttributesL()
|
|
1593 |
//
|
|
1594 |
// Apply header text attributes
|
|
1595 |
// This creates "Move message to:" title caption and background graphics
|
|
1596 |
// ---------------------------------------------------------------------------
|
|
1597 |
//
|
|
1598 |
void CFSEmailUiFolderListVisualiser::SetHeaderTextAttributesL()
|
|
1599 |
{
|
|
1600 |
iHeaderTextVisual->SetOpacity( KFSVisible );
|
|
1601 |
CAlfTextStyle& textStyle =
|
|
1602 |
iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(
|
|
1603 |
AknLayoutScalable_Apps::main_sp_fs_ctrlbar_pane_t1(0));
|
|
1604 |
iHeaderTextVisual->SetTextStyle ( textStyle.Id() );
|
|
1605 |
iHeaderTextVisual->SetColor( iAppUi.LayoutHandler()->
|
|
1606 |
ListNormalStateTextSkinColor() );
|
|
1607 |
iHeaderTextVisual->SetPadding(
|
|
1608 |
iAppUi.LayoutHandler()->TitleCaptionPadding() );
|
|
1609 |
|
|
1610 |
if( iHeaderTextVisual->Brushes() )
|
|
1611 |
{
|
|
1612 |
iHeaderTextVisual->Brushes()->Reset();
|
|
1613 |
}
|
|
1614 |
iHeaderTextVisual->EnableBrushesL();
|
|
1615 |
CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->
|
|
1616 |
NewCtrlBarSelectorBrushLC();
|
|
1617 |
selectorBrush->SetOpacity( KFSHeaderTextBackgroundOpacity );
|
|
1618 |
iHeaderTextVisual->Brushes()->AppendL( selectorBrush, EAlfHasOwnership );
|
|
1619 |
CleanupStack::Pop( selectorBrush );
|
|
1620 |
}
|
|
1621 |
|
|
1622 |
|
|
1623 |
// ---------------------------------------------------------------------------
|
|
1624 |
// CFSEmailUiFolderListVisualiser::ConnectMailbox
|
|
1625 |
// ---------------------------------------------------------------------------
|
|
1626 |
//
|
|
1627 |
void CFSEmailUiFolderListVisualiser::ConnectToMailboxL()
|
|
1628 |
{
|
|
1629 |
CFSMailBox* mb = iAppUi.GetActiveMailbox();
|
|
1630 |
iWaitingToGoOnline = ETrue;
|
|
1631 |
mb->GoOnlineL();
|
|
1632 |
}
|
|
1633 |
|
|
1634 |
|
|
1635 |
// ---------------------------------------------------------------------------
|
|
1636 |
// CFSEmailUiFolderListVisualiser::DisconnectMailbox
|
|
1637 |
// ---------------------------------------------------------------------------
|
|
1638 |
//
|
|
1639 |
void CFSEmailUiFolderListVisualiser::DisconnectFromMailboxL()
|
|
1640 |
{
|
|
1641 |
iAppUi.GetActiveMailbox()->GoOfflineL();
|
|
1642 |
iWaitingToGoOnline = EFalse;
|
|
1643 |
}
|
|
1644 |
|
|
1645 |
|
|
1646 |
// ---------------------------------------------------------------------------
|
|
1647 |
// Construct folder list data
|
|
1648 |
// ---------------------------------------------------------------------------
|
|
1649 |
//
|
|
1650 |
void CFSEmailUiFolderListVisualiser::UpdateFolderListL()
|
|
1651 |
{
|
|
1652 |
FUNC_LOG;
|
|
1653 |
if ( iFirstStartCompleted ) // Safety
|
|
1654 |
{
|
|
1655 |
// <cmail>
|
|
1656 |
iListItemDatas.Reset();
|
|
1657 |
// </cmail>
|
|
1658 |
if( iFullScreen )
|
|
1659 |
{
|
|
1660 |
// Append lines to the model
|
|
1661 |
AppendActiveMailboxFoldersL();
|
|
1662 |
|
|
1663 |
// Update toolbar button statuses.
|
|
1664 |
UpdateToolbarButtons();
|
|
1665 |
}
|
|
1666 |
else
|
|
1667 |
{
|
|
1668 |
//Mailboxes needed to be at the top followed by seperator
|
|
1669 |
AppendMailboxesL();
|
|
1670 |
|
|
1671 |
// Append lines to the model followed by seperator
|
|
1672 |
AppendActiveMailboxFoldersL();
|
|
1673 |
AppendSeparatorLineL();
|
|
1674 |
|
|
1675 |
// Append the folder list view selector
|
|
1676 |
AppendMoreFoldersL();
|
|
1677 |
}
|
|
1678 |
}
|
|
1679 |
}
|
|
1680 |
|
|
1681 |
// ---------------------------------------------------------------------------
|
|
1682 |
// Construct sort list data
|
|
1683 |
// ---------------------------------------------------------------------------
|
|
1684 |
//
|
|
1685 |
void CFSEmailUiFolderListVisualiser::UpdateSortListL()
|
|
1686 |
{
|
|
1687 |
FUNC_LOG;
|
|
1688 |
if ( iFirstStartCompleted ) // Safety
|
|
1689 |
{
|
|
1690 |
iListItemDatas.Reset();
|
|
1691 |
iTreeList->RemoveAllL();
|
|
1692 |
iListItemVisulizers.Reset();
|
|
1693 |
iModel->RemoveAll();
|
|
1694 |
iMoreFoldersItemId = KFsTreeNoneID;
|
|
1695 |
// Append lines to the model
|
|
1696 |
AppendSortListItemsL();
|
|
1697 |
}
|
|
1698 |
}
|
|
1699 |
|
|
1700 |
// ---------------------------------------------------------------------------
|
|
1701 |
// Append active mailbox's folders
|
|
1702 |
// ---------------------------------------------------------------------------
|
|
1703 |
//
|
|
1704 |
void CFSEmailUiFolderListVisualiser::AppendActiveMailboxFoldersL()
|
|
1705 |
{
|
|
1706 |
FUNC_LOG;
|
|
1707 |
if ( iFirstStartCompleted ) // Safety
|
|
1708 |
{
|
|
1709 |
iActiveMailbox = iAppUi.GetActiveMailbox();
|
|
1710 |
if( iActiveMailbox )
|
|
1711 |
{
|
|
1712 |
AppendSubfoldersL( TFSMailMsgId(), KFsTreeRootID, ETrue );
|
|
1713 |
}
|
|
1714 |
}
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
// ---------------------------------------------------------------------------
|
|
1718 |
// Compare two mail folders, used in sorting done with TLinearOrder
|
|
1719 |
// ---------------------------------------------------------------------------
|
|
1720 |
//
|
|
1721 |
TInt CFSEmailUiFolderListVisualiser::CompareFolders( const CFSMailFolder& aFirst, const CFSMailFolder& aSecond )
|
|
1722 |
{
|
|
1723 |
FUNC_LOG;
|
|
1724 |
TInt priorityOfFirst = GetFolderPriorityByType( aFirst );
|
|
1725 |
TInt priorityOfSecond = GetFolderPriorityByType( aSecond );
|
|
1726 |
|
|
1727 |
// First sort the folders by folder type priority.
|
|
1728 |
// If priority is same, sort alphabetically by folder name.
|
|
1729 |
if( priorityOfFirst != priorityOfSecond )
|
|
1730 |
{
|
|
1731 |
return priorityOfFirst - priorityOfSecond;
|
|
1732 |
}
|
|
1733 |
else
|
|
1734 |
{
|
|
1735 |
TDesC& nameOfFirst = aFirst.GetFolderName();
|
|
1736 |
TDesC& nameOfSecond = aSecond.GetFolderName();
|
|
1737 |
|
|
1738 |
return nameOfFirst.CompareC( nameOfSecond );
|
|
1739 |
}
|
|
1740 |
}
|
|
1741 |
|
|
1742 |
// ---------------------------------------------------------------------------
|
|
1743 |
// Compare two mail folders, used in sorting done with TLinearOrder
|
|
1744 |
// ---------------------------------------------------------------------------
|
|
1745 |
//
|
|
1746 |
TInt CFSEmailUiFolderListVisualiser::GetFolderPriorityByType( const CFSMailFolder& aFolder )
|
|
1747 |
{
|
|
1748 |
FUNC_LOG;
|
|
1749 |
TInt folderType = aFolder.GetFolderType();
|
|
1750 |
switch( folderType )
|
|
1751 |
{
|
|
1752 |
case EFSInbox:
|
|
1753 |
return EFolderListPriorityInbox;
|
|
1754 |
|
|
1755 |
case EFSOutbox:
|
|
1756 |
return EFolderListPriorityOutbox;
|
|
1757 |
|
|
1758 |
case EFSDraftsFolder:
|
|
1759 |
return EFolderListPriorityDrafts;
|
|
1760 |
|
|
1761 |
case EFSSentFolder:
|
|
1762 |
return EFolderListPrioritySent;
|
|
1763 |
|
|
1764 |
case EFSDeleted:
|
|
1765 |
return EFolderListPriorityDeleted;
|
|
1766 |
|
|
1767 |
default:
|
|
1768 |
return EFolderListPriorityOtherFolder;
|
|
1769 |
}
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
void CFSEmailUiFolderListVisualiser::AppendSortListItemsL()
|
|
1773 |
{
|
|
1774 |
FUNC_LOG;
|
|
1775 |
|
|
1776 |
// Select correct icon depending on the selected sort criteria
|
|
1777 |
CAlfTexture* icon( NULL );
|
|
1778 |
icon = iCurrentSortCriteria.iField == EFSMailSortByDate ?
|
|
1779 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1780 |
iSortIconArray[ ESortListDateDescIcon ] :
|
|
1781 |
iSortIconArray[ ESortListDateAscIcon ] :
|
|
1782 |
iSortIconArray[ ESortListDateDescIcon ];
|
|
1783 |
|
|
1784 |
TFsTreeItemId itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_DATE, KFsTreeRootID, icon, EFalse );
|
|
1785 |
iModel->AppendL( itemId, EFSMailSortByDate );
|
|
1786 |
|
|
1787 |
switch( iCurrentFolderType )
|
|
1788 |
{
|
|
1789 |
case EFSSentFolder:
|
|
1790 |
case EFSDraftsFolder:
|
|
1791 |
case EFSOutbox:
|
|
1792 |
{
|
|
1793 |
icon = iCurrentSortCriteria.iField == EFSMailSortByRecipient ?
|
|
1794 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1795 |
iSortIconArray[ ESortListSenderDescIcon ] :
|
|
1796 |
iSortIconArray[ ESortListSenderAscIcon ] :
|
|
1797 |
iSortIconArray[ ESortListSenderDescIcon ];
|
|
1798 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_RECIPIENT, KFsTreeRootID, icon, EFalse );
|
|
1799 |
iModel->AppendL( itemId, EFSMailSortByRecipient );
|
|
1800 |
}
|
|
1801 |
break;
|
|
1802 |
|
|
1803 |
default:
|
|
1804 |
{
|
|
1805 |
icon = iCurrentSortCriteria.iField == EFSMailSortBySender ?
|
|
1806 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1807 |
iSortIconArray[ ESortListSenderDescIcon ] :
|
|
1808 |
iSortIconArray[ ESortListSenderAscIcon ] :
|
|
1809 |
iSortIconArray[ ESortListSenderDescIcon ];
|
|
1810 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_SENDER, KFsTreeRootID, icon, EFalse );
|
|
1811 |
iModel->AppendL( itemId, EFSMailSortBySender );
|
|
1812 |
}
|
|
1813 |
break;
|
|
1814 |
}
|
|
1815 |
|
|
1816 |
icon = iCurrentSortCriteria.iField == EFSMailSortBySubject ?
|
|
1817 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1818 |
iSortIconArray[ ESortListSubjectDescIcon ] :
|
|
1819 |
iSortIconArray[ ESortListSubjectAscIcon ] :
|
|
1820 |
iSortIconArray[ ESortListSubjectDescIcon ];
|
|
1821 |
|
|
1822 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_SUBJECT, KFsTreeRootID, icon, EFalse );
|
|
1823 |
iModel->AppendL( itemId, EFSMailSortBySubject );
|
|
1824 |
|
|
1825 |
if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) )
|
|
1826 |
{
|
|
1827 |
icon = iCurrentSortCriteria.iField == EFSMailSortByFlagStatus ?
|
|
1828 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1829 |
iSortIconArray[ ESortListFollowDescIcon ] :
|
|
1830 |
iSortIconArray[ ESortListFollowAscIcon ] :
|
|
1831 |
iSortIconArray[ ESortListFollowDescIcon ];
|
|
1832 |
|
|
1833 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_FLAG, KFsTreeRootID, icon, EFalse );
|
|
1834 |
iModel->AppendL( itemId, EFSMailSortByFlagStatus );
|
|
1835 |
}
|
|
1836 |
|
|
1837 |
icon = iCurrentSortCriteria.iField == EFSMailSortByPriority ?
|
|
1838 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1839 |
iSortIconArray[ ESortListPriorityDescIcon ] :
|
|
1840 |
iSortIconArray[ ESortListPriorityAscIcon ] :
|
|
1841 |
iSortIconArray[ ESortListPriorityDescIcon ];
|
|
1842 |
|
|
1843 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_PRIORITY, KFsTreeRootID, icon, EFalse );
|
|
1844 |
iModel->AppendL( itemId, EFSMailSortByPriority );
|
|
1845 |
|
|
1846 |
if ( iCurrentFolderType != EFSSentFolder &&
|
|
1847 |
iCurrentFolderType != EFSDraftsFolder &&
|
|
1848 |
iCurrentFolderType != EFSOutbox )
|
|
1849 |
{
|
|
1850 |
icon = iCurrentSortCriteria.iField == EFSMailSortByUnread ?
|
|
1851 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1852 |
iSortIconArray[ ESortListUnreadDescIcon ] :
|
|
1853 |
iSortIconArray[ ESortListUnreadAscIcon ] :
|
|
1854 |
iSortIconArray[ ESortListUnreadDescIcon ];
|
|
1855 |
|
|
1856 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_UNREAD, KFsTreeRootID, icon, EFalse );
|
|
1857 |
iModel->AppendL( itemId, EFSMailSortByUnread );
|
|
1858 |
}
|
|
1859 |
|
|
1860 |
// Allow scroll bar refresh only for the last item
|
|
1861 |
icon = iCurrentSortCriteria.iField == EFSMailSortByAttachment ?
|
|
1862 |
iCurrentSortCriteria.iOrder == EFSMailAscending ?
|
|
1863 |
iSortIconArray[ ESortListAttachmentDescIcon ] :
|
|
1864 |
iSortIconArray[ ESortListAttachmentAscIcon ] :
|
|
1865 |
iSortIconArray[ ESortListAttachmentDescIcon ];
|
|
1866 |
|
|
1867 |
itemId = AppendItemToListFromResourceL( R_FREESTYLE_EMAIL_UI_SORT_BY_ATTACHMENT, KFsTreeRootID, icon, ETrue );
|
|
1868 |
iModel->AppendL( itemId, EFSMailSortByAttachment );
|
|
1869 |
}
|
|
1870 |
|
|
1871 |
// ---------------------------------------------------------------------------
|
|
1872 |
// Recursive function to get the folder's subfolder data
|
|
1873 |
// ---------------------------------------------------------------------------
|
|
1874 |
//
|
|
1875 |
void CFSEmailUiFolderListVisualiser::AppendSubfoldersL(
|
|
1876 |
TFSMailMsgId aFolder, TFsTreeItemId aParentNode, TBool aRefreshLastItem )
|
|
1877 |
{
|
|
1878 |
FUNC_LOG;
|
|
1879 |
RPointerArray<CFSMailFolder> folders;
|
|
1880 |
CleanupResetAndDestroyClosePushL( folders );
|
|
1881 |
|
|
1882 |
iActiveMailbox->ListFolders( aFolder, folders );
|
|
1883 |
|
|
1884 |
TLinearOrder<CFSMailFolder> order(
|
|
1885 |
CFSEmailUiFolderListVisualiser::CompareFolders );
|
|
1886 |
folders.Sort( order );
|
|
1887 |
|
|
1888 |
// First check which folders are not shown, and remove those from the list.
|
|
1889 |
// This is done in separate loop to be able to check in next loop which
|
|
1890 |
// folder is last one to be added. This information is needed to enhance
|
|
1891 |
// list performance by allowing scroll bar refresh only for the last item.
|
|
1892 |
for( TInt i = folders.Count() - 1; i >= 0; i-- )
|
|
1893 |
{
|
|
1894 |
if( !ShowThisTypeOfFolderL( folders[i] ) )
|
|
1895 |
{
|
|
1896 |
// Skip this folder
|
|
1897 |
delete folders[i];
|
|
1898 |
folders.Remove(i);
|
|
1899 |
}
|
|
1900 |
}
|
|
1901 |
|
|
1902 |
TBool allowItemRefresh = EFalse;
|
|
1903 |
while( folders.Count() > 0 )
|
|
1904 |
{
|
|
1905 |
// If last item of this level is to be refreshed, and we are in the
|
|
1906 |
// last item, allow the refresh. If this last item is leaf folder,
|
|
1907 |
// then list is refreshed during it's drawn. If this last item is
|
|
1908 |
// node (it has some subfolders), then we don't refresh it, but
|
|
1909 |
// instead we forward the info to next level with next
|
|
1910 |
// AppendSubfoldersL function call.
|
|
1911 |
if( aRefreshLastItem && folders.Count() == 1 )
|
|
1912 |
{
|
|
1913 |
allowItemRefresh = ETrue;
|
|
1914 |
}
|
|
1915 |
|
|
1916 |
// Performance optimisations concerning FS Generic scroll bar update
|
|
1917 |
// logic are implemented so that they assume that all leaf folders
|
|
1918 |
// are added to list as leaf items, not nodes
|
|
1919 |
if( iFullScreen && folders[0]->GetSubFolderCount() > 0 )
|
|
1920 |
{
|
|
1921 |
TFsTreeItemId nodeId = AppendNodeFolderL( folders[0], aParentNode );
|
|
1922 |
// If the returned item id is KFsTreeNoneID, it means that
|
|
1923 |
// the current folder was not added to folder list, so we
|
|
1924 |
// should not append it to model either
|
|
1925 |
if( nodeId != KFsTreeNoneID )
|
|
1926 |
{
|
|
1927 |
// Note that ownership of the folder object is NOT transferred
|
|
1928 |
// to model anymore, so we need to delete it here in all cases
|
|
1929 |
iModel->AppendL( nodeId, folders[0] );
|
|
1930 |
|
|
1931 |
AppendSubfoldersL( folders[0]->GetFolderId(), nodeId, allowItemRefresh );
|
|
1932 |
}
|
|
1933 |
delete folders[0];
|
|
1934 |
folders.Remove(0);
|
|
1935 |
}
|
|
1936 |
else
|
|
1937 |
{
|
|
1938 |
TFsTreeItemId leafId = AppendLeafFolderL( folders[0], aParentNode, allowItemRefresh );
|
|
1939 |
// If the returned item id is KFsTreeNoneID, it means that
|
|
1940 |
// the current folder was not added to folder list, so we
|
|
1941 |
// should not append it to model either
|
|
1942 |
if( leafId != KFsTreeNoneID )
|
|
1943 |
{
|
|
1944 |
// Note that ownership of the folder object is NOT transferred
|
|
1945 |
// to model anymore, so we need to delete it here in all cases
|
|
1946 |
iModel->AppendL( leafId, folders[0] );
|
|
1947 |
}
|
|
1948 |
delete folders[0];
|
|
1949 |
folders.Remove(0);
|
|
1950 |
}
|
|
1951 |
}
|
|
1952 |
|
|
1953 |
CleanupStack::PopAndDestroy( &folders );
|
|
1954 |
}
|
|
1955 |
|
|
1956 |
// ---------------------------------------------------------------------------
|
|
1957 |
// Get "standard" folder's resource id (for name) and icon by folder type
|
|
1958 |
// Returns ETrue if folder type is one of the "standard" folders
|
|
1959 |
// ---------------------------------------------------------------------------
|
|
1960 |
//
|
|
1961 |
TBool CFSEmailUiFolderListVisualiser::GetStandardFolderResouceIdAndIconL( const TInt aFolderType, TInt &aResourceId, CAlfTexture* &aIcon ) const
|
|
1962 |
{
|
|
1963 |
FUNC_LOG;
|
|
1964 |
TBool found(EFalse);
|
|
1965 |
if( aFolderType == EFSInbox )
|
|
1966 |
{
|
|
1967 |
if( iFullScreen )
|
|
1968 |
{
|
|
1969 |
aResourceId = R_FREESTYLE_EMAIL_UI_FOLDER_LIST_INBOX;
|
|
1970 |
}
|
|
1971 |
else
|
|
1972 |
{
|
|
1973 |
aResourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_INBOX;
|
|
1974 |
// Get branded mailbox icon
|
|
1975 |
//aIcon = &iAppUi.FsTextureManager()->TextureByMailboxIdL( iActiveMailbox->GetId().PluginId(),
|
|
1976 |
// iActiveMailbox->GetId().Id(),
|
|
1977 |
// iListIconSize);
|
|
1978 |
}
|
|
1979 |
aIcon = iIconArray[EFolderListIconInbox];
|
|
1980 |
found = ETrue;
|
|
1981 |
}
|
|
1982 |
else if( aFolderType == EFSOutbox )
|
|
1983 |
{
|
|
1984 |
if( iFullScreen )
|
|
1985 |
{
|
|
1986 |
aResourceId = R_FREESTYLE_EMAIL_UI_FOLDER_LIST_OUTBOX;
|
|
1987 |
}
|
|
1988 |
else
|
|
1989 |
{
|
|
1990 |
aResourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_OUTBOX;
|
|
1991 |
}
|
|
1992 |
aIcon = iIconArray[EFolderListIconOutbox];
|
|
1993 |
found = ETrue;
|
|
1994 |
}
|
|
1995 |
else if( aFolderType == EFSDraftsFolder )
|
|
1996 |
{
|
|
1997 |
if( iFullScreen )
|
|
1998 |
{
|
|
1999 |
aResourceId = R_FREESTYLE_EMAIL_UI_FOLDER_LIST_DRAFTS;
|
|
2000 |
}
|
|
2001 |
else
|
|
2002 |
{
|
|
2003 |
aResourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_DRAFTS;
|
|
2004 |
}
|
|
2005 |
aIcon = iIconArray[EFolderListIconDrafts];
|
|
2006 |
found = ETrue;
|
|
2007 |
}
|
|
2008 |
else if( aFolderType == EFSSentFolder )
|
|
2009 |
{
|
|
2010 |
if( iFullScreen )
|
|
2011 |
{
|
|
2012 |
aResourceId = R_FREESTYLE_EMAIL_UI_FOLDER_LIST_SENT;
|
|
2013 |
}
|
|
2014 |
else
|
|
2015 |
{
|
|
2016 |
aResourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_SENT;
|
|
2017 |
}
|
|
2018 |
aIcon = iIconArray[EFolderListIconSent];
|
|
2019 |
found = ETrue;
|
|
2020 |
}
|
|
2021 |
else if( aFolderType == EFSDeleted )
|
|
2022 |
{
|
|
2023 |
if( iFullScreen )
|
|
2024 |
{
|
|
2025 |
aResourceId = R_FREESTYLE_EMAIL_UI_FOLDER_LIST_DELETED;
|
|
2026 |
}
|
|
2027 |
else
|
|
2028 |
{
|
|
2029 |
aResourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_DELETED;
|
|
2030 |
}
|
|
2031 |
aIcon = iIconArray[EFolderListIconDeleted];
|
|
2032 |
found = ETrue;
|
|
2033 |
}
|
|
2034 |
return found;
|
|
2035 |
}
|
|
2036 |
|
|
2037 |
// ---------------------------------------------------------------------------
|
|
2038 |
// Returns true if the specified folder type should be shown in current view
|
|
2039 |
// ---------------------------------------------------------------------------
|
|
2040 |
//
|
|
2041 |
TBool CFSEmailUiFolderListVisualiser::ShowThisTypeOfFolderL(
|
|
2042 |
CFSMailFolder* aFolder ) const
|
|
2043 |
{
|
|
2044 |
FUNC_LOG;
|
|
2045 |
if( iCustomMessageId == KFolderListMoveMessage ||
|
|
2046 |
iCustomMessageId == KFolderListMoveMessages )
|
|
2047 |
{
|
|
2048 |
// When moving or copying message(s), hide Outbox from list
|
|
2049 |
if( aFolder->GetFolderType() == EFSOutbox )
|
|
2050 |
{
|
|
2051 |
return EFalse;
|
|
2052 |
}
|
|
2053 |
// In case of other folders, ask from the folder itself
|
|
2054 |
else
|
|
2055 |
{
|
|
2056 |
return aFolder->SupportsMoveFromL( iCurrentFolderType );
|
|
2057 |
}
|
|
2058 |
}
|
|
2059 |
else if( iCustomMessageId == KFolderListCopyMessage ||
|
|
2060 |
iCustomMessageId == KFolderListCopyMessages )
|
|
2061 |
{
|
|
2062 |
// When moving or copying message(s), hide Outbox from list
|
|
2063 |
if( aFolder->GetFolderType() == EFSOutbox )
|
|
2064 |
{
|
|
2065 |
return EFalse;
|
|
2066 |
}
|
|
2067 |
// In case of other folders, ask from the folder itself
|
|
2068 |
else
|
|
2069 |
{
|
|
2070 |
return aFolder->SupportsCopyFromL( iCurrentFolderType );
|
|
2071 |
}
|
|
2072 |
}
|
|
2073 |
|
|
2074 |
// In case of folder selection list, show all types of folders. In case of
|
|
2075 |
// control bar list, subfolders are filtered AppendNode/LeafFolderL().
|
|
2076 |
return ETrue;
|
|
2077 |
}
|
|
2078 |
|
|
2079 |
// ---------------------------------------------------------------------------
|
|
2080 |
// Append the folder to list as node
|
|
2081 |
// ---------------------------------------------------------------------------
|
|
2082 |
//
|
|
2083 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendNodeFolderL(
|
|
2084 |
CFSMailFolder* aFolder, TFsTreeItemId aParentNode )
|
|
2085 |
{
|
|
2086 |
FUNC_LOG;
|
|
2087 |
TInt folderType = aFolder->GetFolderType();
|
|
2088 |
TInt resourceId( 0 );
|
|
2089 |
CAlfTexture* icon( NULL );
|
|
2090 |
TFsTreeItemId nodeId( KFsTreeNoneID );
|
|
2091 |
|
|
2092 |
// Check if the folder is one of the "standard" folders
|
|
2093 |
if ( GetStandardFolderResouceIdAndIconL( folderType, resourceId, icon ) )
|
|
2094 |
{
|
|
2095 |
// For "standard" folders use the (localised) name from the resource
|
|
2096 |
nodeId = AppendNodeToListFromResourceL( resourceId, aParentNode, icon, aFolder->GetUnreadCount() );
|
|
2097 |
}
|
|
2098 |
else
|
|
2099 |
{
|
|
2100 |
// Append non-standard folders only if in Fullscreen
|
|
2101 |
if( iFullScreen )
|
|
2102 |
{
|
|
2103 |
// For other folders get the name from the folder object
|
|
2104 |
|
|
2105 |
nodeId = AppendNodeToListL(
|
|
2106 |
&aFolder->GetFolderName(),
|
|
2107 |
aParentNode,
|
|
2108 |
iIconArray[EFolderListIconInboxSubfolders],
|
|
2109 |
aFolder->GetUnreadCount());
|
|
2110 |
}
|
|
2111 |
}
|
|
2112 |
return nodeId;
|
|
2113 |
}
|
|
2114 |
|
|
2115 |
// ---------------------------------------------------------------------------
|
|
2116 |
// Append the folder to list as leaf
|
|
2117 |
// ---------------------------------------------------------------------------
|
|
2118 |
//
|
|
2119 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendLeafFolderL(
|
|
2120 |
CFSMailFolder* aFolder, TFsTreeItemId aParentNode, TBool aAllowRefresh )
|
|
2121 |
{
|
|
2122 |
FUNC_LOG;
|
|
2123 |
TInt folderType = aFolder->GetFolderType();
|
|
2124 |
TInt resourceId( 0 );
|
|
2125 |
CAlfTexture* icon( NULL );
|
|
2126 |
TFsTreeItemId itemId( KFsTreeNoneID );
|
|
2127 |
|
|
2128 |
// Check if the folder is one of the "standard" folders
|
|
2129 |
if ( GetStandardFolderResouceIdAndIconL( folderType, resourceId, icon ) )
|
|
2130 |
{
|
|
2131 |
itemId = AppendItemToListFromResourceL( resourceId, aParentNode, icon, aAllowRefresh, aFolder->GetUnreadCount() );
|
|
2132 |
}
|
|
2133 |
else
|
|
2134 |
{
|
|
2135 |
// Append non-standard folders only if in Fullscreen
|
|
2136 |
if ( iFullScreen )
|
|
2137 |
{
|
|
2138 |
// For other folders get the name from the folder object
|
|
2139 |
itemId = AppendItemToListL(
|
|
2140 |
&aFolder->GetFolderName(),
|
|
2141 |
aParentNode,
|
|
2142 |
iIconArray[EFolderListIconInboxSubfolders],
|
|
2143 |
aAllowRefresh,
|
|
2144 |
aFolder->GetUnreadCount());
|
|
2145 |
}
|
|
2146 |
}
|
|
2147 |
return itemId;
|
|
2148 |
}
|
|
2149 |
|
|
2150 |
// ---------------------------------------------------------------------------
|
|
2151 |
// Append mailbox data
|
|
2152 |
// ---------------------------------------------------------------------------
|
|
2153 |
//
|
|
2154 |
void CFSEmailUiFolderListVisualiser::AppendMailboxesL()
|
|
2155 |
{
|
|
2156 |
FUNC_LOG;
|
|
2157 |
RPointerArray<CFSMailBox> mailboxes;
|
|
2158 |
CleanupResetAndDestroyClosePushL( mailboxes );
|
|
2159 |
TFSMailMsgId id;
|
|
2160 |
iAppUi.GetMailClient()->ListMailBoxes( id, mailboxes );
|
|
2161 |
|
|
2162 |
TInt count = mailboxes.Count();
|
|
2163 |
|
|
2164 |
while( mailboxes.Count() > 0 )
|
|
2165 |
{
|
|
2166 |
if( !( mailboxes[0]->GetId() == iAppUi.GetActiveMailboxId() ) )
|
|
2167 |
{
|
|
2168 |
MFSMailBrandManager& brandManager = iAppUi.GetMailClient()->GetBrandManagerL();
|
|
2169 |
|
|
2170 |
CAlfTexture* mailBoxTexture;
|
|
2171 |
CGulIcon* mailboxIcon( NULL );
|
|
2172 |
TRAPD( err, mailboxIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailboxes[0]->GetId() ) );
|
|
2173 |
if ( err == KErrNone && mailboxIcon )
|
|
2174 |
{
|
|
2175 |
CleanupStack::PushL( mailboxIcon );
|
|
2176 |
AknIconUtils::SetSize(mailboxIcon->Bitmap(), iListIconSize);
|
|
2177 |
AknIconUtils::SetSize(mailboxIcon->Mask(), iListIconSize);
|
|
2178 |
|
|
2179 |
// Create texture into TextureManager, If not already existing
|
|
2180 |
iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mailboxIcon,
|
|
2181 |
mailboxes[0]->GetId().PluginId(),
|
|
2182 |
mailboxes[0]->GetId().Id(),
|
|
2183 |
iListIconSize);
|
|
2184 |
// Get branded mailbox icon
|
|
2185 |
mailBoxTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( mailboxes[0]->GetId().PluginId(),
|
|
2186 |
mailboxes[0]->GetId().Id(),
|
|
2187 |
iListIconSize);
|
|
2188 |
|
|
2189 |
CleanupStack::PopAndDestroy( mailboxIcon );
|
|
2190 |
}
|
|
2191 |
else
|
|
2192 |
{
|
|
2193 |
mailBoxTexture = iIconArray[EFolderListIconEmailAccount];
|
|
2194 |
}
|
|
2195 |
|
|
2196 |
// Branded mailbox name is nowadays set in new mailbox event
|
|
2197 |
// handling, so we don't need to use brand manager here anymore.
|
|
2198 |
// Mailboxes are the first items in the list, and there probably
|
|
2199 |
// aren't that much of those, so let's allow scroll bar refresh
|
|
2200 |
// for all of them.
|
|
2201 |
TFsTreeItemId itemId = AppendItemToListL( &mailboxes[0]->GetName(),
|
|
2202 |
KFsTreeRootID,
|
|
2203 |
mailBoxTexture,
|
|
2204 |
ETrue );
|
|
2205 |
|
|
2206 |
// If the returned item id is KFsTreeNoneID, it means that
|
|
2207 |
// the current mailbox was not added to mailbox list, so we
|
|
2208 |
// should not append it to model either
|
|
2209 |
if( itemId != KFsTreeNoneID )
|
|
2210 |
{
|
|
2211 |
// Note that ownership of the mailbox object is NOT transferred
|
|
2212 |
// to model anymore, so we need to delete it here in all cases
|
|
2213 |
iModel->AppendL( itemId, mailboxes[0] );
|
|
2214 |
}
|
|
2215 |
|
|
2216 |
}
|
|
2217 |
|
|
2218 |
delete mailboxes[0];
|
|
2219 |
mailboxes.Remove(0);
|
|
2220 |
}
|
|
2221 |
//There is more then 1 mailbox so we add the seperator at the end
|
|
2222 |
if( count > 1 )
|
|
2223 |
{
|
|
2224 |
AppendSeparatorLineL();
|
|
2225 |
}
|
|
2226 |
|
|
2227 |
CleanupStack::PopAndDestroy( &mailboxes );
|
|
2228 |
}
|
|
2229 |
|
|
2230 |
|
|
2231 |
// ---------------------------------------------------------------------------
|
|
2232 |
// Append separator between active mailbox's folders and other mailboxes
|
|
2233 |
// ---------------------------------------------------------------------------
|
|
2234 |
//
|
|
2235 |
void CFSEmailUiFolderListVisualiser::AppendSeparatorLineL()
|
|
2236 |
{
|
|
2237 |
FUNC_LOG;
|
|
2238 |
CFsSeparatorData* data = CFsSeparatorData::NewL();
|
|
2239 |
CleanupStack::PushL(data);
|
|
2240 |
CFsSeparatorVisualizer* visualizer( NULL );
|
|
2241 |
visualizer = CFsSeparatorVisualizer::NewL(*iTreeList->TreeControl());
|
|
2242 |
CleanupStack::Pop(data);
|
|
2243 |
// We use the default size of the separator, but we need to save it
|
|
2244 |
// here to have it available later when calculating the list height
|
|
2245 |
iListSeparatorHeight = visualizer->Size().iHeight;
|
|
2246 |
|
|
2247 |
// This should never be the last item in the list, so disable the refresh
|
|
2248 |
iTreeList->InsertItemL( *data, *visualizer, KFsTreeRootID, KErrNotFound, EFalse);
|
|
2249 |
|
|
2250 |
iModel->IncreaseSeparatorCount();
|
|
2251 |
}
|
|
2252 |
|
|
2253 |
// ---------------------------------------------------------------------------
|
|
2254 |
// Append separator between active mailbox's folders and other mailboxes
|
|
2255 |
// ---------------------------------------------------------------------------
|
|
2256 |
//
|
|
2257 |
void CFSEmailUiFolderListVisualiser::AppendMoreFoldersL()
|
|
2258 |
{
|
|
2259 |
FUNC_LOG;
|
|
2260 |
TInt resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_MORE_FOLDERS;
|
|
2261 |
CAlfTexture* icon = iIconArray[EFolderListIconMoreFolders];
|
|
2262 |
|
|
2263 |
// This might be the last item in the list, so allow scroll bar refresh
|
|
2264 |
iMoreFoldersItemId = AppendItemToListFromResourceL( resourceId, KFsTreeRootID, icon, ETrue );
|
|
2265 |
}
|
|
2266 |
|
|
2267 |
// ---------------------------------------------------------------------------
|
|
2268 |
// Append node to list by getting the item data from resource
|
|
2269 |
// ---------------------------------------------------------------------------
|
|
2270 |
//
|
|
2271 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendNodeToListFromResourceL( TInt aResourceId, TFsTreeItemId aParentNode, CAlfTexture* aIcon, TUint aUnreadCnt )
|
|
2272 |
{
|
|
2273 |
FUNC_LOG;
|
|
2274 |
HBufC* headingText = StringLoader::LoadLC( aResourceId );
|
|
2275 |
|
|
2276 |
TFsTreeItemId nodeId = AppendNodeToListL( headingText, aParentNode, aIcon, aUnreadCnt);
|
|
2277 |
|
|
2278 |
CleanupStack::PopAndDestroy(headingText);
|
|
2279 |
|
|
2280 |
return nodeId;
|
|
2281 |
}
|
|
2282 |
|
|
2283 |
// ---------------------------------------------------------------------------
|
|
2284 |
// Append node to list
|
|
2285 |
// ---------------------------------------------------------------------------
|
|
2286 |
//
|
|
2287 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendNodeToListL( TDesC* aItemData, TFsTreeItemId aParentNode, CAlfTexture* aIcon, TUint aUnreadCnt )
|
|
2288 |
{
|
|
2289 |
FUNC_LOG;
|
|
2290 |
CFsTreePlainOneLineNodeData* plainItemData;
|
|
2291 |
CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer;
|
|
2292 |
|
|
2293 |
TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt );
|
|
2294 |
CreatePlainNodeLC2( itemDispName, plainItemData, plainNodeVisualizer, aIcon );
|
|
2295 |
|
|
2296 |
// We assume that node can never be the last item to be drawn, there will
|
|
2297 |
// always be leaf folder under it. So we can always deny scroll bar update.
|
|
2298 |
TFsTreeItemId nodeId = iTreeList->InsertNodeL( *plainItemData, *plainNodeVisualizer, aParentNode, KErrNotFound, EFalse);
|
|
2299 |
CleanupStack::Pop( 2 ); // plainItemData & plainNodeVisualizer
|
|
2300 |
CleanupStack::PopAndDestroy( itemDispName );
|
|
2301 |
if( nodeId != KFsTreeNoneID )
|
|
2302 |
{
|
|
2303 |
iTreeList->ExpandNodeL(nodeId);
|
|
2304 |
iListItemVisulizers.Append( plainNodeVisualizer );
|
|
2305 |
}
|
|
2306 |
|
|
2307 |
return nodeId;
|
|
2308 |
}
|
|
2309 |
|
|
2310 |
// ---------------------------------------------------------------------------
|
|
2311 |
// Append leaf to list by getting the item data from resource
|
|
2312 |
// ---------------------------------------------------------------------------
|
|
2313 |
//
|
|
2314 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendItemToListFromResourceL( TInt aResourceId,
|
|
2315 |
TFsTreeItemId aParentNode,
|
|
2316 |
CAlfTexture* aIcon,
|
|
2317 |
TBool aAllowRefresh,
|
|
2318 |
TUint aUnreadCnt)
|
|
2319 |
{
|
|
2320 |
FUNC_LOG;
|
|
2321 |
HBufC* headingText = StringLoader::LoadLC( aResourceId );
|
|
2322 |
|
|
2323 |
TFsTreeItemId itemId = AppendItemToListL( headingText, aParentNode, aIcon, aAllowRefresh, aUnreadCnt);
|
|
2324 |
|
|
2325 |
CleanupStack::PopAndDestroy( headingText );
|
|
2326 |
|
|
2327 |
return itemId;
|
|
2328 |
}
|
|
2329 |
|
|
2330 |
// ---------------------------------------------------------------------------
|
|
2331 |
// Append leaf to list
|
|
2332 |
// ---------------------------------------------------------------------------
|
|
2333 |
//
|
|
2334 |
TFsTreeItemId CFSEmailUiFolderListVisualiser::AppendItemToListL( TDesC* aItemData,
|
|
2335 |
TFsTreeItemId aParentNode,
|
|
2336 |
CAlfTexture* aIcon,
|
|
2337 |
TBool aAllowRefresh,
|
|
2338 |
TUint aUnreadCnt)
|
|
2339 |
{
|
|
2340 |
FUNC_LOG;
|
|
2341 |
CFsTreePlainOneLineItemData* plainItemData;
|
|
2342 |
CFsTreePlainOneLineItemVisualizer* plainItemVisualizer;
|
|
2343 |
|
|
2344 |
TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt );
|
|
2345 |
CreatePlainItemLC2( itemDispName, plainItemData, plainItemVisualizer, aIcon );
|
|
2346 |
|
|
2347 |
|
|
2348 |
TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, aAllowRefresh);
|
|
2349 |
CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer
|
|
2350 |
CleanupStack::PopAndDestroy( itemDispName );
|
|
2351 |
if( itemId != KFsTreeNoneID )
|
|
2352 |
{
|
|
2353 |
iListItemVisulizers.Append( plainItemVisualizer );
|
|
2354 |
}
|
|
2355 |
|
|
2356 |
return itemId;
|
|
2357 |
}
|
|
2358 |
|
|
2359 |
// ---------------------------------------------------------------------------
|
|
2360 |
// Get the display name for a folder
|
|
2361 |
// ---------------------------------------------------------------------------
|
|
2362 |
TDesC* CFSEmailUiFolderListVisualiser::GetItemDisplayNameLC( TDesC& aItemData, TUint aUnreadCnt )
|
|
2363 |
{
|
|
2364 |
TDesC* itemDispName = NULL;
|
|
2365 |
if( aUnreadCnt > 0 )
|
|
2366 |
{
|
|
2367 |
CDesCArray* descArray = new (ELeave) CDesCArrayFlat( 1 );
|
|
2368 |
CleanupStack::PushL( descArray );
|
|
2369 |
descArray->AppendL( aItemData );
|
|
2370 |
CArrayFix<TInt>* intArray = new (ELeave) CArrayFixFlat<TInt>( 1 );
|
|
2371 |
CleanupStack::PushL( intArray );
|
|
2372 |
intArray->AppendL( aUnreadCnt );
|
|
2373 |
itemDispName = StringLoader::LoadL(
|
|
2374 |
R_FREESTYLE_EMAIL_UI_FOLDER_LIST_FOLDER_WITH_UNREAD,
|
|
2375 |
*descArray, *intArray );
|
|
2376 |
CleanupStack::PopAndDestroy( intArray );
|
|
2377 |
CleanupStack::PopAndDestroy( descArray );
|
|
2378 |
CleanupStack::PushL( itemDispName );
|
|
2379 |
}
|
|
2380 |
else
|
|
2381 |
{
|
|
2382 |
itemDispName = aItemData.AllocLC();
|
|
2383 |
}
|
|
2384 |
return itemDispName;
|
|
2385 |
}
|
|
2386 |
|
|
2387 |
// ---------------------------------------------------------------------------
|
|
2388 |
// Create plain leaf item
|
|
2389 |
// ---------------------------------------------------------------------------
|
|
2390 |
//
|
|
2391 |
void CFSEmailUiFolderListVisualiser::CreatePlainItemLC2( const TDesC* aItemDataBuff,
|
|
2392 |
CFsTreePlainOneLineItemData* &aItemData,
|
|
2393 |
CFsTreePlainOneLineItemVisualizer* &aItemVisualizer,
|
|
2394 |
CAlfTexture* aIcon )
|
|
2395 |
{
|
|
2396 |
FUNC_LOG;
|
|
2397 |
aItemData = CFsTreePlainOneLineItemData::NewL();
|
|
2398 |
CleanupStack::PushL( aItemData );
|
|
2399 |
|
|
2400 |
aItemData->SetDataL( *aItemDataBuff );
|
|
2401 |
if( aIcon )
|
|
2402 |
{
|
|
2403 |
aItemData->SetIcon( *aIcon );
|
|
2404 |
}
|
|
2405 |
|
|
2406 |
aItemVisualizer = CFsTreePlainOneLineItemVisualizer::NewL( *iTreeList->TreeControl() );
|
|
2407 |
CleanupStack::PushL( aItemVisualizer );
|
|
2408 |
iListItemDatas.AppendL( aItemData );
|
|
2409 |
// Set folder view specific layouts to be used
|
|
2410 |
if ( iFullScreen )
|
|
2411 |
{
|
|
2412 |
aItemVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EFolderLayout );
|
|
2413 |
}
|
|
2414 |
else
|
|
2415 |
{
|
|
2416 |
aItemVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EPopupLayout );
|
|
2417 |
}
|
|
2418 |
|
|
2419 |
SetItemVisualizerPropertiesL( aItemVisualizer );
|
|
2420 |
}
|
|
2421 |
|
|
2422 |
// ---------------------------------------------------------------------------
|
|
2423 |
// Create plain node itme
|
|
2424 |
// ---------------------------------------------------------------------------
|
|
2425 |
//
|
|
2426 |
void CFSEmailUiFolderListVisualiser::CreatePlainNodeLC2( TDesC* aItemDataBuff,
|
|
2427 |
CFsTreePlainOneLineNodeData* &aItemData,
|
|
2428 |
CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer,
|
|
2429 |
CAlfTexture* aIcon )
|
|
2430 |
{
|
|
2431 |
FUNC_LOG;
|
|
2432 |
aItemData = CFsTreePlainOneLineNodeData::NewL();
|
|
2433 |
CleanupStack::PushL( aItemData );
|
|
2434 |
|
|
2435 |
aItemData->SetDataL( *aItemDataBuff );
|
|
2436 |
if( aIcon )
|
|
2437 |
{
|
|
2438 |
aItemData->SetIconExpanded( *aIcon );
|
|
2439 |
aItemData->SetIconCollapsed( *aIcon );
|
|
2440 |
}
|
|
2441 |
|
|
2442 |
aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL( *iTreeList->TreeControl() );
|
|
2443 |
CleanupStack::PushL( aNodeVisualizer );
|
|
2444 |
|
|
2445 |
// Set folder view specific layouts to be used
|
|
2446 |
if ( iFullScreen )
|
|
2447 |
{
|
|
2448 |
aNodeVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EFolderLayout );
|
|
2449 |
}
|
|
2450 |
else
|
|
2451 |
{
|
|
2452 |
aNodeVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EPopupLayout );
|
|
2453 |
}
|
|
2454 |
SetItemVisualizerPropertiesL( aNodeVisualizer );
|
|
2455 |
}
|
|
2456 |
|
|
2457 |
void CFSEmailUiFolderListVisualiser::SetItemVisualizerPropertiesL( MFsTreeItemVisualizer* aItemVisualizer )
|
|
2458 |
{
|
|
2459 |
FUNC_LOG;
|
|
2460 |
aItemVisualizer->SetFlags(aItemVisualizer->Flags() & ~KFsTreeListItemManagedLayout);
|
|
2461 |
|
|
2462 |
if (iFullScreen)
|
|
2463 |
{
|
|
2464 |
aItemVisualizer->SetSize( iAppUi.LayoutHandler()->FolderListItemSizeInThisResolution( iScreenRect ) );
|
|
2465 |
}
|
|
2466 |
else
|
|
2467 |
{
|
|
2468 |
aItemVisualizer->SetSize(TSize(iScreenRect.Width(), iListItemHeight));
|
|
2469 |
}
|
|
2470 |
|
|
2471 |
aItemVisualizer->SetExtendable( EFalse );
|
|
2472 |
|
|
2473 |
// Set correct skin text colors for the list items
|
|
2474 |
TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
|
|
2475 |
// If list is in full screen, it has general list background, so we use
|
|
2476 |
// general list text color. If it's not in full screen, we use dropdown
|
|
2477 |
// menu specific text color.
|
|
2478 |
TRgb normalColor = KRgbBlack;
|
|
2479 |
if( iFullScreen )
|
|
2480 |
{
|
|
2481 |
normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
|
|
2482 |
}
|
|
2483 |
else
|
|
2484 |
{
|
|
2485 |
normalColor = iAppUi.LayoutHandler()->DropdownMenuTextColor();
|
|
2486 |
}
|
|
2487 |
|
|
2488 |
aItemVisualizer->SetFocusedStateTextColor( focusedColor );
|
|
2489 |
aItemVisualizer->SetNormalStateTextColor( normalColor );
|
|
2490 |
|
|
2491 |
// Set font size
|
|
2492 |
aItemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips( !iFullScreen ) );
|
|
2493 |
// Set node bolded
|
|
2494 |
aItemVisualizer->SetTextBold( EFalse );
|
|
2495 |
aItemVisualizer->MarqueeL( EFsTextMarqueeForth, 30, 1000, 500, 1 ); // same values as in CFsTreeVisualizerBase constructor
|
|
2496 |
aItemVisualizer->OffWrapping();
|
|
2497 |
}
|
|
2498 |
|
|
2499 |
// ---------------------------------------------------------------------------
|
|
2500 |
// If event is pointer event and popup is showing, close popup and return
|
|
2501 |
// ETrue to tell the caller that event was consumed. If the popup is not
|
|
2502 |
// showing but pointer up event haven't been received since the popup was
|
|
2503 |
// closed, then consume event.
|
|
2504 |
// ---------------------------------------------------------------------------
|
|
2505 |
//
|
|
2506 |
TBool CFSEmailUiFolderListVisualiser::HandleWsEventL( const TWsEvent& aEvent )
|
|
2507 |
{
|
|
2508 |
FUNC_LOG;
|
|
2509 |
TBool eventHandled( EFalse );
|
|
2510 |
if ( aEvent.Type() == EEventPointer )
|
|
2511 |
{
|
|
2512 |
const TPointerEvent* pointerEvent( aEvent.Pointer() );
|
|
2513 |
if ( iPopupListShown )
|
|
2514 |
{
|
|
2515 |
const TPoint& position( pointerEvent->iParentPosition );
|
|
2516 |
if ( !CbaButtonPressed( position ) && pointerEvent->iType == TPointerEvent::EButton1Down )
|
|
2517 |
{
|
|
2518 |
// get popup rect in local coordinates
|
|
2519 |
TRect popupRect( iScreenRect );
|
|
2520 |
// translate to screen coorinates
|
|
2521 |
popupRect.Move( iEnv.PrimaryDisplay().VisibleArea().iTl );
|
|
2522 |
// check if the event happened outside of the popup
|
|
2523 |
if ( !popupRect.Contains( position ) )
|
|
2524 |
{
|
|
2525 |
HandleSelectionL( EFSEmailUiCtrlBarResponseCancel );
|
|
2526 |
iConsumeUntilNextUpEvent = eventHandled = ETrue;
|
|
2527 |
}
|
|
2528 |
}
|
|
2529 |
}
|
|
2530 |
else if ( iConsumeUntilNextUpEvent )
|
|
2531 |
{
|
|
2532 |
if ( pointerEvent->iType == TPointerEvent::EButton1Up )
|
|
2533 |
{
|
|
2534 |
iConsumeUntilNextUpEvent = EFalse;
|
|
2535 |
}
|
|
2536 |
eventHandled = ETrue;
|
|
2537 |
}
|
|
2538 |
}
|
|
2539 |
return eventHandled;
|
|
2540 |
}
|
|
2541 |
|
|
2542 |
// Handle foreground event (called by FreestyleEmailUiMailListVisualiser)
|
|
2543 |
void CFSEmailUiFolderListVisualiser::HandleForegroundEventL()
|
|
2544 |
{
|
|
2545 |
FUNC_LOG;
|
|
2546 |
if ( iFirstStartCompleted && iCallback != NULL || iSortListCallback != NULL )
|
|
2547 |
{
|
|
2548 |
ResizeListIcons();
|
|
2549 |
ResizeListItemsL();
|
|
2550 |
iParentLayout->SetRect( iScreenRect );
|
|
2551 |
SetAnchors();
|
|
2552 |
}
|
|
2553 |
}
|
|
2554 |
|
|
2555 |
// ---------------------------------------------------------------------------
|
|
2556 |
// Handle dynamic switch
|
|
2557 |
// ---------------------------------------------------------------------------
|
|
2558 |
//
|
|
2559 |
void CFSEmailUiFolderListVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType /*aType*/ )
|
|
2560 |
{
|
|
2561 |
FUNC_LOG;
|
|
2562 |
if (IsPopupShown() || IsFullScreen())
|
|
2563 |
{
|
|
2564 |
if ( iFirstStartCompleted ) // Safety
|
|
2565 |
{
|
|
2566 |
// Resize fader layout
|
|
2567 |
TRect mainPaneRect;
|
|
2568 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );
|
|
2569 |
iFaderLayout->SetRect( mainPaneRect );
|
|
2570 |
|
|
2571 |
iTreeList->HideListL( EFalse );
|
|
2572 |
UpdateListSizeAttributes();
|
|
2573 |
ResizeListIcons();
|
|
2574 |
ResizeListItemsL();
|
|
2575 |
SetAnchors();
|
|
2576 |
if( !iFullScreen )
|
|
2577 |
{
|
|
2578 |
AdaptScreenRectToListContent();
|
|
2579 |
TAlfMetric padding(
|
|
2580 |
iAppUi.LayoutHandler()->DropDownMenuListPadding() );
|
|
2581 |
iParentLayout->SetPadding( padding );
|
|
2582 |
}
|
|
2583 |
else
|
|
2584 |
{
|
|
2585 |
TAlfMetric padding( 0 );
|
|
2586 |
iParentLayout->SetPadding( padding );
|
|
2587 |
if ( iHeaderTextVisual->Opacity().ValueNow() )
|
|
2588 |
{
|
|
2589 |
// Update text caption colors only if visible
|
|
2590 |
SetHeaderTextAttributesL();
|
|
2591 |
}
|
|
2592 |
}
|
|
2593 |
iParentLayout->SetRect( iScreenRect );
|
|
2594 |
|
|
2595 |
// Make sure that the horizontal position is recalculated
|
|
2596 |
DoHorizontalScrollL( ETrue );
|
|
2597 |
|
|
2598 |
// RefreshListViewL not working correctly
|
|
2599 |
//iTreeVisualizer->RefreshListViewL();
|
|
2600 |
|
|
2601 |
iTreeList->ShowListL();
|
|
2602 |
}
|
|
2603 |
}
|
|
2604 |
}
|
|
2605 |
|
|
2606 |
// ---------------------------------------------------------------------------
|
|
2607 |
// Expand/collapse the focused list item
|
|
2608 |
// ---------------------------------------------------------------------------
|
|
2609 |
//
|
|
2610 |
void CFSEmailUiFolderListVisualiser::ExpandOrCollapseL(
|
|
2611 |
const TExpandCollapseType& aType )
|
|
2612 |
{
|
|
2613 |
FUNC_LOG;
|
|
2614 |
TFsTreeItemId focusedItem = iTreeList->FocusedItem();
|
|
2615 |
|
|
2616 |
if( focusedItem != KFsTreeNoneID && iTreeList->IsNode( focusedItem ) )
|
|
2617 |
{
|
|
2618 |
if( aType == EFolderListCollapse ||
|
|
2619 |
( aType == EFolderListAutomatic && iTreeList->IsExpanded( focusedItem ) ) )
|
|
2620 |
{
|
|
2621 |
iTreeList->CollapseNodeL( focusedItem );
|
|
2622 |
}
|
|
2623 |
else
|
|
2624 |
{
|
|
2625 |
iTreeList->ExpandNodeL( focusedItem );
|
|
2626 |
}
|
|
2627 |
}
|
|
2628 |
}
|
|
2629 |
|
|
2630 |
// ---------------------------------------------------------------------------
|
|
2631 |
// ETrue if in full screen mode, otherwise EFalse
|
|
2632 |
// ---------------------------------------------------------------------------
|
|
2633 |
//
|
|
2634 |
TBool CFSEmailUiFolderListVisualiser::IsFullScreen() const
|
|
2635 |
{
|
|
2636 |
FUNC_LOG;
|
|
2637 |
return iFullScreen;
|
|
2638 |
}
|
|
2639 |
|
|
2640 |
// ---------------------------------------------------------------------------
|
|
2641 |
// Update list size members variables
|
|
2642 |
// ---------------------------------------------------------------------------
|
|
2643 |
//
|
|
2644 |
void CFSEmailUiFolderListVisualiser::UpdateListSizeAttributes()
|
|
2645 |
{
|
|
2646 |
FUNC_LOG;
|
|
2647 |
iListItemHeight = iAppUi.LayoutHandler()->OneLineListItemHeight();
|
|
2648 |
|
|
2649 |
if( iFullScreen )
|
|
2650 |
{
|
|
2651 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, iScreenRect );
|
|
2652 |
TRect noToolbar;
|
|
2653 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane, noToolbar);
|
|
2654 |
|
|
2655 |
|
|
2656 |
if(!Layout_Meta_Data::IsLandscapeOrientation())
|
|
2657 |
{
|
|
2658 |
iScreenRect.SetRect( 0, 0, iScreenRect.Width(), iScreenRect.Height() );
|
|
2659 |
}
|
|
2660 |
else
|
|
2661 |
{
|
|
2662 |
iScreenRect.SetRect( 0, 0, noToolbar.Width(), iScreenRect.Height() );
|
|
2663 |
}
|
|
2664 |
}
|
|
2665 |
else
|
|
2666 |
{
|
|
2667 |
TRect cbr = iAppUi.LayoutHandler()->GetControlBarRect();
|
|
2668 |
if( iCallback )
|
|
2669 |
{
|
|
2670 |
iCtrlButtonRect = iCallback->FolderButtonRect();
|
|
2671 |
iCtrlButtonRect.Move( cbr.iTl );
|
|
2672 |
iScreenRect = FolderListRectInThisResolution();
|
|
2673 |
}
|
|
2674 |
else if ( iSortListCallback )
|
|
2675 |
{
|
|
2676 |
iCtrlButtonRect = iSortListCallback->SortButtonRect();
|
|
2677 |
iCtrlButtonRect.Move( cbr.iTl );
|
|
2678 |
iScreenRect = SortListRectInThisResolution();
|
|
2679 |
}
|
|
2680 |
else
|
|
2681 |
{
|
|
2682 |
// Do nothing. This happens if HandleDynamicVariantSwitch() is called while the popup list is not visible.
|
|
2683 |
}
|
|
2684 |
}
|
|
2685 |
iListIconSize = iAppUi.LayoutHandler()->FolderListIconSize( !iFullScreen );
|
|
2686 |
}
|
|
2687 |
|
|
2688 |
TRect CFSEmailUiFolderListVisualiser::FolderListRectInThisResolution()
|
|
2689 |
{
|
|
2690 |
FUNC_LOG;
|
|
2691 |
return LeftListRectInThisResolution();
|
|
2692 |
}
|
|
2693 |
|
|
2694 |
TRect CFSEmailUiFolderListVisualiser::SortListRectInThisResolution()
|
|
2695 |
{
|
|
2696 |
FUNC_LOG;
|
|
2697 |
return RightListRectInThisResolution();
|
|
2698 |
}
|
|
2699 |
|
|
2700 |
TRect CFSEmailUiFolderListVisualiser::LeftListRectInThisResolution()
|
|
2701 |
{
|
|
2702 |
FUNC_LOG;
|
|
2703 |
return iAppUi.LayoutHandler()->DropDownMenuListRect(
|
|
2704 |
CFSEmailUiLayoutHandler::ELeft );
|
|
2705 |
}
|
|
2706 |
|
|
2707 |
TRect CFSEmailUiFolderListVisualiser::RightListRectInThisResolution()
|
|
2708 |
{
|
|
2709 |
FUNC_LOG;
|
|
2710 |
return iAppUi.LayoutHandler()->DropDownMenuListRect(
|
|
2711 |
CFSEmailUiLayoutHandler::ERight );
|
|
2712 |
}
|
|
2713 |
|
|
2714 |
|
|
2715 |
// ---------------------------------------------------------------------------
|
|
2716 |
// Load the needed icons
|
|
2717 |
// ---------------------------------------------------------------------------
|
|
2718 |
//
|
|
2719 |
void CFSEmailUiFolderListVisualiser::LoadIconsL()
|
|
2720 |
{
|
|
2721 |
FUNC_LOG;
|
|
2722 |
iIconArray.Reset();
|
|
2723 |
if ( iFullScreen )
|
|
2724 |
{
|
|
2725 |
// NOTE: Must be appended same order as are in TFsEmailUiFolderListIcons!
|
|
2726 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListInboxTexture ) ); // EFolderListIconInbox
|
|
2727 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListInboxSubfoldersTexture ) ); // EFolderListIconInboxSubfolders
|
|
2728 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListOutboxTexture ) ); // EFolderListIconOutbox
|
|
2729 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListDraftsTexture ) ); // EFolderListIconDrafts
|
|
2730 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListSentTexture ) ); // EFolderListIconSent
|
|
2731 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListDeletedItemsTexture ) ); // EFolderListIconDeleted
|
|
2732 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListServerFoldersTexture ) ); // EFolderListIconServerFolders
|
|
2733 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListMoreFoldersTexture ) ); // EFolderListIconMoreFolders
|
|
2734 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListEmailAccountTexture ) ); // EFolderListIconEmailAccount
|
|
2735 |
}
|
|
2736 |
else
|
|
2737 |
{
|
|
2738 |
// NOTE: Must be appended same order as are in TFsEmailUiFolderListIcons!
|
|
2739 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListInboxTexturePopup ) ); // EFolderListIconInbox
|
|
2740 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListInboxSubfoldersTexturePopup ) ); // EFolderListIconInboxSubfolders
|
|
2741 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListOutboxTexturePopup ) ); // EFolderListIconOutbox
|
|
2742 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListDraftsTexturePopup ) ); // EFolderListIconDrafts
|
|
2743 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListSentTexturePopup ) ); // EFolderListIconSent
|
|
2744 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListDeletedItemsTexturePopup ) ); // EFolderListIconDeleted
|
|
2745 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListServerFoldersTexturePopup ) ); // EFolderListIconServerFolders
|
|
2746 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListMoreFoldersTexturePopup ) ); // EFolderListIconMoreFolders
|
|
2747 |
iIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( EFolderListEmailAccountTexturePopup ) ); // EFolderListIconEmailAccount
|
|
2748 |
|
|
2749 |
// NOTE: Must be appended same order as are in TFsEmailUiSortListIcons!
|
|
2750 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListAttachmentAscTexturePopup ) ); // ESortListAttachmentAscIcon
|
|
2751 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListAttachmentDescTexturePopup ) ); // ESortListAttachmentDescIcon
|
|
2752 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListDateAscTexturePopup ) ); // ESortListDateAscIcon
|
|
2753 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListDateDescTexturePopup ) ); // ESortListDateDescIcon
|
|
2754 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListFollowAscTexturePopup ) ); // ESortListFollowAscIcon
|
|
2755 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListFollowDescTexturePopup ) ); // ESortListFollowDescIcon
|
|
2756 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListPriorityAscTexturePopup ) ); // ESortListPriorityAscIcon
|
|
2757 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListPriorityDescTexturePopup ) ); // ESortListPriorityDescIcon
|
|
2758 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListSenderAscTexturePopup ) ); // ESortListSenderAscIcon
|
|
2759 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListSenderDescTexturePopup ) ); // ESortListSenderDescIcon
|
|
2760 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListSubjectAscTexturePopup ) ); // ESortListSubjectAscIcon
|
|
2761 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListSubjectDescTexturePopup ) ); // ESortListSubjectDescIcon
|
|
2762 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListUnreadAscTexturePopup ) ); // ESortListUnreadAscIcon
|
|
2763 |
iSortIconArray.AppendL( &iAppUi.FsTextureManager()->TextureByIndex( ESortListUnreadDescTexturePopup ) ); // ESortListUnreadDescIcon
|
|
2764 |
}
|
|
2765 |
}
|
|
2766 |
|
|
2767 |
void CFSEmailUiFolderListVisualiser::ResizeListIcons()
|
|
2768 |
{
|
|
2769 |
FUNC_LOG;
|
|
2770 |
// Resize icons only if the size has changed since previous resize operation
|
|
2771 |
if( iListIconSize != iPreviousListIconSize )
|
|
2772 |
{
|
|
2773 |
iPreviousListIconSize = iListIconSize;
|
|
2774 |
|
|
2775 |
// Resize of textures is not working anymore in Alfred, instead
|
|
2776 |
// we should resize the visuals. But that's not possible with
|
|
2777 |
// with the current implementation of generic list.
|
|
2778 |
// First resize "standard" list icons
|
|
2779 |
TInt arraySize = iIconArray.Count();
|
|
2780 |
for( TInt i = 0 ; i < arraySize ; i++ )
|
|
2781 |
{
|
|
2782 |
iIconArray[i]->Size().SetSize( iListIconSize.iWidth, iListIconSize.iHeight );
|
|
2783 |
}
|
|
2784 |
|
|
2785 |
// Then resize used branded mailbox icons
|
|
2786 |
// Branded mailbox icons are not stored anymore in our own
|
|
2787 |
// array, instead those are owned by texture manager. So
|
|
2788 |
// those should be resized by other means. But currently
|
|
2789 |
// there is no way to do it (see above comment).
|
|
2790 |
|
|
2791 |
// Then resize sort list icons
|
|
2792 |
TInt arraySizeSort = iSortIconArray.Count();
|
|
2793 |
for( TInt i = 0; i < arraySizeSort; i++ )
|
|
2794 |
{
|
|
2795 |
iSortIconArray[i]->Size().SetSize( iListIconSize.iWidth, iListIconSize.iHeight );
|
|
2796 |
}
|
|
2797 |
}
|
|
2798 |
}
|
|
2799 |
|
|
2800 |
// ---------------------------------------------------------------------------
|
|
2801 |
// Resizes the list items without recreating all items
|
|
2802 |
// ---------------------------------------------------------------------------
|
|
2803 |
//
|
|
2804 |
void CFSEmailUiFolderListVisualiser::ResizeListItemsL()
|
|
2805 |
{
|
|
2806 |
FUNC_LOG;
|
|
2807 |
TInt arraySize = iListItemVisulizers.Count();
|
|
2808 |
for( TInt i = 0 ; i < arraySize ; i++ )
|
|
2809 |
{
|
|
2810 |
SetItemVisualizerPropertiesL( iListItemVisulizers[i] );
|
|
2811 |
}
|
|
2812 |
}
|
|
2813 |
|
|
2814 |
// ---------------------------------------------------------------------------
|
|
2815 |
// Start scrolling
|
|
2816 |
// ---------------------------------------------------------------------------
|
|
2817 |
//
|
|
2818 |
void CFSEmailUiFolderListVisualiser::StartScrollingListItemsL()
|
|
2819 |
{
|
|
2820 |
FUNC_LOG;
|
|
2821 |
TInt arraySize = iListItemVisulizers.Count();
|
|
2822 |
for( TInt i = 0 ; i < arraySize ; i++ )
|
|
2823 |
{
|
|
2824 |
iListItemVisulizers[i]->MarqueeL( EFsTextMarqueeForth, 30, 1000, 500, 1 ); // same values as in CFsTreeVisualizerBase constructor
|
|
2825 |
}
|
|
2826 |
}
|
|
2827 |
|
|
2828 |
// ---------------------------------------------------------------------------
|
|
2829 |
// Optimises the screen rect by the list content
|
|
2830 |
// ---------------------------------------------------------------------------
|
|
2831 |
//
|
|
2832 |
void CFSEmailUiFolderListVisualiser::AdaptScreenRectToListContent()
|
|
2833 |
{
|
|
2834 |
FUNC_LOG;
|
|
2835 |
const TInt popupHeight( iScreenRect.Height() );
|
|
2836 |
const TInt separatorHeight( iListSeparatorHeight *
|
|
2837 |
iModel->SeparatorCount() );
|
|
2838 |
const TInt itemCount( iTreeList->Count() - iModel->SeparatorCount() );
|
|
2839 |
TInt visibleItemCount( ( popupHeight - separatorHeight ) /
|
|
2840 |
iListItemHeight );
|
|
2841 |
visibleItemCount = Min( visibleItemCount, itemCount );
|
|
2842 |
iScreenRect.SetHeight( visibleItemCount * iListItemHeight +
|
|
2843 |
separatorHeight +
|
|
2844 |
iAppUi.LayoutHandler()->DropDownMenuListPadding() * 2 +
|
|
2845 |
iAppUi.LayoutHandler()->ControlBarListPadding().iY );
|
|
2846 |
AdjustWidthByContent( iScreenRect );
|
|
2847 |
}
|
|
2848 |
|
|
2849 |
// ---------------------------------------------------------------------------
|
|
2850 |
// Adjusts list width according to content.
|
|
2851 |
// ---------------------------------------------------------------------------
|
|
2852 |
//
|
|
2853 |
void CFSEmailUiFolderListVisualiser::AdjustWidthByContent( TRect& aRect ) const
|
|
2854 |
{
|
|
2855 |
const TRect oldButtonRect( iScreenRect );
|
|
2856 |
const TInt buttonWidth( iCtrlButtonRect.Width() );
|
|
2857 |
const TInt currentWidth( aRect.Width() );
|
|
2858 |
|
|
2859 |
// only do adjusting if the buttonWidth is smaller than current popup width
|
|
2860 |
if ( buttonWidth < currentWidth )
|
|
2861 |
{
|
|
2862 |
TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
|
|
2863 |
TAknLayoutRect scrollPane;
|
|
2864 |
scrollPane.LayoutRect( aRect,
|
|
2865 |
AknLayoutScalable_Apps::sp_fs_scroll_pane_cp01( 6 ) );
|
|
2866 |
const TInt scrollPaneWidth( scrollPane.Rect().Width() );
|
|
2867 |
|
|
2868 |
TAknLayoutText textLayout;
|
|
2869 |
textLayout.LayoutText( aRect,
|
|
2870 |
AknLayoutScalable_Apps::list_single_dyc_row_text_pane_t1( 0 ) );
|
|
2871 |
const CFont& font( *(textLayout.Font()) );
|
|
2872 |
const TInt padding(
|
|
2873 |
iAppUi.LayoutHandler()->DropDownMenuListPadding() * 2 );
|
|
2874 |
if ( iListItemDatas.Count() > 0 )
|
|
2875 |
{
|
|
2876 |
TInt width( 0 );
|
|
2877 |
for ( TInt i = 0; i < iListItemDatas.Count(); i++ )
|
|
2878 |
{
|
|
2879 |
TInt totalWidth( scrollPaneWidth );
|
|
2880 |
const CFsTreePlainOneLineItemData& data( *iListItemDatas[i] );
|
|
2881 |
totalWidth += font.TextWidthInPixels( data.Data() );
|
|
2882 |
totalWidth += padding;
|
|
2883 |
if ( data.IsIconSet() )
|
|
2884 |
{
|
|
2885 |
TAknLayoutRect iconPane;
|
|
2886 |
iconPane.LayoutRect( aRect,
|
|
2887 |
AknLayoutScalable_Apps::list_single_dyc_row_pane_g1( 0 ) );
|
|
2888 |
totalWidth += iconPane.Rect().Width();
|
|
2889 |
}
|
|
2890 |
if (totalWidth > width)
|
|
2891 |
{
|
|
2892 |
width = totalWidth;
|
|
2893 |
}
|
|
2894 |
}
|
|
2895 |
if ( currentWidth > width )
|
|
2896 |
{
|
|
2897 |
if ( width < buttonWidth )
|
|
2898 |
{
|
|
2899 |
width = buttonWidth;
|
|
2900 |
}
|
|
2901 |
aRect.SetWidth( width );
|
|
2902 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
2903 |
{
|
|
2904 |
if ( iCallback )
|
|
2905 |
{
|
|
2906 |
const TInt targetX( iCtrlButtonRect.iBr.iX - width );
|
|
2907 |
aRect.Move( -aRect.iTl.iX + targetX, 0 );
|
|
2908 |
}
|
|
2909 |
else
|
|
2910 |
{
|
|
2911 |
aRect.Move( -aRect.iTl.iX + iCtrlButtonRect.iTl.iX, 0 );
|
|
2912 |
}
|
|
2913 |
}
|
|
2914 |
else
|
|
2915 |
{
|
|
2916 |
if ( !iCallback )
|
|
2917 |
{
|
|
2918 |
const TInt targetX( iCtrlButtonRect.iBr.iX - width );
|
|
2919 |
aRect.Move( -aRect.iTl.iX + targetX, 0 );
|
|
2920 |
}
|
|
2921 |
else
|
|
2922 |
{
|
|
2923 |
aRect.Move( -aRect.iTl.iX + iCtrlButtonRect.iTl.iX, 0 );
|
|
2924 |
}
|
|
2925 |
}
|
|
2926 |
|
|
2927 |
// Keep the right edge position unchanged
|
|
2928 |
if( landscape )
|
|
2929 |
{
|
|
2930 |
if ( !AknLayoutUtils::LayoutMirrored() )
|
|
2931 |
{
|
|
2932 |
aRect.Move( oldButtonRect.iBr.iX - aRect.iBr.iX, 0 );
|
|
2933 |
}
|
|
2934 |
else
|
|
2935 |
{
|
|
2936 |
aRect.Move( ( aRect.Width() - aRect.iBr.iX ) + iCtrlButtonRect.Width(), 0 );
|
|
2937 |
}
|
|
2938 |
}
|
|
2939 |
}
|
|
2940 |
}
|
|
2941 |
}
|
|
2942 |
else
|
|
2943 |
{
|
|
2944 |
aRect.SetWidth( buttonWidth );
|
|
2945 |
if ( !iCallback ) // is sort menu?
|
|
2946 |
{
|
|
2947 |
aRect.Move( currentWidth - buttonWidth, 0 );
|
|
2948 |
}
|
|
2949 |
}
|
|
2950 |
}
|
|
2951 |
|
|
2952 |
void CFSEmailUiFolderListVisualiser::SetAnchors()
|
|
2953 |
{
|
|
2954 |
FUNC_LOG;
|
|
2955 |
if ( iFullScreen && iTitleCaptionVisible )
|
|
2956 |
{
|
|
2957 |
iListHeaderHeight = iAppUi.LayoutHandler()->ControlBarHeight();
|
|
2958 |
}
|
|
2959 |
else
|
|
2960 |
{
|
|
2961 |
iListHeaderHeight = 0;
|
|
2962 |
}
|
|
2963 |
|
|
2964 |
TSize mainPaneSize;
|
|
2965 |
AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, mainPaneSize);
|
|
2966 |
|
|
2967 |
// Set anchor for background visual
|
|
2968 |
iParentLayout->SetAnchor(EAlfAnchorTopLeft,
|
|
2969 |
0,
|
|
2970 |
EAlfAnchorOriginLeft,
|
|
2971 |
EAlfAnchorOriginTop,
|
|
2972 |
EAlfAnchorMetricAbsolute,
|
|
2973 |
EAlfAnchorMetricAbsolute,
|
|
2974 |
TAlfTimedPoint(0, 0));
|
|
2975 |
iParentLayout->SetAnchor(EAlfAnchorBottomRight,
|
|
2976 |
0,
|
|
2977 |
EAlfAnchorOriginRight,
|
|
2978 |
EAlfAnchorOriginTop,
|
|
2979 |
EAlfAnchorMetricAbsolute,
|
|
2980 |
EAlfAnchorMetricAbsolute,
|
|
2981 |
TAlfTimedPoint(mainPaneSize.iWidth,mainPaneSize.iHeight));
|
|
2982 |
|
|
2983 |
// Set anchor for header text visual
|
|
2984 |
iParentLayout->SetAnchor(EAlfAnchorTopLeft,
|
|
2985 |
1,
|
|
2986 |
EAlfAnchorOriginLeft,
|
|
2987 |
EAlfAnchorOriginTop,
|
|
2988 |
EAlfAnchorMetricRelativeToSize,
|
|
2989 |
EAlfAnchorMetricRelativeToSize,
|
|
2990 |
TAlfTimedPoint(0, 0));
|
|
2991 |
iParentLayout->SetAnchor(EAlfAnchorBottomRight,
|
|
2992 |
1,
|
|
2993 |
EAlfAnchorOriginRight,
|
|
2994 |
EAlfAnchorOriginTop,
|
|
2995 |
EAlfAnchorMetricRelativeToSize,
|
|
2996 |
EAlfAnchorMetricAbsolute,
|
|
2997 |
TAlfTimedPoint(0,iListHeaderHeight));
|
|
2998 |
|
|
2999 |
// Set anchor for list's parent layout
|
|
3000 |
iParentLayout->SetAnchor(EAlfAnchorTopLeft,
|
|
3001 |
2,
|
|
3002 |
EAlfAnchorOriginLeft,
|
|
3003 |
EAlfAnchorOriginTop,
|
|
3004 |
//EAlfAnchorMetricRelativeToSize,
|
|
3005 |
EAlfAnchorMetricAbsolute,
|
|
3006 |
EAlfAnchorMetricAbsolute,
|
|
3007 |
TAlfTimedPoint(0, iListHeaderHeight));
|
|
3008 |
iParentLayout->SetAnchor(EAlfAnchorBottomRight,
|
|
3009 |
2,
|
|
3010 |
EAlfAnchorOriginRight,
|
|
3011 |
EAlfAnchorOriginBottom,
|
|
3012 |
//EAlfAnchorMetricRelativeToSize,
|
|
3013 |
EAlfAnchorMetricAbsolute,
|
|
3014 |
EAlfAnchorMetricAbsolute,
|
|
3015 |
TAlfTimedPoint(0, 0));
|
|
3016 |
}
|
|
3017 |
|
|
3018 |
// ---------------------------------------------------------------------------
|
|
3019 |
// Moves the focus to the topmost item
|
|
3020 |
// ---------------------------------------------------------------------------
|
|
3021 |
//
|
|
3022 |
void CFSEmailUiFolderListVisualiser::GoToTopL()
|
|
3023 |
{
|
|
3024 |
FUNC_LOG;
|
|
3025 |
TInt topLevelCount = iTreeList->CountChildren( KFsTreeRootID );
|
|
3026 |
if ( topLevelCount )
|
|
3027 |
{
|
|
3028 |
TFsTreeItemId topId = iTreeList->Child(KFsTreeRootID, 0);
|
|
3029 |
iTreeVisualizer->SetFocusedItemL( topId );
|
|
3030 |
}
|
|
3031 |
}
|
|
3032 |
|
|
3033 |
// ---------------------------------------------------------------------------
|
|
3034 |
// Moves the focus to the bottommost item
|
|
3035 |
// ---------------------------------------------------------------------------
|
|
3036 |
//
|
|
3037 |
void CFSEmailUiFolderListVisualiser::GoToBottomL()
|
|
3038 |
{
|
|
3039 |
FUNC_LOG;
|
|
3040 |
// There may be arbitrary number of nested sub folders. Make sure we focus
|
|
3041 |
// the bottommost visible subfolder.
|
|
3042 |
TFsTreeItemId bottomId = KFsTreeRootID;
|
|
3043 |
|
|
3044 |
while ( iTreeList->IsNode(bottomId) &&
|
|
3045 |
iTreeList->IsExpanded(bottomId) &&
|
|
3046 |
iTreeList->CountChildren(bottomId) )
|
|
3047 |
{
|
|
3048 |
bottomId = iTreeList->Child( bottomId, iTreeList->CountChildren(bottomId)-1 );
|
|
3049 |
}
|
|
3050 |
|
|
3051 |
if ( bottomId != KFsTreeRootID )
|
|
3052 |
{
|
|
3053 |
iTreeVisualizer->SetFocusedItemL( bottomId );
|
|
3054 |
}
|
|
3055 |
}
|
|
3056 |
|
|
3057 |
// ---------------------------------------------------------------------------
|
|
3058 |
// Updates the toolbar buttons (sets the dimmed status of the collapse
|
|
3059 |
// all/expand all buttons).
|
|
3060 |
// ---------------------------------------------------------------------------
|
|
3061 |
//
|
|
3062 |
void CFSEmailUiFolderListVisualiser::UpdateToolbarButtons()
|
|
3063 |
{
|
|
3064 |
FUNC_LOG;
|
|
3065 |
//Toolbar()->SetItemDimmed(EFsEmailUiTbCmdSelect, ( iModel == NULL ) || ( iModel->Count() == 0 ), ETrue );
|
|
3066 |
HideToolbar();
|
|
3067 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, AllNodesExpanded(), ETrue );
|
|
3068 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, AllNodesCollapsed(), ETrue );
|
|
3069 |
}
|
|
3070 |
|
|
3071 |
// ---------------------------------------------------------------------------
|
|
3072 |
// Tells if all expandable nodes are collapsed
|
|
3073 |
// ---------------------------------------------------------------------------
|
|
3074 |
//
|
|
3075 |
TBool CFSEmailUiFolderListVisualiser::AllNodesCollapsed() const
|
|
3076 |
{
|
|
3077 |
FUNC_LOG;
|
|
3078 |
TFsTreeItemId itemId = KFsTreeNoneID;
|
|
3079 |
TInt count = iTreeList->CountChildren(KFsTreeRootID);
|
|
3080 |
|
|
3081 |
// If top level is collapsed, then everything is collapsed. There's no need
|
|
3082 |
// to crawl any deeper in the tree hierarchy.
|
|
3083 |
for ( TInt i=0 ; i<count ; ++i )
|
|
3084 |
{
|
|
3085 |
itemId = iTreeList->Child( KFsTreeRootID, i );
|
|
3086 |
if ( iTreeList->IsNode(itemId) &&
|
|
3087 |
iTreeList->IsExpanded(itemId) )
|
|
3088 |
{
|
|
3089 |
return EFalse;
|
|
3090 |
}
|
|
3091 |
}
|
|
3092 |
|
|
3093 |
return ETrue;
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
// ---------------------------------------------------------------------------
|
|
3097 |
// Tells if all expandable nodes are expanded
|
|
3098 |
// ---------------------------------------------------------------------------
|
|
3099 |
//
|
|
3100 |
TBool CFSEmailUiFolderListVisualiser::AllNodesExpanded( TFsTreeItemId aParentNodeId ) const
|
|
3101 |
{
|
|
3102 |
FUNC_LOG;
|
|
3103 |
// We must crawl through the whole tree to see, if there are any collapsed nodes
|
|
3104 |
// at any level. We do this with recursive depth-first-search.
|
|
3105 |
|
|
3106 |
TFsTreeItemId itemId = KFsTreeNoneID;
|
|
3107 |
TInt count = iTreeList->CountChildren(aParentNodeId);
|
|
3108 |
|
|
3109 |
for ( TInt i=0 ; i<count ; ++i )
|
|
3110 |
{
|
|
3111 |
itemId = iTreeList->Child( aParentNodeId, i );
|
|
3112 |
if ( iTreeList->IsNode(itemId) )
|
|
3113 |
{
|
|
3114 |
if ( !iTreeList->IsExpanded(itemId) ||
|
|
3115 |
!AllNodesExpanded(itemId) )
|
|
3116 |
{
|
|
3117 |
return EFalse;
|
|
3118 |
}
|
|
3119 |
}
|
|
3120 |
}
|
|
3121 |
|
|
3122 |
return ETrue;
|
|
3123 |
}
|
|
3124 |
|
|
3125 |
// ---------------------------------------------------------------------------
|
|
3126 |
// Does a horizontal scrolling for the list by resizing and moving the list
|
|
3127 |
// layout rect out of the screen from the left side.
|
|
3128 |
// ---------------------------------------------------------------------------
|
|
3129 |
//
|
|
3130 |
void CFSEmailUiFolderListVisualiser::DoHorizontalScrollL( TBool aForceRecalculation )
|
|
3131 |
{
|
|
3132 |
FUNC_LOG;
|
|
3133 |
// Horizontal scrolling needed only in full screen list,
|
|
3134 |
// because popup list doesn't contain any subfolders
|
|
3135 |
if( iFirstStartCompleted && iFullScreen )
|
|
3136 |
{
|
|
3137 |
TFsTreeItemId focusedId = iTreeList->FocusedItem();
|
|
3138 |
if ( focusedId > KFsTreeRootID )
|
|
3139 |
{
|
|
3140 |
// Get the list level
|
|
3141 |
TUint level = iTreeList->Level( focusedId );
|
|
3142 |
|
|
3143 |
// Little optimisation, handle all levels up to KListLastBasicLevel
|
|
3144 |
// as root level because horizontal scroll amount is same for all
|
|
3145 |
if( level <= KListLastBasicLevel )
|
|
3146 |
{
|
|
3147 |
level = KListRootLevel;
|
|
3148 |
}
|
|
3149 |
|
|
3150 |
// Recalculate the list rect only if level has changed or if
|
|
3151 |
// recalculation is forced by parameter (e.g. in case of
|
|
3152 |
// dynamic variant switch)
|
|
3153 |
if( ( level != iPreviousListLevel ) || aForceRecalculation )
|
|
3154 |
{
|
|
3155 |
TRect listRect = iListLayout->DisplayRectTarget();
|
|
3156 |
|
|
3157 |
// Calulate list rect by taking x-coordinates from iScreenRect
|
|
3158 |
// and y-coordinates from list layouts target rect (to take
|
|
3159 |
// into account the list header)
|
|
3160 |
listRect.SetRect( iScreenRect.iTl.iX, listRect.iTl.iY,
|
|
3161 |
iScreenRect.iBr.iX, listRect.iBr.iY );
|
|
3162 |
|
|
3163 |
if( level > KListLastBasicLevel )
|
|
3164 |
{
|
|
3165 |
// Calculate rect according to current level
|
|
3166 |
TInt rectChange = (level - KListLastBasicLevel) * iTreeList->Indentation();
|
|
3167 |
listRect.SetWidth( iScreenRect.Width() + rectChange );
|
|
3168 |
listRect.Move( -rectChange, 0 );
|
|
3169 |
}
|
|
3170 |
|
|
3171 |
// Set the list rect only if it has changed from previous
|
|
3172 |
// (because list refresh causes a little twitch)
|
|
3173 |
if( listRect != iPreviousListRect )
|
|
3174 |
{
|
|
3175 |
iListLayout->SetRect( listRect, iAppUi.LayoutHandler()->CtrlBarListFadeEffectTime() );
|
|
3176 |
iTreeVisualizer->RefreshListViewL();
|
|
3177 |
iPreviousListRect = listRect;
|
|
3178 |
}
|
|
3179 |
|
|
3180 |
iPreviousListLevel = level;
|
|
3181 |
}
|
|
3182 |
}
|
|
3183 |
}
|
|
3184 |
}
|
|
3185 |
|
|
3186 |
// ---------------------------------------------------------------------------
|
|
3187 |
// Process a treelist event
|
|
3188 |
// ---------------------------------------------------------------------------
|
|
3189 |
//
|
|
3190 |
void CFSEmailUiFolderListVisualiser::TreeListEventL( const TFsTreeListEvent aEvent,
|
|
3191 |
const TFsTreeItemId /*aId*/,
|
|
3192 |
const TPoint& /*aPoint*/ )
|
|
3193 |
{
|
|
3194 |
switch (aEvent)
|
|
3195 |
{
|
|
3196 |
case EFsTreeListItemTouchAction:
|
|
3197 |
{
|
|
3198 |
HandleSelectionL( EFSEmailUiCtrlBarResponseSelect );
|
|
3199 |
break;
|
|
3200 |
}
|
|
3201 |
|
|
3202 |
// Note that in the handling of the following collapse/expand
|
|
3203 |
// events, we assume that if we have received a collapse (expand)
|
|
3204 |
// event then there must now be something to expand (collapse).
|
|
3205 |
// I.e. we assume that if there is no nesting in the tree list then
|
|
3206 |
// we never get any collapse/expand events.
|
|
3207 |
case EFsTreeListItemCollapsed:
|
|
3208 |
{
|
|
3209 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, EFalse, ETrue );
|
|
3210 |
// Check whether or not everything is now collapsed: if so,
|
|
3211 |
// disable collapsing.
|
|
3212 |
if ( AllNodesCollapsed() )
|
|
3213 |
{
|
|
3214 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, ETrue, ETrue );
|
|
3215 |
}
|
|
3216 |
break;
|
|
3217 |
}
|
|
3218 |
case EFsTreeListItemExpanded:
|
|
3219 |
{
|
|
3220 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, EFalse, ETrue );
|
|
3221 |
// Check whether or not everything is now expanded: if so,
|
|
3222 |
// disable expanding.
|
|
3223 |
if ( AllNodesExpanded() )
|
|
3224 |
{
|
|
3225 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, ETrue, ETrue );
|
|
3226 |
}
|
|
3227 |
break;
|
|
3228 |
}
|
|
3229 |
case EFsTreeListCollapsedAll:
|
|
3230 |
{
|
|
3231 |
// Everything has been collapsed, so disable collapsing and
|
|
3232 |
// enable expanding.
|
|
3233 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, ETrue, ETrue );
|
|
3234 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, EFalse, ETrue );
|
|
3235 |
break;
|
|
3236 |
}
|
|
3237 |
case EFsTreeListExpandedAll:
|
|
3238 |
{
|
|
3239 |
// Everything has been expanded, so disable expanding and
|
|
3240 |
// enable collapsing.
|
|
3241 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, EFalse, ETrue );
|
|
3242 |
Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, ETrue, ETrue );
|
|
3243 |
break;
|
|
3244 |
}
|
|
3245 |
case EFsFocusVisibilityChange:
|
|
3246 |
{
|
|
3247 |
iAppUi.SetFocusVisibility( EFalse );
|
|
3248 |
break;
|
|
3249 |
}
|
|
3250 |
default:
|
|
3251 |
{
|
|
3252 |
// No need to handle other events.
|
|
3253 |
break;
|
|
3254 |
}
|
|
3255 |
}
|
|
3256 |
}
|
|
3257 |
|
|
3258 |
// ---------------------------------------------------------------------------
|
|
3259 |
// HandleMailBoxEventL
|
|
3260 |
// Mailbox event handler, responds to events sent by the plugin.
|
|
3261 |
// ---------------------------------------------------------------------------
|
|
3262 |
//
|
|
3263 |
void CFSEmailUiFolderListVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent,
|
|
3264 |
TFSMailMsgId aMailboxId, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
|
|
3265 |
{
|
|
3266 |
FUNC_LOG;
|
|
3267 |
|
|
3268 |
// Handle the event
|
|
3269 |
if ( iMoveOrCopyInitiated &&
|
|
3270 |
iFirstStartCompleted &&
|
|
3271 |
aMailboxId == iAppUi.GetActiveMailboxId() &&
|
|
3272 |
iAppUi.CurrentActiveView() == this )
|
|
3273 |
{
|
|
3274 |
if ( aEvent == TFSEventMailboxOnline )
|
|
3275 |
{
|
|
3276 |
if( iWaitingToGoOnline )
|
|
3277 |
{
|
|
3278 |
PrepareFolderListL();
|
|
3279 |
PopulateFolderListL();
|
|
3280 |
|
|
3281 |
if ( iModel->Count() )
|
|
3282 |
{
|
|
3283 |
SetFocusToLatestMovedFolderL();
|
|
3284 |
}
|
|
3285 |
iTreeList->SetFocusedL( ETrue );
|
|
3286 |
iWaitingToGoOnline = EFalse;
|
|
3287 |
}
|
|
3288 |
}
|
|
3289 |
else if ( aEvent == TFSEventMailboxOffline )
|
|
3290 |
{
|
|
3291 |
// Empty the list when disconnected if connection is needed for
|
|
3292 |
// the current operation
|
|
3293 |
if( !iNoConnectNeeded )
|
|
3294 |
{
|
|
3295 |
PrepareFolderListL();
|
|
3296 |
}
|
|
3297 |
}
|
|
3298 |
}
|
|
3299 |
}
|
|
3300 |
|
|
3301 |
// ---------------------------------------------------------------------------
|
|
3302 |
//
|
|
3303 |
// ---------------------------------------------------------------------------
|
|
3304 |
//
|
|
3305 |
void CFSEmailUiFolderListVisualiser::FocusVisibilityChange( TBool aVisible )
|
|
3306 |
{
|
|
3307 |
FUNC_LOG;
|
|
3308 |
CFsEmailUiViewBase::FocusVisibilityChange( aVisible );
|
|
3309 |
iTreeVisualizer->SetFocusVisibility( aVisible );
|
|
3310 |
}
|
|
3311 |
|
|
3312 |
// ---------------------------------------------------------------------------
|
|
3313 |
// CbaButtonPressed
|
|
3314 |
// Check if aPosition is on CBA touch area
|
|
3315 |
// ---------------------------------------------------------------------------
|
|
3316 |
//
|
|
3317 |
TBool CFSEmailUiFolderListVisualiser::CbaButtonPressed( TPoint aPosition )
|
|
3318 |
{
|
|
3319 |
TBool cbaPressed( EFalse );
|
|
3320 |
|
|
3321 |
TRect leftCbaRect = TRect();
|
|
3322 |
TRect rightCbaRect = TRect();
|
|
3323 |
GetCbaRects( leftCbaRect, rightCbaRect );
|
|
3324 |
if ( leftCbaRect.Contains( aPosition ) ||
|
|
3325 |
rightCbaRect.Contains( aPosition ))
|
|
3326 |
{
|
|
3327 |
cbaPressed = ETrue;
|
|
3328 |
}
|
|
3329 |
|
|
3330 |
return cbaPressed;
|
|
3331 |
}
|
|
3332 |
|
|
3333 |
// ---------------------------------------------------------------------------
|
|
3334 |
// GetCbaRects
|
|
3335 |
// Resolve CBA touch areas from layouts
|
|
3336 |
// ---------------------------------------------------------------------------
|
|
3337 |
//
|
|
3338 |
void CFSEmailUiFolderListVisualiser::GetCbaRects( TRect& aLeftCbaRect, TRect& aRightCbaRect )
|
|
3339 |
{
|
|
3340 |
TBool rightPaneActive( IsAreaSideRightPaneActive() );
|
|
3341 |
TBool bskLandscape( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
3342 |
!rightPaneActive );
|
|
3343 |
TRect screen;
|
|
3344 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
|
|
3345 |
if ( rightPaneActive )
|
|
3346 |
{
|
|
3347 |
TAknWindowComponentLayout rightAreaLayout(
|
|
3348 |
AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
|
|
3349 |
|
|
3350 |
TAknLayoutRect layoutRect;
|
|
3351 |
// Read right (top in landscape) softkey layout.
|
|
3352 |
layoutRect.LayoutRect(
|
|
3353 |
screen,
|
|
3354 |
TAknWindowComponentLayout::Compose(
|
|
3355 |
rightAreaLayout,
|
|
3356 |
AknLayoutScalable_Avkon::sctrl_sk_bottom_pane() ).LayoutLine() );
|
|
3357 |
TRect bottomSKRect( layoutRect.Rect() );
|
|
3358 |
|
|
3359 |
// Read left (bottom in landscape) softkey layout.
|
|
3360 |
layoutRect.LayoutRect(
|
|
3361 |
screen,
|
|
3362 |
TAknWindowComponentLayout::Compose(
|
|
3363 |
rightAreaLayout,
|
|
3364 |
AknLayoutScalable_Avkon::sctrl_sk_top_pane() ).LayoutLine() );
|
|
3365 |
TRect topSKRect( layoutRect.Rect() );
|
|
3366 |
|
|
3367 |
layoutRect.LayoutRect(
|
|
3368 |
bottomSKRect,
|
|
3369 |
AknLayoutScalable_Avkon::aid_touch_sctrl_bottom().LayoutLine() );
|
|
3370 |
aLeftCbaRect = layoutRect.Rect();
|
|
3371 |
|
|
3372 |
layoutRect.LayoutRect(
|
|
3373 |
topSKRect,
|
|
3374 |
AknLayoutScalable_Avkon::aid_touch_sctrl_top().LayoutLine() );
|
|
3375 |
aRightCbaRect = layoutRect.Rect();
|
|
3376 |
}
|
|
3377 |
else
|
|
3378 |
{
|
|
3379 |
TAknWindowComponentLayout applicationWindow(
|
|
3380 |
AknLayoutScalable_Avkon::application_window( 0 ) );
|
|
3381 |
TAknLayoutRect cbarect;
|
|
3382 |
cbarect.LayoutRect(
|
|
3383 |
screen,
|
|
3384 |
TAknWindowComponentLayout::Compose(
|
|
3385 |
applicationWindow,
|
|
3386 |
TAknWindowComponentLayout::Compose(
|
|
3387 |
AknLayoutScalable_Avkon::area_bottom_pane( bskLandscape ? 2 : 1 ),
|
|
3388 |
AknLayoutScalable_Avkon::control_pane() ) ).LayoutLine() );
|
|
3389 |
aLeftCbaRect = cbarect.Rect();
|
|
3390 |
}
|
|
3391 |
}
|
|
3392 |
|
|
3393 |
// ---------------------------------------------------------------------------
|
|
3394 |
// IsAreaSideRightPaneActive
|
|
3395 |
// Checks if right side pane is active.
|
|
3396 |
// ---------------------------------------------------------------------------
|
|
3397 |
//
|
|
3398 |
TBool CFSEmailUiFolderListVisualiser::IsAreaSideRightPaneActive()
|
|
3399 |
{
|
|
3400 |
// Currently the widescreen status pane layout is in use only
|
|
3401 |
// when pen input (touch) is enabled.
|
|
3402 |
TBool result = EFalse;
|
|
3403 |
|
|
3404 |
if ( Layout_Meta_Data::IsLandscapeOrientation() &&
|
|
3405 |
Layout_Meta_Data::IsPenEnabled() )
|
|
3406 |
{
|
|
3407 |
if ( iAvkonEnv->StatusPaneResIdForCurrentLayout(
|
|
3408 |
AknStatuspaneUtils::CurrentStatusPaneLayoutResId() ) ==
|
|
3409 |
R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS )
|
|
3410 |
{
|
|
3411 |
result = EFalse;
|
|
3412 |
}
|
|
3413 |
else
|
|
3414 |
{
|
|
3415 |
result = ETrue;
|
|
3416 |
}
|
|
3417 |
}
|
|
3418 |
|
|
3419 |
return result;
|
|
3420 |
}
|
|
3421 |
|
|
3422 |
// ---------------------------------------------------------------------------
|
|
3423 |
// Only for testing
|
|
3424 |
// ---------------------------------------------------------------------------
|
|
3425 |
//
|
|
3426 |
//void CFSEmailUiFolderListVisualiser::CancelNotifierTestL()
|
|
3427 |
// {
|
|
3428 |
// iNotifierTest->Cancel();
|
|
3429 |
// }
|
|
3430 |
|