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 message details view implementation
|
|
15 |
* Version : %version: e003sa37#48 %
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// SYSTEM INCLUDES
|
|
22 |
#include "emailtrace.h"
|
|
23 |
#include <AknUtils.h>
|
|
24 |
#include <gulicon.h>
|
|
25 |
#include <freestyleemailui.mbg>
|
|
26 |
#include <FreestyleEmailUi.rsg>
|
|
27 |
#include <StringLoader.h>
|
|
28 |
#include <AknBidiTextUtils.h>
|
|
29 |
#include <akntitle.h>
|
|
30 |
// <cmail> SF
|
|
31 |
#include <alf/alfdecklayout.h>
|
|
32 |
#include <alf/alfcontrolgroup.h>
|
|
33 |
#include <alf/alfframebrush.h>
|
|
34 |
#include <alf/alfevent.h>
|
|
35 |
// </cmail>
|
|
36 |
#include <featmgr.h>
|
|
37 |
//</cmail>
|
|
38 |
|
|
39 |
//<cmail>
|
|
40 |
#include "cfsmailmessage.h"
|
|
41 |
#include "cfsmailclient.h"
|
|
42 |
//</cmail>
|
|
43 |
|
|
44 |
#include "FSEmailBuildFlags.h"
|
|
45 |
//<cmail>
|
|
46 |
#include "cfsccontactactionmenu.h"
|
|
47 |
#include "mfsccontactactionmenumodel.h"
|
|
48 |
//</cmail>
|
|
49 |
|
|
50 |
//<cmail>
|
|
51 |
#include "fstreelist.h"
|
|
52 |
#include "fstreevisualizerbase.h"
|
|
53 |
#include "fstreeplainonelinenodedata.h"
|
|
54 |
#include "fstreeplainonelinenodevisualizer.h"
|
|
55 |
#include "fstreeplainonelineitemdata.h"
|
|
56 |
#include "fstreeplainonelineitemvisualizer.h"
|
|
57 |
#include "fstreeplaintwolineitemdata.h"
|
|
58 |
#include "fstreeplaintwolineitemvisualizer.h"
|
|
59 |
#include <csxhelp/cmail.hlp.hrh>
|
|
60 |
#include "AknWaitDialog.h"
|
|
61 |
// </cmail>
|
|
62 |
|
|
63 |
// INTERNAL INCLUDES
|
|
64 |
#include "FreestyleEmailUiAppui.h"
|
|
65 |
#include "FreestyleEmailUiMsgDetailsControl.h"
|
|
66 |
#include "FreestyleEmailUiMsgDetailsModel.h"
|
|
67 |
#include "FreestyleEmailUiMsgDetailsVisualiser.h"
|
|
68 |
#include "FreestyleEmailUi.hrh"
|
|
69 |
#include "FreestyleEmailUiLayoutHandler.h"
|
|
70 |
#include "FreestyleEmailUiTextureManager.h"
|
|
71 |
#include "FreestyleEmailUiUtilities.h"
|
|
72 |
#include "FreestyleEmailUiShortcutBinding.h"
|
|
73 |
#include "FreestyleEmailUiContactHandler.h"
|
|
74 |
#include "FSDelayedLoader.h"
|
|
75 |
|
|
76 |
|
|
77 |
CFSEmailUiMsgDetailsVisualiser* CFSEmailUiMsgDetailsVisualiser::NewL( CAlfEnv& aEnv,
|
|
78 |
CAlfControlGroup& aControlGroup,
|
|
79 |
CFreestyleEmailUiAppUi& aAppUi )
|
|
80 |
{
|
|
81 |
FUNC_LOG;
|
|
82 |
CFSEmailUiMsgDetailsVisualiser* self = CFSEmailUiMsgDetailsVisualiser::NewLC(aEnv, aControlGroup, aAppUi );
|
|
83 |
CleanupStack::Pop(self);
|
|
84 |
return self;
|
|
85 |
}
|
|
86 |
|
|
87 |
CFSEmailUiMsgDetailsVisualiser* CFSEmailUiMsgDetailsVisualiser::NewLC( CAlfEnv& aEnv,
|
|
88 |
CAlfControlGroup& aControlGroup,
|
|
89 |
CFreestyleEmailUiAppUi& aAppUi )
|
|
90 |
{
|
|
91 |
FUNC_LOG;
|
|
92 |
CFSEmailUiMsgDetailsVisualiser* self = new (ELeave) CFSEmailUiMsgDetailsVisualiser( aEnv, aAppUi, aControlGroup );
|
|
93 |
CleanupStack::PushL(self);
|
|
94 |
self->ConstructL();
|
|
95 |
return self;
|
|
96 |
}
|
|
97 |
|
|
98 |
void CFSEmailUiMsgDetailsVisualiser::ConstructL()
|
|
99 |
{
|
|
100 |
FUNC_LOG;
|
|
101 |
|
|
102 |
BaseConstructL( R_FSEMAILUI_MAIL_DETAILS_VIEW );
|
|
103 |
|
|
104 |
iFirstStartCompleted = EFalse;
|
|
105 |
iFetchingMessageStructure = EFalse;
|
|
106 |
iAsyncProcessComplete = ETrue;
|
|
107 |
iWaitDialog = NULL;
|
|
108 |
}
|
|
109 |
|
|
110 |
// CFSEmailUiMsgDetailsVisualiser::DoFirstStartL()
|
|
111 |
// Purpose of this function is to do first start only when msg details is
|
|
112 |
// really needed to be shown. Implemented to make app startuo faster.
|
|
113 |
void CFSEmailUiMsgDetailsVisualiser::DoFirstStartL()
|
|
114 |
{
|
|
115 |
FUNC_LOG;
|
|
116 |
iControl = CFSEmailUiMsgDetailsControl::NewL( iEnv, *this );
|
|
117 |
iModel = new (ELeave) CFSEmailUiMsgDetailsModel();
|
|
118 |
|
|
119 |
UpdateListSizeAttributes();
|
|
120 |
|
|
121 |
iParentLayout = CAlfDeckLayout::AddNewL( *iControl );
|
|
122 |
iParentLayout->SetFlags( EAlfVisualFlagLayoutUpdateNotification );
|
|
123 |
iParentLayout->SetRect( iScreenRect );
|
|
124 |
|
|
125 |
iTreeVisualizer = CFsTreeVisualizerBase::NewL(iControl, *iParentLayout);
|
|
126 |
iTreeVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() );
|
|
127 |
iTreeVisualizer->SetScrollTime( iAppUi.LayoutHandler()->ListScrollingTime() );
|
|
128 |
iTreeVisualizer->SetFadeInEffectTime( iAppUi.LayoutHandler()->ListFadeInEffectTime() );
|
|
129 |
iTreeVisualizer->SetFadeOutEffectTime( iAppUi.LayoutHandler()->ListFadeOutEffectTime() );
|
|
130 |
|
|
131 |
iTreeList = CFsTreeList::NewL( *iTreeVisualizer, iEnv );
|
|
132 |
iTreeList->HideListL();
|
|
133 |
iTreeList->SetLoopingType( EFsTreeListLoopingJumpToFirstLast );
|
|
134 |
iTreeList->SetScrollbarVisibilityL( EFsScrollbarAuto );
|
|
135 |
iTreeList->SetIndentationL( 0 );
|
|
136 |
|
|
137 |
//<cmail> Compared to S60 3.2.3 in S60 5.0 Alf offers the key events in
|
|
138 |
// opposite order.
|
|
139 |
ControlGroup().AppendL( iControl );
|
|
140 |
ControlGroup().AppendL( iTreeList->TreeControl() );
|
|
141 |
//</cmail>
|
|
142 |
|
|
143 |
// <cmail> Touch
|
|
144 |
iTreeList->AddObserverL(*this);
|
|
145 |
//</cmail>
|
|
146 |
|
|
147 |
// Set page up and page down keys
|
|
148 |
iTreeVisualizer->AddCustomPageUpKey( EStdKeyPageUp );
|
|
149 |
iTreeVisualizer->AddCustomPageDownKey( EStdKeyPageDown );
|
|
150 |
iTreeVisualizer->SetItemsAlwaysExtendedL( ETrue );
|
|
151 |
|
|
152 |
iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iTreeList );
|
|
153 |
|
|
154 |
iFirstStartCompleted = ETrue;
|
|
155 |
}
|
|
156 |
|
|
157 |
CFSEmailUiMsgDetailsVisualiser::CFSEmailUiMsgDetailsVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi& aAppUi, CAlfControlGroup& aControlGroup )
|
|
158 |
: CFsEmailUiViewBase(aControlGroup, aAppUi),
|
|
159 |
iEnv(aEnv),
|
|
160 |
iFirstViewActivation( ETrue ),
|
|
161 |
iExpandCollapseMode( EExpandAll ),
|
|
162 |
// <cmail> video call
|
|
163 |
iVideoCall( EFalse )
|
|
164 |
// </cmail>
|
|
165 |
{
|
|
166 |
FUNC_LOG;
|
|
167 |
}
|
|
168 |
|
|
169 |
CFSEmailUiMsgDetailsVisualiser::~CFSEmailUiMsgDetailsVisualiser()
|
|
170 |
{
|
|
171 |
FUNC_LOG;
|
|
172 |
delete iModel;
|
|
173 |
iModel = NULL;
|
|
174 |
|
|
175 |
delete iPreviousTitleText;
|
|
176 |
iPreviousTitleText = NULL;
|
|
177 |
|
|
178 |
delete iViewedMsg;
|
|
179 |
iViewedMsg = NULL;
|
|
180 |
|
|
181 |
delete iNoDisplayNameAvailableText;
|
|
182 |
iNoDisplayNameAvailableText = NULL;
|
|
183 |
|
|
184 |
delete iNoEmailAddressAvailableText;
|
|
185 |
iNoEmailAddressAvailableText = NULL;
|
|
186 |
|
|
187 |
delete iTreeList;
|
|
188 |
iTreeList = NULL;
|
|
189 |
|
|
190 |
iNodeIds.Close();
|
|
191 |
}
|
|
192 |
|
|
193 |
TUid CFSEmailUiMsgDetailsVisualiser::Id() const
|
|
194 |
{
|
|
195 |
FUNC_LOG;
|
|
196 |
return MsgDetailsViewId;
|
|
197 |
}
|
|
198 |
|
|
199 |
// <cmail> Toolbar
|
|
200 |
/*void CFSEmailUiMsgDetailsVisualiser::DoActivateL(const TVwsViewId& aPrevViewId,
|
|
201 |
TUid aCustomMessageId,
|
|
202 |
const TDesC8& aCustomMessage)*/
|
|
203 |
void CFSEmailUiMsgDetailsVisualiser::ChildDoActivateL(
|
|
204 |
const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
|
|
205 |
const TDesC8& aCustomMessage)
|
|
206 |
// </cmail> Toolbar
|
|
207 |
{
|
|
208 |
FUNC_LOG;
|
|
209 |
if ( !iFirstStartCompleted )
|
|
210 |
{
|
|
211 |
DoFirstStartL();
|
|
212 |
}
|
|
213 |
|
|
214 |
UpdateListSizeAttributes();
|
|
215 |
iParentLayout->SetRect( iScreenRect );
|
|
216 |
|
|
217 |
if ( aCustomMessageId == KStartMsgDetailsReturnToPrevious )
|
|
218 |
{
|
|
219 |
// Fisrt handle special case where we are returning to msg details view,
|
|
220 |
// so we don't need to recreate list contents, just refresh the view
|
|
221 |
if ( iViewedMsg ) // Safety check
|
|
222 |
{
|
|
223 |
// Set title bar text to "Message/Meeting details"
|
|
224 |
ChangeTitleBarTextL( ETrue );
|
|
225 |
|
|
226 |
// Hide list and switch this view as active
|
|
227 |
iTreeList->HideListL();
|
|
228 |
|
|
229 |
// Then just refresh the list as in dynamic variant switch,
|
|
230 |
// because screen orientation might have changed
|
|
231 |
HandleDynamicVariantSwitchL( EScreenLayoutChanged );
|
|
232 |
}
|
|
233 |
}
|
|
234 |
else
|
|
235 |
{
|
|
236 |
// This is the "normal" case, so we need to recreate the list contents
|
|
237 |
|
|
238 |
// Store previous view ID
|
|
239 |
iPreviousViewUid = aPrevViewId.iViewUid;
|
|
240 |
|
|
241 |
TMsgDetailsActivationData subView;
|
|
242 |
TPckgBuf<TMsgDetailsActivationData> viewData( subView );
|
|
243 |
viewData.Copy( aCustomMessage );
|
|
244 |
subView = viewData();
|
|
245 |
|
|
246 |
delete iViewedMsg;
|
|
247 |
iViewedMsg = NULL;
|
|
248 |
|
|
249 |
iViewedMsg = iAppUi.GetMailClient()->GetMessageByUidL( subView.iMailBoxId, subView.iFolderId, subView.iMessageId, EFSMsgDataEnvelope );
|
|
250 |
CFSMailBox* mailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( subView.iMailBoxId );
|
|
251 |
CleanupStack::PushL( mailBox );
|
|
252 |
if ( mailBox && TFsEmailUiUtility::IsRemoteLookupSupported( *mailBox ) )
|
|
253 |
{
|
|
254 |
iRCLSupported = ETrue;
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
iRCLSupported = EFalse;
|
|
259 |
}
|
|
260 |
CleanupStack::PopAndDestroy( mailBox );
|
|
261 |
|
|
262 |
if( iFirstViewActivation )
|
|
263 |
{
|
|
264 |
iTreeVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) );
|
|
265 |
//<cmail> S60 skin support
|
|
266 |
//iTreeVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) );
|
|
267 |
//</cmail>
|
|
268 |
|
|
269 |
CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL();
|
|
270 |
iTreeVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly );
|
|
271 |
|
|
272 |
iFirstViewActivation = EFalse;
|
|
273 |
}
|
|
274 |
|
|
275 |
if ( iViewedMsg ) // Safety check
|
|
276 |
{
|
|
277 |
//<cmail>
|
|
278 |
// The code below fetches the mail structure in order to have access to all detail needed.
|
|
279 |
// IMAP - hasStructure should be always True
|
|
280 |
// POP - it is False if the message has not been read yet so the code below
|
|
281 |
// should fetch the message structure
|
|
282 |
iAsyncProcessComplete = ETrue;
|
|
283 |
TBool hasStructure = TFsEmailUiUtility::IsMessageStructureKnown( *iViewedMsg );
|
|
284 |
if (!hasStructure)
|
|
285 |
{
|
|
286 |
iWaitDialog = new (ELeave) CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), EFalse);
|
|
287 |
iWaitDialog->SetCallback(this);
|
|
288 |
iWaitDialog->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG);
|
|
289 |
|
|
290 |
iDialogNotDismissed = ETrue;
|
|
291 |
iAsyncProcessComplete = EFalse;
|
|
292 |
StartFetchingMessageStructureL(iViewedMsg);
|
|
293 |
}
|
|
294 |
//</cmail>
|
|
295 |
// Set title bar text to "Message/Meeting details"
|
|
296 |
ChangeTitleBarTextL( ETrue );
|
|
297 |
|
|
298 |
iTreeList->HideListL();
|
|
299 |
|
|
300 |
// By default we expand all nodes, if parameters doesn't state
|
|
301 |
// something else
|
|
302 |
iExpandCollapseMode = EExpandAll;
|
|
303 |
if ( aCustomMessageId == KStartMsgDetailsToTo )
|
|
304 |
{
|
|
305 |
iExpandCollapseMode = ECollapseAllExceptTo;
|
|
306 |
}
|
|
307 |
else if ( aCustomMessageId == KStartMsgDetailsToCc )
|
|
308 |
{
|
|
309 |
iExpandCollapseMode = ECollapseAllExceptCc;
|
|
310 |
}
|
|
311 |
else if ( aCustomMessageId == KStartMsgDetailsToBcc )
|
|
312 |
{
|
|
313 |
iExpandCollapseMode = ECollapseAllExceptBcc;
|
|
314 |
}
|
|
315 |
|
|
316 |
iParentLayout->SetRect( iScreenRect );
|
|
317 |
ClearMsgDetailsModelL();
|
|
318 |
|
|
319 |
//<cmail>
|
|
320 |
// IMAP - hasStructure is True so the view can be updated.
|
|
321 |
// POP - if hasStructure is False then the message strucure is being fetched. Wait for responce that will be received in
|
|
322 |
// observer method RequestResponseL( ... )
|
|
323 |
if ( hasStructure )
|
|
324 |
{
|
|
325 |
UpdateMsgDetailsModelL();
|
|
326 |
iTreeList->ShowListL();
|
|
327 |
}
|
|
328 |
//</cmail>
|
|
329 |
}
|
|
330 |
}
|
|
331 |
// <cmail> Touch
|
|
332 |
iTreeList->SetFocusedL(ETrue);
|
|
333 |
// </cmail>
|
|
334 |
}
|
|
335 |
|
|
336 |
void CFSEmailUiMsgDetailsVisualiser::ChildDoDeactivate()
|
|
337 |
{
|
|
338 |
FUNC_LOG;
|
|
339 |
//<cmail>
|
|
340 |
CancelFetching();
|
|
341 |
//</cmail>
|
|
342 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
343 |
{
|
|
344 |
if ( iTreeList->IsFocused() )
|
|
345 |
{
|
|
346 |
TRAP_IGNORE( {
|
|
347 |
iTreeList->SetFocusedL(EFalse);
|
|
348 |
iTreeList->SetFocusedItemL(KFsTreeNoneID);
|
|
349 |
} );
|
|
350 |
}
|
|
351 |
iTreeVisualizer->NotifyControlVisibilityChange( EFalse );
|
|
352 |
}
|
|
353 |
}
|
|
354 |
|
|
355 |
void CFSEmailUiMsgDetailsVisualiser::PrepareForExit()
|
|
356 |
{
|
|
357 |
delete iViewedMsg;
|
|
358 |
iViewedMsg = NULL;
|
|
359 |
}
|
|
360 |
|
|
361 |
|
|
362 |
void CFSEmailUiMsgDetailsVisualiser::ChangeTitleBarTextL( TBool aViewStarted )
|
|
363 |
{
|
|
364 |
FUNC_LOG;
|
|
365 |
if ( iFirstStartCompleted ) // Safety
|
|
366 |
{
|
|
367 |
if ( aViewStarted )
|
|
368 |
{
|
|
369 |
// Store previous application title text
|
|
370 |
delete iPreviousTitleText;
|
|
371 |
iPreviousTitleText = NULL;
|
|
372 |
iPreviousTitleText = iAppUi.TitlePaneTextL().AllocL();
|
|
373 |
|
|
374 |
HBufC* titleText = NULL;
|
|
375 |
if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
|
|
376 |
{
|
|
377 |
titleText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MEETING_HEADING );
|
|
378 |
}
|
|
379 |
else
|
|
380 |
{
|
|
381 |
titleText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_HEADING );
|
|
382 |
}
|
|
383 |
|
|
384 |
iAppUi.SetTitlePaneTextL( *titleText );
|
|
385 |
|
|
386 |
CleanupStack::PopAndDestroy( titleText );
|
|
387 |
}
|
|
388 |
else
|
|
389 |
{
|
|
390 |
if ( iPreviousTitleText )
|
|
391 |
{
|
|
392 |
iAppUi.SetTitlePaneTextL( *iPreviousTitleText ); // Set application title text back
|
|
393 |
}
|
|
394 |
}
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
void CFSEmailUiMsgDetailsVisualiser::LaunchActionMenuL()
|
|
399 |
{
|
|
400 |
FUNC_LOG;
|
|
401 |
CFSEmailUiActionMenu::RemoveAllL();
|
|
402 |
|
|
403 |
RFsEActionMenuIdList itemList;
|
|
404 |
itemList.AppendL(FsEActionMenuCall);
|
|
405 |
// <cmail> video call
|
|
406 |
itemList.AppendL( FsEActionMenuCallVideo );
|
|
407 |
// </cmail>
|
|
408 |
itemList.AppendL(FsEActionMenuCreateMessage);
|
|
409 |
itemList.AppendL(FsEActionMenuContactDetails);
|
|
410 |
itemList.AppendL(FsEActionMenuAddToContacts);
|
|
411 |
if ( iRCLSupported )
|
|
412 |
{
|
|
413 |
itemList.AppendL(FsEActionMenuRemoteLookup);
|
|
414 |
}
|
|
415 |
CFSEmailUiActionMenu::AddCustomItemsL( itemList );
|
|
416 |
itemList.Close();
|
|
417 |
|
|
418 |
// <cmail> Touch
|
|
419 |
TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( EFscCustom, 0, this );
|
|
420 |
// </cmail>
|
|
421 |
|
|
422 |
HandleActionMenuCommandL( itemId );
|
|
423 |
}
|
|
424 |
|
|
425 |
void CFSEmailUiMsgDetailsVisualiser::HandleActionMenuCommandL( TActionMenuCustomItemId itemId )
|
|
426 |
{
|
|
427 |
FUNC_LOG;
|
|
428 |
switch( itemId )
|
|
429 |
{
|
|
430 |
case FsEActionMenuCall:
|
|
431 |
{
|
|
432 |
CallToFocusedItemL();
|
|
433 |
}
|
|
434 |
break;
|
|
435 |
// <cmail> video call
|
|
436 |
case FsEActionMenuCallVideo: // Video Call
|
|
437 |
{
|
|
438 |
iVideoCall = ETrue;
|
|
439 |
CallToFocusedItemL();
|
|
440 |
}
|
|
441 |
break;
|
|
442 |
// </cmail>
|
|
443 |
case FsEActionMenuCreateMessage:
|
|
444 |
{
|
|
445 |
CreateMessageToFocusedItemL();
|
|
446 |
}
|
|
447 |
break;
|
|
448 |
|
|
449 |
case FsEActionMenuContactDetails:
|
|
450 |
{
|
|
451 |
ShowContactDetailsForFocusedItemL();
|
|
452 |
}
|
|
453 |
break;
|
|
454 |
|
|
455 |
case FsEActionMenuAddToContacts:
|
|
456 |
{
|
|
457 |
AddFocusedItemToContactsL();
|
|
458 |
}
|
|
459 |
break;
|
|
460 |
|
|
461 |
case FsEActionMenuRemoteLookup:
|
|
462 |
{
|
|
463 |
LaunchRemoteLookupForFocusedItemL();
|
|
464 |
}
|
|
465 |
break;
|
|
466 |
}
|
|
467 |
}
|
|
468 |
|
|
469 |
|
|
470 |
// -----------------------------------------------------------------------------
|
|
471 |
// CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem
|
|
472 |
// Returns email address of the focused list item. NULL returned if not found.
|
|
473 |
// -----------------------------------------------------------------------------
|
|
474 |
CFSMailAddress* CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem() const
|
|
475 |
{
|
|
476 |
FUNC_LOG;
|
|
477 |
CFSMailAddress* foundEmailAddress = NULL;
|
|
478 |
CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() );
|
|
479 |
if( item )
|
|
480 |
{
|
|
481 |
foundEmailAddress = item->iMailAddress;
|
|
482 |
}
|
|
483 |
return foundEmailAddress;
|
|
484 |
}
|
|
485 |
|
|
486 |
// -----------------------------------------------------------------------------
|
|
487 |
// CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItem
|
|
488 |
// Returns email address of the focused list item. NULL returned if not found.
|
|
489 |
// -----------------------------------------------------------------------------
|
|
490 |
TDesC* CFSEmailUiMsgDetailsVisualiser::GetEmailAddressForFocusedItemAsTDes() const
|
|
491 |
{
|
|
492 |
FUNC_LOG;
|
|
493 |
TDesC* foundEmailAddress = NULL;
|
|
494 |
CFSMailAddress* address = GetEmailAddressForFocusedItem();
|
|
495 |
if( address )
|
|
496 |
{
|
|
497 |
foundEmailAddress = &address->GetEmailAddress();
|
|
498 |
}
|
|
499 |
return foundEmailAddress;
|
|
500 |
}
|
|
501 |
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
// CFSEmailUiMsgDetailsVisualiser::SendEmailToFocusedItemL
|
|
504 |
//
|
|
505 |
// Open composer and set the focused item as recipient, if valid email address
|
|
506 |
// is available. Return ETrue if valid email address was found, EFalse if not.
|
|
507 |
// -----------------------------------------------------------------------------
|
|
508 |
TBool CFSEmailUiMsgDetailsVisualiser::SendEmailToFocusedItemL() const
|
|
509 |
{
|
|
510 |
FUNC_LOG;
|
|
511 |
TBool addrFound = EFalse;
|
|
512 |
CFSMailAddress* address = GetEmailAddressForFocusedItem();
|
|
513 |
if( address )
|
|
514 |
{
|
|
515 |
iAppUi.LaunchEditorL( address );
|
|
516 |
addrFound = ETrue;
|
|
517 |
}
|
|
518 |
return addrFound;
|
|
519 |
}
|
|
520 |
|
|
521 |
// -----------------------------------------------------------------------------
|
|
522 |
// CFSEmailUiMsgDetailsVisualiser::CallToFocusedItemL
|
|
523 |
// -----------------------------------------------------------------------------
|
|
524 |
void CFSEmailUiMsgDetailsVisualiser::CallToFocusedItemL()
|
|
525 |
{
|
|
526 |
FUNC_LOG;
|
|
527 |
TDesC* email = GetEmailAddressForFocusedItemAsTDes();
|
|
528 |
if( email )
|
|
529 |
{
|
|
530 |
CFSMailClient* mailClient = iAppUi.GetMailClient();
|
|
531 |
CFSMailBox* mailBox = mailClient->GetMailBoxByUidL( iViewedMsg->GetMailBoxId() );
|
|
532 |
CleanupStack::PushL( mailBox );
|
|
533 |
|
|
534 |
// <cmail> video call
|
|
535 |
if ( iVideoCall )
|
|
536 |
{
|
|
537 |
iVideoCall = EFalse;
|
|
538 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->SetVideoCall( ETrue );
|
|
539 |
}
|
|
540 |
// </cmail>
|
|
541 |
|
|
542 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( *email,
|
|
543 |
iAppUi.GetActiveMailbox(), this, EFalse );
|
|
544 |
|
|
545 |
CleanupStack::PopAndDestroy( mailBox );
|
|
546 |
}
|
|
547 |
}
|
|
548 |
|
|
549 |
// -----------------------------------------------------------------------------
|
|
550 |
// CFSEmailUiMsgDetailsVisualiser::CreateMessageToFocusedItemL
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
void CFSEmailUiMsgDetailsVisualiser::CreateMessageToFocusedItemL() const
|
|
553 |
{
|
|
554 |
FUNC_LOG;
|
|
555 |
TDesC* email = GetEmailAddressForFocusedItemAsTDes();
|
|
556 |
if( email )
|
|
557 |
{
|
|
558 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCreateMsgToContactByEmailL( *email, iAppUi.GetActiveMailbox() );
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
// -----------------------------------------------------------------------------
|
|
563 |
// CFSEmailUiMsgDetailsVisualiser::LaunchRemoteLookupForFocusedItemL
|
|
564 |
// -----------------------------------------------------------------------------
|
|
565 |
void CFSEmailUiMsgDetailsVisualiser::LaunchRemoteLookupForFocusedItemL() const
|
|
566 |
{
|
|
567 |
FUNC_LOG;
|
|
568 |
CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() );
|
|
569 |
if( !item )
|
|
570 |
{
|
|
571 |
return;
|
|
572 |
}
|
|
573 |
CFSMailAddress* address = item->iMailAddress;
|
|
574 |
if( !address )
|
|
575 |
{
|
|
576 |
return;
|
|
577 |
}
|
|
578 |
TDesC* queryString = &address->GetEmailAddress();
|
|
579 |
if( !queryString )
|
|
580 |
{
|
|
581 |
queryString = &address->GetDisplayName();
|
|
582 |
if( !queryString )
|
|
583 |
{
|
|
584 |
return;
|
|
585 |
}
|
|
586 |
}
|
|
587 |
|
|
588 |
// this method assumes that remote lookup is available with current plugin.
|
|
589 |
CFSMailClient* mailClient = iAppUi.GetMailClient();
|
|
590 |
CFSMailBox* mailBox = mailClient->GetMailBoxByUidL( iViewedMsg->GetMailBoxId() );
|
|
591 |
CleanupStack::PushL( mailBox );
|
|
592 |
|
|
593 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupWithQueryL( *mailBox, *queryString );
|
|
594 |
|
|
595 |
CleanupStack::PopAndDestroy( mailBox );
|
|
596 |
}
|
|
597 |
|
|
598 |
// -----------------------------------------------------------------------------
|
|
599 |
// CFSEmailUiMsgDetailsVisualiser::AddFocusedItemToContactsL
|
|
600 |
// -----------------------------------------------------------------------------
|
|
601 |
void CFSEmailUiMsgDetailsVisualiser::AddFocusedItemToContactsL() const
|
|
602 |
{
|
|
603 |
FUNC_LOG;
|
|
604 |
TDesC* email = GetEmailAddressForFocusedItemAsTDes();
|
|
605 |
if( email )
|
|
606 |
{
|
|
607 |
TAddToContactsType aType;
|
|
608 |
//Query to "update existing" or "Create new" --> EFALSE = user choosed "cancel"
|
|
609 |
if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddtoContactsQueryL( aType ) )
|
|
610 |
{
|
|
611 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL(
|
|
612 |
*email, EContactUpdateEmail, aType );
|
|
613 |
}
|
|
614 |
}
|
|
615 |
}
|
|
616 |
|
|
617 |
// -----------------------------------------------------------------------------
|
|
618 |
// CFSEmailUiMsgDetailsVisualiser::ShowContactDetailsForFocusedItemL
|
|
619 |
// -----------------------------------------------------------------------------
|
|
620 |
void CFSEmailUiMsgDetailsVisualiser::ShowContactDetailsForFocusedItemL() const
|
|
621 |
{
|
|
622 |
FUNC_LOG;
|
|
623 |
TDesC* email = GetEmailAddressForFocusedItemAsTDes();
|
|
624 |
if( email )
|
|
625 |
{
|
|
626 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->ShowContactDetailsL(
|
|
627 |
*email, EContactUpdateEmail, NULL );
|
|
628 |
}
|
|
629 |
}
|
|
630 |
|
|
631 |
// -----------------------------------------------------------------------------
|
|
632 |
// CFSEmailUiMsgDetailsVisualiser::CopyFocusedItemToClipboardL
|
|
633 |
// -----------------------------------------------------------------------------
|
|
634 |
void CFSEmailUiMsgDetailsVisualiser::CopyFocusedItemToClipboardL() const
|
|
635 |
{
|
|
636 |
FUNC_LOG;
|
|
637 |
CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() );
|
|
638 |
if (item)
|
|
639 |
{
|
|
640 |
CFSMailAddress* address = item->iMailAddress;
|
|
641 |
TDesC* text = item->iText;
|
|
642 |
if ( address )
|
|
643 |
{
|
|
644 |
TDesC* clipBoardText = &address->GetEmailAddress();
|
|
645 |
if( !clipBoardText ||
|
|
646 |
(clipBoardText && clipBoardText->Length() == 0) )
|
|
647 |
{
|
|
648 |
clipBoardText = &address->GetDisplayName();
|
|
649 |
if( !clipBoardText )
|
|
650 |
{
|
|
651 |
return;
|
|
652 |
}
|
|
653 |
}
|
|
654 |
TFsEmailUiUtility::CopyToClipboardL( *clipBoardText );
|
|
655 |
}
|
|
656 |
else if( text )
|
|
657 |
{
|
|
658 |
TFsEmailUiUtility::CopyToClipboardL( *text );
|
|
659 |
}
|
|
660 |
}
|
|
661 |
}
|
|
662 |
|
|
663 |
// -----------------------------------------------------------------------------
|
|
664 |
// Action menu is available for items that has iMailAddress set in model.
|
|
665 |
// -----------------------------------------------------------------------------
|
|
666 |
TBool CFSEmailUiMsgDetailsVisualiser::HasFocusedItemActionMenu() const
|
|
667 |
{
|
|
668 |
FUNC_LOG;
|
|
669 |
CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() );
|
|
670 |
if( item && item->iMailAddress )
|
|
671 |
{
|
|
672 |
const TDesC* displayName = &item->iMailAddress->GetDisplayName();
|
|
673 |
const TDesC* emailAddress = &item->iMailAddress->GetEmailAddress();
|
|
674 |
|
|
675 |
if ( (displayName && displayName->Length()) ||
|
|
676 |
(emailAddress && emailAddress->Length()) )
|
|
677 |
{
|
|
678 |
return ETrue;
|
|
679 |
}
|
|
680 |
}
|
|
681 |
return EFalse;
|
|
682 |
}
|
|
683 |
|
|
684 |
void CFSEmailUiMsgDetailsVisualiser::SetMskL()
|
|
685 |
{
|
|
686 |
FUNC_LOG;
|
|
687 |
if ( iFirstStartCompleted ) // Safety
|
|
688 |
{
|
|
689 |
TFsTreeItemId curId = iTreeList->FocusedItem();
|
|
690 |
|
|
691 |
if ( iTreeList->IsNode( curId ) )
|
|
692 |
{
|
|
693 |
if ( iTreeList->IsExpanded( curId ) )
|
|
694 |
{
|
|
695 |
ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE );
|
|
696 |
}
|
|
697 |
else
|
|
698 |
{
|
|
699 |
ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND );
|
|
700 |
}
|
|
701 |
}
|
|
702 |
else // non-node item
|
|
703 |
{
|
|
704 |
if( GetEmailAddressForFocusedItem() )
|
|
705 |
{
|
|
706 |
ChangeMskCommandL( R_FSE_QTN_MSK_COMPOSE );
|
|
707 |
}
|
|
708 |
else
|
|
709 |
{
|
|
710 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
711 |
}
|
|
712 |
}
|
|
713 |
}
|
|
714 |
}
|
|
715 |
|
|
716 |
TBool CFSEmailUiMsgDetailsVisualiser::OfferEventL(const TAlfEvent& aEvent)
|
|
717 |
{
|
|
718 |
FUNC_LOG;
|
|
719 |
TBool result = EFalse;
|
|
720 |
SetMskL();
|
|
721 |
if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey )
|
|
722 |
{
|
|
723 |
TInt scanCode = aEvent.KeyEvent().iScanCode;
|
|
724 |
// Swap right and left controls in mirrored layout
|
|
725 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
726 |
{
|
|
727 |
if (scanCode == EStdKeyRightArrow) scanCode = EStdKeyLeftArrow;
|
|
728 |
else if (scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow;
|
|
729 |
}
|
|
730 |
|
|
731 |
switch ( scanCode )
|
|
732 |
{
|
|
733 |
case EStdKeyDevice3: // CENTER CLICK
|
|
734 |
case EStdKeyEnter: // ENTER
|
|
735 |
{
|
|
736 |
// Send email to focused item. Set the event as consumed if
|
|
737 |
// valid email address was found and composer was opened with
|
|
738 |
// that email address as recipent. If email address was not
|
|
739 |
// found, offer the event to list by not consuming it.
|
|
740 |
result = SendEmailToFocusedItemL();
|
|
741 |
}
|
|
742 |
break;
|
|
743 |
|
|
744 |
case EStdKeyYes:
|
|
745 |
{
|
|
746 |
CallToFocusedItemL();
|
|
747 |
result = ETrue;
|
|
748 |
}
|
|
749 |
break;
|
|
750 |
|
|
751 |
case EStdKeyRightArrow:
|
|
752 |
{
|
|
753 |
// Show action toolbar if the item has action menu.
|
|
754 |
if( HasFocusedItemActionMenu() )
|
|
755 |
{
|
|
756 |
LaunchActionMenuL();
|
|
757 |
result = ETrue;
|
|
758 |
}
|
|
759 |
else
|
|
760 |
{
|
|
761 |
result = EFalse;
|
|
762 |
}
|
|
763 |
}
|
|
764 |
break;
|
|
765 |
|
|
766 |
default:
|
|
767 |
// Check keyboard shortcuts.
|
|
768 |
TInt shortcutCommand =
|
|
769 |
iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(),
|
|
770 |
CFSEmailUiShortcutBinding::EContextMailDetails );
|
|
771 |
if ( shortcutCommand != KErrNotFound )
|
|
772 |
{
|
|
773 |
HandleCommandL( shortcutCommand );
|
|
774 |
result = ETrue;
|
|
775 |
}
|
|
776 |
break;
|
|
777 |
}
|
|
778 |
}
|
|
779 |
else if (aEvent.IsPointerEvent())
|
|
780 |
{
|
|
781 |
result = iTreeList->TreeControl()->OfferEventL(aEvent);
|
|
782 |
}
|
|
783 |
|
|
784 |
return result;
|
|
785 |
}
|
|
786 |
|
|
787 |
// ---------------------------------------------------------------------------
|
|
788 |
// From MFSEmailUiContactHandlerObserver
|
|
789 |
// The ownership of the CLS items in the contacts array is transferred to the
|
|
790 |
// observer, and they must be deleted by the observer.
|
|
791 |
// ---------------------------------------------------------------------------
|
|
792 |
//
|
|
793 |
void CFSEmailUiMsgDetailsVisualiser::OperationCompleteL(
|
|
794 |
TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ )
|
|
795 |
{
|
|
796 |
FUNC_LOG;
|
|
797 |
}
|
|
798 |
|
|
799 |
// ---------------------------------------------------------------------------
|
|
800 |
// From MFSEmailUiContactHandlerObserver
|
|
801 |
// Handles error in contact handler operation.
|
|
802 |
// ---------------------------------------------------------------------------
|
|
803 |
//
|
|
804 |
void CFSEmailUiMsgDetailsVisualiser::OperationErrorL( TContactHandlerCmd /*aCmd*/,
|
|
805 |
TInt /*aError*/ )
|
|
806 |
{
|
|
807 |
FUNC_LOG;
|
|
808 |
}
|
|
809 |
|
|
810 |
void CFSEmailUiMsgDetailsVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
|
|
811 |
{
|
|
812 |
FUNC_LOG;
|
|
813 |
|
|
814 |
if ( aResourceId == R_FSEMAILUI_MAILDETAILS_MENUPANE )
|
|
815 |
{
|
|
816 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
|
|
817 |
{
|
|
818 |
// remove help support in pf5250
|
|
819 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
|
|
820 |
}
|
|
821 |
|
|
822 |
// Hide "actions" option if currently focused item doesn't have action menu
|
|
823 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, !HasFocusedItemActionMenu() );
|
|
824 |
// Hide "copy to clipboard" option if there is nothing to copy on the focused row
|
|
825 |
CFSEmailUiMsgDetailsItem* item = iModel->ItemByListId( iTreeList->FocusedItem() );
|
|
826 |
if ( !item )
|
|
827 |
{
|
|
828 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCopyToClipboard, ETrue );
|
|
829 |
}
|
|
830 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() );
|
|
831 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() );
|
|
832 |
}
|
|
833 |
|
|
834 |
if ( aResourceId == R_FSEMAILUI_MAILDETAILS_SUBMENU_ACTIONS )
|
|
835 |
{
|
|
836 |
TInt pos( 0 );
|
|
837 |
if ( !iRCLSupported && aMenuPane->MenuItemExists( EFsEmailUiCmdActionsRemoteLookup ,pos) )
|
|
838 |
{
|
|
839 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsRemoteLookup, ETrue );
|
|
840 |
}
|
|
841 |
}
|
|
842 |
|
|
843 |
// Add shortcut hints
|
|
844 |
iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane,
|
|
845 |
CFSEmailUiShortcutBinding::EContextMailDetails );
|
|
846 |
}
|
|
847 |
|
|
848 |
void CFSEmailUiMsgDetailsVisualiser::HandleCommandL( TInt aCommand )
|
|
849 |
{
|
|
850 |
FUNC_LOG;
|
|
851 |
switch(aCommand)
|
|
852 |
{
|
|
853 |
case EAknSoftkeyBack:
|
|
854 |
{
|
|
855 |
if ( !iAppUi.ViewSwitchingOngoing() )
|
|
856 |
{
|
|
857 |
ChangeTitleBarTextL( EFalse );
|
|
858 |
iAppUi.ReturnToPreviousViewL();
|
|
859 |
}
|
|
860 |
}
|
|
861 |
break;
|
|
862 |
|
|
863 |
case EFsEmailUiCmdActionsCopyToClipboard:
|
|
864 |
{
|
|
865 |
CopyFocusedItemToClipboardL();
|
|
866 |
}
|
|
867 |
break;
|
|
868 |
case EFsEmailUiCmdCollapse:
|
|
869 |
{
|
|
870 |
TFsTreeItemId focId1 = iTreeList->FocusedItem();
|
|
871 |
iTreeList->CollapseNodeL(focId1);
|
|
872 |
ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND);
|
|
873 |
}
|
|
874 |
break;
|
|
875 |
|
|
876 |
case EFsEmailUiCmdExpand:
|
|
877 |
{
|
|
878 |
TFsTreeItemId focId2 = iTreeList->FocusedItem();
|
|
879 |
iTreeList->ExpandNodeL(focId2);
|
|
880 |
ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE);
|
|
881 |
}
|
|
882 |
break;
|
|
883 |
// Options menu commands
|
|
884 |
case EFsEmailUiCmdActionsCollapseAll:
|
|
885 |
{
|
|
886 |
TFsTreeItemId prevId = iTreeList->FocusedItem();
|
|
887 |
prevId = GetRootParent( prevId );
|
|
888 |
iTreeVisualizer->CollapseAllL();
|
|
889 |
if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID )
|
|
890 |
{
|
|
891 |
iTreeVisualizer->SetFocusedItemL( prevId );
|
|
892 |
}
|
|
893 |
}
|
|
894 |
break;
|
|
895 |
|
|
896 |
case EFsEmailUiCmdActionsExpandAll:
|
|
897 |
{
|
|
898 |
TFsTreeItemId prevId = iTreeList->FocusedItem();
|
|
899 |
iTreeVisualizer->ExpandAllL();
|
|
900 |
if ( prevId != KFsTreeRootID && prevId != KFsTreeNoneID )
|
|
901 |
{
|
|
902 |
iTreeVisualizer->SetFocusedItemL( prevId );
|
|
903 |
}
|
|
904 |
}
|
|
905 |
break;
|
|
906 |
|
|
907 |
case EFsEmailUiCmdActionsCall:
|
|
908 |
{
|
|
909 |
CallToFocusedItemL();
|
|
910 |
}
|
|
911 |
break;
|
|
912 |
// <cmail> video call
|
|
913 |
case EFsEmailUiCmdActionsCallVideo:
|
|
914 |
{
|
|
915 |
iVideoCall = ETrue;
|
|
916 |
CallToFocusedItemL();
|
|
917 |
}
|
|
918 |
break;
|
|
919 |
// </cmail>
|
|
920 |
case EFsEmailUiCmdActionsCreateMessage:
|
|
921 |
{
|
|
922 |
CreateMessageToFocusedItemL();
|
|
923 |
}
|
|
924 |
break;
|
|
925 |
|
|
926 |
case EFsEmailUiCmdComposeTo:
|
|
927 |
{
|
|
928 |
SendEmailToFocusedItemL();
|
|
929 |
}
|
|
930 |
break;
|
|
931 |
|
|
932 |
case EFsEmailUiCmdActionsContactDetails:
|
|
933 |
{
|
|
934 |
ShowContactDetailsForFocusedItemL();
|
|
935 |
}
|
|
936 |
break;
|
|
937 |
|
|
938 |
case EFsEmailUiCmdActionsAddContact:
|
|
939 |
{
|
|
940 |
AddFocusedItemToContactsL();
|
|
941 |
}
|
|
942 |
break;
|
|
943 |
|
|
944 |
case EFsEmailUiCmdActionsRemoteLookup:
|
|
945 |
{
|
|
946 |
LaunchRemoteLookupForFocusedItemL();
|
|
947 |
}
|
|
948 |
break;
|
|
949 |
|
|
950 |
case EFsEmailUiCmdHelp:
|
|
951 |
{
|
|
952 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
|
|
953 |
}
|
|
954 |
break;
|
|
955 |
|
|
956 |
case EFsEmailUiCmdExit:
|
|
957 |
{
|
|
958 |
//<cmail>
|
|
959 |
iTreeList->SetFocusedL(EFalse);
|
|
960 |
//</cmail>
|
|
961 |
iAppUi.Exit();
|
|
962 |
}
|
|
963 |
break;
|
|
964 |
|
|
965 |
case EFsEmailUiCmdActionsCollapseExpandAllToggle:
|
|
966 |
{
|
|
967 |
ShortcutCollapseExpandAllToggleL();
|
|
968 |
}
|
|
969 |
break;
|
|
970 |
|
|
971 |
case EFsEmailUiCmdGoToTop:
|
|
972 |
{
|
|
973 |
GoToTopL();
|
|
974 |
}
|
|
975 |
break;
|
|
976 |
|
|
977 |
case EFsEmailUiCmdGoToBottom:
|
|
978 |
{
|
|
979 |
GoToBottomL();
|
|
980 |
}
|
|
981 |
break;
|
|
982 |
|
|
983 |
case EFsEmailUiCmdPageUp:
|
|
984 |
{
|
|
985 |
TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 };
|
|
986 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
|
|
987 |
}
|
|
988 |
break;
|
|
989 |
|
|
990 |
case EFsEmailUiCmdPageDown:
|
|
991 |
{
|
|
992 |
TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 };
|
|
993 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey );
|
|
994 |
}
|
|
995 |
break;
|
|
996 |
|
|
997 |
default:
|
|
998 |
break;
|
|
999 |
}
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
|
|
1003 |
void CFSEmailUiMsgDetailsVisualiser::ClearMsgDetailsModelL()
|
|
1004 |
{
|
|
1005 |
FUNC_LOG;
|
|
1006 |
iTreeList->RemoveAllL();
|
|
1007 |
iModel->RemoveAll();
|
|
1008 |
|
|
1009 |
iNodeIds.Reset();
|
|
1010 |
iToNodeId = iCcNodeId = iBccNodeId = KFsTreeNoneID;
|
|
1011 |
}
|
|
1012 |
|
|
1013 |
void CFSEmailUiMsgDetailsVisualiser::UpdateMsgDetailsModelL()
|
|
1014 |
{
|
|
1015 |
FUNC_LOG;
|
|
1016 |
// If there are lots of items under some node, then the list drawing
|
|
1017 |
// might become very slow because of scroll bar updating. So we deny
|
|
1018 |
// the list refresh during the construction. List refresh is still
|
|
1019 |
// allowed in case of node insert, as there aren't that many nodes,
|
|
1020 |
// and it will keep the scroll bar roughly in the map.
|
|
1021 |
iAllowListRefreshInInsert = ETrue;
|
|
1022 |
iExpandAndHighlightNextNode = EFalse;
|
|
1023 |
|
|
1024 |
// Append lines to the model
|
|
1025 |
AppendFromLinesL();
|
|
1026 |
AppendSubjectLinesL();
|
|
1027 |
|
|
1028 |
if( iExpandCollapseMode == ECollapseAllExceptTo )
|
|
1029 |
{
|
|
1030 |
iExpandAndHighlightNextNode = ETrue;
|
|
1031 |
}
|
|
1032 |
AppendToLinesL();
|
|
1033 |
|
|
1034 |
if( iExpandCollapseMode == ECollapseAllExceptCc )
|
|
1035 |
{
|
|
1036 |
iExpandAndHighlightNextNode = ETrue;
|
|
1037 |
}
|
|
1038 |
AppendCcLinesL();
|
|
1039 |
|
|
1040 |
if( iExpandCollapseMode == ECollapseAllExceptBcc )
|
|
1041 |
{
|
|
1042 |
iExpandAndHighlightNextNode = ETrue;
|
|
1043 |
}
|
|
1044 |
AppendBccLinesL();
|
|
1045 |
AppendSizeLinesL();
|
|
1046 |
AppendSentLinesL();
|
|
1047 |
AppendPriorityLinesL();
|
|
1048 |
// Allow list (scroll bar) refresh for last item(s)
|
|
1049 |
//iAllowListRefreshInInsert = ETrue;
|
|
1050 |
AppendMessageTypeLinesL();
|
|
1051 |
}
|
|
1052 |
|
|
1053 |
void CFSEmailUiMsgDetailsVisualiser::CreateOneLinePlainItemLC2( const TDesC& aItemDataBuff,
|
|
1054 |
CFsTreePlainOneLineItemData* &aItemData,
|
|
1055 |
CFsTreePlainOneLineItemVisualizer* &aItemVisualizer )
|
|
1056 |
{
|
|
1057 |
FUNC_LOG;
|
|
1058 |
aItemData = CFsTreePlainOneLineItemData::NewL();
|
|
1059 |
CleanupStack::PushL( aItemData );
|
|
1060 |
aItemData->SetDataL( aItemDataBuff );
|
|
1061 |
|
|
1062 |
aItemVisualizer = CFsTreePlainOneLineItemVisualizer::NewL(*iTreeList->TreeControl());
|
|
1063 |
CleanupStack::PushL( aItemVisualizer );
|
|
1064 |
aItemVisualizer->SetExtendable( EFalse ); // One line items are obviously not extendable
|
|
1065 |
aItemVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EFolderLayout );
|
|
1066 |
|
|
1067 |
SetItemVisualizerCommonProperties( *aItemVisualizer );
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
void CFSEmailUiMsgDetailsVisualiser::CreateTwoLinePlainItemLC2( const TDesC& aPrimaryDataBuff,
|
|
1071 |
const TDesC& aSecondaryDataBuff,
|
|
1072 |
CFsTreePlainTwoLineItemData* &aItemData,
|
|
1073 |
CFsTreePlainTwoLineItemVisualizer* &aItemVisualizer )
|
|
1074 |
{
|
|
1075 |
FUNC_LOG;
|
|
1076 |
aItemData = CFsTreePlainTwoLineItemData::NewL();
|
|
1077 |
CleanupStack::PushL( aItemData );
|
|
1078 |
aItemData->SetDataL( aPrimaryDataBuff );
|
|
1079 |
aItemData->SetSecondaryDataL( aSecondaryDataBuff );
|
|
1080 |
|
|
1081 |
aItemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL(*iTreeList->TreeControl());
|
|
1082 |
CleanupStack::PushL( aItemVisualizer );
|
|
1083 |
aItemVisualizer->SetExtendable( ETrue ); // All two line items are extendable
|
|
1084 |
aItemVisualizer->SetMenu( NULL );
|
|
1085 |
aItemVisualizer->SetLayoutHints( CFsTreeItemVisualizerBase::EFolderLayout );
|
|
1086 |
|
|
1087 |
SetItemVisualizerCommonProperties( *aItemVisualizer );
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
void CFSEmailUiMsgDetailsVisualiser::SetItemVisualizerCommonProperties( MFsTreeItemVisualizer& aItemVisualizer )
|
|
1091 |
{
|
|
1092 |
FUNC_LOG;
|
|
1093 |
aItemVisualizer.SetSize(TSize(iScreenRect.Width(), iAppUi.LayoutHandler()->OneLineListItemHeight()));
|
|
1094 |
aItemVisualizer.SetExtendedSize(TSize(iScreenRect.Width(), iAppUi.LayoutHandler()->TwoLineListItemHeight()));
|
|
1095 |
|
|
1096 |
// Set correct skin text colors for the list items
|
|
1097 |
TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
|
|
1098 |
TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
|
|
1099 |
aItemVisualizer.SetFocusedStateTextColor( focusedColor );
|
|
1100 |
aItemVisualizer.SetNormalStateTextColor( normalColor );
|
|
1101 |
}
|
|
1102 |
|
|
1103 |
void CFSEmailUiMsgDetailsVisualiser::CreatePlainNodeLC2( const TDesC& aItemDataBuff,
|
|
1104 |
CFsTreePlainOneLineNodeData* &aItemData,
|
|
1105 |
CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer )
|
|
1106 |
{
|
|
1107 |
FUNC_LOG;
|
|
1108 |
aItemData = CFsTreePlainOneLineNodeData::NewL();
|
|
1109 |
CleanupStack::PushL( aItemData );
|
|
1110 |
|
|
1111 |
aItemData->SetDataL( aItemDataBuff );
|
|
1112 |
aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ) );
|
|
1113 |
aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed ) );
|
|
1114 |
|
|
1115 |
aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL(*iTreeList->TreeControl());
|
|
1116 |
CleanupStack::PushL( aNodeVisualizer );
|
|
1117 |
|
|
1118 |
SetNodeVisualizerProperties( *aNodeVisualizer );
|
|
1119 |
|
|
1120 |
// Gradient background for headings
|
|
1121 |
CAlfBrush *titleDividerBgBrush = iAppUi.FsTextureManager()->TitleDividerBgBrushL();
|
|
1122 |
aNodeVisualizer->SetBackgroundBrush( titleDividerBgBrush );
|
|
1123 |
}
|
|
1124 |
|
|
1125 |
void CFSEmailUiMsgDetailsVisualiser::SetNodeVisualizerProperties( MFsTreeItemVisualizer& aNodeVisualizer )
|
|
1126 |
{
|
|
1127 |
FUNC_LOG;
|
|
1128 |
aNodeVisualizer.SetSize(TSize(iScreenRect.Width(), iListNodeHeight));
|
|
1129 |
|
|
1130 |
// Set correct skin text colors for the list items
|
|
1131 |
TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
|
|
1132 |
TRgb normalColor = iAppUi.LayoutHandler()->ListNodeTextColor();
|
|
1133 |
aNodeVisualizer.SetFocusedStateTextColor( focusedColor );
|
|
1134 |
aNodeVisualizer.SetNormalStateTextColor( normalColor );
|
|
1135 |
|
|
1136 |
// Set font size
|
|
1137 |
aNodeVisualizer.SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
|
|
1138 |
// Set node bolded
|
|
1139 |
aNodeVisualizer.SetTextBold( ETrue );
|
|
1140 |
|
|
1141 |
// Temporary fix for EASV-7GJFVD
|
|
1142 |
//aNodeVisualizer.SetBackgroundColorL( iAppUi.LayoutHandler()->ListNodeBackgroundColor() );
|
|
1143 |
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendHeadingToListL( TInt aResourceId )
|
|
1147 |
{
|
|
1148 |
FUNC_LOG;
|
|
1149 |
CFsTreePlainOneLineNodeData* plainNodeData;
|
|
1150 |
CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer;
|
|
1151 |
|
|
1152 |
HBufC* headingText = StringLoader::LoadLC( aResourceId );
|
|
1153 |
|
|
1154 |
CreatePlainNodeLC2( *headingText, plainNodeData, plainNodeVisualizer );
|
|
1155 |
|
|
1156 |
TFsTreeItemId nodeId = iTreeList->InsertNodeL( *plainNodeData, *plainNodeVisualizer, KFsTreeRootID);
|
|
1157 |
CleanupStack::Pop( 2 ); // plainNodeData & plainNodeVisualizer
|
|
1158 |
|
|
1159 |
// Set the node expanded/collapsed according to the member variables
|
|
1160 |
if( nodeId != KFsTreeNoneID ) // Safety check
|
|
1161 |
{
|
|
1162 |
if( iExpandCollapseMode == EExpandAll )
|
|
1163 |
{
|
|
1164 |
// The "normal" case, expand all and keep the first one highlighted
|
|
1165 |
iTreeList->ExpandNodeL( nodeId );
|
|
1166 |
}
|
|
1167 |
else if( iExpandAndHighlightNextNode )
|
|
1168 |
{
|
|
1169 |
// View opened to To, Cc or Bcc field and we just added the
|
|
1170 |
// corresponding node, so expand and focus it
|
|
1171 |
iTreeList->ExpandNodeL( nodeId );
|
|
1172 |
iTreeVisualizer->SetFocusedItemL( nodeId );
|
|
1173 |
}
|
|
1174 |
else
|
|
1175 |
{
|
|
1176 |
// View opened to To, Cc or Bcc field but we added some other
|
|
1177 |
// node, so collapse it
|
|
1178 |
iTreeList->CollapseNodeL( nodeId );
|
|
1179 |
}
|
|
1180 |
}
|
|
1181 |
// Reset the node expanding and highlighting flag
|
|
1182 |
iExpandAndHighlightNextNode = EFalse;
|
|
1183 |
|
|
1184 |
CleanupStack::PopAndDestroy(headingText);
|
|
1185 |
|
|
1186 |
return nodeId;
|
|
1187 |
}
|
|
1188 |
|
|
1189 |
TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendOneLineItemToListL( const TDesC& aItemData, TFsTreeItemId aParentNode )
|
|
1190 |
{
|
|
1191 |
FUNC_LOG;
|
|
1192 |
CFsTreePlainOneLineItemData* plainItemData;
|
|
1193 |
CFsTreePlainOneLineItemVisualizer* plainItemVisualizer;
|
|
1194 |
|
|
1195 |
CreateOneLinePlainItemLC2( aItemData, plainItemData, plainItemVisualizer );
|
|
1196 |
|
|
1197 |
TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert );
|
|
1198 |
CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer
|
|
1199 |
|
|
1200 |
return itemId;
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendTwoLineItemToListL( const TDesC& aPrimaryDataBuff,
|
|
1204 |
const TDesC& aSecondaryDataBuff,
|
|
1205 |
TFsTreeItemId aParentNode,
|
|
1206 |
TBool aItemHasActionMenu /*= EFalse*/ )
|
|
1207 |
{
|
|
1208 |
FUNC_LOG;
|
|
1209 |
CFsTreePlainTwoLineItemData* plainItemData;
|
|
1210 |
CFsTreePlainTwoLineItemVisualizer* plainItemVisualizer;
|
|
1211 |
|
|
1212 |
CreateTwoLinePlainItemLC2( aPrimaryDataBuff, aSecondaryDataBuff, plainItemData, plainItemVisualizer );
|
|
1213 |
|
|
1214 |
if ( aItemHasActionMenu )
|
|
1215 |
{
|
|
1216 |
plainItemVisualizer->SetFlags( plainItemVisualizer->Flags() | KFsTreeListItemHasMenu );
|
|
1217 |
}
|
|
1218 |
|
|
1219 |
plainItemVisualizer->SetFlags(plainItemVisualizer->Flags() & ~KFsTreeListItemManagedLayout);
|
|
1220 |
|
|
1221 |
TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert );
|
|
1222 |
CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer
|
|
1223 |
|
|
1224 |
return itemId;
|
|
1225 |
}
|
|
1226 |
|
|
1227 |
TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::AppendDateTimeItemToListL( const TDesC& aPrimaryDataBuff,
|
|
1228 |
const TDesC& aSecondaryDataBuff,
|
|
1229 |
const TDesC& aDateTimeDataBuff,
|
|
1230 |
TFsTreeItemId aParentNode )
|
|
1231 |
{
|
|
1232 |
FUNC_LOG;
|
|
1233 |
CFsTreePlainTwoLineItemData* plainItemData;
|
|
1234 |
CFsTreePlainTwoLineItemVisualizer* plainItemVisualizer;
|
|
1235 |
|
|
1236 |
CreateTwoLinePlainItemLC2( aPrimaryDataBuff, aSecondaryDataBuff, plainItemData, plainItemVisualizer );
|
|
1237 |
|
|
1238 |
plainItemData->SetDateTimeDataL( aDateTimeDataBuff );
|
|
1239 |
plainItemVisualizer->SetExtendable( EFalse );
|
|
1240 |
|
|
1241 |
TFsTreeItemId itemId = iTreeList->InsertItemL( *plainItemData, *plainItemVisualizer, aParentNode, KErrNotFound, iAllowListRefreshInInsert );
|
|
1242 |
CleanupStack::Pop( 2 ); // plainItemData & plainItemVisualizer
|
|
1243 |
|
|
1244 |
return itemId;
|
|
1245 |
}
|
|
1246 |
|
|
1247 |
TBool CFSEmailUiMsgDetailsVisualiser::GetDisplayNameAndEmailAddressL( CFSMailAddress* aAddressData, TDesC* &aDisplayName, TDesC* &aEmailAddress )
|
|
1248 |
{
|
|
1249 |
FUNC_LOG;
|
|
1250 |
aDisplayName = &aAddressData->GetDisplayName();
|
|
1251 |
aEmailAddress = &aAddressData->GetEmailAddress();
|
|
1252 |
TInt notFoundCount(0);
|
|
1253 |
|
|
1254 |
// If display name is not set, then the plugins seem to set it to be same
|
|
1255 |
// as email address. So there's no safe way to know wheter the display name
|
|
1256 |
// is set or not. Best quess is that if display name is the same as email
|
|
1257 |
// address, then there are no display name available.
|
|
1258 |
if ( !aDisplayName || ( aDisplayName->Length() == 0 ) || ( *aDisplayName == *aEmailAddress ) )
|
|
1259 |
{
|
|
1260 |
// Internal variable used to store the text to avoid problems with ownership handling
|
|
1261 |
if( !iNoDisplayNameAvailableText )
|
|
1262 |
{
|
|
1263 |
iNoDisplayNameAvailableText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_DISPLAY_NAME );
|
|
1264 |
}
|
|
1265 |
|
|
1266 |
aDisplayName = iNoDisplayNameAvailableText;
|
|
1267 |
notFoundCount++;
|
|
1268 |
}
|
|
1269 |
if ( !aEmailAddress || ( aEmailAddress->Length() == 0 ) )
|
|
1270 |
{
|
|
1271 |
// Internal variable used to store the text to avoid problems with ownership handling
|
|
1272 |
if( !iNoEmailAddressAvailableText )
|
|
1273 |
{
|
|
1274 |
iNoEmailAddressAvailableText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_EMAIL_ADDRESS );
|
|
1275 |
}
|
|
1276 |
|
|
1277 |
aEmailAddress = iNoEmailAddressAvailableText;
|
|
1278 |
notFoundCount++;
|
|
1279 |
}
|
|
1280 |
|
|
1281 |
// If both display name and email address are empty, return EFalse
|
|
1282 |
if( notFoundCount > 1 )
|
|
1283 |
{
|
|
1284 |
return EFalse;
|
|
1285 |
}
|
|
1286 |
else
|
|
1287 |
{
|
|
1288 |
return ETrue;
|
|
1289 |
}
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
void CFSEmailUiMsgDetailsVisualiser::AppendFromLinesL()
|
|
1293 |
{
|
|
1294 |
FUNC_LOG;
|
|
1295 |
TFsTreeItemId nodeId;
|
|
1296 |
if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
|
|
1297 |
{
|
|
1298 |
nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_ORGANIZER );
|
|
1299 |
}
|
|
1300 |
else
|
|
1301 |
{
|
|
1302 |
nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_FROM );
|
|
1303 |
}
|
|
1304 |
iNodeIds.Append( nodeId );
|
|
1305 |
|
|
1306 |
CFSMailAddress* fromAddress = iViewedMsg->GetSender();
|
|
1307 |
// If CFSMailAddress not available, show "No sender info available"
|
|
1308 |
if( fromAddress == NULL )
|
|
1309 |
{
|
|
1310 |
HBufC* noSender = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE );
|
|
1311 |
AppendOneLineItemToListL( *noSender, nodeId );
|
|
1312 |
CleanupStack::PopAndDestroy( noSender );
|
|
1313 |
}
|
|
1314 |
else
|
|
1315 |
{
|
|
1316 |
TDesC* displayName( NULL );
|
|
1317 |
TDesC* emailAddress( NULL );
|
|
1318 |
if( GetDisplayNameAndEmailAddressL( fromAddress, displayName, emailAddress ) )
|
|
1319 |
{
|
|
1320 |
TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, nodeId, ETrue );
|
|
1321 |
iModel->AppendL( itemId, fromAddress );
|
|
1322 |
}
|
|
1323 |
else
|
|
1324 |
{
|
|
1325 |
HBufC* noSender = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE );
|
|
1326 |
AppendOneLineItemToListL( *noSender, nodeId );
|
|
1327 |
CleanupStack::PopAndDestroy( noSender );
|
|
1328 |
}
|
|
1329 |
}
|
|
1330 |
}
|
|
1331 |
|
|
1332 |
void CFSEmailUiMsgDetailsVisualiser::AppendSubjectLinesL()
|
|
1333 |
{
|
|
1334 |
FUNC_LOG;
|
|
1335 |
TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SUBJECT );
|
|
1336 |
iNodeIds.Append( nodeId );
|
|
1337 |
|
|
1338 |
TDesC* subject = &iViewedMsg->GetSubject();
|
|
1339 |
if ( subject == NULL || subject->Length() <= 0 )
|
|
1340 |
{
|
|
1341 |
HBufC* noSubject = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SUBJECT );
|
|
1342 |
AppendOneLineItemToListL( *noSubject, nodeId );
|
|
1343 |
CleanupStack::PopAndDestroy( noSubject );
|
|
1344 |
}
|
|
1345 |
else
|
|
1346 |
{
|
|
1347 |
HBufC* subjectText = TFsEmailUiUtility::CreateSubjectTextLC( iViewedMsg );
|
|
1348 |
TFsTreeItemId itemId = AppendOneLineItemToListL( *subjectText, nodeId );
|
|
1349 |
CleanupStack::PopAndDestroy( subjectText );
|
|
1350 |
iModel->AppendL( itemId, subject );
|
|
1351 |
}
|
|
1352 |
}
|
|
1353 |
|
|
1354 |
// Duplicate code in AppendToLinesL/AppendCcLinesL/AppendBccLinesL, create
|
|
1355 |
// one generic function that can be used from all of these functions
|
|
1356 |
void CFSEmailUiMsgDetailsVisualiser::AppendToLinesL()
|
|
1357 |
{
|
|
1358 |
FUNC_LOG;
|
|
1359 |
if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
|
|
1360 |
{
|
|
1361 |
iToNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_REQUIRED );
|
|
1362 |
}
|
|
1363 |
else
|
|
1364 |
{
|
|
1365 |
iToNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_TO );
|
|
1366 |
}
|
|
1367 |
iNodeIds.Append( iToNodeId );
|
|
1368 |
|
|
1369 |
RPointerArray<CFSMailAddress>& toArray = iViewedMsg->GetToRecipients();
|
|
1370 |
TInt toArrayCount = toArray.Count();
|
|
1371 |
if ( toArrayCount )
|
|
1372 |
{
|
|
1373 |
for ( TInt i=0 ; i<toArrayCount ; i++ )
|
|
1374 |
{
|
|
1375 |
CFSMailAddress* toAddress = toArray[i];
|
|
1376 |
if( toAddress )
|
|
1377 |
{
|
|
1378 |
TDesC* displayName( NULL );
|
|
1379 |
TDesC* emailAddress( NULL );
|
|
1380 |
TBool toNameFound = GetDisplayNameAndEmailAddressL( toAddress, displayName, emailAddress );
|
|
1381 |
|
|
1382 |
TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iToNodeId, toNameFound );
|
|
1383 |
iModel->AppendL( itemId, toAddress );
|
|
1384 |
}
|
|
1385 |
}
|
|
1386 |
}
|
|
1387 |
else
|
|
1388 |
{
|
|
1389 |
//Laske To- ja Cc-vastaanottajat yhteensä ja näytä tämä vain jos kumpiakaan ei ole yhtään
|
|
1390 |
HBufC* noToText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_VISIBLE_RECIPIENTS );
|
|
1391 |
AppendOneLineItemToListL( *noToText, iToNodeId );
|
|
1392 |
CleanupStack::PopAndDestroy( noToText );
|
|
1393 |
}
|
|
1394 |
}
|
|
1395 |
|
|
1396 |
void CFSEmailUiMsgDetailsVisualiser::AppendCcLinesL()
|
|
1397 |
{
|
|
1398 |
FUNC_LOG;
|
|
1399 |
RPointerArray<CFSMailAddress>& ccArray = iViewedMsg->GetCCRecipients();
|
|
1400 |
TInt ccArrayCount = ccArray.Count();
|
|
1401 |
|
|
1402 |
if ( ccArrayCount )
|
|
1403 |
{
|
|
1404 |
if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
|
|
1405 |
{
|
|
1406 |
iCcNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_OPTIONAL );
|
|
1407 |
}
|
|
1408 |
else
|
|
1409 |
{
|
|
1410 |
iCcNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_CC );
|
|
1411 |
}
|
|
1412 |
iNodeIds.Append( iCcNodeId );
|
|
1413 |
|
|
1414 |
for ( TInt i=0 ; i<ccArrayCount ; i++ )
|
|
1415 |
{
|
|
1416 |
CFSMailAddress* ccAddress = ccArray[i];
|
|
1417 |
if( ccAddress )
|
|
1418 |
{
|
|
1419 |
TDesC* displayName( NULL );
|
|
1420 |
TDesC* emailAddress( NULL );
|
|
1421 |
TBool ccNameFound = GetDisplayNameAndEmailAddressL( ccAddress, displayName, emailAddress );
|
|
1422 |
|
|
1423 |
TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iCcNodeId, ccNameFound );
|
|
1424 |
iModel->AppendL( itemId, ccAddress );
|
|
1425 |
}
|
|
1426 |
}
|
|
1427 |
}
|
|
1428 |
}
|
|
1429 |
|
|
1430 |
void CFSEmailUiMsgDetailsVisualiser::AppendBccLinesL()
|
|
1431 |
{
|
|
1432 |
FUNC_LOG;
|
|
1433 |
// Get message's parent folder
|
|
1434 |
TFSMailMsgId folderId = iViewedMsg->GetFolderId();
|
|
1435 |
TFSMailMsgId mailboxId = iViewedMsg->GetMailBoxId();
|
|
1436 |
CFSMailFolder* folder = iAppUi.GetMailClient()->GetFolderByUidL( mailboxId, folderId );
|
|
1437 |
|
|
1438 |
// Show bcc field only if message's parent folder is some outgoing folder,
|
|
1439 |
// so basically outbox, drafts or sent items.
|
|
1440 |
TBool showBcc( EFalse );
|
|
1441 |
if( folder )
|
|
1442 |
{
|
|
1443 |
TInt folderType = folder->GetFolderType();
|
|
1444 |
|
|
1445 |
switch( folderType )
|
|
1446 |
{
|
|
1447 |
case EFSOutbox:
|
|
1448 |
case EFSDraftsFolder:
|
|
1449 |
case EFSSentFolder:
|
|
1450 |
{
|
|
1451 |
showBcc = ETrue;
|
|
1452 |
}
|
|
1453 |
break;
|
|
1454 |
|
|
1455 |
case EFSInbox:
|
|
1456 |
case EFSDeleted:
|
|
1457 |
default:
|
|
1458 |
break;
|
|
1459 |
}
|
|
1460 |
}
|
|
1461 |
delete folder;
|
|
1462 |
|
|
1463 |
if( showBcc )
|
|
1464 |
{
|
|
1465 |
RPointerArray<CFSMailAddress>& bccArray = iViewedMsg->GetBCCRecipients();
|
|
1466 |
TInt bccArrayCount = bccArray.Count();
|
|
1467 |
|
|
1468 |
if ( bccArrayCount )
|
|
1469 |
{
|
|
1470 |
iBccNodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_BCC );
|
|
1471 |
iNodeIds.Append( iBccNodeId );
|
|
1472 |
|
|
1473 |
for ( TInt i=0 ; i<bccArrayCount ; i++ )
|
|
1474 |
{
|
|
1475 |
CFSMailAddress* bccAddress = bccArray[i];
|
|
1476 |
if( bccAddress )
|
|
1477 |
{
|
|
1478 |
TDesC* displayName( NULL );
|
|
1479 |
TDesC* emailAddress( NULL );
|
|
1480 |
TBool bccNameFound = GetDisplayNameAndEmailAddressL( bccAddress, displayName, emailAddress );
|
|
1481 |
|
|
1482 |
TFsTreeItemId itemId = AppendTwoLineItemToListL( *displayName, *emailAddress, iBccNodeId, bccNameFound );
|
|
1483 |
iModel->AppendL( itemId, bccAddress );
|
|
1484 |
}
|
|
1485 |
}
|
|
1486 |
}
|
|
1487 |
}
|
|
1488 |
}
|
|
1489 |
|
|
1490 |
void CFSEmailUiMsgDetailsVisualiser::AppendSizeLinesL()
|
|
1491 |
{
|
|
1492 |
FUNC_LOG;
|
|
1493 |
TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SIZE_HEADER );
|
|
1494 |
iNodeIds.Append( nodeId );
|
|
1495 |
|
|
1496 |
// Gets the full content size (in bytes)
|
|
1497 |
TUint msgSize = iViewedMsg->ContentSize();
|
|
1498 |
|
|
1499 |
HBufC* sizeText = TFsEmailUiUtility::CreateSizeDescLC( msgSize, ETrue );
|
|
1500 |
|
|
1501 |
AppendOneLineItemToListL( *sizeText, nodeId );
|
|
1502 |
CleanupStack::PopAndDestroy( sizeText );
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
void CFSEmailUiMsgDetailsVisualiser::AppendSentLinesL()
|
|
1506 |
{
|
|
1507 |
FUNC_LOG;
|
|
1508 |
TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_SENT );
|
|
1509 |
iNodeIds.Append( nodeId );
|
|
1510 |
|
|
1511 |
HBufC* dateFromMsg = TFsEmailUiUtility::DateTextFromMsgLC( iViewedMsg );
|
|
1512 |
HBufC* dateText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_DATE_U, *dateFromMsg );
|
|
1513 |
|
|
1514 |
AppendOneLineItemToListL( *dateText, nodeId );
|
|
1515 |
|
|
1516 |
CleanupStack::PopAndDestroy( dateText );
|
|
1517 |
CleanupStack::PopAndDestroy( dateFromMsg );
|
|
1518 |
|
|
1519 |
//////////////////////////
|
|
1520 |
HBufC* timeFromMsg = TFsEmailUiUtility::TimeTextFromMsgLC( iViewedMsg );
|
|
1521 |
HBufC* timeText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_TIME_U, *timeFromMsg );
|
|
1522 |
|
|
1523 |
AppendOneLineItemToListL( *timeText, nodeId );
|
|
1524 |
|
|
1525 |
CleanupStack::PopAndDestroy( timeText );
|
|
1526 |
CleanupStack::PopAndDestroy( timeFromMsg );
|
|
1527 |
}
|
|
1528 |
|
|
1529 |
void CFSEmailUiMsgDetailsVisualiser::AppendPriorityLinesL()
|
|
1530 |
{
|
|
1531 |
FUNC_LOG;
|
|
1532 |
TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY );
|
|
1533 |
iNodeIds.Append( nodeId );
|
|
1534 |
|
|
1535 |
HBufC* priorityText( NULL );
|
|
1536 |
if ( iViewedMsg->IsFlagSet( EFSMsgFlag_Important ) )
|
|
1537 |
{
|
|
1538 |
priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_HIGH );
|
|
1539 |
}
|
|
1540 |
else if ( iViewedMsg->IsFlagSet( EFSMsgFlag_Low ) )
|
|
1541 |
{
|
|
1542 |
priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_LOW );
|
|
1543 |
}
|
|
1544 |
else
|
|
1545 |
{
|
|
1546 |
priorityText = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_PRIORITY_NORMAL );
|
|
1547 |
}
|
|
1548 |
|
|
1549 |
CleanupStack::PushL( priorityText );
|
|
1550 |
AppendOneLineItemToListL( *priorityText, nodeId );
|
|
1551 |
CleanupStack::PopAndDestroy( priorityText );
|
|
1552 |
}
|
|
1553 |
|
|
1554 |
void CFSEmailUiMsgDetailsVisualiser::AppendMessageTypeLinesL()
|
|
1555 |
{
|
|
1556 |
FUNC_LOG;
|
|
1557 |
TFsTreeItemId nodeId = AppendHeadingToListL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE );
|
|
1558 |
iNodeIds.Append( nodeId );
|
|
1559 |
|
|
1560 |
HBufC* msgType;
|
|
1561 |
if( iViewedMsg->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
|
|
1562 |
{
|
|
1563 |
msgType = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE_MEETING );
|
|
1564 |
}
|
|
1565 |
else
|
|
1566 |
{
|
|
1567 |
msgType = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_MSG_TYPE_EMAIL );
|
|
1568 |
}
|
|
1569 |
|
|
1570 |
AppendOneLineItemToListL( *msgType, nodeId );
|
|
1571 |
CleanupStack::PopAndDestroy( msgType );
|
|
1572 |
}
|
|
1573 |
|
|
1574 |
void CFSEmailUiMsgDetailsVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType /*aType*/ )
|
|
1575 |
{
|
|
1576 |
FUNC_LOG;
|
|
1577 |
if ( iFirstStartCompleted ) // Safety
|
|
1578 |
{
|
|
1579 |
iTreeList->HideListL();
|
|
1580 |
UpdateListSizeAttributes();
|
|
1581 |
iParentLayout->SetRect( iScreenRect );
|
|
1582 |
for ( TInt i = 0; i < iNodeIds.Count(); i++ )
|
|
1583 |
{
|
|
1584 |
MFsTreeItemVisualizer& vis = iTreeList->ItemVisualizer( iNodeIds[i] );
|
|
1585 |
SetNodeVisualizerProperties( vis );
|
|
1586 |
SetChildVisualizersProperties( iNodeIds[i] );
|
|
1587 |
}
|
|
1588 |
iTreeList->ShowListL();
|
|
1589 |
}
|
|
1590 |
}
|
|
1591 |
|
|
1592 |
// ---------------------------------------------------------------------------
|
|
1593 |
// Sets tree item visualizer properties for all the childs of the given node
|
|
1594 |
// ---------------------------------------------------------------------------
|
|
1595 |
//
|
|
1596 |
void CFSEmailUiMsgDetailsVisualiser::SetChildVisualizersProperties( TFsTreeItemId aNodeId )
|
|
1597 |
{
|
|
1598 |
FUNC_LOG;
|
|
1599 |
TUint childrenCount = iTreeList->CountChildren( aNodeId );
|
|
1600 |
for( TInt i = 0; i < childrenCount; ++i )
|
|
1601 |
{
|
|
1602 |
TFsTreeItemId childId = iTreeList->Child( aNodeId, i );
|
|
1603 |
MFsTreeItemVisualizer& vis = iTreeList->ItemVisualizer( childId );
|
|
1604 |
SetItemVisualizerCommonProperties( vis );
|
|
1605 |
}
|
|
1606 |
}
|
|
1607 |
|
|
1608 |
// ---------------------------------------------------------------------------
|
|
1609 |
// Update list size members variables
|
|
1610 |
// ---------------------------------------------------------------------------
|
|
1611 |
//
|
|
1612 |
void CFSEmailUiMsgDetailsVisualiser::UpdateListSizeAttributes()
|
|
1613 |
{
|
|
1614 |
FUNC_LOG;
|
|
1615 |
if ( iFirstStartCompleted ) // Safety
|
|
1616 |
{
|
|
1617 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, iScreenRect );
|
|
1618 |
iScreenRect.SetRect( 0, 0, iScreenRect.Width(), iScreenRect.Height() );
|
|
1619 |
|
|
1620 |
|
|
1621 |
iListNodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight();
|
|
1622 |
}
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
// ---------------------------------------------------------------------------
|
|
1626 |
// Collapse nodes except the specified one (used when starting the list in
|
|
1627 |
// specific loaction)
|
|
1628 |
// ---------------------------------------------------------------------------
|
|
1629 |
//
|
|
1630 |
void CFSEmailUiMsgDetailsVisualiser::CollapseNodesExceptL( TFsTreeItemId aExcludedNode )
|
|
1631 |
{
|
|
1632 |
FUNC_LOG;
|
|
1633 |
for( TInt i = 0; i < iNodeIds.Count(); i++ )
|
|
1634 |
{
|
|
1635 |
if( iNodeIds[i] != aExcludedNode )
|
|
1636 |
{
|
|
1637 |
iTreeList->CollapseNodeL( iNodeIds[i] );
|
|
1638 |
}
|
|
1639 |
}
|
|
1640 |
}
|
|
1641 |
|
|
1642 |
// ---------------------------------------------------------------------------
|
|
1643 |
// If there is one or more expanded nodes, collapses all nodes.
|
|
1644 |
// Otherwise expands all nodes.
|
|
1645 |
// ---------------------------------------------------------------------------
|
|
1646 |
//
|
|
1647 |
void CFSEmailUiMsgDetailsVisualiser::ShortcutCollapseExpandAllToggleL()
|
|
1648 |
{
|
|
1649 |
FUNC_LOG;
|
|
1650 |
TBool collapseAllNodes( EFalse );
|
|
1651 |
for( TInt i=0 ; i<iNodeIds.Count() ; i++ )
|
|
1652 |
{
|
|
1653 |
if( iTreeList->IsExpanded( iNodeIds[i] ) )
|
|
1654 |
{
|
|
1655 |
collapseAllNodes = ETrue;
|
|
1656 |
break;
|
|
1657 |
}
|
|
1658 |
}
|
|
1659 |
|
|
1660 |
if( collapseAllNodes )
|
|
1661 |
{
|
|
1662 |
HandleCommandL( EFsEmailUiCmdActionsCollapseAll );
|
|
1663 |
}
|
|
1664 |
else
|
|
1665 |
{
|
|
1666 |
HandleCommandL( EFsEmailUiCmdActionsExpandAll );
|
|
1667 |
}
|
|
1668 |
}
|
|
1669 |
|
|
1670 |
// ---------------------------------------------------------------------------
|
|
1671 |
// Moves the focus to the topmost item
|
|
1672 |
// ---------------------------------------------------------------------------
|
|
1673 |
//
|
|
1674 |
void CFSEmailUiMsgDetailsVisualiser::GoToTopL()
|
|
1675 |
{
|
|
1676 |
FUNC_LOG;
|
|
1677 |
if ( iNodeIds.Count() )
|
|
1678 |
{
|
|
1679 |
TFsTreeItemId topId = iNodeIds[0];
|
|
1680 |
iTreeVisualizer->SetFocusedItemL( topId );
|
|
1681 |
}
|
|
1682 |
}
|
|
1683 |
|
|
1684 |
// ---------------------------------------------------------------------------
|
|
1685 |
// Moves the focus to the bottommost item
|
|
1686 |
// ---------------------------------------------------------------------------
|
|
1687 |
//
|
|
1688 |
void CFSEmailUiMsgDetailsVisualiser::GoToBottomL()
|
|
1689 |
{
|
|
1690 |
FUNC_LOG;
|
|
1691 |
if ( iNodeIds.Count() )
|
|
1692 |
{
|
|
1693 |
TFsTreeItemId bottomId = iNodeIds[ iNodeIds.Count()-1 ];
|
|
1694 |
TInt childCount = iTreeList->CountChildren(bottomId);
|
|
1695 |
if ( childCount && iTreeList->IsExpanded(bottomId) )
|
|
1696 |
{
|
|
1697 |
// Focus the last child of the bottom node if the node is expanded.
|
|
1698 |
bottomId = iTreeList->Child( bottomId, childCount-1 );
|
|
1699 |
}
|
|
1700 |
iTreeVisualizer->SetFocusedItemL( bottomId );
|
|
1701 |
}
|
|
1702 |
}
|
|
1703 |
|
|
1704 |
|
|
1705 |
// ---------------------------------------------------------------------------
|
|
1706 |
// Recursive function to get the root parent of given item
|
|
1707 |
// ---------------------------------------------------------------------------
|
|
1708 |
//
|
|
1709 |
TFsTreeItemId CFSEmailUiMsgDetailsVisualiser::GetRootParent( const TFsTreeItemId aItemId ) const
|
|
1710 |
{
|
|
1711 |
FUNC_LOG;
|
|
1712 |
TFsTreeItemId parentId = iTreeList->Parent( aItemId );
|
|
1713 |
// If current item's parent is KFsTreeRootID, return its id
|
|
1714 |
if( parentId == KFsTreeRootID || parentId == KFsTreeNoneID )
|
|
1715 |
{
|
|
1716 |
return aItemId;
|
|
1717 |
}
|
|
1718 |
else
|
|
1719 |
{
|
|
1720 |
// Get the root parent recursively
|
|
1721 |
return GetRootParent( parentId );
|
|
1722 |
}
|
|
1723 |
}
|
|
1724 |
|
|
1725 |
|
|
1726 |
// ---------------------------------------------------------------------------
|
|
1727 |
// Tells if all expandable nodes are collapsed
|
|
1728 |
// ---------------------------------------------------------------------------
|
|
1729 |
//
|
|
1730 |
TBool CFSEmailUiMsgDetailsVisualiser::AllNodesCollapsed() const
|
|
1731 |
{
|
|
1732 |
FUNC_LOG;
|
|
1733 |
TFsTreeItemId itemId = KFsTreeNoneID;
|
|
1734 |
TInt count = iTreeList->CountChildren(KFsTreeRootID);
|
|
1735 |
|
|
1736 |
// If top level is collapsed, then everything is collapsed. There's no need
|
|
1737 |
// to crawl any deeper in the tree hierarchy.
|
|
1738 |
for ( TInt i=0 ; i<count ; ++i )
|
|
1739 |
{
|
|
1740 |
itemId = iTreeList->Child( KFsTreeRootID, i );
|
|
1741 |
if ( iTreeList->IsNode(itemId) &&
|
|
1742 |
iTreeList->IsExpanded(itemId) )
|
|
1743 |
{
|
|
1744 |
return EFalse;
|
|
1745 |
}
|
|
1746 |
}
|
|
1747 |
|
|
1748 |
return ETrue;
|
|
1749 |
}
|
|
1750 |
|
|
1751 |
// ---------------------------------------------------------------------------
|
|
1752 |
// Tells if all expandable nodes are expanded
|
|
1753 |
// ---------------------------------------------------------------------------
|
|
1754 |
//
|
|
1755 |
TBool CFSEmailUiMsgDetailsVisualiser::AllNodesExpanded( TFsTreeItemId aParentNodeId ) const
|
|
1756 |
{
|
|
1757 |
FUNC_LOG;
|
|
1758 |
// We must crawl through the whole tree to see, if there are any collapsed nodes
|
|
1759 |
// at any level. We do this with recursive depth-first-search.
|
|
1760 |
|
|
1761 |
TFsTreeItemId itemId = KFsTreeNoneID;
|
|
1762 |
TInt count = iTreeList->CountChildren(aParentNodeId);
|
|
1763 |
|
|
1764 |
for ( TInt i=0 ; i<count ; ++i )
|
|
1765 |
{
|
|
1766 |
itemId = iTreeList->Child( aParentNodeId, i );
|
|
1767 |
if ( iTreeList->IsNode(itemId) )
|
|
1768 |
{
|
|
1769 |
if ( !iTreeList->IsExpanded(itemId) ||
|
|
1770 |
!AllNodesExpanded(itemId) )
|
|
1771 |
{
|
|
1772 |
return EFalse;
|
|
1773 |
}
|
|
1774 |
}
|
|
1775 |
}
|
|
1776 |
|
|
1777 |
return ETrue;
|
|
1778 |
}
|
|
1779 |
|
|
1780 |
// <cmail> Touch
|
|
1781 |
// ---------------------------------------------------------------------------
|
|
1782 |
// Process a treelist event
|
|
1783 |
// ---------------------------------------------------------------------------
|
|
1784 |
//
|
|
1785 |
void CFSEmailUiMsgDetailsVisualiser::TreeListEventL( const TFsTreeListEvent aEvent,
|
|
1786 |
const TFsTreeItemId /*aId*/,
|
|
1787 |
const TPoint& /*aPoint*/ )
|
|
1788 |
{
|
|
1789 |
switch (aEvent)
|
|
1790 |
{
|
|
1791 |
case EFsTreeListItemTouchAction:
|
|
1792 |
{
|
|
1793 |
if (TFsTreeItemId focId1 = iTreeList->FocusedItem())
|
|
1794 |
{
|
|
1795 |
if (iTreeList->IsNode(focId1))
|
|
1796 |
{
|
|
1797 |
if (iTreeList->IsExpanded(focId1))
|
|
1798 |
{
|
|
1799 |
HandleCommandL(EFsEmailUiCmdCollapse);
|
|
1800 |
}
|
|
1801 |
else
|
|
1802 |
{
|
|
1803 |
HandleCommandL(EFsEmailUiCmdExpand);
|
|
1804 |
}
|
|
1805 |
}
|
|
1806 |
else
|
|
1807 |
{
|
|
1808 |
SendEmailToFocusedItemL();
|
|
1809 |
}
|
|
1810 |
}
|
|
1811 |
break;
|
|
1812 |
}
|
|
1813 |
case EFsTreeListItemTouchLongTap:
|
|
1814 |
{
|
|
1815 |
// Show action toolbar if the item has action menu.
|
|
1816 |
if( HasFocusedItemActionMenu() )
|
|
1817 |
{
|
|
1818 |
LaunchActionMenuL();
|
|
1819 |
}
|
|
1820 |
break;
|
|
1821 |
}
|
|
1822 |
case EFsTreeListItemWillGetFocused:
|
|
1823 |
{
|
|
1824 |
SetMskL();
|
|
1825 |
break;
|
|
1826 |
}
|
|
1827 |
}
|
|
1828 |
}
|
|
1829 |
|
|
1830 |
|
|
1831 |
TPoint CFSEmailUiMsgDetailsVisualiser::ActionMenuPosition()
|
|
1832 |
{
|
|
1833 |
TAlfRealRect focusRect;
|
|
1834 |
TFsTreeItemId listItemId = iTreeList->FocusedItem();
|
|
1835 |
iTreeList->GetItemDisplayRectTarget(listItemId, focusRect);
|
|
1836 |
return focusRect.iTl;
|
|
1837 |
}
|
|
1838 |
// </cmail>
|
|
1839 |
|
|
1840 |
void CFSEmailUiMsgDetailsVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const
|
|
1841 |
{
|
|
1842 |
aLayoutArray.AppendL( iParentLayout );
|
|
1843 |
}
|
|
1844 |
|
|
1845 |
// <cmail>
|
|
1846 |
// ---------------------------------------------------------------------------
|
|
1847 |
// Fetching the Message Structure. It is necessary for POP protocol in order to read recipients
|
|
1848 |
// ---------------------------------------------------------------------------
|
|
1849 |
//
|
|
1850 |
void CFSEmailUiMsgDetailsVisualiser::StartFetchingMessageStructureL(
|
|
1851 |
CFSMailMessage* aMsg)
|
|
1852 |
{
|
|
1853 |
FUNC_LOG;
|
|
1854 |
TFSMailMsgId currentMailboxId = aMsg->GetMailBoxId();
|
|
1855 |
TFSMailMsgId currentMessageFolderId = aMsg->GetFolderId();
|
|
1856 |
CFSMailFolder* currentFolder = iAppUi.GetMailClient()->GetFolderByUidL(
|
|
1857 |
currentMailboxId, currentMessageFolderId);
|
|
1858 |
CleanupStack::PushL(currentFolder);
|
|
1859 |
RArray<TFSMailMsgId> messageIds;
|
|
1860 |
CleanupClosePushL(messageIds);
|
|
1861 |
messageIds.Append(aMsg->GetMessageId());
|
|
1862 |
// Fetch the message structure
|
|
1863 |
iCurrentStructureFetchRequestId = currentFolder->FetchMessagesL(messageIds,
|
|
1864 |
EFSMsgDataStructure, *this);
|
|
1865 |
iFetchingMessageStructure = ETrue;
|
|
1866 |
CleanupStack::PopAndDestroy(&messageIds);
|
|
1867 |
CleanupStack::PopAndDestroy(currentFolder);
|
|
1868 |
}
|
|
1869 |
// </cmail>
|
|
1870 |
|
|
1871 |
// <cmail>
|
|
1872 |
// ---------------------------------------------------------------------------
|
|
1873 |
// MFSMailRequestObserver interface implementation
|
|
1874 |
// ---------------------------------------------------------------------------
|
|
1875 |
//
|
|
1876 |
void CFSEmailUiMsgDetailsVisualiser::RequestResponseL(TFSProgress aEvent,
|
|
1877 |
TInt aRequestId)
|
|
1878 |
{
|
|
1879 |
FUNC_LOG;
|
|
1880 |
if (aRequestId == iCurrentStructureFetchRequestId && iFetchingMessageStructure)
|
|
1881 |
{
|
|
1882 |
if (aEvent.iError != KErrNone || aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled)
|
|
1883 |
{
|
|
1884 |
iAsyncProcessComplete = ETrue;
|
|
1885 |
iFetchingMessageStructure = EFalse;
|
|
1886 |
}
|
|
1887 |
else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete)
|
|
1888 |
{
|
|
1889 |
iAsyncProcessComplete = ETrue;
|
|
1890 |
iFetchingMessageStructure = EFalse;
|
|
1891 |
|
|
1892 |
// get message again, there might be new information
|
|
1893 |
if (iViewedMsg)
|
|
1894 |
{
|
|
1895 |
TFSMailMsgId mailboxId = iViewedMsg->GetMailBoxId();
|
|
1896 |
TFSMailMsgId folderId = iViewedMsg->GetFolderId();
|
|
1897 |
TFSMailMsgId messageId = iViewedMsg->GetMessageId();
|
|
1898 |
UpdateMessagePtrL(mailboxId, folderId, messageId);
|
|
1899 |
}
|
|
1900 |
}
|
|
1901 |
}
|
|
1902 |
//<cmail>
|
|
1903 |
if (iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed)
|
|
1904 |
{
|
|
1905 |
iWaitDialog->ProcessFinishedL(); // deletes the dialog
|
|
1906 |
}
|
|
1907 |
//</cmail>
|
|
1908 |
|
|
1909 |
if (iViewedMsg) //safety check
|
|
1910 |
{
|
|
1911 |
UpdateMsgDetailsModelL();
|
|
1912 |
iTreeList->ShowListL();
|
|
1913 |
iTreeList->SetFocusedL(ETrue);
|
|
1914 |
}
|
|
1915 |
}
|
|
1916 |
// </cmail>
|
|
1917 |
|
|
1918 |
// <cmail>
|
|
1919 |
// ---------------------------------------------------------------------------
|
|
1920 |
// Update our message pointer and saves its status
|
|
1921 |
// ---------------------------------------------------------------------------
|
|
1922 |
//
|
|
1923 |
void CFSEmailUiMsgDetailsVisualiser::UpdateMessagePtrL(
|
|
1924 |
TFSMailMsgId aNewMailboxId, TFSMailMsgId aNewFolderId,
|
|
1925 |
TFSMailMsgId aNewMessageId)
|
|
1926 |
{
|
|
1927 |
FUNC_LOG;
|
|
1928 |
if (iViewedMsg)
|
|
1929 |
{
|
|
1930 |
|
|
1931 |
delete iViewedMsg;
|
|
1932 |
iViewedMsg = NULL;
|
|
1933 |
}
|
|
1934 |
|
|
1935 |
// it should contain all data now (including recipients)
|
|
1936 |
iViewedMsg = iAppUi.GetMailClient()->GetMessageByUidL(aNewMailboxId,
|
|
1937 |
aNewFolderId, aNewMessageId, EFSMsgDataEnvelope);
|
|
1938 |
|
|
1939 |
if (iViewedMsg)
|
|
1940 |
{
|
|
1941 |
// Save read status
|
|
1942 |
iViewedMsg->SaveMessageL();
|
|
1943 |
}
|
|
1944 |
}
|
|
1945 |
// </cmail>
|
|
1946 |
|
|
1947 |
// <cmail>
|
|
1948 |
// ---------------------------------------------------------------------------
|
|
1949 |
// Cancel fetching of the message structure
|
|
1950 |
// ---------------------------------------------------------------------------
|
|
1951 |
//
|
|
1952 |
void CFSEmailUiMsgDetailsVisualiser::CancelFetching()
|
|
1953 |
{
|
|
1954 |
FUNC_LOG;
|
|
1955 |
|
|
1956 |
if (iFetchingMessageStructure)
|
|
1957 |
{
|
|
1958 |
TRAP_IGNORE( iAppUi.GetMailClient()->CancelL( iCurrentStructureFetchRequestId ) );
|
|
1959 |
iFetchingMessageStructure = EFalse;
|
|
1960 |
}
|
|
1961 |
iAsyncProcessComplete = ETrue;
|
|
1962 |
if (iWaitDialog && iDialogNotDismissed)
|
|
1963 |
{
|
|
1964 |
TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); // deletes the dialog
|
|
1965 |
iWaitDialog = NULL;
|
|
1966 |
}
|
|
1967 |
//</cmail>
|
|
1968 |
}
|
|
1969 |
// </cmail>
|
|
1970 |
|
|
1971 |
// <cmail>
|
|
1972 |
// ---------------------------------------------------------------------------
|
|
1973 |
// MProgressDialogCallback interface implementation
|
|
1974 |
// ---------------------------------------------------------------------------
|
|
1975 |
//
|
|
1976 |
void CFSEmailUiMsgDetailsVisualiser::DialogDismissedL( TInt aButtonId)
|
|
1977 |
{
|
|
1978 |
FUNC_LOG;
|
|
1979 |
iDialogNotDismissed = EFalse;
|
|
1980 |
if( aButtonId == EAknSoftkeyCancel )
|
|
1981 |
{
|
|
1982 |
CancelFetching();
|
|
1983 |
}
|
|
1984 |
|
|
1985 |
}
|
|
1986 |
// </cmail>
|