|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file implements class CFSEmailUiSearchListVisualiser. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // SYSTEM INCLUDES |
|
21 #include "emailtrace.h" |
|
22 #include <freestyleemailui.mbg> |
|
23 #include <AknUtils.h> |
|
24 #include <gulicon.h> |
|
25 #include <StringLoader.h> |
|
26 #include <FreestyleEmailUi.rsg> |
|
27 |
|
28 //<cmail> |
|
29 #include "CFSMailMessage.h" |
|
30 #include "CFSMailClient.h" |
|
31 #include "CFSMailFolder.h" |
|
32 #include "CFSMailBox.h" |
|
33 #include <alf/alfframebrush.h> |
|
34 #include <alf/alftextvisual.h> |
|
35 #include "fstreelist.h" |
|
36 #include "fstreevisualizerbase.h" |
|
37 #include "fstreeplaintwolineitemdata.h" |
|
38 #include "fstreeplaintwolineitemvisualizer.h" |
|
39 #include "fstreeplainonelinenodedata.h" |
|
40 #include "fstreeplainonelinenodevisualizer.h" |
|
41 |
|
42 //</cmail> |
|
43 #include <AknQueryDialog.h> |
|
44 //<cmail> |
|
45 #include "CFSMailCommon.h" |
|
46 #include <alf/alfanchorlayout.h> |
|
47 #include <alf/alfdecklayout.h> |
|
48 #include <alf/alfcontrolgroup.h> |
|
49 #include <alf/alfevent.h> |
|
50 #include <alf/alfbrusharray.h> |
|
51 // </cmail> |
|
52 #include <alf/alfenv.h> |
|
53 #include <alf/alfcommand.h> |
|
54 #include <aknnotewrappers.h> |
|
55 // <cmail> |
|
56 #include <aknlayoutscalable_apps.cdl.h> |
|
57 // </cmail> |
|
58 #include <featmgr.h> |
|
59 //</cmail> |
|
60 |
|
61 //<cmail> |
|
62 #include "cfsccontactactionmenu.h" |
|
63 #include "mfsccontactactionmenumodel.h" |
|
64 #include "fscontrolbar.h" |
|
65 #include "fscontrolbuttoninterface.h" |
|
66 #include "fscontrolbuttonvisualiser.h" |
|
67 #include <csxhelp/cmail.hlp.hrh> |
|
68 // </cmail> |
|
69 |
|
70 // Meeting request headers |
|
71 #include <MeetingRequestUids.hrh> |
|
72 //<cmail> |
|
73 #include "cesmricalviewer.h" |
|
74 //</cmail> |
|
75 |
|
76 // INTERNAL INCLUDES |
|
77 #include "FreestyleEmailUiLayoutHandler.h" |
|
78 #include "FreestyleEmailUiMailListModel.h" |
|
79 #include "FreestyleEmailUiMailListVisualiser.h" |
|
80 #include "FreestyleEmailUiSearchListVisualiser.h" |
|
81 #include "FreestyleEmailUiSearchListControl.h" |
|
82 #include "FreestyleEmailUiFileSystemInfo.h" |
|
83 #include "FreestyleEmailUiAppui.h" |
|
84 #include "FreestyleEmailUi.hrh" |
|
85 #include "FreestyleEmailUiTextureManager.h" |
|
86 #include "FreestyleEmailUiMailViewerVisualiser.h" |
|
87 #include "FreestyleEmailUiUtilities.h" |
|
88 #include "FreestyleEmailUiLiterals.h" |
|
89 #include "FreestyleEmailUiShortcutBinding.h" |
|
90 #include "FreestyleEmailUiMsgDetailsVisualiser.h" |
|
91 #include "FreestyleEmailCenRepHandler.h" |
|
92 #include "FreestyleEmailUiHtmlViewerView.h" |
|
93 #include "FSEmail.pan" |
|
94 |
|
95 // CONST VALUES |
|
96 static const TInt KMaxLengthOfSearchString = 255; |
|
97 //<cmail> s60 platform layouts |
|
98 //static const TInt KSearchIconWidth = 30; |
|
99 const TReal KFSHeaderTextBackgroundOpacity = 0.3f; |
|
100 //</cmail> |
|
101 static const TInt KItemExpansionDelay = 400; |
|
102 static const TInt KListScrollingDelay = 200; |
|
103 static const TInt KMaxPreviewPaneLength = 60; |
|
104 |
|
105 |
|
106 |
|
107 CFSEmailUiSearchListVisualiser* CFSEmailUiSearchListVisualiser::NewL(CAlfEnv& aEnv, |
|
108 CFreestyleEmailUiAppUi* aAppUi, |
|
109 CAlfControlGroup& aSearchListControlGroup ) |
|
110 { |
|
111 FUNC_LOG; |
|
112 CFSEmailUiSearchListVisualiser* self = CFSEmailUiSearchListVisualiser::NewLC(aEnv, aAppUi, aSearchListControlGroup ); |
|
113 CleanupStack::Pop(self); |
|
114 return self; |
|
115 } |
|
116 |
|
117 CFSEmailUiSearchListVisualiser* CFSEmailUiSearchListVisualiser::NewLC(CAlfEnv& aEnv, |
|
118 CFreestyleEmailUiAppUi* aAppUi, |
|
119 CAlfControlGroup& aSearchListControlGroup) |
|
120 { |
|
121 FUNC_LOG; |
|
122 CFSEmailUiSearchListVisualiser* self = new (ELeave) CFSEmailUiSearchListVisualiser(aAppUi, aEnv, aSearchListControlGroup); |
|
123 CleanupStack::PushL(self); |
|
124 self->ConstructL(); |
|
125 return self; |
|
126 } |
|
127 |
|
128 void CFSEmailUiSearchListVisualiser::ConstructL() |
|
129 { |
|
130 FUNC_LOG; |
|
131 BaseConstructL( R_FSEMAILUI_MAIL_SEARCH_VIEW ); |
|
132 |
|
133 // Set list as initial focused control |
|
134 iThisViewActive = EFalse; |
|
135 iFirstStartCompleted = EFalse; |
|
136 } |
|
137 |
|
138 // CFSEmailUiSearchListVisualiser::DoFirstStartL() |
|
139 // Purpose of this function is to do first start only when search list is |
|
140 // really needed to be shown. Implemented to make app startuo faster. |
|
141 void CFSEmailUiSearchListVisualiser::DoFirstStartL() |
|
142 { |
|
143 FUNC_LOG; |
|
144 TRect screenRect; |
|
145 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
|
146 |
|
147 // Create control and anchor layout |
|
148 iSearchListControl = CFreestyleEmailUiSearchListControl::NewL( *iEnv, this ); |
|
149 iScreenAnchorLayout = CAlfAnchorLayout::AddNewL( *iSearchListControl ); |
|
150 iScreenAnchorLayout->SetFlags(EAlfVisualFlagAutomaticLocaleMirroringEnabled); |
|
151 SetSearchListLayoutAnchors(); |
|
152 |
|
153 // Create top bar layout |
|
154 iSearchTopBarLayout = CAlfDeckLayout::AddNewL( *iSearchListControl, iScreenAnchorLayout ); |
|
155 iBarBgVisual = CAlfImageVisual::AddNewL( *iSearchListControl, iSearchTopBarLayout ); |
|
156 /*<cmail> paltform layout changes to cmail |
|
157 TAlfTimedValue barBgTextureOpacity; |
|
158 barBgTextureOpacity.SetValueNow( 1 ); |
|
159 iBarBgVisual->SetOpacity( barBgTextureOpacity ); |
|
160 CAlfTexture* barBgTexture = &iAppUi.FsTextureManager()->TextureByIndex( EMailListBarBgIcon ); |
|
161 barBgTexture->Size().SetSize( screenRect.Width(), iAppUi.LayoutHandler()->ControlBarHeight() ); |
|
162 iBarBgVisual->SetImage( TAlfImage( *barBgTexture ) ); |
|
163 */ //</cmail> |
|
164 |
|
165 /*<cmail> magnifier image is not in cmail |
|
166 // Add bar image component |
|
167 iBarFindImage = CAlfImageVisual::AddNewL( *iSearchListControl, iScreenAnchorLayout ); |
|
168 TAlfTimedValue barFindImageOpacity; |
|
169 barFindImageOpacity.SetValueNow( 1 ); |
|
170 iBarFindImage->SetOpacity( barFindImageOpacity ); |
|
171 CAlfTexture* barFindTexture = &iAppUi.FsTextureManager()->TextureByIndex( ESearchLookingGlassIcon ); |
|
172 barFindTexture->Size().SetSize( 15, 15 ); |
|
173 iBarFindImage->SetImage( TAlfImage( *barFindTexture ) ); |
|
174 */ //</cmail> |
|
175 |
|
176 // <cmail> |
|
177 // Add bar text component |
|
178 iBarTextVisual = CAlfTextVisual::AddNewL( *iSearchListControl, iScreenAnchorLayout ); |
|
179 iBarTextVisual->EnableShadow(EFalse); |
|
180 iBarTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
181 // </cmail> |
|
182 |
|
183 /*<cmail> no initial text or opacity required in cmail |
|
184 HBufC* initialSearchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH ); |
|
185 iBarTextVisual->SetTextL( *initialSearchText ); |
|
186 CleanupStack::PopAndDestroy( initialSearchText ); |
|
187 TAlfTimedValue barTextVisualOpacity; |
|
188 barTextVisualOpacity.SetValueNow( 1 ); |
|
189 iBarTextVisual->SetOpacity( barTextVisualOpacity ); |
|
190 |
|
191 CAlfTextStyle* textStyle = iAppUi.LayoutHandler()->FSTextStyleFromIdL( EFSFontTypeSmallBold ); |
|
192 iBarTextVisual->SetTextStyle ( textStyle->Id() );*/ //</cmail> |
|
193 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
194 { |
|
195 iBarTextVisual->SetAlign(EAlfAlignHLeft, EAlfAlignVCenter); |
|
196 } |
|
197 else |
|
198 { |
|
199 iBarTextVisual->SetAlign(EAlfAlignHRight, EAlfAlignVCenter); |
|
200 } |
|
201 |
|
202 // Create model |
|
203 iModel = CFSEmailUiMailListModel::NewL( &iAppUi, ETrue ); |
|
204 |
|
205 // Create list and append to control group and anchor layout |
|
206 iSearchListLayout = CAlfDeckLayout::AddNewL( *iSearchListControl, iScreenAnchorLayout ); |
|
207 iSearchListLayout->SetSize( TSize( screenRect.Width(), screenRect.Height()- |
|
208 iAppUi.LayoutHandler()->ControlBarHeight() ) ); |
|
209 iSearchTreeListVisualizer = CFsTreeVisualizerBase::NewL(iSearchListControl, *iSearchListLayout); |
|
210 iSearchList = CFsTreeList::NewL(*iSearchTreeListVisualizer, *iEnv ); |
|
211 iSearchList->SetScrollbarVisibilityL( EFsScrollbarHideAlways ); |
|
212 |
|
213 // Set mark type and icon |
|
214 iSearchList->SetMarkTypeL( CFsTreeList::EFsTreeListMultiMarkable ); |
|
215 iSearchTreeListVisualizer->SetMarkIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMarkIcon ) ); |
|
216 iSearchTreeListVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) ); |
|
217 iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen ); |
|
218 iSearchTreeListVisualizer->SetFocusVisibility( iFocusVisible ); |
|
219 iSearchList->SetIndentationL(0); |
|
220 |
|
221 //<cmail> events are now offered to controls in different order |
|
222 ControlGroup().AppendL( iSearchListControl ); |
|
223 ControlGroup().AppendL( iSearchList->TreeControl() ); |
|
224 //</cmail> |
|
225 //<cmail> touch |
|
226 iSearchList->AddObserverL(*this); |
|
227 //</cmail> |
|
228 iSearchOngoing = EFalse; |
|
229 |
|
230 // Set mail list background |
|
231 //<cmail> S60 skin support |
|
232 //iSearchTreeListVisualizer->SetBackgroundTextureL( iAppUi.FsTextureManager()->TextureByIndex( EBackgroundTextureMailList ) ); |
|
233 //</cmail> |
|
234 |
|
235 iSearchTreeListVisualizer->SetItemExpansionDelay( KItemExpansionDelay ); |
|
236 iSearchList->SetScrollTime( KListScrollingDelay, 0.5 ); |
|
237 |
|
238 // Set empty text |
|
239 HBufC* emptyText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_EMPTY_MSG_LIST_TEXT ); |
|
240 iSearchTreeListVisualizer->SetEmptyListTextL( *emptyText ); |
|
241 CleanupStack::PopAndDestroy( emptyText ); |
|
242 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
243 iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor ); |
|
244 |
|
245 // Create startup timer |
|
246 iStartupCallbackTimer = CFSEmailUiGenericTimer::NewL( this ); |
|
247 |
|
248 // Set page up and page down keys |
|
249 iSearchTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp ); |
|
250 iSearchTreeListVisualizer->AddCustomPageDownKey( EStdKeyPageDown ); |
|
251 |
|
252 CAlfBrush* selectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL(); |
|
253 iSearchTreeListVisualizer->SetSelectorPropertiesL( selectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly ); |
|
254 |
|
255 iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iSearchList ); |
|
256 |
|
257 iFirstStartCompleted = ETrue; |
|
258 } |
|
259 |
|
260 void CFSEmailUiSearchListVisualiser::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ ) |
|
261 { |
|
262 FUNC_LOG; |
|
263 LaunchSearchDialogL(); |
|
264 } |
|
265 |
|
266 CFSEmailUiSearchListVisualiser::CFSEmailUiSearchListVisualiser( CFreestyleEmailUiAppUi* aAppUi, |
|
267 CAlfEnv& aEnv, |
|
268 CAlfControlGroup& aSearchListControlGroup ) |
|
269 :CFsEmailUiViewBase( aSearchListControlGroup, *aAppUi ), |
|
270 iEnv( &aEnv ), |
|
271 iLatestSearchText(0), |
|
272 iListAddedToControlGroup(EFalse), //<cmail> |
|
273 iPreparedForExit(EFalse) //<cmail> |
|
274 { |
|
275 FUNC_LOG; |
|
276 } |
|
277 |
|
278 CFSEmailUiSearchListVisualiser::~CFSEmailUiSearchListVisualiser() |
|
279 { |
|
280 FUNC_LOG; |
|
281 if ( iStartupCallbackTimer ) |
|
282 { |
|
283 iStartupCallbackTimer->Cancel(); |
|
284 delete iStartupCallbackTimer; |
|
285 } |
|
286 iSearchStrings.ResetAndDestroy(); |
|
287 iSearchListItemArray.Reset(); |
|
288 delete iModel; |
|
289 delete iLatestSearchText; |
|
290 delete iSearchList; |
|
291 |
|
292 } |
|
293 |
|
294 void CFSEmailUiSearchListVisualiser::PrepareForExit() |
|
295 { |
|
296 FUNC_LOG; |
|
297 //<cmail> Not needed anymore as controls aren't removed from control group |
|
298 /*if(!iListAddedToControlGroup) |
|
299 { |
|
300 if(iSearchList && iSearchList->TreeControl()) |
|
301 TRAP_IGNORE(ControlGroup().AppendL( iSearchList->TreeControl() )); |
|
302 if(iSearchListControl) |
|
303 TRAP_IGNORE(ControlGroup().AppendL( iSearchListControl )); |
|
304 iListAddedToControlGroup = ETrue; |
|
305 }*/ |
|
306 //<cmail> |
|
307 if ( iSearchOngoing ) |
|
308 { |
|
309 TRAP_IGNORE( StopSearchL() ); |
|
310 } |
|
311 delete iMailBox; |
|
312 iMailBox = NULL; |
|
313 iPreparedForExit = ETrue; |
|
314 } |
|
315 |
|
316 TInt CFSEmailUiSearchListVisualiser::HighlightedIndex() const |
|
317 { |
|
318 FUNC_LOG; |
|
319 TFsTreeItemId focusedId = static_cast<TFsTreeItemId>( iSearchList->FocusedItem() ); |
|
320 // Map id to the index in model |
|
321 TInt ret( KErrNotFound ); |
|
322 for ( TInt i=0; i<iSearchListItemArray.Count();i++ ) |
|
323 { |
|
324 if ( focusedId == iSearchListItemArray[i].iSearchListItemId) |
|
325 { |
|
326 ret = i; |
|
327 break; |
|
328 } |
|
329 } |
|
330 return ret; |
|
331 } |
|
332 |
|
333 |
|
334 TUid CFSEmailUiSearchListVisualiser::Id() const |
|
335 { |
|
336 FUNC_LOG; |
|
337 return SearchListViewId; |
|
338 } |
|
339 |
|
340 // <cmail> Toolbar |
|
341 /*void CFSEmailUiSearchListVisualiser::DoActivateL(const TVwsViewId& aPrevViewId, |
|
342 TUid aCustomMessageId, |
|
343 const TDesC8& aCustomMessage)*/ |
|
344 void CFSEmailUiSearchListVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId, |
|
345 TUid aCustomMessageId, |
|
346 const TDesC8& aCustomMessage) |
|
347 // </cmail> Toolbar |
|
348 { |
|
349 FUNC_LOG; |
|
350 if ( !iFirstStartCompleted ) |
|
351 { |
|
352 DoFirstStartL(); |
|
353 } |
|
354 |
|
355 // <cmail> |
|
356 //iSearchList->SetScrollbarVisibilityL( EFsScrollbarHideAlways ); |
|
357 if ( aCustomMessageId != KStartListReturnToPreviousFolder ) |
|
358 { |
|
359 iBarTextVisual->SetTextL(KNullDesC); |
|
360 } |
|
361 |
|
362 if ( &aCustomMessage && aCustomMessageId == KStartNewSearch ) |
|
363 { |
|
364 // If new search, clear old search list |
|
365 iSearchCount=0; |
|
366 iMsgDataCouldBeChanged = EFalse; |
|
367 // <cmail> fixed CS high cat. finding |
|
368 ResetResultListL(); |
|
369 } |
|
370 // </cmail> |
|
371 |
|
372 // Store previous view ID |
|
373 iPreviousViewUid = aPrevViewId.iViewUid; |
|
374 TSearchListActivationData subView; |
|
375 TPckgBuf<TSearchListActivationData> viewData( subView ); |
|
376 viewData.Copy( aCustomMessage ); |
|
377 subView = viewData(); |
|
378 |
|
379 // Update settings and set list mode according to settings |
|
380 UpdateMailListSettingsL(); |
|
381 |
|
382 if ( iMailBox ) |
|
383 { |
|
384 delete iMailBox; |
|
385 iMailBox = NULL; |
|
386 } |
|
387 iMailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( subView.iMailBoxId ); |
|
388 // If mailbox data is not, try to get default MCE account |
|
389 if ( !iMailBox ) |
|
390 { |
|
391 CMsvSession* msvSession = iAppUi.GetMsvSession(); |
|
392 CFSMailClient* client = iAppUi.GetMailClient(); |
|
393 iMailBox = TFsEmailUiUtility::GetMceDefaultMailboxL( *client, *msvSession ); |
|
394 } |
|
395 |
|
396 if ( iMailBox ) |
|
397 { |
|
398 iThisViewActive = ETrue; |
|
399 //<cmail> visible/unvisible is not controlled by opacity in cmail |
|
400 //TAlfTimedValue opacity; |
|
401 //opacity.SetValueNow( 1 ); |
|
402 //iScreenAnchorLayout->SetOpacity( opacity ); |
|
403 //</cmail> |
|
404 iSearchList->ShowListL(); |
|
405 iSearchList->SetFocusedL(ETrue); |
|
406 // Set empty text color |
|
407 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
408 iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor ); |
|
409 |
|
410 // Launch search dialog automatically when activated |
|
411 if ( &aCustomMessage && aCustomMessageId == KStartNewSearch ) |
|
412 { |
|
413 // <cmail> list reseting moved into the begining of the function |
|
414 // requeset async launching of the search dialog because DoActivateL must |
|
415 // not be blocked |
|
416 iStartupCallbackTimer->Cancel(); // just in case |
|
417 iStartupCallbackTimer->Start( iAppUi.LayoutHandler()->ViewSlideEffectTime() ); |
|
418 } |
|
419 else if ( iModel && iModel->Count() ) |
|
420 { |
|
421 // Need to make sure that return to this view works even if following function leaves. |
|
422 TRAP_IGNORE( CheckAndUpdateFocusedMessageL() ); |
|
423 } |
|
424 } |
|
425 CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel ); |
|
426 // Set msk always empty when view is activated. |
|
427 SetMskL(); |
|
428 // <cmail> |
|
429 ReScaleUiL(); // In case that Landscape/Portrait has changed. |
|
430 // </cmail> |
|
431 |
|
432 // <cmail> Touch |
|
433 iSearchList->SetFocusedL(ETrue); |
|
434 // </cmail> |
|
435 } |
|
436 |
|
437 void CFSEmailUiSearchListVisualiser::ChildDoDeactivate() |
|
438 { |
|
439 FUNC_LOG; |
|
440 if(iListAddedToControlGroup && (!iPreparedForExit)) |
|
441 { |
|
442 iListAddedToControlGroup = EFalse; |
|
443 } |
|
444 iThisViewActive = EFalse; |
|
445 |
|
446 if ( !iAppUi.AppUiExitOngoing() ) |
|
447 { |
|
448 if ( iSearchList->IsFocused() ) |
|
449 { |
|
450 TRAP_IGNORE(iSearchList->SetFocusedL(EFalse)); |
|
451 } |
|
452 iSearchTreeListVisualizer->NotifyControlVisibilityChange( EFalse ); |
|
453 } |
|
454 } |
|
455 |
|
456 CFSEmailUiMailListModel* CFSEmailUiSearchListVisualiser::Model() |
|
457 { |
|
458 FUNC_LOG; |
|
459 return iModel; |
|
460 } |
|
461 |
|
462 void CFSEmailUiSearchListVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
463 { |
|
464 FUNC_LOG; |
|
465 if ( iSearchList->Count() && iModel ) |
|
466 { |
|
467 if ( aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE ) |
|
468 { |
|
469 if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) ) |
|
470 { |
|
471 // remove help support in pf5250 |
|
472 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
473 } |
|
474 |
|
475 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
476 if ( item && item->ModelItemType() == ETypeMailItem && |
|
477 item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
478 { |
|
479 // Highlighted mail is calendar msg |
|
480 aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, ETrue); |
|
481 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, EFalse); |
|
482 } |
|
483 else |
|
484 { |
|
485 // Highlighted mail is mail msg |
|
486 aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, EFalse); |
|
487 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, ETrue); |
|
488 } |
|
489 aMenuPane->SetItemDimmed(EFsEmailUiCmdOpen, EFalse); |
|
490 } |
|
491 } |
|
492 else |
|
493 { |
|
494 if ( aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE ) |
|
495 { |
|
496 |
|
497 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
498 { |
|
499 // remove help support in pf5250 |
|
500 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
501 } |
|
502 |
|
503 aMenuPane->SetItemDimmed(EFsEmailUiCmdMore, ETrue); |
|
504 aMenuPane->SetItemDimmed(EFsEmailUiCmdMailActions, ETrue); |
|
505 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActions, ETrue); |
|
506 aMenuPane->SetItemDimmed(EFsEmailUiCmdOpen, ETrue); |
|
507 aMenuPane->SetItemDimmed(EFsEmailUiCmdReadEmail, ETrue); |
|
508 } |
|
509 } |
|
510 |
|
511 if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_ACTIONS || |
|
512 aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_CALEVENT_ACTIONS) |
|
513 { |
|
514 if ( iSearchList->Count() ) |
|
515 { |
|
516 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
517 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
518 { |
|
519 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
520 if ( messagePtr && messagePtr->IsFlagSet( EFSMsgFlag_Read ) ) |
|
521 { |
|
522 aMenuPane->SetItemDimmed(EFsEmailUiCmdMarkAsRead, ETrue); |
|
523 } |
|
524 else |
|
525 { |
|
526 aMenuPane->SetItemDimmed(EFsEmailUiCmdMarkAsUnread, ETrue); |
|
527 } |
|
528 } |
|
529 } |
|
530 } |
|
531 |
|
532 if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_CALEVENT_ACTIONS) |
|
533 { |
|
534 if ( iSearchList->Count() ) |
|
535 { |
|
536 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
537 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
538 { |
|
539 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
540 if ( messagePtr && messagePtr->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
541 { |
|
542 TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown ); |
|
543 if ( iAppUi.MrViewerInstanceL() ) |
|
544 { |
|
545 // Search must be stopped, otherwise resolve will lead to crash |
|
546 if ( iSearchOngoing ) |
|
547 { |
|
548 StopSearchL(); |
|
549 } |
|
550 mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( item->MessagePtr() ); |
|
551 } |
|
552 switch ( mrMethod ) |
|
553 { |
|
554 case EESMRMeetingRequestMethodRequest: |
|
555 { |
|
556 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
557 } |
|
558 break; |
|
559 case EESMRMeetingRequestMethodCancellation: |
|
560 { |
|
561 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue); |
|
562 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue); |
|
563 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue); |
|
564 |
|
565 TBool supportsRemove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaRemoveFromCalendar ); |
|
566 if( !supportsRemove ) |
|
567 { |
|
568 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
569 } |
|
570 } |
|
571 break; |
|
572 default: |
|
573 case EESMRMeetingRequestMethodUnknown: |
|
574 case EESMRMeetingRequestMethodResponse: |
|
575 { |
|
576 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalRemoveFromCalendar, ETrue); |
|
577 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsAccept, ETrue); |
|
578 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsTentative, ETrue); |
|
579 aMenuPane->SetItemDimmed(EFsEmailUiCmdCalActionsDecline, ETrue); |
|
580 } |
|
581 break; |
|
582 } |
|
583 } |
|
584 } |
|
585 |
|
586 } |
|
587 } |
|
588 |
|
589 |
|
590 if ( aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_MORE ) |
|
591 { |
|
592 // <cmail> Prevent Download Manager opening with attachments |
|
593 // if ( iAppUi.DownloadInfoMediator() && !iAppUi.DownloadInfoMediator()->IsAnyAttachmentDownloads() ) |
|
594 // { |
|
595 // aMenuPane->SetItemDimmed(EFsEmailUiCmdDownloadManager, ETrue); |
|
596 // } |
|
597 // </cmail> |
|
598 } |
|
599 |
|
600 if (aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_ACTIONS) |
|
601 { |
|
602 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
603 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
604 TInt menuIndex( 0 ); |
|
605 |
|
606 //Get # of recipients |
|
607 TInt numRecipients(0); |
|
608 if ( messagePtr ) |
|
609 { |
|
610 numRecipients =TFsEmailUiUtility::CountRecepients( messagePtr ); |
|
611 if ( numRecipients == 1 ) |
|
612 { |
|
613 //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the |
|
614 //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI. |
|
615 if ( messagePtr->GetToRecipients().Count() ) |
|
616 { |
|
617 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetToRecipients()[0]->GetEmailAddress()) ) |
|
618 { |
|
619 numRecipients++; |
|
620 } |
|
621 } |
|
622 if ( messagePtr->GetCCRecipients().Count() ) |
|
623 { |
|
624 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetCCRecipients()[0]->GetEmailAddress()) ) |
|
625 { |
|
626 numRecipients++; |
|
627 } |
|
628 } |
|
629 if ( messagePtr->GetBCCRecipients().Count() ) |
|
630 { |
|
631 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetBCCRecipients()[0]->GetEmailAddress()) ) |
|
632 { |
|
633 numRecipients++; |
|
634 } |
|
635 } |
|
636 } |
|
637 |
|
638 } |
|
639 if ( numRecipients > 1 ) |
|
640 { |
|
641 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, EFalse ); |
|
642 } |
|
643 else if ( aMenuPane->MenuItemExists( EFsEmailUiCmdActionsReplyAll, menuIndex ) ) |
|
644 { |
|
645 aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
646 } |
|
647 } |
|
648 |
|
649 if ( !iSearchOngoing && aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE ) |
|
650 { |
|
651 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
652 { |
|
653 // remove help support in pf5250 |
|
654 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
655 } |
|
656 |
|
657 aMenuPane->SetItemDimmed(EFsEmailUiCmdStopSearch, ETrue); |
|
658 if ( iSearchCount == 0 ) |
|
659 { |
|
660 aMenuPane->SetItemDimmed(EFsEmailUiCmdNewSearch, ETrue); |
|
661 } |
|
662 else |
|
663 { |
|
664 aMenuPane->SetItemDimmed(EFsEmailUiCmdSearch, ETrue); |
|
665 } |
|
666 } |
|
667 |
|
668 if ( iSearchOngoing && aResourceId == R_FSEMAILUI_SEARCHLIST_MENUPANE ) |
|
669 { |
|
670 if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
671 { |
|
672 // remove help support in pf5250 |
|
673 aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
674 } |
|
675 |
|
676 aMenuPane->SetItemDimmed(EFsEmailUiCmdSearch, ETrue); |
|
677 aMenuPane->SetItemDimmed(EFsEmailUiCmdNewSearch, ETrue); |
|
678 } |
|
679 |
|
680 iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, CFSEmailUiShortcutBinding::EContextSearchResults ); |
|
681 } |
|
682 |
|
683 void CFSEmailUiSearchListVisualiser::RefreshL() |
|
684 { |
|
685 FUNC_LOG; |
|
686 if ( iFirstStartCompleted ) //Safety |
|
687 { |
|
688 if ( iModel && iModel->Count() ) |
|
689 { |
|
690 // Check if zoom level has been switched and refresh items if so |
|
691 TAknUiZoom prevZoomLevel = iCurrentZoomLevel; |
|
692 CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel ); |
|
693 if ( prevZoomLevel != iCurrentZoomLevel ) |
|
694 { |
|
695 for ( TInt i=0; i<iModel->Count(); i++ ) |
|
696 { |
|
697 // Set font height |
|
698 iSearchListItemArray[i].iTreeItemVisualiser-> |
|
699 SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
700 iSearchTreeListVisualizer->UpdateItemL( iSearchListItemArray[i].iSearchListItemId ); |
|
701 } |
|
702 } |
|
703 } |
|
704 } |
|
705 } |
|
706 |
|
707 |
|
708 void CFSEmailUiSearchListVisualiser::CreatePlainNodeL( const TDesC& aItemDataBuff, |
|
709 CFsTreePlainOneLineNodeData* &aItemData, |
|
710 CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const |
|
711 { |
|
712 FUNC_LOG; |
|
713 aItemData = CFsTreePlainOneLineNodeData::NewL(); |
|
714 aItemData->SetDataL( aItemDataBuff ); |
|
715 aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex(EListTextureNodeExpanded) ); |
|
716 aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex(EListTextureNodeCollapsed) ); |
|
717 aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL( *iSearchList->TreeControl() ); |
|
718 TRect screenRect; |
|
719 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
|
720 TInt nodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight(); |
|
721 aNodeVisualizer->SetSize( TSize(screenRect.Width(), nodeHeight) ); |
|
722 aNodeVisualizer->SetExtendable(EFalse); |
|
723 // Set correct skin text colors for the list items |
|
724 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
725 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
726 aNodeVisualizer->SetFocusedStateTextColor( focusedColor ); |
|
727 aNodeVisualizer->SetNormalStateTextColor( normalColor ); |
|
728 } |
|
729 |
|
730 |
|
731 void CFSEmailUiSearchListVisualiser::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType ) |
|
732 { |
|
733 FUNC_LOG; |
|
734 CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType ); |
|
735 if ( iFirstStartCompleted ) // Safety |
|
736 { |
|
737 if ( iSearchTreeListVisualizer ) |
|
738 { |
|
739 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
740 iSearchTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor ); |
|
741 } |
|
742 ReScaleUiL(); |
|
743 } |
|
744 } |
|
745 |
|
746 void CFSEmailUiSearchListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const |
|
747 { |
|
748 aLayoutArray.Append( iScreenAnchorLayout ); |
|
749 } |
|
750 |
|
751 // ----------------------------------------------------------------------------- |
|
752 // CFSEmailUiMailListVisualiser::FlipStateChangedL |
|
753 // Called when keyboard flip state is changed |
|
754 // ----------------------------------------------------------------------------- |
|
755 // |
|
756 void CFSEmailUiSearchListVisualiser::FlipStateChangedL( TBool aKeyboardFlipOpen ) |
|
757 { |
|
758 CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen ); |
|
759 iSearchTreeListVisualizer->SetFlipState( iKeyboardFlipOpen ); |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // CFSEmailUiSearchListVisualiser::HandleTimerFocusStateChange |
|
764 // ----------------------------------------------------------------------------- |
|
765 // |
|
766 void CFSEmailUiSearchListVisualiser::HandleTimerFocusStateChange( TBool aShow ) |
|
767 { |
|
768 CFsEmailUiViewBase::HandleTimerFocusStateChange( aShow ); |
|
769 iSearchTreeListVisualizer->SetFocusVisibility( aShow ); |
|
770 } |
|
771 |
|
772 // --------------------------------------------------------------------------- |
|
773 // CFSEmailUiSearchListVisualiser::SetStatusBarLayout() |
|
774 // Sets status bar layout |
|
775 // --------------------------------------------------------------------------- |
|
776 // |
|
777 void CFSEmailUiSearchListVisualiser::SetStatusBarLayout() |
|
778 { |
|
779 if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ) |
|
780 { |
|
781 TRAP_IGNORE( |
|
782 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )); |
|
783 } |
|
784 } |
|
785 |
|
786 void CFSEmailUiSearchListVisualiser::HandleCommandL( TInt aCommand ) |
|
787 { |
|
788 FUNC_LOG; |
|
789 switch ( aCommand ) |
|
790 { |
|
791 case EAknSoftkeySelect: |
|
792 { |
|
793 TInt modelCount(0); |
|
794 if ( iModel ) |
|
795 { |
|
796 modelCount = iModel->Count(); |
|
797 } |
|
798 if ( modelCount ) // Safety check |
|
799 { |
|
800 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
801 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
802 { |
|
803 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
804 if ( messagePtr ) |
|
805 { |
|
806 OpenHighlightedMailL(); |
|
807 } |
|
808 } |
|
809 } |
|
810 } |
|
811 break; |
|
812 case EAknSoftkeyBack: |
|
813 { |
|
814 if ( !iAppUi.ViewSwitchingOngoing()) |
|
815 { |
|
816 if ( iSearchOngoing ) |
|
817 { |
|
818 StopSearchL(); |
|
819 } |
|
820 //<cmail> useless code removed |
|
821 //HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH ); |
|
822 //iBarTextVisual->SetTextL( *searchText ); |
|
823 //CleanupStack::PopAndDestroy( searchText ); |
|
824 //</cmail> |
|
825 TVwsViewId viewId = TVwsViewId( KFSEmailUiUid, MailListId ); |
|
826 TMailListActivationData tmp; |
|
827 if ( iMsgDataCouldBeChanged ) |
|
828 { |
|
829 tmp.iRequestRefresh = ETrue; |
|
830 iMsgDataCouldBeChanged = EFalse; // List starts a new search |
|
831 } |
|
832 const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
|
833 iAppUi.ReturnToPreviousViewL( pkgOut ); |
|
834 } |
|
835 } |
|
836 break; |
|
837 case EEikCmdExit: |
|
838 case EAknSoftkeyExit: |
|
839 case EFsEmailUiCmdExit: |
|
840 iAppUi.Exit(); |
|
841 break; |
|
842 case EFsEmailUiCmdCalActionsReplyAsMail: |
|
843 case EFsEmailUiCmdActionsReply: |
|
844 { |
|
845 if ( iSearchList->Count() ) |
|
846 { |
|
847 iMsgDataCouldBeChanged = ETrue; |
|
848 ReplyL( NULL ); // Function will check marked/highlighted msg |
|
849 } |
|
850 } |
|
851 break; |
|
852 case EFsEmailUiCmdActionsReplyAll: |
|
853 { |
|
854 if ( iSearchList->Count() ) |
|
855 { |
|
856 iMsgDataCouldBeChanged = ETrue; |
|
857 ReplyAllL( NULL ); // Function will check marked/highlighted msg |
|
858 } |
|
859 } |
|
860 break; |
|
861 case EFsEmailUiCmdCalActionsForwardAsMail: |
|
862 case EFsEmailUiCmdActionsForward: |
|
863 { |
|
864 if ( iSearchList->Count() ) |
|
865 { |
|
866 iMsgDataCouldBeChanged = ETrue; |
|
867 ForwardL( NULL ); // Function will check marked/highlighted msg |
|
868 } |
|
869 } |
|
870 break; |
|
871 case EFsEmailUiCmdGoToTop: |
|
872 { |
|
873 if ( iSearchListItemArray.Count() ) |
|
874 { |
|
875 TInt bottomItemId = iSearchListItemArray[0].iSearchListItemId; |
|
876 iSearchTreeListVisualizer->SetFocusedItemL( bottomItemId ); |
|
877 } |
|
878 } |
|
879 break; |
|
880 case EFsEmailUiCmdGoToBottom: |
|
881 { |
|
882 if ( iSearchListItemArray.Count() ) |
|
883 { |
|
884 TInt bottomItemId = iSearchListItemArray[ iSearchListItemArray.Count()-1 ].iSearchListItemId; |
|
885 iSearchTreeListVisualizer->SetFocusedItemL( bottomItemId ); |
|
886 } |
|
887 } |
|
888 break; |
|
889 case EFsEmailUiCmdPageUp: |
|
890 { |
|
891 TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 }; |
|
892 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
893 } |
|
894 break; |
|
895 case EFsEmailUiCmdPageDown: |
|
896 { |
|
897 TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 }; |
|
898 iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
899 } |
|
900 break; |
|
901 |
|
902 case EFsEmailUiCmdActionsDeleteCalEvent: |
|
903 case EFsEmailUiCmdActionsDelete: |
|
904 { |
|
905 if ( iSearchList->Count() ) |
|
906 { |
|
907 DeleteFocusedMessageL(); |
|
908 } |
|
909 } |
|
910 break; |
|
911 case EAknSoftkeyOpen: |
|
912 case EFsEmailUiCmdOpen: |
|
913 { |
|
914 if ( iSearchList->Count() ) |
|
915 { |
|
916 OpenHighlightedMailL(); |
|
917 } |
|
918 } |
|
919 break; |
|
920 case EFsEmailUiCmdNewSearch: |
|
921 case EFsEmailUiCmdSearch: |
|
922 { |
|
923 LaunchSearchDialogL(); |
|
924 } |
|
925 break; |
|
926 case EFsEmailUiCmdStopSearch: |
|
927 { |
|
928 StopSearchL(); |
|
929 } |
|
930 break; |
|
931 case EFsEmailUiCmdMessageDetails: |
|
932 { |
|
933 if ( iSearchList->Count() ) |
|
934 { |
|
935 CFSEmailUiMailListModelItem* item = |
|
936 static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( HighlightedIndex() ) ); |
|
937 CFSMailMessage& msg = item->MessagePtr(); |
|
938 |
|
939 TMsgDetailsActivationData msgDetailsData; |
|
940 msgDetailsData.iMailBoxId = msg.GetMailBoxId(); |
|
941 msgDetailsData.iFolderId = msg.GetFolderId(); |
|
942 msgDetailsData.iMessageId = msg.GetMessageId(); |
|
943 |
|
944 const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData ); |
|
945 iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning, pkgOut); |
|
946 } |
|
947 } |
|
948 break; |
|
949 case EFsEmailUiCmdHelp: |
|
950 { |
|
951 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
952 } |
|
953 break; |
|
954 case EFsEmailUiCmdActionsCallSender: |
|
955 { |
|
956 if ( iSearchList->Count() ) |
|
957 { |
|
958 CallToSenderL(); |
|
959 } |
|
960 } |
|
961 break; |
|
962 case EFsEmailUiCmdActionsAddContact: |
|
963 { |
|
964 if ( iSearchList->Count() ) |
|
965 { |
|
966 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
967 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
968 { |
|
969 CFSMailAddress* fromAddress = item->MessagePtr().GetSender(); |
|
970 TDesC* emailAddress(0); |
|
971 if ( fromAddress ) |
|
972 { |
|
973 emailAddress = &fromAddress->GetEmailAddress(); |
|
974 } |
|
975 if ( emailAddress && emailAddress->Length() ) |
|
976 { |
|
977 TAddToContactsType aType; |
|
978 //Query to "update existing" or "Create new" --> EFALSE = user choosed "cancel" |
|
979 if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddtoContactsQueryL( aType ) ) |
|
980 { |
|
981 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL( |
|
982 *emailAddress, EContactUpdateEmail, aType, this ); |
|
983 } |
|
984 } |
|
985 } |
|
986 } |
|
987 } |
|
988 break; |
|
989 case EFsEmailUiCmdMarkAsReadUnreadToggle: |
|
990 { |
|
991 if ( iSearchList->Count() ) |
|
992 { |
|
993 CFSEmailUiMailListModelItem* item = |
|
994 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() )); |
|
995 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
996 { |
|
997 if ( item->MessagePtr().IsFlagSet(EFSMsgFlag_Read) ) |
|
998 { |
|
999 HandleCommandL( EFsEmailUiCmdMarkAsUnread ); |
|
1000 } |
|
1001 else |
|
1002 { |
|
1003 HandleCommandL( EFsEmailUiCmdMarkAsRead ); |
|
1004 } |
|
1005 } |
|
1006 } |
|
1007 } |
|
1008 break; |
|
1009 case EFsEmailUiCmdMarkAsUnread: |
|
1010 { |
|
1011 ChangeReadStatusOfHighlightedL( EFalse ); |
|
1012 } |
|
1013 break; |
|
1014 case EFsEmailUiCmdMarkAsRead: |
|
1015 { |
|
1016 ChangeReadStatusOfHighlightedL( ETrue ); |
|
1017 } |
|
1018 break; |
|
1019 case EFsEmailUiCmdCalActionsAccept: |
|
1020 case EFsEmailUiCmdCalActionsTentative: |
|
1021 case EFsEmailUiCmdCalActionsDecline: |
|
1022 case EFsEmailUiCmdCalRemoveFromCalendar: |
|
1023 { |
|
1024 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
1025 if ( item && item->ModelItemType() == ETypeMailItem && |
|
1026 item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1027 { |
|
1028 ChangeReadStatusOfHighlightedL( ETrue ); |
|
1029 iAppUi.MailViewer().HandleMrCommandL( aCommand, |
|
1030 iAppUi.GetActiveMailbox()->GetId(), |
|
1031 item->MessagePtr().GetFolderId(), |
|
1032 item->MessagePtr().GetMessageId() ); |
|
1033 } |
|
1034 } |
|
1035 break; |
|
1036 // <cmail> Prevent Download Manager opening with attachments |
|
1037 // case EFsEmailUiCmdDownloadManager: |
|
1038 // { |
|
1039 // if (iSearchOngoing) |
|
1040 // { |
|
1041 // StopSearchL(); |
|
1042 // } |
|
1043 // iAppUi.EnterFsEmailViewL( DownloadManagerViewId ); |
|
1044 // } |
|
1045 // break; |
|
1046 // </cmail> |
|
1047 case EFsEmailUiCmdReadEmail: |
|
1048 { |
|
1049 iAppUi.StartReadingEmailsL(); |
|
1050 } |
|
1051 break; |
|
1052 default: |
|
1053 break; |
|
1054 } |
|
1055 } |
|
1056 |
|
1057 |
|
1058 TInt CFSEmailUiSearchListVisualiser::LaunchSearchDialogL() |
|
1059 { |
|
1060 FUNC_LOG; |
|
1061 if ( !iLatestSearchText ) |
|
1062 { |
|
1063 iLatestSearchText = HBufC::NewL( KMaxLengthOfSearchString ); |
|
1064 } |
|
1065 TPtr16 textData = iLatestSearchText->Des(); |
|
1066 CAknQueryDialog* dlg = CAknQueryDialog::NewL( textData ); |
|
1067 HBufC* searchPrompt = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_LABEL ); |
|
1068 dlg->SetPromptL(*searchPrompt); |
|
1069 CleanupStack::PopAndDestroy( searchPrompt ); |
|
1070 TInt ret = dlg->ExecuteLD( R_FSEMAILUI_FIND_MAIL_DIALOG ); |
|
1071 if ( ret ) |
|
1072 { |
|
1073 // Stop any ongoing search before starting a new one |
|
1074 if ( iSearchOngoing ) |
|
1075 { |
|
1076 StopSearchL(); |
|
1077 } |
|
1078 //<cmail> make list and header visible by showing control group |
|
1079 else if( !iListAddedToControlGroup ) |
|
1080 { |
|
1081 //ControlGroup().AppendL( iSearchListControl ); |
|
1082 //ControlGroup().AppendL( iSearchList->TreeControl() ); |
|
1083 iListAddedToControlGroup = ETrue; |
|
1084 } |
|
1085 iSearchList->SetScrollbarVisibilityL( EFsScrollbarAuto ); |
|
1086 //</cmail> |
|
1087 // Set searching text |
|
1088 HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCHING ); |
|
1089 HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + KSpace().Length() ); |
|
1090 finalText->Des().Append( *searchText ); |
|
1091 finalText->Des().Append( KSpace ); |
|
1092 finalText->Des().Append( *iLatestSearchText ); |
|
1093 iBarTextVisual->SetTextL( *finalText ); |
|
1094 CleanupStack::PopAndDestroy( finalText ); |
|
1095 CleanupStack::PopAndDestroy( searchText ); |
|
1096 StartSearchL(); |
|
1097 } |
|
1098 return ret; |
|
1099 } |
|
1100 |
|
1101 |
|
1102 void CFSEmailUiSearchListVisualiser::UpdateMailListSettingsL() |
|
1103 { |
|
1104 FUNC_LOG; |
|
1105 if ( iAppUi.GetCRHandler() ) |
|
1106 { |
|
1107 iNodesInUse = iAppUi.GetCRHandler()->TitleDividers(); |
|
1108 TInt lineValue = iAppUi.GetCRHandler()->MessageListLayout(); |
|
1109 TInt bodyPreviewValue = iAppUi.GetCRHandler()->BodyPreview(); |
|
1110 if ( lineValue == 1 ) // 1-line layouts |
|
1111 { |
|
1112 if ( bodyPreviewValue == 0 ) |
|
1113 { |
|
1114 iListMode = EListControlTypeSingleLinePreviewOff; |
|
1115 } |
|
1116 else |
|
1117 { |
|
1118 iListMode = EListControlTypeSingleLinePreviewOn; |
|
1119 } |
|
1120 } |
|
1121 else // |
|
1122 { |
|
1123 if ( bodyPreviewValue == 0 ) |
|
1124 { |
|
1125 iListMode = EListControlTypeDoubleLinePreviewOff; |
|
1126 } |
|
1127 else |
|
1128 { |
|
1129 iListMode = EListControlTypeDoubleLinePreviewOn; |
|
1130 } |
|
1131 } |
|
1132 } |
|
1133 else |
|
1134 { |
|
1135 iNodesInUse = EListControlSeparatorDisabled; |
|
1136 iListMode = EListControlTypeDoubleLinePreviewOff; |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 |
|
1141 TBool CFSEmailUiSearchListVisualiser::OfferEventL(const TAlfEvent& aEvent) |
|
1142 { |
|
1143 FUNC_LOG; |
|
1144 TBool result(EFalse); |
|
1145 |
|
1146 if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
|
1147 { |
|
1148 TInt scanCode = aEvent.KeyEvent().iScanCode; |
|
1149 // Swap right and left controls in mirrored layout |
|
1150 if ( AknLayoutUtils::LayoutMirrored() ) |
|
1151 { |
|
1152 if ( scanCode == EStdKeyRightArrow ) scanCode = EStdKeyLeftArrow; |
|
1153 else if ( scanCode == EStdKeyLeftArrow ) scanCode = EStdKeyRightArrow; |
|
1154 } |
|
1155 |
|
1156 switch ( scanCode ) |
|
1157 { |
|
1158 case EStdKeyDevice3: // CENTER CLICK |
|
1159 case EStdKeyEnter: // ENTER EITHER SELECTS ITEM IN TOOLBAR OR OPENS MAIL |
|
1160 case EStdKeyNkpEnter: |
|
1161 { |
|
1162 if ( iSearchList->Count() ) |
|
1163 { |
|
1164 OpenHighlightedMailL(); |
|
1165 } |
|
1166 result = ETrue; |
|
1167 } |
|
1168 break; |
|
1169 case EStdKeyYes: |
|
1170 { |
|
1171 if ( iSearchList->Count() ) |
|
1172 { |
|
1173 CallToSenderL(); |
|
1174 } |
|
1175 } |
|
1176 break; |
|
1177 case EStdKeyRightArrow: |
|
1178 { |
|
1179 if ( iSearchList->Count() ) |
|
1180 { |
|
1181 LaunchActionMenuL(); |
|
1182 } |
|
1183 result = ETrue; |
|
1184 } |
|
1185 break; |
|
1186 default: |
|
1187 { |
|
1188 // check keyboard shortcuts: |
|
1189 TInt command = |
|
1190 iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
1191 CFSEmailUiShortcutBinding::EContextSearchResults ); |
|
1192 if ( command >= 0 ) |
|
1193 { |
|
1194 HandleCommandL( command ); |
|
1195 result = ETrue; |
|
1196 } |
|
1197 } |
|
1198 break; |
|
1199 } |
|
1200 } |
|
1201 else if (aEvent.IsPointerEvent()) |
|
1202 { |
|
1203 iSearchList->TreeControl()->OfferEventL(aEvent); |
|
1204 } |
|
1205 |
|
1206 return result; |
|
1207 } |
|
1208 |
|
1209 |
|
1210 |
|
1211 void CFSEmailUiSearchListVisualiser::ReScaleUiL() |
|
1212 { |
|
1213 FUNC_LOG; |
|
1214 if ( iFirstStartCompleted ) //Safety |
|
1215 { |
|
1216 SetSearchListLayoutAnchors(); |
|
1217 iScreenAnchorLayout->UpdateChildrenLayout(); |
|
1218 iSearchListLayout->UpdateChildrenLayout(); |
|
1219 // Set bar text color from skin |
|
1220 if ( iBarTextVisual ) |
|
1221 { |
|
1222 //<cmail> |
|
1223 SetHeaderAttributesL(); |
|
1224 /*TRgb barTextColor( KRgbBlack ); |
|
1225 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
|
1226 barTextColor, KAknsIIDFsTextColors, EAknsCIFsTextColorsCG10 ); |
|
1227 iBarTextVisual->SetColor( barTextColor );*/ |
|
1228 //</cmail> |
|
1229 } |
|
1230 RefreshL(); |
|
1231 //iSearchTreeListVisualizer->HideList(); |
|
1232 iSearchTreeListVisualizer->ShowListL(); |
|
1233 } |
|
1234 } |
|
1235 |
|
1236 void CFSEmailUiSearchListVisualiser::SetSearchListLayoutAnchors() |
|
1237 { |
|
1238 FUNC_LOG; |
|
1239 // Set anchors so that list leaves space for control bar |
|
1240 |
|
1241 // The anchor layout mirrors itself automatically when necessary. |
|
1242 // There's no need to mirror anything manually here. |
|
1243 |
|
1244 // BAR BACGROUND IMAGE |
|
1245 //<cmail> platform layout changes |
|
1246 TRect contBarRect = iAppUi.LayoutHandler()->GetControlBarRect(); |
|
1247 TPoint& tl( contBarRect.iTl ); |
|
1248 iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 0, |
|
1249 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1250 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1251 TAlfTimedPoint( tl.iX, tl.iY )); |
|
1252 TPoint& br( contBarRect.iBr ); |
|
1253 iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0, |
|
1254 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1255 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1256 TAlfTimedPoint( br.iX, br.iY )); |
|
1257 //</cmail> |
|
1258 |
|
1259 // LOOKING GLASS IMAGE |
|
1260 //<cmail> search magnifier icon removed from cmail |
|
1261 /*TRect searchIconRect( iAppUi.LayoutHandler()->GetControlBarMailboxIconRect() ); |
|
1262 const TPoint& tl( searchIconRect.iTl ); |
|
1263 iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, |
|
1264 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1265 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1266 TAlfTimedPoint(0, 0 )); |
|
1267 iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, |
|
1268 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1269 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1270 TAlfTimedPoint(KSearchIconWidth, iAppUi.LayoutHandler()->ControlBarHeight()));*/ |
|
1271 |
|
1272 // TEXT |
|
1273 //<cmail> platform layout changes |
|
1274 TRect textRect = iAppUi.LayoutHandler()->GetSearchListHeaderTextLayout().TextRect(); |
|
1275 tl = textRect.iTl; |
|
1276 iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, |
|
1277 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1278 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1279 TAlfTimedPoint( tl.iX, tl.iY )); |
|
1280 br = textRect.iBr; |
|
1281 iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, |
|
1282 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1283 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1284 TAlfTimedPoint( br.iX, br.iY )); |
|
1285 //</cmail> |
|
1286 |
|
1287 //<cmail> platform layout changes |
|
1288 TRect listRect = iAppUi.LayoutHandler()->GetListRect(); |
|
1289 iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2, |
|
1290 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1291 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1292 TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY)); |
|
1293 iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2, |
|
1294 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1295 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
1296 TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY)); |
|
1297 //</cmail> |
|
1298 } |
|
1299 |
|
1300 |
|
1301 TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromIndex( TInt aItemIdx ) const |
|
1302 { |
|
1303 FUNC_LOG; |
|
1304 TFSMailMsgId msgId; // constructs null ID |
|
1305 if ( 0 <= aItemIdx && aItemIdx < iModel->Count() ) |
|
1306 { |
|
1307 CFSEmailUiMailListModelItem* item = |
|
1308 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(aItemIdx)); |
|
1309 if ( item->ModelItemType() == ETypeMailItem ) |
|
1310 { |
|
1311 msgId = item->MessagePtr().GetMessageId(); |
|
1312 } |
|
1313 } |
|
1314 |
|
1315 return msgId; |
|
1316 } |
|
1317 |
|
1318 TFSMailMsgId CFSEmailUiSearchListVisualiser::MsgIdFromListId( TFsTreeItemId aListId ) const |
|
1319 { |
|
1320 FUNC_LOG; |
|
1321 TFSMailMsgId msgId; |
|
1322 for ( TInt i=0; i<iModel->Count();i++) |
|
1323 { |
|
1324 CFSEmailUiMailListModelItem* item = |
|
1325 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1326 if ( item->ModelItemType() == ETypeMailItem && |
|
1327 aListId == item->CorrespondingListId() ) |
|
1328 { |
|
1329 msgId = item->MessagePtr().GetMessageId(); |
|
1330 break; |
|
1331 } |
|
1332 } |
|
1333 return msgId; |
|
1334 } |
|
1335 |
|
1336 CFSMailMessage& CFSEmailUiSearchListVisualiser::MsgPtrFromListId( TFsTreeItemId aListId ) |
|
1337 { |
|
1338 FUNC_LOG; |
|
1339 CFSMailMessage* msgPtr(NULL); |
|
1340 for ( TInt i=0; i<iModel->Count();i++) |
|
1341 { |
|
1342 CFSEmailUiMailListModelItem* item = |
|
1343 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1344 if ( aListId == item->CorrespondingListId() ) |
|
1345 { |
|
1346 msgPtr = &item->MessagePtr(); |
|
1347 } |
|
1348 } |
|
1349 return *msgPtr; |
|
1350 } |
|
1351 |
|
1352 // Item data and visualiser helper functions |
|
1353 MFsTreeItemData* CFSEmailUiSearchListVisualiser::ItemDataFromItemId( TFsTreeItemId aItemId ) |
|
1354 { |
|
1355 FUNC_LOG; |
|
1356 TInt i(0); |
|
1357 MFsTreeItemData* itemData(NULL); |
|
1358 for ( ; i<iSearchListItemArray.Count(); i++ ) |
|
1359 { |
|
1360 if ( aItemId == iSearchListItemArray[i].iSearchListItemId ) |
|
1361 { |
|
1362 itemData = iSearchListItemArray[i].iTreeItemData; |
|
1363 } |
|
1364 } |
|
1365 return itemData; |
|
1366 } |
|
1367 |
|
1368 MFsTreeItemVisualizer* CFSEmailUiSearchListVisualiser::ItemVisualiserFromItemId( TFsTreeItemId aItemId ) |
|
1369 { |
|
1370 FUNC_LOG; |
|
1371 TInt i(0); |
|
1372 MFsTreeItemVisualizer* itemVis(NULL); |
|
1373 for ( ; i<iSearchListItemArray.Count(); i++ ) |
|
1374 { |
|
1375 if ( aItemId == iSearchListItemArray[i].iSearchListItemId ) |
|
1376 { |
|
1377 itemVis = iSearchListItemArray[i].iTreeItemVisualiser; |
|
1378 } |
|
1379 } |
|
1380 return itemVis; |
|
1381 } |
|
1382 |
|
1383 // Helpers to get the ordinal of a message in the iModel |
|
1384 TInt CFSEmailUiSearchListVisualiser::ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const |
|
1385 { |
|
1386 FUNC_LOG; |
|
1387 TInt idx = KErrNotFound; |
|
1388 |
|
1389 for ( TInt i=0; i<iModel->Count() ; i++ ) |
|
1390 { |
|
1391 CFSEmailUiMailListModelItem* item = |
|
1392 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1393 if ( item->ModelItemType() == ETypeMailItem && |
|
1394 aMessageId == item->MessagePtr().GetMessageId() ) |
|
1395 { |
|
1396 idx = i; |
|
1397 break; |
|
1398 } |
|
1399 } |
|
1400 |
|
1401 return idx; |
|
1402 } |
|
1403 |
|
1404 TInt CFSEmailUiSearchListVisualiser::NextMessageIndex( TInt aCurMsgIdx ) const |
|
1405 { |
|
1406 FUNC_LOG; |
|
1407 TInt idx = KErrNotFound; |
|
1408 |
|
1409 for ( TInt i=aCurMsgIdx+1 ; i<iModel->Count() ; i++ ) |
|
1410 { |
|
1411 CFSEmailUiMailListModelItem* item = |
|
1412 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1413 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
1414 { |
|
1415 idx = i; |
|
1416 break; |
|
1417 } |
|
1418 } |
|
1419 |
|
1420 return idx; |
|
1421 } |
|
1422 |
|
1423 TInt CFSEmailUiSearchListVisualiser::PreviousMessageIndex( TInt aCurMsgIdx ) const |
|
1424 { |
|
1425 FUNC_LOG; |
|
1426 TInt idx = KErrNotFound; |
|
1427 |
|
1428 if ( aCurMsgIdx < iModel->Count() ) |
|
1429 { |
|
1430 for ( TInt i=aCurMsgIdx-1 ; i>=0 ; i-- ) |
|
1431 { |
|
1432 CFSEmailUiMailListModelItem* item = |
|
1433 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1434 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
1435 { |
|
1436 idx = i; |
|
1437 break; |
|
1438 } |
|
1439 } |
|
1440 } |
|
1441 |
|
1442 return idx; |
|
1443 } |
|
1444 |
|
1445 |
|
1446 void CFSEmailUiSearchListVisualiser::OpenHighlightedMailL() |
|
1447 { |
|
1448 FUNC_LOG; |
|
1449 if (iSearchOngoing) |
|
1450 { |
|
1451 StopSearchL(); |
|
1452 } |
|
1453 |
|
1454 CFSEmailUiMailListModelItem* item = |
|
1455 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
1456 if ( item->ModelItemType() == ETypeMailItem ) |
|
1457 { |
|
1458 // First make sure that the highlighted message really exists in the store |
|
1459 // Get confirmed msg ptr |
|
1460 CFSMailMessage* confirmedMsgPtr(0); |
|
1461 TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(), |
|
1462 item->MessagePtr().GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope ) ); |
|
1463 if ( confirmedMsgPtr && err == KErrNone ) |
|
1464 { |
|
1465 CFSMailFolder* highlightedMsgFolder = |
|
1466 iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), confirmedMsgPtr->GetFolderId() ); |
|
1467 CleanupStack::PushL( highlightedMsgFolder ); |
|
1468 TInt msgFolderType = highlightedMsgFolder->GetFolderType(); |
|
1469 TFSMailMsgId highlightedMsgFolderId = highlightedMsgFolder->GetFolderId(); |
|
1470 CleanupStack::PopAndDestroy( highlightedMsgFolder ); |
|
1471 // Pointer confirmed, store Id and delete not needed anymore |
|
1472 TFSMailMsgId confirmedId = confirmedMsgPtr->GetMessageId(); |
|
1473 delete confirmedMsgPtr; |
|
1474 |
|
1475 // Open to editor from drafts |
|
1476 if ( msgFolderType == EFSDraftsFolder ) |
|
1477 { |
|
1478 TEditorLaunchParams params; |
|
1479 params.iMailboxId = iAppUi.GetActiveMailboxId(); |
|
1480 params.iActivatedExternally = EFalse; |
|
1481 params.iMsgId = confirmedId; |
|
1482 params.iFolderId = highlightedMsgFolderId; |
|
1483 iAppUi.LaunchEditorL( KEditorCmdOpen, params ); |
|
1484 } |
|
1485 else if ( msgFolderType == EFSOutbox ) |
|
1486 { |
|
1487 TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_OPEN_FROM_OUTBOX_NOTE, ETrue ); |
|
1488 } |
|
1489 else |
|
1490 { |
|
1491 THtmlViewerActivationData tmp; |
|
1492 tmp.iMailBoxId = iAppUi.GetActiveMailbox()->GetId(); |
|
1493 tmp.iMessageId = confirmedId; |
|
1494 tmp.iFolderId = highlightedMsgFolderId; |
|
1495 |
|
1496 const TPckgBuf<THtmlViewerActivationData> pkgOut( tmp ); |
|
1497 ChangeReadStatusOfHighlightedL( ETrue ); |
|
1498 iAppUi.EnterFsEmailViewL( HtmlViewerId, KStartViewerWithMsgId, pkgOut ); |
|
1499 } |
|
1500 } |
|
1501 else if ( err == KErrNotFound ) |
|
1502 { |
|
1503 TRAP_IGNORE( CheckAndUpdateFocusedMessageL() ); |
|
1504 } |
|
1505 } |
|
1506 } |
|
1507 |
|
1508 |
|
1509 |
|
1510 void CFSEmailUiSearchListVisualiser::ReplyL( CFSMailMessage* aMsgPtr ) |
|
1511 { |
|
1512 FUNC_LOG; |
|
1513 DoReplyForwardL( KEditorCmdReply, aMsgPtr ); |
|
1514 } |
|
1515 |
|
1516 void CFSEmailUiSearchListVisualiser::ReplyAllL( CFSMailMessage* aMsgPtr ) |
|
1517 { |
|
1518 FUNC_LOG; |
|
1519 DoReplyForwardL( KEditorCmdReplyAll, aMsgPtr ); |
|
1520 } |
|
1521 |
|
1522 void CFSEmailUiSearchListVisualiser::ForwardL( CFSMailMessage* aMsgPtr ) |
|
1523 { |
|
1524 FUNC_LOG; |
|
1525 DoReplyForwardL( KEditorCmdForward, aMsgPtr ); |
|
1526 } |
|
1527 |
|
1528 void CFSEmailUiSearchListVisualiser::DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr ) |
|
1529 { |
|
1530 FUNC_LOG; |
|
1531 // Stop search when reply/forward has been selected |
|
1532 if ( iSearchOngoing ) |
|
1533 { |
|
1534 StopSearchL(); |
|
1535 } |
|
1536 |
|
1537 if ( iModel->Count() ) |
|
1538 { |
|
1539 CFSMailMessage* messagePointer = aMsgPtr; |
|
1540 if ( !messagePointer ) |
|
1541 { |
|
1542 RFsTreeItemIdList markedEntries; |
|
1543 iSearchList->GetMarkedItemsL( markedEntries ); |
|
1544 TInt markedCount = markedEntries.Count(); |
|
1545 if ( markedCount == 0 ) |
|
1546 { |
|
1547 CFSEmailUiMailListModelItem* item = NULL; |
|
1548 item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
1549 if (item) |
|
1550 { |
|
1551 messagePointer = &item->MessagePtr(); |
|
1552 } |
|
1553 } |
|
1554 else if ( markedCount == 1) |
|
1555 { |
|
1556 messagePointer = &MsgPtrFromListId( markedEntries[0] ); |
|
1557 } |
|
1558 } |
|
1559 if ( messagePointer ) |
|
1560 { |
|
1561 // No reply/Forward for calendar messages, at least not in 1.0 |
|
1562 if ( !messagePointer->IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
1563 { |
|
1564 TEditorLaunchParams params; |
|
1565 params.iMailboxId = iAppUi.GetActiveMailboxId(); |
|
1566 params.iActivatedExternally = EFalse; |
|
1567 params.iMsgId = messagePointer->GetMessageId(); |
|
1568 iAppUi.LaunchEditorL( aMode, params ); |
|
1569 } |
|
1570 } |
|
1571 } |
|
1572 } |
|
1573 |
|
1574 void CFSEmailUiSearchListVisualiser::StartSearchL() |
|
1575 { |
|
1576 FUNC_LOG; |
|
1577 iSearchCount++; |
|
1578 |
|
1579 // Reset previous results before starting new search |
|
1580 // <cmail> fixed CS high cat. finding |
|
1581 ResetResultListL(); |
|
1582 TLex lex( *iLatestSearchText ); |
|
1583 while ( !lex.Eos() ) |
|
1584 { |
|
1585 HBufC* token = lex.NextToken().AllocLC(); |
|
1586 |
|
1587 iSearchStrings.AppendL( token ); |
|
1588 |
|
1589 CleanupStack::Pop( token ); |
|
1590 } |
|
1591 |
|
1592 TFSMailSortCriteria sortCriteria; |
|
1593 sortCriteria.iField = EFSMailSortByDate; |
|
1594 sortCriteria.iOrder = EFSMailDescending; |
|
1595 iSearchOngoing = ETrue; |
|
1596 // Model and list is set to be empty, set also MSK to empty |
|
1597 SetMskL(); |
|
1598 // Initialisr TextSearcher |
|
1599 |
|
1600 // Start search. |
|
1601 iMailBox->SearchL( iSearchStrings, sortCriteria, *this ); |
|
1602 } |
|
1603 |
|
1604 void CFSEmailUiSearchListVisualiser::StopSearchL() |
|
1605 { |
|
1606 FUNC_LOG; |
|
1607 iSearchOngoing = EFalse; |
|
1608 if ( iMailBox ) |
|
1609 { |
|
1610 iMailBox->CancelSearch(); |
|
1611 } |
|
1612 HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH_RESULTS ); |
|
1613 HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + 4 ); |
|
1614 finalText->Des().Append( *searchText ); |
|
1615 finalText->Des().Append( KSpace ); |
|
1616 finalText->Des().Append( *iLatestSearchText ); |
|
1617 iBarTextVisual->SetTextL( *finalText ); |
|
1618 CleanupStack::PopAndDestroy( finalText ); |
|
1619 CleanupStack::PopAndDestroy( searchText ); |
|
1620 } |
|
1621 |
|
1622 void CFSEmailUiSearchListVisualiser::ResetResultListL() |
|
1623 { |
|
1624 // <cmail> fixed CS high cat. finding |
|
1625 FUNC_LOG; |
|
1626 iModel->Reset(); |
|
1627 iSearchList->RemoveAllL(); |
|
1628 iSearchListItemArray.Reset(); |
|
1629 iSearchStrings.ResetAndDestroy(); |
|
1630 } |
|
1631 |
|
1632 void CFSEmailUiSearchListVisualiser::MatchFoundL( CFSMailMessage* aMatchMessage ) |
|
1633 { |
|
1634 FUNC_LOG; |
|
1635 |
|
1636 if ( !iSearchList->IsFocused() ) |
|
1637 { |
|
1638 iSearchList->SetFocusedL( ETrue ); |
|
1639 } |
|
1640 |
|
1641 // Delete receved owned object and add confirmed msg pointer to model insteaed |
|
1642 // This is done because it seems that matched message objects seems to be different |
|
1643 // in some protocols than original messages |
|
1644 CleanupStack::PushL( aMatchMessage ); |
|
1645 CFSMailMessage* confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
|
1646 aMatchMessage->GetFolderId(), aMatchMessage->GetMessageId(), EFSMsgDataEnvelope ); |
|
1647 CleanupStack::PopAndDestroy( aMatchMessage ); |
|
1648 |
|
1649 if ( confirmedMsgPtr ) // Append item into model and list if msg pointer was confirmed |
|
1650 { |
|
1651 // Append to model |
|
1652 CFSEmailUiMailListModelItem* newItem = CFSEmailUiMailListModelItem::NewL( confirmedMsgPtr, ETypeMailItem); |
|
1653 iModel->AppendL(newItem); |
|
1654 |
|
1655 // Append to list |
|
1656 TRect screenRect; |
|
1657 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
|
1658 |
|
1659 CFSMailAddress* fromAddress = confirmedMsgPtr->GetSender(); |
|
1660 TDesC* diplayName(0); |
|
1661 if ( fromAddress ) |
|
1662 { |
|
1663 diplayName = &fromAddress->GetDisplayName(); |
|
1664 } |
|
1665 |
|
1666 // Set first line of data |
|
1667 HBufC* dispName(0); |
|
1668 if ( fromAddress && diplayName && diplayName->Length() != 0 ) |
|
1669 { |
|
1670 dispName = HBufC::NewLC( diplayName->Length() ); |
|
1671 dispName->Des().Append( *diplayName ); |
|
1672 } |
|
1673 else if ( fromAddress && fromAddress->GetEmailAddress().Length() != 0 ) |
|
1674 { |
|
1675 dispName = HBufC::NewLC( fromAddress->GetEmailAddress().Length() ); |
|
1676 dispName->Des().Append( fromAddress->GetEmailAddress() ); |
|
1677 } |
|
1678 else |
|
1679 { |
|
1680 dispName = HBufC::NewLC( 0 ); |
|
1681 dispName->Des().Append( KNullDesC ); |
|
1682 } |
|
1683 |
|
1684 // Drop out unwanted characters from display name such as <> and "" |
|
1685 // And set display name data |
|
1686 if ( dispName ) |
|
1687 { |
|
1688 TFsEmailUiUtility::StripDisplayName( *dispName ); |
|
1689 } |
|
1690 // Create item data and |
|
1691 CFsTreePlainTwoLineItemData* itemData = CFsTreePlainTwoLineItemData::NewL(); |
|
1692 |
|
1693 itemData->SetDataL( *dispName ); |
|
1694 CleanupStack::PopAndDestroy( dispName ); |
|
1695 |
|
1696 // Set time text data |
|
1697 HBufC* timeText = TFsEmailUiUtility::ListMsgTimeTextFromMsgLC( confirmedMsgPtr, EFalse ); |
|
1698 itemData->SetDateTimeDataL ( *timeText ); |
|
1699 CleanupStack::PopAndDestroy(); |
|
1700 |
|
1701 // Set second line of data |
|
1702 |
|
1703 HBufC* subjectText = TFsEmailUiUtility::CreateSubjectTextLC( confirmedMsgPtr ); |
|
1704 |
|
1705 |
|
1706 itemData->SetSecondaryDataL( *subjectText); |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 CleanupStack::PopAndDestroy( subjectText ); |
|
1712 |
|
1713 |
|
1714 // Set message icon |
|
1715 CAlfTexture* itemTexture = &TFsEmailUiUtility::GetMsgIcon( confirmedMsgPtr, *iAppUi.FsTextureManager() ); |
|
1716 itemData->SetIcon ( *itemTexture ); |
|
1717 CFsTreePlainTwoLineItemVisualizer* itemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL(*iSearchList->TreeControl()); |
|
1718 |
|
1719 |
|
1720 itemVisualizer->SetExtendable( ETrue ); |
|
1721 TInt itemHeight = iAppUi.LayoutHandler()->OneLineListItemHeight(); |
|
1722 |
|
1723 itemVisualizer->SetSize(TSize(screenRect.Width(), itemHeight)); |
|
1724 itemVisualizer->SetExtendedSize(TSize(screenRect.Width(), 2*itemHeight)); |
|
1725 |
|
1726 // Set menu icon |
|
1727 itemVisualizer->SetFlags( itemVisualizer->Flags() | KFsTreeListItemHasMenu ); |
|
1728 |
|
1729 // Set font height |
|
1730 itemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
1731 |
|
1732 // Set font bolding |
|
1733 if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read ) ) |
|
1734 { |
|
1735 itemVisualizer->SetTextBold( EFalse ); |
|
1736 } |
|
1737 else |
|
1738 { |
|
1739 itemVisualizer->SetTextBold( ETrue ); |
|
1740 } |
|
1741 |
|
1742 // Set correct skin text colors for the list items |
|
1743 TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
1744 TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
1745 itemVisualizer->SetFocusedStateTextColor( focusedColor ); |
|
1746 itemVisualizer->SetNormalStateTextColor( normalColor ); |
|
1747 |
|
1748 switch ( iListMode ) |
|
1749 { |
|
1750 case EListControlTypeDoubleLinePreviewOn: |
|
1751 case EListControlTypeSingleLinePreviewOn: |
|
1752 itemVisualizer->SetPreviewPaneOn( ETrue ); |
|
1753 itemVisualizer->SetPreviewPaneEnabledSize( TSize(screenRect.Width(), 3*itemHeight) ); |
|
1754 // fall through |
|
1755 case EListControlTypeDoubleLinePreviewOff: |
|
1756 case EListControlTypeSingleLinePreviewOff: |
|
1757 itemVisualizer->SetExtendable(ETrue); |
|
1758 itemVisualizer->SetExtendedSize(TSize(screenRect.Width(), 2*itemHeight)); |
|
1759 break; |
|
1760 default: |
|
1761 break; |
|
1762 } |
|
1763 |
|
1764 // Update initial preview pane text for items if needed |
|
1765 if ( iListMode == EListControlTypeSingleLinePreviewOn || |
|
1766 iListMode == EListControlTypeDoubleLinePreviewOn ) |
|
1767 { |
|
1768 UpdatePreviewPaneTextForItemL( itemData, confirmedMsgPtr ); |
|
1769 } |
|
1770 |
|
1771 // Set follow up flag icon |
|
1772 if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) ) |
|
1773 { |
|
1774 if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_FollowUp ) ) |
|
1775 { |
|
1776 itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagList ) ); |
|
1777 itemVisualizer->SetFlagIconVisible( ETrue ); |
|
1778 } |
|
1779 else if ( confirmedMsgPtr->IsFlagSet( EFSMsgFlag_FollowUpComplete ) ) |
|
1780 { |
|
1781 itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagCompleteList ) ); |
|
1782 itemVisualizer->SetFlagIconVisible( ETrue ); |
|
1783 } |
|
1784 else |
|
1785 { |
|
1786 itemVisualizer->SetFlagIconVisible( EFalse ); |
|
1787 } |
|
1788 } |
|
1789 else |
|
1790 { |
|
1791 itemVisualizer->SetFlagIconVisible( EFalse ); |
|
1792 } |
|
1793 |
|
1794 TFsTreeItemId itemId = iSearchList->InsertItemL( *itemData, *itemVisualizer, KFsTreeRootID ); |
|
1795 if (iSearchList->FocusedItem() == KFsTreeNoneID) |
|
1796 { |
|
1797 iSearchList->SetFocusedItemL(itemId); |
|
1798 } |
|
1799 |
|
1800 SSearchListItem searchListItem; |
|
1801 searchListItem.iSearchListItemId = itemId; |
|
1802 searchListItem.iTreeItemData = itemData; |
|
1803 searchListItem.iTreeItemVisualiser = itemVisualizer; |
|
1804 iSearchListItemArray.AppendL( searchListItem ); |
|
1805 newItem->AddCorrespondingListId( itemId ); |
|
1806 |
|
1807 if ( iSearchList->Count() == 1 ) // Call only once, temp fix because of error in generic |
|
1808 { |
|
1809 if ( iListMode == EListControlTypeDoubleLinePreviewOn || |
|
1810 iListMode == EListControlTypeDoubleLinePreviewOff ) |
|
1811 { |
|
1812 iSearchTreeListVisualizer->SetItemsAlwaysExtendedL( ETrue ); |
|
1813 } |
|
1814 else |
|
1815 { |
|
1816 // Set the extendedability and extended size |
|
1817 iSearchTreeListVisualizer->SetItemsAlwaysExtendedL( EFalse ); |
|
1818 } |
|
1819 |
|
1820 // Set msk to "Open when first is found". |
|
1821 SetMskL(); |
|
1822 } |
|
1823 } |
|
1824 |
|
1825 } |
|
1826 |
|
1827 // --------------------------------------------------------------------------- |
|
1828 // HandleMailBoxEventL |
|
1829 // Function removes objects from the list that are deleted. |
|
1830 // Also updates icon and read status if synced so from the server |
|
1831 // --------------------------------------------------------------------------- |
|
1832 // |
|
1833 void CFSEmailUiSearchListVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent, |
|
1834 TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ ) |
|
1835 { |
|
1836 FUNC_LOG; |
|
1837 if ( iFirstStartCompleted ) // Safety |
|
1838 { |
|
1839 CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox(); |
|
1840 if ( activeMailbox && aMailbox.Id() == activeMailbox->GetId().Id() ) // Safety, in list events that only concern active mailbox are handled |
|
1841 { |
|
1842 if ( iModel && iModel->Count() && aEvent == TFSEventMailDeleted ) |
|
1843 { |
|
1844 RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>(aParam1); |
|
1845 if ( removedEntries && removedEntries->Count() ) |
|
1846 { |
|
1847 RemoveMsgItemsFromListIfFoundL( *removedEntries ); |
|
1848 } |
|
1849 } |
|
1850 else if ( iModel && iModel->Count() && aEvent == TFSEventMailChanged ) |
|
1851 { |
|
1852 // Get array of changed entries |
|
1853 RArray<TFSMailMsgId>* entries = static_cast<RArray<TFSMailMsgId>*>(aParam1); |
|
1854 // Get ID of the folder that this cahnge concerns. |
|
1855 TFSMailMsgId* parentFolderId = static_cast<TFSMailMsgId*>( aParam2 ); |
|
1856 for ( TInt i=0 ; i < entries->Count() ; i++) |
|
1857 { |
|
1858 TFSMailMsgId entryId = (*entries)[i]; |
|
1859 CFSMailMessage* confirmedMsgPtr(0); |
|
1860 TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
|
1861 *parentFolderId, entryId, EFSMsgDataEnvelope ) ); |
|
1862 if ( confirmedMsgPtr && err == KErrNone ) |
|
1863 { |
|
1864 CleanupStack::PushL( confirmedMsgPtr ); |
|
1865 UpdateMsgIconAndBoldingL( confirmedMsgPtr ); |
|
1866 CleanupStack::PopAndDestroy( confirmedMsgPtr ); |
|
1867 } |
|
1868 } |
|
1869 } |
|
1870 } |
|
1871 } |
|
1872 } |
|
1873 |
|
1874 // --------------------------------------------------------------------------- |
|
1875 // RemoveMsgItemsFromListIfFoundL |
|
1876 // Message removing from list if found. Does not panic or return found status. |
|
1877 // --------------------------------------------------------------------------- |
|
1878 // |
|
1879 void CFSEmailUiSearchListVisualiser::RemoveMsgItemsFromListIfFoundL( const RArray<TFSMailMsgId>& aEntryIds ) |
|
1880 { |
|
1881 FUNC_LOG; |
|
1882 if ( iModel && iModel->Count() ) |
|
1883 { |
|
1884 for ( TInt i=0 ; i<aEntryIds.Count() ; ++i ) |
|
1885 { |
|
1886 const TFSMailMsgId& entryId = aEntryIds[i]; |
|
1887 if ( !entryId.IsNullId() ) |
|
1888 { |
|
1889 TInt idx = ItemIndexFromMessageId( entryId ); |
|
1890 if ( idx >= 0 ) |
|
1891 { |
|
1892 iSearchList->RemoveL( iSearchListItemArray[idx].iSearchListItemId ); // remove from list |
|
1893 iSearchListItemArray.Remove( idx ); // remove from internal array. |
|
1894 iModel->RemoveAndDestroy( idx ); // Remove from model |
|
1895 } |
|
1896 } |
|
1897 } |
|
1898 } |
|
1899 } |
|
1900 |
|
1901 // --------------------------------------------------------------------------- |
|
1902 // UpdatePreviewPaneTextForItemL |
|
1903 // Updates preview pane text for item |
|
1904 // --------------------------------------------------------------------------- |
|
1905 // |
|
1906 void CFSEmailUiSearchListVisualiser::UpdatePreviewPaneTextForItemL(CFsTreePlainTwoLineItemData* aItemData, CFSMailMessage* aMsgPtr ) |
|
1907 { |
|
1908 FUNC_LOG; |
|
1909 // Preview pane data update |
|
1910 if ( aMsgPtr && ( iListMode == EListControlTypeSingleLinePreviewOn || |
|
1911 iListMode == EListControlTypeDoubleLinePreviewOn ) ) |
|
1912 { |
|
1913 CFSMailMessagePart* textPart = aMsgPtr->PlainTextBodyPartL(); |
|
1914 CleanupStack::PushL( textPart ); |
|
1915 if ( textPart && ( textPart->FetchLoadState() == EFSPartial || |
|
1916 textPart->FetchLoadState() == EFSFull ) ) |
|
1917 { |
|
1918 TInt previewSize = Min( KMaxPreviewPaneLength, textPart->FetchedContentSize() ); |
|
1919 HBufC* plainTextData16 = HBufC::NewLC( previewSize ); |
|
1920 TPtr textPtr = plainTextData16->Des(); |
|
1921 |
|
1922 textPart->GetContentToBufferL( textPtr, 0 ); // Zero is start offset |
|
1923 // Crop out line feed, paragraph break, and tabulator |
|
1924 TFsEmailUiUtility::FilterListItemTextL( textPtr ); |
|
1925 aItemData->SetPreviewPaneDataL( *plainTextData16 ); |
|
1926 |
|
1927 CleanupStack::PopAndDestroy( plainTextData16 ); |
|
1928 } |
|
1929 |
|
1930 // Else display message size in preview pane |
|
1931 else |
|
1932 { |
|
1933 TUint contentSize = aMsgPtr->ContentSize(); |
|
1934 HBufC* sizeDesc = TFsEmailUiUtility::CreateSizeDescLC( contentSize ); |
|
1935 HBufC* msgSizeText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_PREV_PANE_MSG_SIZE, *sizeDesc ); |
|
1936 aItemData->SetPreviewPaneDataL( *msgSizeText ); |
|
1937 CleanupStack::PopAndDestroy( msgSizeText ); |
|
1938 CleanupStack::PopAndDestroy( sizeDesc ); |
|
1939 } |
|
1940 CleanupStack::PopAndDestroy( textPart ); |
|
1941 } |
|
1942 } |
|
1943 |
|
1944 void CFSEmailUiSearchListVisualiser::SearchCompletedL() |
|
1945 { |
|
1946 FUNC_LOG; |
|
1947 iSearchOngoing = EFalse; |
|
1948 HBufC* searchText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FIND_DLG_SEARCH_RESULTS ); |
|
1949 HBufC* finalText = HBufC::NewLC( searchText->Length() + iLatestSearchText->Length() + 4 ); |
|
1950 finalText->Des().Append( *searchText ); |
|
1951 finalText->Des().Append( KSpace ); |
|
1952 finalText->Des().Append( *iLatestSearchText ); |
|
1953 iBarTextVisual->SetTextL( *finalText ); |
|
1954 CleanupStack::PopAndDestroy( finalText ); |
|
1955 CleanupStack::PopAndDestroy( searchText ); |
|
1956 } |
|
1957 |
|
1958 |
|
1959 void CFSEmailUiSearchListVisualiser::ChangeReadStatusOfHighlightedL( TInt aRead ) |
|
1960 { |
|
1961 FUNC_LOG; |
|
1962 if ( iSearchList->Count() ) |
|
1963 { |
|
1964 CFSEmailUiMailListModelItem* selectedItem = |
|
1965 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() )); |
|
1966 |
|
1967 TBool wasRead = selectedItem->MessagePtr().IsFlagSet( EFSMsgFlag_Read ); |
|
1968 if ( (wasRead && !aRead) || (!wasRead && aRead) ) |
|
1969 { |
|
1970 // Read status is changed |
|
1971 iMsgDataCouldBeChanged = ETrue; |
|
1972 |
|
1973 if ( aRead ) |
|
1974 { |
|
1975 // Send flags, local and server |
|
1976 selectedItem->MessagePtr().SetFlag( EFSMsgFlag_Read ); |
|
1977 } |
|
1978 else |
|
1979 { |
|
1980 // Send flags, local and server |
|
1981 selectedItem->MessagePtr().ResetFlag( EFSMsgFlag_Read ); |
|
1982 } |
|
1983 selectedItem->MessagePtr().SaveMessageL(); // Save flag |
|
1984 // Switch icon to correct one |
|
1985 UpdateMsgIconAndBoldingL( HighlightedIndex() ); |
|
1986 } |
|
1987 } |
|
1988 } |
|
1989 |
|
1990 void CFSEmailUiSearchListVisualiser::CheckAndUpdateFocusedMessageL() |
|
1991 { |
|
1992 FUNC_LOG; |
|
1993 if ( iModel && iModel->Count() ) // Needed safety check |
|
1994 { |
|
1995 TInt highlightedIndex = HighlightedIndex(); |
|
1996 CFSEmailUiMailListModelItem* selectedItem = |
|
1997 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( highlightedIndex )); |
|
1998 if ( selectedItem->ModelItemType() == ETypeMailItem ) |
|
1999 { |
|
2000 CFSMailMessage* msgPtr = &selectedItem->MessagePtr(); |
|
2001 if ( msgPtr ) |
|
2002 { |
|
2003 CFSMailFolder* folderPtr = |
|
2004 iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), msgPtr->GetFolderId() ); |
|
2005 CleanupStack::PushL( folderPtr ); |
|
2006 |
|
2007 if ( !folderPtr ) |
|
2008 { |
|
2009 // Pointer is not valid anymore, msg has been delete, |
|
2010 // so it must be removed from the search list |
|
2011 RemoveFocusedFromListL(); |
|
2012 } |
|
2013 else |
|
2014 { |
|
2015 CFSMailMessage* confirmedMsgPtr(0); |
|
2016 TRAPD( err, confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
|
2017 folderPtr->GetFolderId(), msgPtr->GetMessageId(), EFSMsgDataEnvelope ) ); |
|
2018 if ( confirmedMsgPtr && err == KErrNone) |
|
2019 { |
|
2020 CleanupStack::PushL( confirmedMsgPtr ); |
|
2021 UpdateMsgIconAndBoldingL( confirmedMsgPtr ); |
|
2022 CleanupStack::PopAndDestroy( confirmedMsgPtr ); |
|
2023 } |
|
2024 else |
|
2025 { |
|
2026 RemoveFocusedFromListL(); |
|
2027 } |
|
2028 } |
|
2029 |
|
2030 CleanupStack::PopAndDestroy( folderPtr ); |
|
2031 } |
|
2032 } |
|
2033 } |
|
2034 } |
|
2035 |
|
2036 void CFSEmailUiSearchListVisualiser::RemoveFocusedFromListL() |
|
2037 { |
|
2038 FUNC_LOG; |
|
2039 iMsgDataCouldBeChanged = ETrue; |
|
2040 SSearchListItem item; |
|
2041 item.iSearchListItemId = iSearchList->FocusedItem(); |
|
2042 TInt IndexToBeDestroyed = iSearchListItemArray.Find( item ); |
|
2043 iSearchListItemArray.Remove( IndexToBeDestroyed ); // remove from internal array. |
|
2044 iModel->RemoveAndDestroy( IndexToBeDestroyed ); // Remove from model |
|
2045 iSearchList->RemoveL( iSearchList->FocusedItem() ); // remove from list |
|
2046 } |
|
2047 |
|
2048 |
|
2049 // Updates our own message object with the data from a given message object. |
|
2050 // The messages are matched with the message ID. |
|
2051 void CFSEmailUiSearchListVisualiser::UpdateMsgIconAndBoldingL( CFSMailMessage* aMsgPtr ) |
|
2052 { |
|
2053 FUNC_LOG; |
|
2054 if ( aMsgPtr ) |
|
2055 { |
|
2056 for ( TInt i=0 ; i < iModel->Count() ; i++) |
|
2057 { |
|
2058 CFSEmailUiMailListModelItem* item = |
|
2059 static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) ); |
|
2060 if ( item && item->ModelItemType()==ETypeMailItem && |
|
2061 item->MessagePtr().GetMessageId() == aMsgPtr->GetMessageId() ) |
|
2062 { |
|
2063 // Update all flags |
|
2064 TUint32 prevFlags = item->MessagePtr().GetFlags(); |
|
2065 TUint32 newFlags = aMsgPtr->GetFlags(); |
|
2066 if ( prevFlags != newFlags ) |
|
2067 { |
|
2068 item->MessagePtr().ResetFlag( prevFlags ); |
|
2069 item->MessagePtr().SetFlag( newFlags ); |
|
2070 |
|
2071 // Save changed flags in internal model array |
|
2072 item->MessagePtr().SaveMessageL(); |
|
2073 iMsgDataCouldBeChanged = ETrue; |
|
2074 } |
|
2075 |
|
2076 // Update the list item graphics |
|
2077 UpdateMsgIconAndBoldingL( i ); |
|
2078 break; |
|
2079 } |
|
2080 } |
|
2081 } |
|
2082 } |
|
2083 |
|
2084 // Updates list item at given index to match the state of the message object |
|
2085 void CFSEmailUiSearchListVisualiser::UpdateMsgIconAndBoldingL( TInt aListIndex ) |
|
2086 { |
|
2087 FUNC_LOG; |
|
2088 if (aListIndex < iSearchListItemArray.Count()) |
|
2089 { |
|
2090 CFSEmailUiMailListModelItem* item = |
|
2091 static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(aListIndex) ); |
|
2092 if ( item && item->ModelItemType()==ETypeMailItem ) |
|
2093 { |
|
2094 CFSMailMessage* msgPtr = &item->MessagePtr(); |
|
2095 CAlfTexture* itemTexture = &TFsEmailUiUtility::GetMsgIcon( msgPtr, *iAppUi.FsTextureManager() ); |
|
2096 CFsTreePlainTwoLineItemData* itemData = |
|
2097 static_cast<CFsTreePlainTwoLineItemData*>( iSearchListItemArray[aListIndex].iTreeItemData ); |
|
2098 CFsTreePlainTwoLineItemVisualizer* itemVis = |
|
2099 static_cast<CFsTreePlainTwoLineItemVisualizer*>( iSearchListItemArray[aListIndex].iTreeItemVisualiser ); |
|
2100 itemData->SetIcon( *itemTexture ); |
|
2101 if ( msgPtr->IsFlagSet( EFSMsgFlag_Read ) ) |
|
2102 { |
|
2103 itemVis->SetTextBold( EFalse ); |
|
2104 } |
|
2105 else |
|
2106 { |
|
2107 itemVis->SetTextBold( ETrue ); |
|
2108 } |
|
2109 // Set follow up flag icon correctly |
|
2110 if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) ) |
|
2111 { |
|
2112 if ( msgPtr->IsFlagSet( EFSMsgFlag_FollowUp ) ) |
|
2113 { |
|
2114 itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagList ) ); |
|
2115 itemVis->SetFlagIconVisible( ETrue ); |
|
2116 } |
|
2117 else if ( msgPtr->IsFlagSet( EFSMsgFlag_FollowUpComplete ) ) |
|
2118 { |
|
2119 itemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagCompleteList ) ); |
|
2120 itemVis->SetFlagIconVisible( ETrue ); |
|
2121 } |
|
2122 else |
|
2123 { |
|
2124 itemVis->SetFlagIconVisible( EFalse ); |
|
2125 } |
|
2126 } |
|
2127 else |
|
2128 { |
|
2129 itemVis->SetFlagIconVisible( EFalse ); |
|
2130 } |
|
2131 iSearchTreeListVisualizer->UpdateItemL( iSearchListItemArray[aListIndex].iSearchListItemId ); |
|
2132 } |
|
2133 } |
|
2134 } |
|
2135 |
|
2136 |
|
2137 // Delete messages |
|
2138 void CFSEmailUiSearchListVisualiser::DeleteFocusedMessageL() |
|
2139 { |
|
2140 FUNC_LOG; |
|
2141 if ( iSearchList->Count() ) |
|
2142 { |
|
2143 TInt currentItemIndex = HighlightedIndex(); |
|
2144 CFSEmailUiMailListModelItem* item = |
|
2145 static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(currentItemIndex)); |
|
2146 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2147 { |
|
2148 CFSMailMessage& messagePtr = item->MessagePtr(); |
|
2149 TInt queryTextId(0); |
|
2150 if ( messagePtr.IsFlagSet( EFSMsgFlag_CalendarMsg )) |
|
2151 { |
|
2152 queryTextId = R_FREESTYLE_EMAIL_DELETE_CALEVENT_NOTE; |
|
2153 } |
|
2154 else |
|
2155 { |
|
2156 queryTextId = R_FREESTYLE_EMAIL_DELETE_MAIL_NOTE; |
|
2157 } |
|
2158 HBufC* msgSubject = TFsEmailUiUtility::CreateSubjectTextLC( &messagePtr ); |
|
2159 |
|
2160 TInt okToDelete( ETrue ); |
|
2161 if ( iAppUi.GetCRHandler()->WarnBeforeDelete() ) |
|
2162 { |
|
2163 okToDelete = TFsEmailUiUtility::ShowConfirmationQueryL( queryTextId, *msgSubject ); |
|
2164 } |
|
2165 CleanupStack::PopAndDestroy( msgSubject ); |
|
2166 |
|
2167 if ( okToDelete ) |
|
2168 { |
|
2169 iMsgDataCouldBeChanged = ETrue; // Refresh |
|
2170 // Delete message from framework, and perform internal housekeeping |
|
2171 TFSMailMsgId msgId = messagePtr.GetMessageId(); |
|
2172 RArray<TFSMailMsgId> msgIds; |
|
2173 msgIds.Append( msgId ); |
|
2174 TFSMailMsgId folderId = messagePtr.GetFolderId(); |
|
2175 TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId(); |
|
2176 iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
|
2177 msgIds.Reset(); |
|
2178 SSearchListItem item; |
|
2179 item.iSearchListItemId = iSearchList->FocusedItem(); |
|
2180 TInt IndexToBeDestroyed = iSearchListItemArray.Find( item ); |
|
2181 iSearchListItemArray.Remove( IndexToBeDestroyed ); // remove from internal array. |
|
2182 iModel->RemoveAndDestroy( IndexToBeDestroyed ); // Remove from model |
|
2183 iSearchList->RemoveL( iSearchList->FocusedItem() ); // remove from list |
|
2184 } |
|
2185 } |
|
2186 } |
|
2187 } |
|
2188 |
|
2189 |
|
2190 // Navigation functions, used mainly from viewer |
|
2191 TBool CFSEmailUiSearchListVisualiser::IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
2192 TFSMailMsgId& aFoundNextMsgId, |
|
2193 TFSMailMsgId& aFoundNextMsgFolderId ) const |
|
2194 { |
|
2195 FUNC_LOG; |
|
2196 TBool ret(EFalse); |
|
2197 |
|
2198 TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
2199 if ( curIdx >= 0 ) |
|
2200 { |
|
2201 TInt nextIdx = NextMessageIndex(curIdx); |
|
2202 if ( nextIdx >= 0 ) |
|
2203 { |
|
2204 ret = ETrue; |
|
2205 aFoundNextMsgId = MsgIdFromIndex(nextIdx); |
|
2206 CFSEmailUiMailListModelItem* item = |
|
2207 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item( nextIdx )); |
|
2208 if ( item->ModelItemType() == ETypeMailItem ) |
|
2209 { |
|
2210 aFoundNextMsgFolderId = item->MessagePtr().GetFolderId(); |
|
2211 } |
|
2212 } |
|
2213 } |
|
2214 |
|
2215 return ret; |
|
2216 } |
|
2217 |
|
2218 |
|
2219 TBool CFSEmailUiSearchListVisualiser::IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
2220 TFSMailMsgId& aFoundPreviousMsgId, |
|
2221 TFSMailMsgId& aFoundPrevMsgFolderId ) const |
|
2222 { |
|
2223 FUNC_LOG; |
|
2224 TBool ret(EFalse); |
|
2225 |
|
2226 TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
2227 if ( curIdx >= 0 ) |
|
2228 { |
|
2229 TInt prevIdx = PreviousMessageIndex(curIdx); |
|
2230 if ( prevIdx >= 0 ) |
|
2231 { |
|
2232 ret = ETrue; |
|
2233 aFoundPreviousMsgId = MsgIdFromIndex(prevIdx); |
|
2234 CFSEmailUiMailListModelItem* item = |
|
2235 static_cast<CFSEmailUiMailListModelItem*>(iModel->Item( prevIdx )); |
|
2236 if ( item->ModelItemType() == ETypeMailItem ) |
|
2237 { |
|
2238 aFoundPrevMsgFolderId = item->MessagePtr().GetFolderId(); |
|
2239 } |
|
2240 } |
|
2241 } |
|
2242 |
|
2243 return ret; |
|
2244 } |
|
2245 |
|
2246 TInt CFSEmailUiSearchListVisualiser::MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId ) |
|
2247 { |
|
2248 FUNC_LOG; |
|
2249 TInt ret(KErrNotFound); |
|
2250 |
|
2251 TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
2252 TInt nextIdx = NextMessageIndex( curIdx ); |
|
2253 |
|
2254 if ( curIdx >= 0 && nextIdx >= 0 ) |
|
2255 { |
|
2256 // Focus the new message |
|
2257 iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[nextIdx].iSearchListItemId ); |
|
2258 ChangeReadStatusOfHighlightedL( ETrue ); |
|
2259 aFoundNextMsgId = MsgIdFromIndex( nextIdx ); |
|
2260 ret = KErrNone; |
|
2261 } |
|
2262 if ( ret == KErrNone ) |
|
2263 { |
|
2264 OpenHighlightedMailL(); |
|
2265 } |
|
2266 return ret; |
|
2267 } |
|
2268 |
|
2269 TInt CFSEmailUiSearchListVisualiser::MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId ) |
|
2270 { |
|
2271 FUNC_LOG; |
|
2272 TInt ret(KErrNotFound); |
|
2273 |
|
2274 TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
2275 TInt prevIdx = PreviousMessageIndex( curIdx ); |
|
2276 |
|
2277 if ( curIdx >= 0 && prevIdx >= 0 ) |
|
2278 { |
|
2279 // Focus the new message |
|
2280 iSearchTreeListVisualizer->SetFocusedItemL( iSearchListItemArray[prevIdx].iSearchListItemId ); |
|
2281 ChangeReadStatusOfHighlightedL( ETrue ); |
|
2282 aFoundPreviousMsgId = MsgIdFromIndex( prevIdx ); |
|
2283 ret = KErrNone; |
|
2284 } |
|
2285 if ( ret == KErrNone ) |
|
2286 { |
|
2287 OpenHighlightedMailL(); |
|
2288 } |
|
2289 return ret; |
|
2290 } |
|
2291 |
|
2292 |
|
2293 // Helper functions to get highlighted message id and folder id |
|
2294 TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageFolderId() |
|
2295 { |
|
2296 FUNC_LOG; |
|
2297 TFSMailMsgId ret; |
|
2298 if ( iSearchList->Count() && iModel ) |
|
2299 { |
|
2300 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
2301 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2302 { |
|
2303 ret = item->MessagePtr().GetFolderId(); |
|
2304 } |
|
2305 } |
|
2306 return ret; |
|
2307 } |
|
2308 |
|
2309 TFSMailMsgId CFSEmailUiSearchListVisualiser::HighlightedMessageId() |
|
2310 { |
|
2311 FUNC_LOG; |
|
2312 TFSMailMsgId ret; |
|
2313 if ( iSearchList->Count() && iModel ) |
|
2314 { |
|
2315 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
2316 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2317 { |
|
2318 ret = item->MessagePtr().GetMessageId(); |
|
2319 } |
|
2320 } |
|
2321 return ret; |
|
2322 } |
|
2323 |
|
2324 |
|
2325 //<cmail> Touch |
|
2326 // --------------------------------------------------------------------------- |
|
2327 // CFSEmailUiSearchListVisualiser::TreeListEventL |
|
2328 // From MFsTreeListObserver |
|
2329 // --------------------------------------------------------------------------- |
|
2330 // |
|
2331 void CFSEmailUiSearchListVisualiser::TreeListEventL( const TFsTreeListEvent aEvent, const TFsTreeItemId /*aId*/ ) |
|
2332 { |
|
2333 FUNC_LOG; |
|
2334 |
|
2335 switch(aEvent) |
|
2336 { |
|
2337 case MFsTreeListObserver::EFsTreeListItemTouchAction: |
|
2338 DoHandleActionL(); |
|
2339 break; |
|
2340 case MFsTreeListObserver::EFsTreeListItemTouchLongTap: |
|
2341 if ( iSearchList->Count() ) |
|
2342 { |
|
2343 LaunchActionMenuL(); |
|
2344 } |
|
2345 break; |
|
2346 case MFsTreeListObserver::EFsTreeListItemWillGetFocused: |
|
2347 { |
|
2348 SetMskL(); |
|
2349 break; |
|
2350 } |
|
2351 case MFsTreeListObserver::EFsTreeListItemTouchFocused: |
|
2352 default: |
|
2353 //Just ignore rest of events |
|
2354 break; |
|
2355 } |
|
2356 } |
|
2357 |
|
2358 // --------------------------------------------------------------------------- |
|
2359 // CFSEmailUiSearchListVisualiser::DoHandleActionL |
|
2360 // --------------------------------------------------------------------------- |
|
2361 // |
|
2362 void CFSEmailUiSearchListVisualiser::DoHandleActionL() |
|
2363 { |
|
2364 FUNC_LOG; |
|
2365 TInt modelCount = 0; |
|
2366 |
|
2367 if ( iModel ) |
|
2368 { |
|
2369 modelCount = iModel->Count(); |
|
2370 } |
|
2371 if ( modelCount ) // Safety check |
|
2372 { |
|
2373 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
2374 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2375 { |
|
2376 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
2377 if ( messagePtr ) |
|
2378 { |
|
2379 OpenHighlightedMailL(); |
|
2380 } |
|
2381 } |
|
2382 } |
|
2383 } |
|
2384 |
|
2385 //</cmail> |
|
2386 |
|
2387 // --------------------------------------------------------------------------- |
|
2388 // From MFSEmailUiContactHandlerObserver |
|
2389 // The ownership of the CLS items in the contacts array is transferred to the |
|
2390 // observer, and they must be deleted by the observer. |
|
2391 // --------------------------------------------------------------------------- |
|
2392 // |
|
2393 void CFSEmailUiSearchListVisualiser::OperationCompleteL( |
|
2394 TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ ) |
|
2395 { |
|
2396 FUNC_LOG; |
|
2397 } |
|
2398 |
|
2399 // --------------------------------------------------------------------------- |
|
2400 // From MFSEmailUiContactHandlerObserver |
|
2401 // Handles error in contact handler operation. |
|
2402 // --------------------------------------------------------------------------- |
|
2403 // |
|
2404 void CFSEmailUiSearchListVisualiser::OperationErrorL( |
|
2405 TContactHandlerCmd /*aCmd*/, TInt /*aError*/ ) |
|
2406 { |
|
2407 FUNC_LOG; |
|
2408 } |
|
2409 |
|
2410 void CFSEmailUiSearchListVisualiser::CallToSenderL() |
|
2411 { |
|
2412 FUNC_LOG; |
|
2413 CFSEmailUiMailListModelItem* item = |
|
2414 dynamic_cast<CFSEmailUiMailListModelItem*> |
|
2415 ( iModel->Item( HighlightedIndex() ) ); |
|
2416 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2417 { |
|
2418 CFSMailAddress* fromAddress = item->MessagePtr().GetSender(); |
|
2419 TDesC* emailAddress(0); |
|
2420 if ( fromAddress ) |
|
2421 { |
|
2422 emailAddress = &fromAddress->GetEmailAddress(); |
|
2423 } |
|
2424 if ( emailAddress && emailAddress->Length() ) |
|
2425 { |
|
2426 CFsDelayedLoader::InstanceL()->GetContactHandlerL()-> |
|
2427 FindAndCallToContactByEmailL( *emailAddress, |
|
2428 iAppUi.GetActiveMailbox(), this, ETrue ); |
|
2429 } |
|
2430 } |
|
2431 } |
|
2432 |
|
2433 |
|
2434 // --------------------------------------------------------------------------- |
|
2435 // Logic for changing msk |
|
2436 // --------------------------------------------------------------------------- |
|
2437 // |
|
2438 void CFSEmailUiSearchListVisualiser::SetMskL() |
|
2439 { |
|
2440 FUNC_LOG; |
|
2441 if ( iFirstStartCompleted ) |
|
2442 { |
|
2443 if ( iSearchList && iSearchList->Count() ) |
|
2444 { |
|
2445 ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); |
|
2446 } |
|
2447 else |
|
2448 { |
|
2449 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
|
2450 } |
|
2451 } |
|
2452 } |
|
2453 |
|
2454 |
|
2455 // --------------------------------------------------------------------------- |
|
2456 // LaunchActionMenuL |
|
2457 // Function launches action menu based on the highlighted or marked messages |
|
2458 // --------------------------------------------------------------------------- |
|
2459 // |
|
2460 void CFSEmailUiSearchListVisualiser::LaunchActionMenuL() |
|
2461 { |
|
2462 FUNC_LOG; |
|
2463 if ( iModel && iModel->Count() ) |
|
2464 { |
|
2465 // Remove old items from action menu |
|
2466 CFSEmailUiActionMenu::RemoveAllL(); |
|
2467 // Construct item list |
|
2468 RFsEActionMenuIdList itemList; |
|
2469 CleanupClosePushL( itemList ); |
|
2470 |
|
2471 CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
2472 // Right click action menu for calendar events |
|
2473 if ( item && item->ModelItemType() == ETypeMailItem && |
|
2474 item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
2475 { |
|
2476 TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown ); |
|
2477 if ( iAppUi.MrViewerInstanceL() ) |
|
2478 { |
|
2479 // Search must be stopped, otherwise resolve will lead to crash |
|
2480 if ( iSearchOngoing ) |
|
2481 { |
|
2482 StopSearchL(); |
|
2483 } |
|
2484 mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( item->MessagePtr() ); |
|
2485 } |
|
2486 switch ( mrMethod ) |
|
2487 { |
|
2488 case EESMRMeetingRequestMethodRequest: |
|
2489 itemList.AppendL( FsEActionMenuAccept ); |
|
2490 itemList.AppendL( FsEActionMenuTentative ); |
|
2491 itemList.AppendL( FsEActionMenuDecline ); |
|
2492 break; |
|
2493 case EESMRMeetingRequestMethodCancellation: |
|
2494 { |
|
2495 TBool supportsRemove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaRemoveFromCalendar ); |
|
2496 if( supportsRemove ) |
|
2497 { |
|
2498 itemList.AppendL( FsEActionMenuRemoveFormCal ); |
|
2499 } |
|
2500 break; |
|
2501 } |
|
2502 default: |
|
2503 case EESMRMeetingRequestMethodUnknown: |
|
2504 case EESMRMeetingRequestMethodResponse: |
|
2505 itemList.AppendL( FsEActionMenuOpen); |
|
2506 break; |
|
2507 } |
|
2508 } |
|
2509 // Right click action menu for normal mail items |
|
2510 else |
|
2511 { |
|
2512 itemList.AppendL( FsEActionMenuReply ); |
|
2513 //Get # of recipients |
|
2514 TInt numRecipients(0); |
|
2515 CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
2516 if ( messagePtr ) |
|
2517 { |
|
2518 numRecipients =TFsEmailUiUtility::CountRecepients( messagePtr ); |
|
2519 if ( numRecipients == 1 ) |
|
2520 { |
|
2521 //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the |
|
2522 //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI. |
|
2523 if ( messagePtr->GetToRecipients().Count() ) |
|
2524 { |
|
2525 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetToRecipients()[0]->GetEmailAddress()) ) |
|
2526 { |
|
2527 numRecipients++; |
|
2528 } |
|
2529 } |
|
2530 if ( messagePtr->GetCCRecipients().Count() ) |
|
2531 { |
|
2532 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetCCRecipients()[0]->GetEmailAddress()) ) |
|
2533 { |
|
2534 numRecipients++; |
|
2535 } |
|
2536 } |
|
2537 if ( messagePtr->GetBCCRecipients().Count() ) |
|
2538 { |
|
2539 if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetBCCRecipients()[0]->GetEmailAddress()) ) |
|
2540 { |
|
2541 numRecipients++; |
|
2542 } |
|
2543 } |
|
2544 } |
|
2545 |
|
2546 } |
|
2547 |
|
2548 if ( numRecipients > 1 ) |
|
2549 { |
|
2550 itemList.AppendL( FsEActionMenuReplyAll ); |
|
2551 } |
|
2552 itemList.AppendL( FsEActionMenuForward ); |
|
2553 } |
|
2554 // Add mark as read/unread options |
|
2555 if ( item->MessagePtr().IsFlagSet(EFSMsgFlag_Read) ) |
|
2556 { |
|
2557 itemList.AppendL( FsEActionMenuMarkUnread ); |
|
2558 } |
|
2559 else |
|
2560 { |
|
2561 itemList.AppendL( FsEActionMenuMarkRead ); |
|
2562 } |
|
2563 itemList.AppendL( FsEActionMenuDelete ); |
|
2564 |
|
2565 // <cmail> Touch |
|
2566 TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList, EFscCustom, 0, this ); |
|
2567 // </cmail> |
|
2568 CleanupStack::PopAndDestroy( &itemList ); |
|
2569 HandleActionMenuCommandL( itemId ); |
|
2570 } |
|
2571 } |
|
2572 |
|
2573 |
|
2574 // <cmail> |
|
2575 // --------------------------------------------------------------------------- |
|
2576 // ActionMenuPosition |
|
2577 // --------------------------------------------------------------------------- |
|
2578 // |
|
2579 TPoint CFSEmailUiSearchListVisualiser::ActionMenuPosition() |
|
2580 { |
|
2581 TAlfRealRect focusRect; |
|
2582 TFsTreeItemId listItemId = iSearchList->FocusedItem(); |
|
2583 iSearchList->GetItemDisplayRectTarget(listItemId, focusRect); |
|
2584 return focusRect.iTl; |
|
2585 } |
|
2586 // </cmail> |
|
2587 |
|
2588 |
|
2589 // --------------------------------------------------------------------------- |
|
2590 // HandleActionMenuCommandL |
|
2591 // Action menu command callback handler |
|
2592 // --------------------------------------------------------------------------- |
|
2593 // |
|
2594 void CFSEmailUiSearchListVisualiser::HandleActionMenuCommandL( TActionMenuCustomItemId itemId ) |
|
2595 { |
|
2596 FUNC_LOG; |
|
2597 // Map each Action Menu ID to correcponding command ID. |
|
2598 TInt commandId = KErrNotFound; |
|
2599 |
|
2600 switch( itemId ) |
|
2601 { |
|
2602 case FsEActionMenuOpenCalendarEvent: |
|
2603 case FsEActionMenuOpen: |
|
2604 commandId = EFsEmailUiCmdOpen; |
|
2605 break; |
|
2606 case FsEActionMenuAccept: |
|
2607 commandId = EFsEmailUiCmdCalActionsAccept; |
|
2608 break; |
|
2609 case FsEActionMenuTentative: |
|
2610 commandId = EFsEmailUiCmdCalActionsTentative; |
|
2611 break; |
|
2612 case FsEActionMenuDecline: |
|
2613 commandId = EFsEmailUiCmdCalActionsDecline; |
|
2614 break; |
|
2615 case FsEActionMenuRemoveFormCal: |
|
2616 commandId = EFsEmailUiCmdCalRemoveFromCalendar; |
|
2617 break; |
|
2618 case FsEActionMenuMarkRead: |
|
2619 commandId = EFsEmailUiCmdMarkAsRead; |
|
2620 break; |
|
2621 case FsEActionMenuMarkUnread: |
|
2622 commandId = EFsEmailUiCmdMarkAsUnread; |
|
2623 break; |
|
2624 case FsEActionMenuDelete: |
|
2625 commandId = EFsEmailUiCmdActionsDelete; |
|
2626 break; |
|
2627 case FsEActionMenuReply: |
|
2628 commandId = EFsEmailUiCmdActionsReply; |
|
2629 break; |
|
2630 case FsEActionMenuReplyAll: |
|
2631 commandId = EFsEmailUiCmdActionsReplyAll; |
|
2632 break; |
|
2633 case FsEActionMenuForward: |
|
2634 commandId = EFsEmailUiCmdActionsForward; |
|
2635 break; |
|
2636 case FsEActionMenuMove: |
|
2637 commandId = EFsEmailUiCmdActionsMoveMessage; |
|
2638 break; |
|
2639 case FsEActionMenuMoveToDrafts: |
|
2640 commandId = EFsEmailUiCmdActionsMoveToDrafts; |
|
2641 break; |
|
2642 case FsEActionMenuDismissed: |
|
2643 commandId = KErrCancel; |
|
2644 break; |
|
2645 default: |
|
2646 __ASSERT_DEBUG( EFalse, Panic( EFSEmailUiUnexpectedValue ) ); |
|
2647 break; |
|
2648 } |
|
2649 |
|
2650 if ( commandId >= 0 ) |
|
2651 { |
|
2652 HandleCommandL( commandId ); |
|
2653 } |
|
2654 } |
|
2655 |
|
2656 //<cmail> |
|
2657 // --------------------------------------------------------------------------- |
|
2658 // CFSEmailUiSearchListVisualiser::SetHeaderTextAttributesL() |
|
2659 // |
|
2660 // Apply header text/background attributes |
|
2661 // This creates i.e "Search result: %S " title caption and background graphics |
|
2662 // --------------------------------------------------------------------------- |
|
2663 // |
|
2664 void CFSEmailUiSearchListVisualiser::SetHeaderAttributesL() |
|
2665 { |
|
2666 // Set bar text color/style from skin |
|
2667 iBarTextVisual->SetTextStyle( iAppUi.LayoutHandler()-> |
|
2668 FSTextStyleFromLayoutL( AknLayoutScalable_Apps::main_sp_fs_ctrlbar_pane_t1( 0 ) ).Id() ); |
|
2669 iBarTextVisual->SetColor( iAppUi.LayoutHandler()-> |
|
2670 ListNormalStateTextSkinColor() ); |
|
2671 |
|
2672 if( iBarBgVisual->Brushes() ) |
|
2673 { |
|
2674 iBarBgVisual->Brushes()->Reset(); |
|
2675 } |
|
2676 iBarBgVisual->EnableBrushesL(); |
|
2677 CAlfBrush* selectorBrush = iAppUi.FsTextureManager()-> |
|
2678 NewCtrlBarSelectorBrushLC(); |
|
2679 selectorBrush->SetOpacity( KFSHeaderTextBackgroundOpacity ); |
|
2680 iBarBgVisual->Brushes()->AppendL( selectorBrush, EAlfHasOwnership ); |
|
2681 CleanupStack::Pop( selectorBrush ); |
|
2682 } |
|
2683 //</cmail> |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 // End of file |