|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements control for the attachment list view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include "emailtrace.h" |
|
21 #include <pathinfo.h> |
|
22 //<cmail> |
|
23 #include "fstreelist.h" // for attachment visual list |
|
24 #include <DocumentHandler.h> // for file opening |
|
25 #include <apmstd.h> // for TDataType |
|
26 #include <gulicon.h> // icons |
|
27 #include <AknIconUtils.h> // icons |
|
28 #include <AknWaitDialog.h> |
|
29 #include <freestyleemailui.mbg> |
|
30 #include <FreestyleEmailUi.rsg> |
|
31 #include <CommonContentPolicy.h> |
|
32 #include <aknnotewrappers.h> |
|
33 #include <StringLoader.h> |
|
34 #include "CFSMailClient.h" |
|
35 #include <CVPbkContactManager.h> // Virtual phonebook contact manager |
|
36 // <cmail> SF |
|
37 #include <alf/alfevent.h> |
|
38 // </cmail> |
|
39 |
|
40 // for action menu |
|
41 #include "cfsccontactactionservice.h" |
|
42 #include "cfsccontactactionmenu.h" |
|
43 #include "mfsccontactactionmenumodel.h" |
|
44 #include "cfsccontactactionmenuitem.h" |
|
45 #include "fsccontactactionmenuuids.hrh" |
|
46 #include "fsccontactactionmenudefines.h" |
|
47 //</cmail> |
|
48 |
|
49 // LOCAL INCLUDES |
|
50 #include "FreestyleEmailUiSendAttachmentsListControl.h" |
|
51 #include "FreestyleEmailUiSendAttachmentsListVisualiser.h" |
|
52 #include "FreestyleEmailUiSendAttachmentsListModel.h" |
|
53 #include "FreestyleEmailUiAppui.h" |
|
54 #include "FreestyleEmailUiTextureManager.h" |
|
55 #include "FreestyleEmailUiAttachmentsListModel.h" |
|
56 #include "FreestyleEmailUiUtilities.h" |
|
57 #include "FreestyleEmailUiShortcutBinding.h" |
|
58 #include "ncscomposeview.h" |
|
59 |
|
60 |
|
61 // CONSTANTS |
|
62 |
|
63 // CLASS IMPLEMENTATION |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // Two-phased constructor. |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CFreestyleEmailUiSendAttachmentsListControl* CFreestyleEmailUiSendAttachmentsListControl::NewL( |
|
70 CAlfEnv& aEnv, |
|
71 CFSEmailUiSendAttachmentsListVisualiser* aVisualiser, |
|
72 CFreestyleEmailUiAppUi* aAppUi ) |
|
73 { |
|
74 FUNC_LOG; |
|
75 CFreestyleEmailUiSendAttachmentsListControl* self = |
|
76 CFreestyleEmailUiSendAttachmentsListControl::NewLC( aEnv, aVisualiser, aAppUi ); |
|
77 CleanupStack::Pop(self); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // Two-phased constructor. |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 CFreestyleEmailUiSendAttachmentsListControl* CFreestyleEmailUiSendAttachmentsListControl::NewLC( |
|
86 CAlfEnv& aEnv, |
|
87 CFSEmailUiSendAttachmentsListVisualiser* aVisualiser, |
|
88 CFreestyleEmailUiAppUi* aAppUi ) |
|
89 { |
|
90 FUNC_LOG; |
|
91 CFreestyleEmailUiSendAttachmentsListControl* self = |
|
92 new (ELeave) CFreestyleEmailUiSendAttachmentsListControl( aVisualiser, aAppUi ); |
|
93 CleanupStack::PushL(self); |
|
94 self->ConstructL(aEnv); |
|
95 return self; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 //C++ constructor. |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 CFreestyleEmailUiSendAttachmentsListControl::CFreestyleEmailUiSendAttachmentsListControl( |
|
103 CFSEmailUiSendAttachmentsListVisualiser* aVisualiser, |
|
104 CFreestyleEmailUiAppUi* aAppUi ) |
|
105 : CAlfControl(), |
|
106 iVisualiser( aVisualiser ), |
|
107 iAppUi( aAppUi ) |
|
108 { |
|
109 FUNC_LOG; |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // Two-phased constructor. |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void CFreestyleEmailUiSendAttachmentsListControl::ConstructL( CAlfEnv& aEnv ) |
|
117 { |
|
118 FUNC_LOG; |
|
119 CAlfControl::ConstructL( aEnv ); |
|
120 iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() ); |
|
121 iModel = CFSEmailUiSendAttachmentsListModel::NewL( iAppUi, Env(), this ); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // Virtual destructor. |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 CFreestyleEmailUiSendAttachmentsListControl::~CFreestyleEmailUiSendAttachmentsListControl() |
|
129 { |
|
130 FUNC_LOG; |
|
131 delete iService; |
|
132 } |
|
133 |
|
134 // <cmail> |
|
135 // --------------------------------------------------------------------------- |
|
136 // Verify file selection (e.g. DRM) |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 TBool CFreestyleEmailUiSendAttachmentsListControl::VerifySelectionL( const MDesCArray* /*aSelectedFiles*/ ) |
|
140 { |
|
141 return ETrue; |
|
142 } |
|
143 // </cmail> |
|
144 |
|
145 void CFreestyleEmailUiSendAttachmentsListControl::DeleteModel() |
|
146 { |
|
147 FUNC_LOG; |
|
148 delete iModel; |
|
149 iModel = NULL; |
|
150 } |
|
151 |
|
152 //<cmail> touch |
|
153 void CFreestyleEmailUiSendAttachmentsListControl::SetMskL() |
|
154 { |
|
155 iVisualiser->SetMskL(); |
|
156 } |
|
157 //</cmail> |
|
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // OfferEventL |
|
161 // called by ALF |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 TBool CFreestyleEmailUiSendAttachmentsListControl::OfferEventL( const TAlfEvent& aEvent ) |
|
165 { |
|
166 FUNC_LOG; |
|
167 TBool result( EFalse ); |
|
168 iVisualiser->SetMskL(); |
|
169 // handle key events |
|
170 if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
|
171 { |
|
172 |
|
173 TInt scanCode = aEvent.KeyEvent().iScanCode; |
|
174 // Swap right and left controls in mirrored layout |
|
175 if ( AknLayoutUtils::LayoutMirrored() ) |
|
176 { |
|
177 if (scanCode == EStdKeyRightArrow) |
|
178 { |
|
179 scanCode = EStdKeyLeftArrow; |
|
180 } |
|
181 else if ( scanCode == EStdKeyLeftArrow ) |
|
182 { |
|
183 scanCode = EStdKeyRightArrow; |
|
184 } |
|
185 } |
|
186 |
|
187 switch ( scanCode ) |
|
188 { |
|
189 case EStdKeyDevice3: |
|
190 case EStdKeyEnter: |
|
191 { |
|
192 iModel->HandleActionL(); |
|
193 result = ETrue; |
|
194 break; |
|
195 } |
|
196 case EStdKeyUpArrow: |
|
197 { |
|
198 // do not highlight header |
|
199 if ( !iModel->CanSelectPreviousItem() ) |
|
200 { |
|
201 // Check that this works correctly! |
|
202 // If previous item is header, mark the event consumed |
|
203 // so that it is not forwarded to list's control. |
|
204 result = ETrue; |
|
205 //result = iModel->AttachmentList()->TreeControl()->OfferEventL( aEvent ); |
|
206 } |
|
207 break; |
|
208 } |
|
209 case EStdKeyLeftArrow: |
|
210 //hide action menu (automatic) |
|
211 break; |
|
212 case EStdKeyRightArrow: |
|
213 { |
|
214 // show action menu when we are on list item |
|
215 CFSEmailUiSendAttachmentsListModelItem* item = NULL; |
|
216 |
|
217 item = iModel->GetSelectedItem(); |
|
218 |
|
219 if ( item ) |
|
220 { |
|
221 ShowActionMenuL( item ); |
|
222 } |
|
223 |
|
224 break; |
|
225 } |
|
226 default : |
|
227 // Check keyboard shortcuts. |
|
228 TInt shortcutCommand = |
|
229 iAppUi->ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
230 CFSEmailUiShortcutBinding::EContextSendAttachmentList ); |
|
231 if ( shortcutCommand != KErrNotFound ) |
|
232 { |
|
233 HandleCommandL( shortcutCommand ); |
|
234 result = ETrue; |
|
235 } |
|
236 /* |
|
237 else |
|
238 { |
|
239 result = iModel->AttachmentList()->TreeControl()->OfferEventL( aEvent ); |
|
240 } |
|
241 */ |
|
242 break; |
|
243 } |
|
244 } |
|
245 else if (aEvent.IsPointerEvent()) |
|
246 { |
|
247 result = iModel->AttachmentList()->TreeControl()->OfferEventL(aEvent); |
|
248 } |
|
249 |
|
250 return result; |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------------------------- |
|
254 // HandleCommandL |
|
255 // --------------------------------------------------------------------------- |
|
256 // |
|
257 void CFreestyleEmailUiSendAttachmentsListControl::HandleCommandL( TInt aCommand ) |
|
258 { |
|
259 FUNC_LOG; |
|
260 switch ( aCommand ) |
|
261 { |
|
262 case EAknSoftkeyOpen: |
|
263 case ESendAttachmentMenuOpen: |
|
264 OpenHighlightedFileL(); |
|
265 break; |
|
266 case EFsEmailUiCmdGoToTop: |
|
267 { |
|
268 iModel->GoToTopL(); |
|
269 } |
|
270 break; |
|
271 case EFsEmailUiCmdGoToBottom: |
|
272 { |
|
273 iModel->GoToBottomL(); |
|
274 } |
|
275 break; |
|
276 case EFsEmailUiCmdCollapse: |
|
277 { |
|
278 iModel->CollapseL(); |
|
279 } |
|
280 break; |
|
281 case EFsEmailUiCmdExpand: |
|
282 { |
|
283 iModel->ExpandL(); |
|
284 } |
|
285 break; |
|
286 case EFsEmailUiCmdActionsCollapseExpandAllToggle: |
|
287 { |
|
288 iModel->CollapseExpandAllToggleL(); |
|
289 } |
|
290 break; |
|
291 default: |
|
292 { |
|
293 if ( iVisualiser ) // Offer aCommand to view |
|
294 { |
|
295 return iVisualiser->HandleCommandL( aCommand ); |
|
296 } |
|
297 } |
|
298 break; |
|
299 } |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------------------------- |
|
303 // LoadModelContent |
|
304 // |
|
305 // Load model content for list |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 void CFreestyleEmailUiSendAttachmentsListControl::LoadModelContentL() |
|
309 { |
|
310 FUNC_LOG; |
|
311 // Check if saved mail has attachments included |
|
312 |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // Model |
|
317 // |
|
318 // return pointer to current item model |
|
319 // --------------------------------------------------------------------------- |
|
320 // |
|
321 CFSEmailUiSendAttachmentsListModel* CFreestyleEmailUiSendAttachmentsListControl::Model() |
|
322 { |
|
323 FUNC_LOG; |
|
324 return iModel; |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // AppendAttachmentToListL |
|
329 // |
|
330 // Open files selection dialog and append given filename to attachment list |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 TBool CFreestyleEmailUiSendAttachmentsListControl::AppendAttachmentToListL(MsgAttachmentUtils::TMsgAttachmentFetchType aType) |
|
334 { |
|
335 FUNC_LOG; |
|
336 TBool ret = EFalse; |
|
337 TFileName filePath; |
|
338 // <cmail> |
|
339 TBool fetchOK = EFalse; |
|
340 |
|
341 if (aType != MsgAttachmentUtils::EUnknown) |
|
342 { |
|
343 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); |
|
344 |
|
345 CDesCArrayFlat* files = new( ELeave ) CDesC16ArrayFlat( 1 ); |
|
346 CleanupStack::PushL( files ); |
|
347 |
|
348 // MsgAttachmentUtils messes up the display area, save it and set back after the call |
|
349 TRect visibleArea = CAlfEnv::Static()->PrimaryDisplay().VisibleArea(); |
|
350 fetchOK = MsgAttachmentUtils::FetchFileL( aType, |
|
351 *files, |
|
352 paramList, |
|
353 EFalse, // disk space checked in VerifySelectionL or CUniEditorInsertOperation, if image scaled/compressed |
|
354 EFalse, |
|
355 this ); |
|
356 CAlfEnv::Static()->PrimaryDisplay().SetVisibleArea(visibleArea); |
|
357 |
|
358 if (files->MdcaCount() > 0) |
|
359 { |
|
360 filePath = files->MdcaPoint( 0 ); |
|
361 //when the filepath contains the Drive letter (ie. "e:\\") in lower case then RecognizeData of class RApaLsSession fails. |
|
362 //RecognizeData is used by FS framework to detect the content type of the attachment. To fix this possible failure, |
|
363 //we change the drive letter to upper case here. |
|
364 TBuf<1> driveLetter; |
|
365 driveLetter=filePath.Left(1); |
|
366 driveLetter.CopyUC(driveLetter); |
|
367 filePath.Replace(0,1,driveLetter); |
|
368 } |
|
369 CleanupStack::PopAndDestroy(2, paramList); |
|
370 } |
|
371 else |
|
372 { |
|
373 fetchOK = TFsEmailUiUtility::ShowSelectFileDialogL( filePath ); |
|
374 } |
|
375 |
|
376 if ( fetchOK && filePath.Length() > 0 ) // </cmail> |
|
377 { |
|
378 if ( !FileDrmProtectedL( filePath ) ) |
|
379 { |
|
380 // add file as a email message part |
|
381 CFSMailMessagePart* msgPart = NULL; |
|
382 |
|
383 CNcsComposeView* composeView = |
|
384 static_cast<CNcsComposeView*>( iAppUi->View(MailEditorId) ); |
|
385 |
|
386 TFSMailMsgId nullId; |
|
387 if ( composeView->NewMessage() ) |
|
388 { |
|
389 // use composeview NewMessage if available |
|
390 msgPart = composeView->NewMessage()->AddNewAttachmentL( filePath, nullId ); |
|
391 } |
|
392 else |
|
393 { |
|
394 // Open message from framework and append attachment |
|
395 CFSMailClient* mailClient = iAppUi->GetMailClient(); // not owned |
|
396 CFSMailMessage* msg = mailClient->GetMessageByUidL( |
|
397 iVisualiser->EditorParams().iMailboxId, |
|
398 iVisualiser->EditorParams().iFolderId, |
|
399 iVisualiser->EditorParams().iMsgId, |
|
400 EFSMsgDataStructure ); |
|
401 CleanupStack::PushL( msg ); |
|
402 msgPart = msg->AddNewAttachmentL( filePath, nullId ); |
|
403 CleanupStack::PopAndDestroy( msg ); |
|
404 } |
|
405 CleanupStack::PushL( msgPart ); |
|
406 msgPart->SaveL(); |
|
407 |
|
408 // append file to list model |
|
409 const TPtrC fileName = TParsePtrC( filePath ).NameAndExt(); |
|
410 TFileType fileType = TFsEmailUiUtility::GetFileType( fileName, msgPart->GetContentType() ); |
|
411 AppendFileToModelL( msgPart->GetPartId(), |
|
412 fileName, |
|
413 msgPart->ContentSize(), |
|
414 fileType ); |
|
415 |
|
416 // free resources |
|
417 CleanupStack::PopAndDestroy( msgPart ); |
|
418 |
|
419 // add new tree list item and update header content |
|
420 CFSEmailUiSendAttachmentsListModelItem* newItem = |
|
421 static_cast<CFSEmailUiSendAttachmentsListModelItem*>( iModel->Item( iModel->Count()-1 ) ); |
|
422 iModel->AppendItemToAttachmentListL( newItem ); |
|
423 iModel->UpdateHeaderItemTextL(); |
|
424 |
|
425 ret = ETrue; |
|
426 } |
|
427 } |
|
428 return ret; |
|
429 } |
|
430 |
|
431 // --------------------------------------------------------------------------- |
|
432 // FileDrmProtectedL |
|
433 // |
|
434 // Check if file is DRM protected |
|
435 // --------------------------------------------------------------------------- |
|
436 // |
|
437 TBool CFreestyleEmailUiSendAttachmentsListControl::FileDrmProtectedL( RFile& aFile ) |
|
438 { |
|
439 FUNC_LOG; |
|
440 TBool isProtected( EFalse ); |
|
441 CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC(); |
|
442 isProtected = ccp->IsClosedFileL( aFile ); |
|
443 if ( isProtected ) |
|
444 { |
|
445 TFsEmailUiUtility::ShowErrorNoteL( R_FS_EMAILUI_SENDATTACHMENTS_ITEM_DRM_PROTECTED_TXT, ETrue ); |
|
446 } |
|
447 CleanupStack::PopAndDestroy( ccp ); |
|
448 return isProtected; |
|
449 } |
|
450 |
|
451 // --------------------------------------------------------------------------- |
|
452 // FileDrmProtectedL |
|
453 // |
|
454 // Check if file is DRM protected |
|
455 // --------------------------------------------------------------------------- |
|
456 // |
|
457 TBool CFreestyleEmailUiSendAttachmentsListControl::FileDrmProtectedL( const TDesC& aFilePath ) |
|
458 { |
|
459 TBool isProtected( EFalse ); |
|
460 |
|
461 RFile file; |
|
462 TInt err = file.Open( CCoeEnv::Static()->FsSession(), |
|
463 aFilePath, |
|
464 EFileRead | EFileShareAny ); |
|
465 User::LeaveIfError( err ); |
|
466 CleanupClosePushL( file ); |
|
467 isProtected = FileDrmProtectedL( file ); |
|
468 CleanupStack::PopAndDestroy( &file ); |
|
469 |
|
470 return isProtected; |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // AppendFileToModelL |
|
475 // |
|
476 // Append given file to attachment list model |
|
477 // |
|
478 // --------------------------------------------------------------------------- |
|
479 // |
|
480 void CFreestyleEmailUiSendAttachmentsListControl::AppendFileToModelL( |
|
481 const TFSMailMsgId aPartId, |
|
482 const TDesC& aFileName, |
|
483 TInt aSize, |
|
484 TFileType aFileType /*= EUnidentifiedType*/, |
|
485 TBool aReadOnly /*= EFalse*/, |
|
486 TBool aRemoteFile /*= EFalse*/ ) |
|
487 { |
|
488 FUNC_LOG; |
|
489 // add item to model |
|
490 CFSEmailUiSendAttachmentsListModelItem* newItem = |
|
491 CFSEmailUiSendAttachmentsListModelItem::NewL( |
|
492 aFileName, |
|
493 aSize, |
|
494 aFileType, |
|
495 aRemoteFile, |
|
496 aReadOnly ); |
|
497 newItem->SetMailMsgPartId( aPartId ); |
|
498 |
|
499 iModel->AppendL( newItem ); |
|
500 } |
|
501 |
|
502 // --------------------------------------------------------------------------- |
|
503 // RemoveAttachmentFromListL |
|
504 // |
|
505 // removes item by given index |
|
506 // or |
|
507 // removes currently higlighted item from attachment list and model |
|
508 // --------------------------------------------------------------------------- |
|
509 // |
|
510 void CFreestyleEmailUiSendAttachmentsListControl::RemoveAttachmentFromListL( |
|
511 const TInt aIndex ) |
|
512 { |
|
513 FUNC_LOG; |
|
514 TInt index = ( aIndex < 0 ? iModel->HighlightedIndex() : aIndex ); |
|
515 |
|
516 if ( index >= 0 ) |
|
517 { |
|
518 CFSEmailUiSendAttachmentsListModelItem* item = |
|
519 static_cast<CFSEmailUiSendAttachmentsListModelItem*>( iModel->Item( index ) ); |
|
520 |
|
521 if ( !item->IsReadOnly() ) |
|
522 { |
|
523 iModel->RemoveItemByIndexL( index ); |
|
524 iModel->UpdateHeaderItemTextL(); |
|
525 } |
|
526 } |
|
527 } |
|
528 |
|
529 // --------------------------------------------------------------------------- |
|
530 // RemoveAllAttachmentsL |
|
531 // |
|
532 // removes all items from attachment list and model |
|
533 // --------------------------------------------------------------------------- |
|
534 // |
|
535 void CFreestyleEmailUiSendAttachmentsListControl::RemoveAllAttachmentsL() |
|
536 { |
|
537 FUNC_LOG; |
|
538 TFsEmailUiUtility::ShowWaitNoteL( iWaitNote, R_FSE_WAIT_REMOVING_TEXT, EFalse ); |
|
539 iModel->RemoveAllAttachmentsL(); |
|
540 iWaitNote->ProcessFinishedL(); |
|
541 } |
|
542 |
|
543 // --------------------------------------------------------------------------- |
|
544 // OpenHighlightedFile |
|
545 // |
|
546 // Opens highklighted list item with its corresponding handler |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 void CFreestyleEmailUiSendAttachmentsListControl::OpenHighlightedFileL() |
|
550 { |
|
551 FUNC_LOG; |
|
552 TInt index = iModel->HighlightedIndex(); |
|
553 if ( index >= 0 ) |
|
554 { |
|
555 CFSEmailUiSendAttachmentsListModelItem* item = |
|
556 static_cast<CFSEmailUiSendAttachmentsListModelItem*>( iModel->Item( index ) ); |
|
557 |
|
558 if ( !item->IsRemote() ) |
|
559 { |
|
560 // Open message using the IDs |
|
561 TEditorLaunchParams editorParams = iVisualiser->EditorParams(); |
|
562 TPartData attachmentPart( editorParams.iMailboxId, |
|
563 editorParams.iFolderId, |
|
564 editorParams.iMsgId, |
|
565 item->MailMsgPartId() ); |
|
566 TFsEmailUiUtility::OpenAttachmentL( attachmentPart ); |
|
567 } |
|
568 } |
|
569 } |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // ShowActionMenu |
|
573 // |
|
574 // Displays action menu and handles selection |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 void CFreestyleEmailUiSendAttachmentsListControl::ShowActionMenuL( CFSEmailUiSendAttachmentsListModelItem* aItem ) |
|
578 { |
|
579 FUNC_LOG; |
|
580 // Remove old items from action menu |
|
581 CFSEmailUiActionMenu::RemoveAllL(); |
|
582 |
|
583 // Construct item list |
|
584 RFsEActionMenuIdList itemList; |
|
585 CleanupClosePushL( itemList ); |
|
586 |
|
587 if ( !aItem->IsRemote() ) |
|
588 { |
|
589 itemList.AppendL( FsEActionAttachmentOpen ); |
|
590 } |
|
591 |
|
592 itemList.AppendL( FsEActionAttachmentAdd ); |
|
593 |
|
594 if ( !aItem->IsReadOnly() ) |
|
595 { |
|
596 itemList.AppendL( FsEActionAttachmentRemove ); |
|
597 } |
|
598 |
|
599 if ( iModel->Count() > 1 && !iModel->HasReadOnlyAttachments() ) |
|
600 { |
|
601 itemList.AppendL( FsEActionAttachmentRemoveAll ); |
|
602 } |
|
603 |
|
604 |
|
605 //<cmail> touch |
|
606 // Execute action list |
|
607 TActionMenuCustomItemId itemId = CFSEmailUiActionMenu::ExecuteL( itemList, EFscCustom, 0, this ); |
|
608 //</cmail> |
|
609 CleanupStack::PopAndDestroy( &itemList ); |
|
610 |
|
611 // Handle action menu selection |
|
612 switch ( itemId ) |
|
613 { |
|
614 case FsEActionAttachmentOpen: |
|
615 HandleCommandL( ESendAttachmentMenuOpen ); |
|
616 break; |
|
617 case FsEActionAttachmentRemove: |
|
618 HandleCommandL( ESendAttachmentMenuRemoveAttachment ); |
|
619 break; |
|
620 case FsEActionAttachmentRemoveAll: |
|
621 HandleCommandL( ESendAttachmentMenuRemoveAllAttachments ); |
|
622 break; |
|
623 case FsEActionAttachmentAdd: |
|
624 HandleCommandL( ESendAttachmentMenuAddAttachment ); |
|
625 break; |
|
626 default: |
|
627 break; |
|
628 } |
|
629 } |
|
630 |
|
631 // <cmail> |
|
632 TPoint CFreestyleEmailUiSendAttachmentsListControl::ActionMenuPosition() |
|
633 { |
|
634 TAlfRealRect focusRect; |
|
635 TFsTreeItemId listItemId = iModel->GetVisualizer()->FocusedItem(); |
|
636 iModel->GetVisualizer()->GetItemDisplayRectTarget(listItemId, focusRect); |
|
637 return focusRect.iTl; |
|
638 } |
|
639 // </cmail> |
|
640 |