64
|
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: CFsEmailUiHtmlViewerView class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include <coemain.h>
|
|
21 |
#include <aknconsts.h>
|
|
22 |
#include <AknsUtils.h>
|
|
23 |
#include <StringLoader.h>
|
|
24 |
#include <AknWaitDialog.h>
|
|
25 |
#include <AknGlobalListQuery.h>
|
|
26 |
#include <AknGlobalNote.h>
|
|
27 |
#include <aknnavi.h>
|
|
28 |
#include <aknnavide.h>
|
|
29 |
#include <apgcli.h>
|
|
30 |
#include <apmstd.h>
|
|
31 |
#include <favouritesdb.h>
|
|
32 |
//<cmail>
|
|
33 |
#include <featmgr.h>
|
|
34 |
#include "cfsmailmessage.h"
|
|
35 |
#include "cfsmailclient.h"
|
|
36 |
#include <FreestyleEmailUi.rsg>
|
|
37 |
#include <schemehandler.h> // CSchemeHandler
|
|
38 |
#include <brctlinterface.h>
|
|
39 |
#include <csxhelp/cmail.hlp.hrh>
|
|
40 |
#include <baclipb.h> // for clipboard copy
|
|
41 |
|
|
42 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
43 |
#include <txtclipboard.h>
|
|
44 |
#endif
|
|
45 |
|
|
46 |
// Meeting request
|
|
47 |
#include <MeetingRequestUids.hrh>
|
|
48 |
#include <layoutmetadata.cdl.h>
|
|
49 |
#include "cesmricalviewer.h"
|
|
50 |
#include "FreestyleEmailUiHtmlViewerView.h"
|
|
51 |
#include "FreestyleEmailUi.hrh"
|
|
52 |
#include "FreestyleEmailUiAppui.h"
|
|
53 |
#include "FreestyleEmailUiHtmlViewerContainer.h"
|
|
54 |
#include "FreestyleEmailUiUtilities.h"
|
|
55 |
#include "FreestyleEmailUiShortcutBinding.h"
|
|
56 |
#include "freestyleemailcenrephandler.h"
|
|
57 |
#include "FreestyleEmailUiAttachmentsListModel.h"
|
|
58 |
#include "FreestyleEmailUiConstants.h"
|
|
59 |
#include "FSEmail.pan"
|
|
60 |
#include "cfsmailcommon.h"
|
|
61 |
|
|
62 |
#include "FreestyleEmailUiMailViewerConstants.h"
|
|
63 |
#include "FSDelayedLoader.h"
|
|
64 |
#include "FreestyleMessageHeaderURL.h"
|
|
65 |
#include "FreestyleEmailUiAknStatusIndicator.h"
|
|
66 |
|
|
67 |
#include <eiksoftkeyimage.h>
|
|
68 |
|
|
69 |
CFsEmailUiHtmlViewerView* CFsEmailUiHtmlViewerView::NewL(
|
|
70 |
CAlfEnv& aEnv,
|
|
71 |
CFreestyleEmailUiAppUi& aAppUi,
|
|
72 |
CAlfControlGroup& aControlGroup )
|
|
73 |
{
|
|
74 |
FUNC_LOG;
|
|
75 |
CFsEmailUiHtmlViewerView* self = new ( ELeave ) CFsEmailUiHtmlViewerView(
|
|
76 |
aEnv, aAppUi, aControlGroup );
|
|
77 |
CleanupStack::PushL( self );
|
|
78 |
self->ConstructL();
|
|
79 |
CleanupStack::Pop( self );
|
|
80 |
return self;
|
|
81 |
}
|
|
82 |
|
|
83 |
CFsEmailUiHtmlViewerView::CFsEmailUiHtmlViewerView( CAlfEnv& aEnv,
|
|
84 |
CFreestyleEmailUiAppUi& aAppUi,
|
|
85 |
CAlfControlGroup& aControlGroup )
|
|
86 |
: CFsEmailUiViewBase( aControlGroup, aAppUi ),
|
|
87 |
iEnv( aEnv )
|
|
88 |
{
|
|
89 |
FUNC_LOG;
|
|
90 |
}
|
|
91 |
|
|
92 |
CFsEmailUiHtmlViewerView::~CFsEmailUiHtmlViewerView()
|
|
93 |
{
|
|
94 |
FUNC_LOG;
|
|
95 |
CancelFetchings();
|
|
96 |
if ( iAppUi.DownloadInfoMediator() && iMessage )
|
|
97 |
{
|
|
98 |
iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
|
|
99 |
}
|
|
100 |
|
|
101 |
if ( iContainer )
|
|
102 |
{
|
|
103 |
iContainer->PrepareForExit();
|
|
104 |
}
|
|
105 |
|
|
106 |
delete iNewMailTempAddress;
|
|
107 |
if ( iContainer )
|
|
108 |
{
|
|
109 |
iContainer->CancelFetch();
|
|
110 |
}
|
|
111 |
delete iContainer;
|
|
112 |
delete iAttachmentsListModel;
|
|
113 |
|
|
114 |
delete iOpenMessages;
|
|
115 |
iOpenMessages = NULL;
|
|
116 |
delete iEmbeddedMessages;
|
|
117 |
iEmbeddedMessages = NULL;
|
|
118 |
iMessage = NULL;
|
|
119 |
|
|
120 |
delete iMailBox;
|
|
121 |
iMailBox = NULL;
|
|
122 |
delete iAsyncCallback;
|
|
123 |
}
|
|
124 |
|
|
125 |
void CFsEmailUiHtmlViewerView::ConstructL()
|
|
126 |
{
|
|
127 |
FUNC_LOG;
|
|
128 |
BaseConstructL( R_FSEMAILUI_HTML_VIEW_FULLSCREEN );
|
|
129 |
iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityLow );
|
|
130 |
iOpenMessages = new (ELeave) CStack<CFSMailMessage, ETrue>();
|
|
131 |
iEmbeddedMessages = new (ELeave) CStack<CFSMailMessage, EFalse>();
|
|
132 |
iNextOrPrevMessageSelected = EFalse;
|
|
133 |
iForwardingMessage = EFalse;
|
|
134 |
iMessageIsDeleted = EFalse;
|
|
135 |
}
|
|
136 |
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
// CFsEmailUiHtmlViewerView::Id()
|
|
139 |
// Returns View's ID.
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
TUid CFsEmailUiHtmlViewerView::Id() const
|
|
143 |
{
|
|
144 |
FUNC_LOG;
|
|
145 |
return HtmlViewerId;
|
|
146 |
}
|
|
147 |
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
// CFsEmailUiHtmlViewerView::HandleCommandL()
|
|
150 |
// Takes care of Command handling.
|
|
151 |
// -----------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
void CFsEmailUiHtmlViewerView::HandleCommandL( TInt aCommand )
|
|
154 |
{
|
|
155 |
FUNC_LOG;
|
|
156 |
|
|
157 |
if ( !iAppUi.ViewSwitchingOngoing() )
|
|
158 |
{
|
|
159 |
switch ( aCommand )
|
|
160 |
{
|
|
161 |
// Open MSK handling
|
|
162 |
case EFsEmailUiCmdActionsCall:
|
|
163 |
case EFsEmailUiCmdActionsOpenWeb:
|
|
164 |
case EFsEmailUiCmdComposeTo:
|
|
165 |
{
|
|
166 |
TBrCtlDefs::TBrCtlElementType elementType = iContainer->BrowserControlIf()->FocusedElementType();
|
|
167 |
|
|
168 |
switch ( elementType )
|
|
169 |
{
|
|
170 |
case TBrCtlDefs::EElementTelAnchor:
|
|
171 |
case TBrCtlDefs::EElementSmartLinkTel:
|
|
172 |
{
|
|
173 |
iContainer->BrowserControlIf()->HandleCommandL( ( TInt )TBrCtlDefs::ECommandIdBase +
|
|
174 |
( TInt )TBrCtlDefs::ECommandMakeCall );
|
|
175 |
}
|
|
176 |
break;
|
|
177 |
case TBrCtlDefs::EElementMailtoAnchor:
|
|
178 |
case TBrCtlDefs::EElementSmartLinkEmail:
|
|
179 |
{
|
|
180 |
// <cmail> change made because the functionality of
|
|
181 |
// sending email is not present in the browser control
|
|
182 |
// anymore
|
|
183 |
|
|
184 |
// Create buffer and strip scheme data "mailto:"
|
|
185 |
HBufC* mailAddress =
|
|
186 |
iContainer->BrowserControlIf()->PageInfoLC(
|
|
187 |
TBrCtlDefs::EPageInfoFocusedNodeUrl );
|
|
188 |
|
|
189 |
if ( mailAddress->FindC( KMailtoPrefix ) == 0 )
|
|
190 |
{
|
|
191 |
mailAddress->Des().Delete( 0,
|
|
192 |
KMailtoPrefix().Length() );
|
|
193 |
}
|
|
194 |
|
|
195 |
delete iNewMailTempAddress;
|
|
196 |
iNewMailTempAddress = NULL;
|
|
197 |
iNewMailTempAddress = CFSMailAddress::NewL();
|
|
198 |
iNewMailTempAddress->SetEmailAddress( *mailAddress );
|
|
199 |
CleanupStack::PopAndDestroy( mailAddress );
|
|
200 |
iAppUi.LaunchEditorL( iNewMailTempAddress );
|
|
201 |
|
|
202 |
/*iContainer->BrowserControlIf()->HandleCommandL( (TInt)TBrCtlDefs::ECommandIdBase +
|
|
203 |
(TInt)TBrCtlDefs::ECommandSmartLinkSendEmail );*/
|
|
204 |
// </cmail>
|
|
205 |
}
|
|
206 |
break;
|
|
207 |
case TBrCtlDefs::EElementAnchor:
|
|
208 |
{
|
|
209 |
// OPEN url in standalone browser UI
|
|
210 |
HBufC* url = iContainer->BrowserControlIf()->PageInfoLC(TBrCtlDefs::EPageInfoFocusedNodeUrl);
|
|
211 |
// Use scheme handler to launch the browser as a stand alone application
|
|
212 |
TInt urlPos = url->Find( KUrlPrefixIdentifier );
|
|
213 |
if( urlPos == KErrNotFound )
|
|
214 |
{
|
|
215 |
HBufC* newBuf = url->ReAllocL( url->Length() + KHttpUrlPrefix().Length() );
|
|
216 |
CleanupStack::Pop( url );
|
|
217 |
url = newBuf;
|
|
218 |
CleanupStack::PushL( url );
|
|
219 |
TPtr urlPtr = url->Des();
|
|
220 |
urlPtr.Insert( 0, KHttpUrlPrefix );
|
|
221 |
}
|
|
222 |
CSchemeHandler* handler = CSchemeHandler::NewL( *url );
|
|
223 |
CleanupStack::PushL( handler );
|
|
224 |
handler->HandleUrlStandaloneL();
|
|
225 |
CleanupStack::PopAndDestroy( handler );
|
|
226 |
CleanupStack::PopAndDestroy( url );
|
|
227 |
}
|
|
228 |
break;
|
|
229 |
case TBrCtlDefs::EElementNone:
|
|
230 |
default:
|
|
231 |
break;
|
|
232 |
}
|
|
233 |
}
|
|
234 |
break;
|
|
235 |
case EAknSoftkeyBack:
|
|
236 |
{
|
|
237 |
CancelPendingMrCommandL();
|
|
238 |
NavigateBackL();
|
|
239 |
}
|
|
240 |
break;
|
|
241 |
case EFsEmailUiCmdActionsOpen:
|
|
242 |
case EFsEmailUiCmdActionsReply:
|
|
243 |
{
|
|
244 |
TIMESTAMP( "Reply selected from html viewer" );
|
|
245 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
246 |
{
|
|
247 |
TEditorLaunchParams params;
|
|
248 |
|
|
249 |
params.iMailboxId = iAppUi.GetActiveMailboxId();
|
|
250 |
params.iMsgId = iMessage->GetMessageId();
|
|
251 |
params.iActivatedExternally = EFalse;
|
|
252 |
iAppUi.LaunchEditorL( KEditorCmdReply, params );
|
|
253 |
}
|
|
254 |
}
|
|
255 |
break;
|
|
256 |
case EFsEmailUiCmdActionsReplyAll:
|
|
257 |
{
|
|
258 |
TIMESTAMP( "Reply to all selected from html viewer" );
|
|
259 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
260 |
{
|
|
261 |
TEditorLaunchParams params;
|
|
262 |
params.iMailboxId = iAppUi.GetActiveMailboxId();
|
|
263 |
params.iMsgId = iMessage->GetMessageId();
|
|
264 |
params.iActivatedExternally = EFalse;
|
|
265 |
iAppUi.LaunchEditorL( KEditorCmdReplyAll, params );
|
|
266 |
}
|
|
267 |
}
|
|
268 |
break;
|
|
269 |
case EFsEmailUiCmdActionsForward:
|
|
270 |
{
|
|
271 |
TIMESTAMP( "Forward selected from html viewer" );
|
|
272 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
273 |
{
|
|
274 |
TEditorLaunchParams params;
|
|
275 |
params.iMailboxId = iAppUi.GetActiveMailboxId();
|
|
276 |
params.iMsgId = iMessage->GetMessageId();
|
|
277 |
params.iActivatedExternally = EFalse;
|
|
278 |
iForwardingMessage = ETrue;
|
|
279 |
iAppUi.LaunchEditorL( KEditorCmdForward, params );
|
|
280 |
}
|
|
281 |
}
|
|
282 |
break;
|
|
283 |
case EFsEmailUiCmdActionsDelete:
|
|
284 |
{
|
|
285 |
TIMESTAMP( "Delete selected from html viewer" );
|
|
286 |
DeleteMailL();
|
|
287 |
}
|
|
288 |
break;
|
|
289 |
case EFsEmailUiCmdZoomIn:
|
|
290 |
{
|
|
291 |
iContainer->ZoomInL();
|
|
292 |
}
|
|
293 |
break;
|
|
294 |
case EFsEmailUiCmdZoomOut:
|
|
295 |
{
|
|
296 |
iContainer->ZoomOutL();
|
|
297 |
}
|
|
298 |
break;
|
|
299 |
case EFsEmailUiCmdHelp:
|
|
300 |
{
|
|
301 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
|
|
302 |
}
|
|
303 |
break;
|
|
304 |
case EFsEmailUiCmdExit:
|
|
305 |
{
|
|
306 |
TIMESTAMP( "Exit selected from html viewer" );
|
|
307 |
// <cmail>
|
|
308 |
iContainer->PrepareForExit();
|
|
309 |
// </cmail>
|
|
310 |
iAppUi.Exit();
|
|
311 |
}
|
|
312 |
break;
|
|
313 |
case EFsEmailUiCmdOpenAttachmentList:
|
|
314 |
{
|
|
315 |
if( iMessage )
|
|
316 |
{
|
|
317 |
TAttachmentListActivationData params;
|
|
318 |
params.iMailBoxId = iMessage->GetMailBoxId();
|
|
319 |
params.iFolderId = iMessage->GetFolderId();
|
|
320 |
params.iMessageId = iMessage->GetMessageId();
|
|
321 |
|
|
322 |
// use package buffer to pass the params
|
|
323 |
TPckgBuf<TAttachmentListActivationData> buf( params );
|
|
324 |
TUid emptyCustomMessageId = { 0 };
|
|
325 |
iAppUi.EnterFsEmailViewL( AttachmentMngrViewId, emptyCustomMessageId, buf );
|
|
326 |
}
|
|
327 |
|
|
328 |
}
|
|
329 |
break;
|
|
330 |
case EFsEmailUiCmdPreviousMessage:
|
|
331 |
{
|
|
332 |
ShowPreviousMessageL();
|
|
333 |
}
|
|
334 |
break;
|
|
335 |
case EFsEmailUiCmdNextMessage:
|
|
336 |
{
|
|
337 |
ShowNextMessageL();
|
|
338 |
}
|
|
339 |
break;
|
|
340 |
case EFsEmailUiCmdMarkAsUnread:
|
|
341 |
{
|
|
342 |
ChangeMsgReadStatusL( EFalse, EFalse );
|
|
343 |
}
|
|
344 |
break;
|
|
345 |
case EFsEmailUiCmdMarkAsRead:
|
|
346 |
{
|
|
347 |
ChangeMsgReadStatusL( ETrue, EFalse );
|
|
348 |
}
|
|
349 |
break;
|
|
350 |
case EFsEmailUiCmdActionsMoveMessage:
|
|
351 |
{
|
|
352 |
OpenFolderListForMessageMovingL();
|
|
353 |
}
|
|
354 |
break;
|
|
355 |
case EFsEmailUiCmdActionsFlag:
|
|
356 |
{
|
|
357 |
SetMessageFollowupFlagL();
|
|
358 |
}
|
|
359 |
break;
|
|
360 |
case EFsEmailUiCmdMessageDetails:
|
|
361 |
{
|
|
362 |
}
|
|
363 |
case EFsEmailUiCmdCompose:
|
|
364 |
{
|
|
365 |
if ( iMessage )
|
|
366 |
{
|
|
367 |
|
|
368 |
if ( iActivationData.iEmbeddedMessageMode )
|
|
369 |
{
|
|
370 |
iCreateNewMsgFromEmbeddedMsg = ETrue;
|
|
371 |
}
|
|
372 |
|
|
373 |
HBufC* mailAddress=iMessage->GetSender()->GetEmailAddress().AllocLC();
|
|
374 |
delete iNewMailTempAddress;
|
|
375 |
iNewMailTempAddress = NULL;
|
|
376 |
iNewMailTempAddress = CFSMailAddress::NewL();
|
|
377 |
iNewMailTempAddress->SetEmailAddress( *mailAddress );
|
|
378 |
CleanupStack::PopAndDestroy( mailAddress );
|
|
379 |
iAppUi.LaunchEditorL( iNewMailTempAddress );
|
|
380 |
}
|
|
381 |
}
|
|
382 |
break;
|
|
383 |
default:
|
|
384 |
{
|
|
385 |
/* -- pinch zoom only --
|
|
386 |
if ( aCommand >= EFsEmailUiCmdZoomSmall )
|
|
387 |
{
|
|
388 |
iContainer->SetZoomLevelL( aCommand - EFsEmailUiCmdZoomSmall );
|
|
389 |
}
|
|
390 |
*/
|
|
391 |
}
|
|
392 |
break;
|
|
393 |
}
|
|
394 |
}
|
|
395 |
TIMESTAMP( "Html viewer selected operation done" );
|
|
396 |
}
|
|
397 |
|
|
398 |
// ---------------------------------------------------------------------------
|
|
399 |
// Changes the MSK command depending on the focused element.
|
|
400 |
// ---------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
void CFsEmailUiHtmlViewerView::SetMskL()
|
|
403 |
{
|
|
404 |
FUNC_LOG;
|
|
405 |
TBrCtlDefs::TBrCtlElementType elementType = iContainer->BrowserControlIf()->FocusedElementType();
|
|
406 |
|
|
407 |
switch ( elementType )
|
|
408 |
{
|
|
409 |
case TBrCtlDefs::EElementTelAnchor:
|
|
410 |
case TBrCtlDefs::EElementSmartLinkTel:
|
|
411 |
ChangeMskCommandL( R_FSE_QTN_MSK_CALL );
|
|
412 |
break;
|
|
413 |
case TBrCtlDefs::EElementMailtoAnchor:
|
|
414 |
case TBrCtlDefs::EElementSmartLinkEmail:
|
|
415 |
ChangeMskCommandL( R_FSE_QTN_MSK_COMPOSE );
|
|
416 |
break;
|
|
417 |
case TBrCtlDefs::EElementAnchor:
|
|
418 |
ChangeMskCommandL( R_FSE_QTN_MSK_OPENURL );
|
|
419 |
break;
|
|
420 |
case TBrCtlDefs::EElementNone:
|
|
421 |
default:
|
|
422 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
423 |
break;
|
|
424 |
}
|
|
425 |
}
|
|
426 |
|
|
427 |
// -----------------------------------------------------------------------------
|
|
428 |
// Hides the container and removes it from control stack.
|
|
429 |
// -----------------------------------------------------------------------------
|
|
430 |
//
|
|
431 |
void CFsEmailUiHtmlViewerView::HideContainer()
|
|
432 |
{
|
|
433 |
FUNC_LOG;
|
|
434 |
|
|
435 |
if ( iContainer )
|
|
436 |
{
|
|
437 |
iContainer->HideDownloadStatus();
|
|
438 |
iContainer->MakeVisible( EFalse );
|
|
439 |
iAppUi.RemoveFromStack( iContainer );
|
|
440 |
}
|
|
441 |
}
|
|
442 |
|
|
443 |
// -----------------------------------------------------------------------------
|
|
444 |
// Add the container to control stack and sets it visible.
|
|
445 |
// -----------------------------------------------------------------------------
|
|
446 |
//
|
|
447 |
void CFsEmailUiHtmlViewerView::ShowContainerL()
|
|
448 |
{
|
|
449 |
FUNC_LOG;
|
|
450 |
|
|
451 |
if ( iContainer )
|
|
452 |
{
|
|
453 |
iAppUi.AddToStackL( iContainer );
|
|
454 |
iContainer->MakeVisible( ETrue );
|
|
455 |
}
|
|
456 |
}
|
|
457 |
|
|
458 |
// ---------------------------------------------------------------------------
|
|
459 |
// hide or show Container ( used for activation of the view )
|
|
460 |
//
|
|
461 |
void CFsEmailUiHtmlViewerView::FadeOut(TBool aDirectionOut )
|
|
462 |
{
|
|
463 |
FUNC_LOG;
|
|
464 |
iContainer->MakeVisible(!aDirectionOut);
|
|
465 |
}
|
|
466 |
|
|
467 |
|
|
468 |
// -----------------------------------------------------------------------------
|
|
469 |
// CFsEmailUiHtmlViewerView::DoActivateL()
|
|
470 |
// Activate an Compose view
|
|
471 |
// -----------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
void CFsEmailUiHtmlViewerView::ChildDoActivateL( const TVwsViewId& aPrevViewId,
|
|
474 |
TUid aCustomMessageId, const TDesC8& aCustomMessage )
|
|
475 |
{
|
|
476 |
FUNC_LOG;
|
|
477 |
|
|
478 |
TBool msgBodyStructurePresent ( EFalse );
|
|
479 |
TBool msgBodyContentPresent ( EFalse );
|
|
480 |
|
|
481 |
if( aCustomMessageId != KHtmlViewerReturnToPrevious)
|
|
482 |
{
|
|
483 |
ViewEntered( aPrevViewId );
|
|
484 |
}
|
|
485 |
|
|
486 |
if ( iMrObserverToInform &&
|
|
487 |
aCustomMessageId == KStartViewerReturnToPreviousMsg )
|
|
488 |
{
|
|
489 |
// If returning from view launched by MRUI, complete the ongoing
|
|
490 |
// async process.
|
|
491 |
// Exception is the move message operation as it is not done through
|
|
492 |
// normal async process for MR.
|
|
493 |
if ( iOpResult.iOpType != EESMRCmdMailMoveMessage )
|
|
494 |
{
|
|
495 |
CompletePendingMrCommand();
|
|
496 |
}
|
|
497 |
else
|
|
498 |
{
|
|
499 |
CancelPendingMrCommandL();
|
|
500 |
}
|
|
501 |
}
|
|
502 |
else if ( aCustomMessageId != KStartViewerReturnFromEmbeddedMsg )
|
|
503 |
{
|
|
504 |
// Cancel any pending asynchronous MR operation.
|
|
505 |
CancelPendingMrCommandL();
|
|
506 |
}
|
|
507 |
|
|
508 |
// When returning from another view, we use previous activation data.
|
|
509 |
// Otherwise it's read from the custom message.
|
|
510 |
if ( aCustomMessageId != KHtmlViewerReturnToPrevious )
|
|
511 |
{
|
|
512 |
TPckgBuf<THtmlViewerActivationData> pckgData;
|
|
513 |
pckgData.Copy( aCustomMessage );
|
|
514 |
iActivationData = pckgData();
|
|
515 |
}
|
|
516 |
|
|
517 |
CleanupClosePushL( iActivationData.iFile );
|
|
518 |
|
|
519 |
if ( !iMessage && iContainer )
|
|
520 |
{
|
|
521 |
iContainer->ResetContent();
|
|
522 |
iAppUi.RemoveFromStack( iContainer );
|
|
523 |
iContainer->CancelFetch();
|
|
524 |
iContainer->ClearCacheAndLoadEmptyContent();
|
|
525 |
}
|
|
526 |
|
|
527 |
if ( !iContainer )
|
|
528 |
{
|
|
529 |
iContainer = CFsEmailUiHtmlViewerContainer::NewL( iAppUi, *this );
|
|
530 |
}
|
|
531 |
|
|
532 |
// Check whether this activation is actually for a meeting request
|
|
533 |
TBool openedInMrViewer( EFalse );
|
|
534 |
if ( THtmlViewerActivationData::EMailMessage == iActivationData.iActivationDataType )
|
|
535 |
{
|
|
536 |
openedInMrViewer = IsOpenedInMRViewerL();
|
|
537 |
}
|
|
538 |
|
|
539 |
if ( openedInMrViewer )
|
|
540 |
{
|
|
541 |
// The previous contents are cleared (otherwise they are shown just
|
|
542 |
// before the meeting request viewer kicks in, especially annoying
|
|
543 |
// when navigating between prev/next meeting requests by using navi
|
|
544 |
// decorator array buttons.
|
|
545 |
iContainer->ClearCacheAndLoadEmptyContent();
|
|
546 |
ClearMailViewer();
|
|
547 |
}
|
|
548 |
|
|
549 |
ShowContainerL();
|
|
550 |
|
|
551 |
switch ( iActivationData.iActivationDataType )
|
|
552 |
{
|
|
553 |
case THtmlViewerActivationData::EMailMessage:
|
|
554 |
{
|
|
555 |
|
|
556 |
if ( iMessage && iAppUi.DownloadInfoMediator() )
|
|
557 |
{
|
|
558 |
iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
|
|
559 |
}
|
|
560 |
|
|
561 |
//clean message stack which owns object iMessage
|
|
562 |
EraseMessageStack();
|
|
563 |
iMessage = NULL;
|
|
564 |
iMessage = iAppUi.GetMailClient()->GetMessageByUidL(
|
|
565 |
iActivationData.iMailBoxId,
|
|
566 |
iActivationData.iFolderId,
|
|
567 |
iActivationData.iMessageId,
|
|
568 |
EFSMsgDataEnvelope );
|
|
569 |
|
|
570 |
if ( iMessage && iAppUi.DownloadInfoMediator() )
|
|
571 |
{
|
|
572 |
iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
|
|
573 |
}
|
|
574 |
|
|
575 |
delete iAttachmentsListModel;
|
|
576 |
iAttachmentsListModel = NULL;
|
|
577 |
|
|
578 |
if ( iMessage )
|
|
579 |
{
|
|
580 |
if ( !( iMrObserverToInform && aCustomMessageId == KStartViewerReturnToPreviousMsg )
|
|
581 |
&& aCustomMessageId != KStartViewerReturnFromEmbeddedMsg )
|
|
582 |
{
|
|
583 |
//take ownership of iMessage
|
|
584 |
PushMessageL( iMessage, EFalse );
|
|
585 |
}
|
|
586 |
|
|
587 |
if ( openedInMrViewer )
|
|
588 |
{
|
|
589 |
iContainer->DisplayStatusIndicatorL();
|
|
590 |
iAppUi.GetMailClient()->PrepareMrDescriptionL( iActivationData.iMailBoxId,
|
|
591 |
iActivationData.iMessageId );
|
|
592 |
|
|
593 |
// Setting MSK empty. This blocks unwanted MSK keypresses before MrViewer is initialized.
|
|
594 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
595 |
iMrUiActive = ETrue;
|
|
596 |
iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );
|
|
597 |
}
|
|
598 |
else
|
|
599 |
{
|
|
600 |
// Attachment list model is not created when opening mrViewer, so attachment options menu is
|
|
601 |
// not working with MR messages
|
|
602 |
iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
|
|
603 |
TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId );
|
|
604 |
iAttachmentsListModel->UpdateListL( msgPartData );
|
|
605 |
CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
|
|
606 |
LoadContentFromMailMessageL( iMessage, ETrue );
|
|
607 |
}
|
|
608 |
}
|
|
609 |
else
|
|
610 |
{
|
|
611 |
User::Leave( KErrNotFound );
|
|
612 |
}
|
|
613 |
|
|
614 |
if ( aCustomMessageId != KStartViewerReturnToPreviousMsg && iMessage )
|
|
615 |
{
|
|
616 |
delete iMailBox; iMailBox = NULL;
|
|
617 |
iMailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
|
|
618 |
|
|
619 |
// Change active mailbox if necessary
|
|
620 |
if ( !iMessage->GetMailBoxId().IsNullId() )
|
|
621 |
{
|
|
622 |
iAppUi.SetActiveMailboxL( iMessage->GetMailBoxId(), EFalse );
|
|
623 |
}
|
|
624 |
}
|
|
625 |
|
|
626 |
}
|
|
627 |
break;
|
|
628 |
case THtmlViewerActivationData::EmbeddedEmailMessage:
|
|
629 |
{
|
|
630 |
if ( aCustomMessageId != KStartViewerReturnFromEmbeddedMsg && !iCreateNewMsgFromEmbeddedMsg )
|
|
631 |
{
|
|
632 |
PushMessageL(iActivationData.iEmbeddedMessage, ETrue);
|
|
633 |
}
|
|
634 |
|
|
635 |
iMessage = iOpenMessages->Head();
|
|
636 |
iCreateNewMsgFromEmbeddedMsg = EFalse;
|
|
637 |
|
|
638 |
delete iAttachmentsListModel;
|
|
639 |
iAttachmentsListModel = NULL;
|
|
640 |
iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
|
|
641 |
|
|
642 |
if ( iOpenMessages->Head()== iOpenMessages->Last() )
|
|
643 |
{
|
|
644 |
TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
|
|
645 |
iAttachmentsListModel->UpdateListL( msgPartData );
|
|
646 |
|
|
647 |
}
|
|
648 |
else{
|
|
649 |
iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );
|
|
650 |
}
|
|
651 |
|
|
652 |
CheckMessageBodyL( *iOpenMessages->Head(), msgBodyStructurePresent, msgBodyContentPresent );
|
|
653 |
LoadContentFromMailMessageL( iOpenMessages->Head(), ETrue );
|
|
654 |
|
|
655 |
}
|
|
656 |
break;
|
|
657 |
case THtmlViewerActivationData::EFile:
|
|
658 |
{
|
|
659 |
LoadContentFromFileL( iActivationData.iFile );
|
|
660 |
}
|
|
661 |
break;
|
|
662 |
case THtmlViewerActivationData::EFileName:
|
|
663 |
{
|
|
664 |
LoadContentFromFileL( iActivationData.iFileName );
|
|
665 |
}
|
|
666 |
break;
|
|
667 |
case THtmlViewerActivationData::EUrl:
|
|
668 |
{
|
|
669 |
LoadContentFromUrlL( iActivationData.iUrl );
|
|
670 |
}
|
|
671 |
break;
|
|
672 |
}
|
|
673 |
|
|
674 |
CleanupStack::PopAndDestroy( &iActivationData.iFile );
|
|
675 |
SetMskL();
|
|
676 |
|
|
677 |
if(iMessage)
|
|
678 |
{
|
|
679 |
CFSMailAddress* address = iMessage->GetSender();
|
|
680 |
if ( address )
|
|
681 |
{
|
|
682 |
HBufC* displayName = address->GetDisplayName().AllocLC();
|
|
683 |
|
|
684 |
if ( displayName->Length() )
|
|
685 |
{
|
|
686 |
iAppUi.SetTitlePaneTextL( *displayName );
|
|
687 |
}
|
|
688 |
else
|
|
689 |
{
|
|
690 |
HBufC* emailAddress = address->GetEmailAddress().AllocLC();
|
|
691 |
iAppUi.SetTitlePaneTextL(*emailAddress);
|
|
692 |
CleanupStack::PopAndDestroy(emailAddress);
|
|
693 |
}
|
|
694 |
CleanupStack::PopAndDestroy( displayName );
|
|
695 |
}
|
|
696 |
}
|
|
697 |
|
|
698 |
if ( !openedInMrViewer && iMessage)
|
|
699 |
{
|
|
700 |
CFSMailMessagePart* htmlBodyPart = iMessage->HtmlBodyPartL();
|
|
701 |
TFetchedType type;
|
|
702 |
if ( htmlBodyPart )
|
|
703 |
{
|
|
704 |
type = EMessageHtmlBodyPart;
|
|
705 |
delete htmlBodyPart;
|
|
706 |
}
|
|
707 |
else
|
|
708 |
{
|
|
709 |
type = EMessagePlainTextBodyPart;
|
|
710 |
}
|
|
711 |
|
|
712 |
if ( !MessageStructureKnown(*iMessage) )
|
|
713 |
{
|
|
714 |
iContainer->DisplayStatusIndicatorL();
|
|
715 |
StartWaitedFetchingL(EMessageStructure);
|
|
716 |
iFetchingAlready = ETrue;
|
|
717 |
}
|
|
718 |
else
|
|
719 |
{
|
|
720 |
if ( msgBodyStructurePresent && !msgBodyContentPresent )
|
|
721 |
{
|
|
722 |
iAsyncProcessComplete = EFalse;
|
|
723 |
iFetchingAlready = EFalse;
|
|
724 |
iStartAsyncFetchType = type;
|
|
725 |
if(iMessage)
|
|
726 |
{
|
|
727 |
StartFetchingMessagePartL( *iMessage, type );
|
|
728 |
}
|
|
729 |
}
|
|
730 |
}
|
|
731 |
}
|
|
732 |
iNextOrPrevMessageSelected = EFalse;
|
|
733 |
iForwardingMessage = EFalse;
|
|
734 |
|
|
735 |
//update rect only if it has changed from previous time.
|
|
736 |
if ( iContainer->Rect() != ContainerRect() )
|
|
737 |
{
|
|
738 |
iContainer->SetRect( ContainerRect() );
|
|
739 |
}
|
|
740 |
|
|
741 |
TIMESTAMP( "Html viewer opened" );
|
|
742 |
}
|
|
743 |
|
|
744 |
// -----------------------------------------------------------------------------
|
|
745 |
// CFsEmailUiHtmlViewerView::ChildDoDeactivate()
|
|
746 |
// Deactivate the HTML view
|
|
747 |
// -----------------------------------------------------------------------------
|
|
748 |
//
|
|
749 |
void CFsEmailUiHtmlViewerView::ChildDoDeactivate()
|
|
750 |
{
|
|
751 |
FUNC_LOG;
|
|
752 |
// Don't cancel fetching the message parts when forwarding the message:
|
|
753 |
// it would also cancel the fetchings initiated by the forwarding,
|
|
754 |
// causing the forwarding to abort.
|
|
755 |
if ( !iForwardingMessage )
|
|
756 |
{
|
|
757 |
CancelFetchings();
|
|
758 |
}
|
|
759 |
|
|
760 |
if ( iContainer )
|
|
761 |
{
|
|
762 |
HideContainer();
|
|
763 |
iContainer->ResetContent(ETrue);
|
|
764 |
iAppUi.RemoveFromStack(iContainer);
|
|
765 |
iContainer->CancelFetch();
|
|
766 |
if ( !iAppUi.AppUiExitOngoing() )
|
|
767 |
{
|
|
768 |
// if app ui is exiting, a call to this function causes a KERN-EXEC 3 crash in iBrCtlInterface->ClearCache();
|
|
769 |
iContainer->ClearCacheAndLoadEmptyContent();
|
|
770 |
}
|
|
771 |
}
|
|
772 |
iMessage = NULL;
|
|
773 |
}
|
|
774 |
|
|
775 |
void CFsEmailUiHtmlViewerView::DoExitL()
|
|
776 |
{
|
|
777 |
FUNC_LOG;
|
|
778 |
delete iMessage;
|
|
779 |
iMessage = NULL;
|
|
780 |
CancelFetchings();
|
|
781 |
|
|
782 |
if ( iFlagSelectionHandler )
|
|
783 |
{
|
|
784 |
iFlagSelectionHandler->Cancel();
|
|
785 |
delete iFlagSelectionHandler;
|
|
786 |
iFlagSelectionHandler = NULL;
|
|
787 |
}
|
|
788 |
iAppUi.ReturnFromHtmlViewerL();
|
|
789 |
}
|
|
790 |
|
|
791 |
// CFsEmailUiHtmlViewerView::NavigateBackL
|
|
792 |
// Overriden from base class
|
|
793 |
// -----------------------------------------------------------------------------
|
|
794 |
void CFsEmailUiHtmlViewerView::NavigateBackL()
|
|
795 |
{
|
|
796 |
FUNC_LOG;
|
|
797 |
// clean up current message
|
|
798 |
if ( iMessage && iAppUi.DownloadInfoMediator() )
|
|
799 |
{
|
|
800 |
iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
|
|
801 |
}
|
|
802 |
if( iContainer )
|
|
803 |
{
|
|
804 |
iContainer->StopObserving();
|
|
805 |
iContainer->ResetContent();
|
|
806 |
}
|
|
807 |
CFSMailMessage* tmp = PopMessage();
|
|
808 |
if( tmp )
|
|
809 |
{
|
|
810 |
delete tmp;
|
|
811 |
tmp = NULL;
|
|
812 |
}
|
|
813 |
|
|
814 |
if ( iFlagSelectionHandler )
|
|
815 |
{
|
|
816 |
iFlagSelectionHandler->Cancel();
|
|
817 |
delete iFlagSelectionHandler;
|
|
818 |
iFlagSelectionHandler = NULL;
|
|
819 |
}
|
|
820 |
|
|
821 |
// Return to previous message in the stack if there is still some left
|
|
822 |
if ( !iOpenMessages->IsEmpty() )
|
|
823 |
{
|
|
824 |
|
|
825 |
THtmlViewerActivationData htmlData;
|
|
826 |
if ( iOpenMessages->Head()!= iOpenMessages->Last() )
|
|
827 |
{
|
|
828 |
htmlData.iActivationDataType = THtmlViewerActivationData::EmbeddedEmailMessage;
|
|
829 |
htmlData.iEmbeddedMessageMode = ETrue;
|
|
830 |
|
|
831 |
}
|
|
832 |
else
|
|
833 |
{
|
|
834 |
htmlData.iActivationDataType = THtmlViewerActivationData::EMailMessage;
|
|
835 |
htmlData.iMailBoxId = iOpenMessages->Head()->GetMailBoxId();
|
|
836 |
htmlData.iFolderId = iOpenMessages->Head()->GetFolderId();
|
|
837 |
htmlData.iMessageId = iOpenMessages->Head()->GetMessageId();
|
|
838 |
}
|
|
839 |
|
|
840 |
TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
|
|
841 |
iAppUi.EnterFsEmailViewL( HtmlViewerId, KStartViewerReturnFromEmbeddedMsg, pckgData );
|
|
842 |
|
|
843 |
}
|
|
844 |
// In usual case we use the base view implementation
|
|
845 |
else
|
|
846 |
{
|
|
847 |
iMessage = NULL;
|
|
848 |
CancelFetchings();
|
|
849 |
CFsEmailUiViewBase::NavigateBackL();
|
|
850 |
|
|
851 |
if ( iContainer )
|
|
852 |
{
|
|
853 |
HideContainer();
|
|
854 |
iContainer->ResetContent();
|
|
855 |
}
|
|
856 |
}
|
|
857 |
}
|
|
858 |
|
|
859 |
// ---------------------------------------------------------------------------
|
|
860 |
// Wrapper for implementation in view base class
|
|
861 |
// ---------------------------------------------------------------------------
|
|
862 |
//
|
|
863 |
void CFsEmailUiHtmlViewerView::ChangeMskCommandL( TInt /*aLabelResourceId*/ )
|
|
864 |
{
|
|
865 |
CEikButtonGroupContainer* cba( Cba() );
|
|
866 |
if ( cba )
|
|
867 |
{
|
|
868 |
cba->SetCommandSetL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK_FULLSCREEN );
|
|
869 |
CEikCba* eikCba( static_cast< CEikCba* >( cba->ButtonGroup() ) );
|
|
870 |
TFileName filename;
|
|
871 |
TFsEmailUiUtility::GetFullIconFileNameL( filename );
|
|
872 |
if (iActivationData.iEmbeddedMessageMode)
|
|
873 |
{
|
|
874 |
eikCba->UpdateMSKIconL( KAknsIIDQsnIconColors, filename,
|
|
875 |
EMbmFreestyleemailuiQgn_graf_cmail_blank,
|
|
876 |
EMbmFreestyleemailuiQgn_graf_cmail_blank_mask, ETrue );
|
|
877 |
}
|
|
878 |
else
|
|
879 |
{
|
|
880 |
eikCba->UpdateMSKIconL( KAknsIIDQsnIconColors, filename,
|
|
881 |
EMbmFreestyleemailuiQgn_prop_cmail_action_delete,
|
|
882 |
EMbmFreestyleemailuiQgn_prop_cmail_action_delete_mask, ETrue );
|
|
883 |
}
|
|
884 |
}
|
|
885 |
}
|
|
886 |
|
|
887 |
// ---------------------------------------------------------------------------
|
|
888 |
// Sets status bar layout
|
|
889 |
// ---------------------------------------------------------------------------
|
|
890 |
//
|
|
891 |
TBool CFsEmailUiHtmlViewerView::IsStatusPaneVisible() const
|
|
892 |
{
|
|
893 |
return EFalse;
|
|
894 |
}
|
|
895 |
|
|
896 |
// ---------------------------------------------------------------------------
|
|
897 |
// Sets status bar layout
|
|
898 |
// ---------------------------------------------------------------------------
|
|
899 |
//
|
|
900 |
void CFsEmailUiHtmlViewerView::SetStatusBarLayout()
|
|
901 |
{
|
|
902 |
if( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT )
|
|
903 |
{
|
|
904 |
TRAP_IGNORE( StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ) );
|
|
905 |
}
|
|
906 |
}
|
|
907 |
|
|
908 |
void CFsEmailUiHtmlViewerView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
909 |
{
|
|
910 |
FUNC_LOG;
|
|
911 |
|
|
912 |
if ( aResourceId == R_FSEMAILUI_HTMLVIEWER_MENUPANE )
|
|
913 |
{
|
|
914 |
// Pinch zoom only
|
|
915 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomLevel, ETrue );
|
|
916 |
|
|
917 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
|
|
918 |
{
|
|
919 |
// remove help support in pf5250
|
|
920 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
|
|
921 |
}
|
|
922 |
|
|
923 |
const TBool toolbarExists( EFalse );
|
|
924 |
|
|
925 |
// Some commands are blocked when viewing embedded message object
|
|
926 |
// or separate HTML file.
|
|
927 |
const TBool blockCmds( !iMessage || iActivationData.iEmbeddedMessageMode || toolbarExists );
|
|
928 |
const TBool blockReplyALLCmd( toolbarExists || !iMessage || iActivationData.iEmbeddedMessageMode ||
|
|
929 |
TFsEmailUiUtility::CountRecipientsSmart( iAppUi, iMessage ) < 2 );
|
|
930 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, blockCmds );
|
|
931 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, blockReplyALLCmd );
|
|
932 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, blockCmds );
|
|
933 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsDelete, blockCmds );
|
|
934 |
|
|
935 |
if( iActivationData.iEmbeddedMessageMode )
|
|
936 |
{
|
|
937 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, ETrue );
|
|
938 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, ETrue );
|
|
939 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, ETrue );
|
|
940 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue );
|
|
941 |
}
|
|
942 |
|
|
943 |
TBool hideNext = !ShowNextMessageMenuInOptions();
|
|
944 |
TBool blockNextCmd = !iMessage || iActivationData.iEmbeddedMessageMode || hideNext;
|
|
945 |
TInt menuPos;
|
|
946 |
if( aMenuPane->MenuItemExists( EFsEmailUiCmdNextMessage, menuPos ) )
|
|
947 |
{
|
|
948 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdNextMessage, blockNextCmd );
|
|
949 |
}
|
|
950 |
TBool hidePrev = !ShowPreviousMessageMenuInOptions();
|
|
951 |
TBool blockPrevCmd = !iMessage || iActivationData.iEmbeddedMessageMode || hidePrev;
|
|
952 |
if( aMenuPane->MenuItemExists( EFsEmailUiCmdPreviousMessage, menuPos ) )
|
|
953 |
{
|
|
954 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdPreviousMessage, blockPrevCmd );
|
|
955 |
}
|
|
956 |
|
|
957 |
CFSMailFolder* currentFolder = NULL;
|
|
958 |
if ( iMessage )
|
|
959 |
{
|
|
960 |
TRAP_IGNORE( currentFolder =
|
|
961 |
iAppUi.GetMailClient()->GetFolderByUidL(
|
|
962 |
iMessage->GetMailBoxId(),
|
|
963 |
iMessage->GetFolderId() ) );
|
|
964 |
}
|
|
965 |
|
|
966 |
if ( currentFolder &&
|
|
967 |
currentFolder->GetFolderType() != EFSOutbox )
|
|
968 |
{
|
|
969 |
// Mark as read/unread options
|
|
970 |
TBool messageIsRead( iMessage->IsFlagSet( EFSMsgFlag_Read ) );
|
|
971 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, messageIsRead );
|
|
972 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !messageIsRead );
|
|
973 |
|
|
974 |
// Move to another folder option
|
|
975 |
aMenuPane->SetItemDimmed(
|
|
976 |
EFsEmailUiCmdActionsMoveMessage,
|
|
977 |
!iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ) );
|
|
978 |
|
|
979 |
// Follow-up flag option
|
|
980 |
aMenuPane->SetItemDimmed(
|
|
981 |
EFsEmailUiCmdActionsFlag,
|
|
982 |
!( iMailBox && TFsEmailUiUtility::IsFollowUpSupported( *iMailBox ) ) );
|
|
983 |
}
|
|
984 |
else
|
|
985 |
{
|
|
986 |
// In case of outbox, all these are dimmed
|
|
987 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, ETrue );
|
|
988 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, ETrue );
|
|
989 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, ETrue );
|
|
990 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue );
|
|
991 |
}
|
|
992 |
delete currentFolder;
|
|
993 |
}
|
|
994 |
else if ( aResourceId == R_FSEMAILUI_HTMLVIEWER_SUBMENU_ZOOM_LEVEL &&
|
|
995 |
iContainer && iContainer->BrowserControlIf() )
|
|
996 |
{
|
|
997 |
DynInitZoomMenuL( aMenuPane );
|
|
998 |
}
|
|
999 |
iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane,
|
|
1000 |
CFSEmailUiShortcutBinding::EContextHtmlViewer );
|
|
1001 |
}
|
|
1002 |
|
|
1003 |
// -----------------------------------------------------------------------------
|
|
1004 |
// CFsEmailUiHtmlViewerView::HandleMrCommandL
|
|
1005 |
// Handle accept/decline/tentative/remove commands given for meeting request
|
|
1006 |
// message directly from list UI.
|
|
1007 |
// -----------------------------------------------------------------------------
|
|
1008 |
void CFsEmailUiHtmlViewerView::HandleMrCommandL(
|
|
1009 |
TInt aCommandId,
|
|
1010 |
TFSMailMsgId aMailboxId,
|
|
1011 |
TFSMailMsgId aFolderId,
|
|
1012 |
TFSMailMsgId aMessageId )
|
|
1013 |
{
|
|
1014 |
FUNC_LOG;
|
|
1015 |
///any init required?
|
|
1016 |
UpdateMessagePtrL( aMailboxId, aFolderId, aMessageId );
|
|
1017 |
|
|
1018 |
if ( aCommandId == EFsEmailUiCmdCalRemoveFromCalendar && iMessage )
|
|
1019 |
{
|
|
1020 |
iAppUi.MrViewerInstanceL()->RemoveMeetingRequestFromCalendarL(
|
|
1021 |
*iMessage, *this );
|
|
1022 |
}
|
|
1023 |
else
|
|
1024 |
{
|
|
1025 |
TESMRAttendeeStatus respondStatus;
|
|
1026 |
if ( aCommandId == EFsEmailUiCmdCalActionsAccept )
|
|
1027 |
{
|
|
1028 |
respondStatus = EESMRAttendeeStatusAccept;
|
|
1029 |
}
|
|
1030 |
else if ( aCommandId == EFsEmailUiCmdCalActionsTentative )
|
|
1031 |
{
|
|
1032 |
respondStatus = EESMRAttendeeStatusTentative;
|
|
1033 |
}
|
|
1034 |
else // ( aCommandId == EFsEmailUiCmdCalActionsDecline )
|
|
1035 |
{
|
|
1036 |
respondStatus = EESMRAttendeeStatusDecline;
|
|
1037 |
}
|
|
1038 |
if( iMessage )
|
|
1039 |
{
|
|
1040 |
iAppUi.MrViewerInstanceL()->ResponseToMeetingRequestL(
|
|
1041 |
respondStatus, *iMessage, *this );
|
|
1042 |
}
|
|
1043 |
}
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
|
|
1047 |
void CFsEmailUiHtmlViewerView::HandleViewRectChange()
|
|
1048 |
{
|
|
1049 |
CFsEmailUiViewBase::HandleViewRectChange();
|
|
1050 |
|
|
1051 |
if ( iContainer )
|
|
1052 |
{
|
|
1053 |
iContainer->SetRect( ContainerRect() );
|
|
1054 |
}
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
void CFsEmailUiHtmlViewerView::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType )
|
|
1058 |
{
|
|
1059 |
FUNC_LOG;
|
|
1060 |
|
|
1061 |
if ( aType == EScreenLayoutChanged )
|
|
1062 |
{
|
|
1063 |
SetStatusBarLayout();
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
if ( iContainer )
|
|
1067 |
{
|
|
1068 |
iContainer->SetRect( ContainerRect() );
|
|
1069 |
iContainer->HandleResourceChange( aType );
|
|
1070 |
}
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
TRect CFsEmailUiHtmlViewerView::ContainerRect() const
|
|
1074 |
{
|
|
1075 |
TRect rect( ClientRect() );
|
|
1076 |
return rect;
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
void CFsEmailUiHtmlViewerView::LoadContentFromFileL( const TDesC& aFileName )
|
|
1080 |
{
|
|
1081 |
FUNC_LOG;
|
|
1082 |
|
|
1083 |
if ( iContainer )
|
|
1084 |
{
|
|
1085 |
iContainer->LoadContentFromFileL( aFileName );
|
|
1086 |
}
|
|
1087 |
}
|
|
1088 |
|
|
1089 |
void CFsEmailUiHtmlViewerView::LoadContentFromFileL( RFile& aFile )
|
|
1090 |
{
|
|
1091 |
FUNC_LOG;
|
|
1092 |
|
|
1093 |
if ( iContainer )
|
|
1094 |
{
|
|
1095 |
iContainer->LoadContentFromFileL( aFile );
|
|
1096 |
}
|
|
1097 |
}
|
|
1098 |
|
|
1099 |
void CFsEmailUiHtmlViewerView::LoadContentFromUrlL( const TDesC& aUrl )
|
|
1100 |
{
|
|
1101 |
FUNC_LOG;
|
|
1102 |
|
|
1103 |
if ( iContainer )
|
|
1104 |
{
|
|
1105 |
iContainer->LoadContentFromUrlL( aUrl );
|
|
1106 |
}
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
void CFsEmailUiHtmlViewerView::LoadContentFromMailMessageL( CFSMailMessage* aMailMessage, TBool aResetScrollPos )
|
|
1110 |
{
|
|
1111 |
FUNC_LOG;
|
|
1112 |
|
|
1113 |
if ( iContainer )
|
|
1114 |
{
|
|
1115 |
iContainer->LoadContentFromMailMessageL( aMailMessage, aResetScrollPos );
|
|
1116 |
}
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
TInt CFsEmailUiHtmlViewerView::DeleteMail( TAny* aSelf )
|
|
1120 |
{
|
|
1121 |
FUNC_LOG;
|
|
1122 |
CFsEmailUiHtmlViewerView* self =
|
|
1123 |
static_cast<CFsEmailUiHtmlViewerView*>( aSelf );
|
|
1124 |
TRAP_IGNORE( self->DeleteMailL( EFalse ) );
|
|
1125 |
return KErrNone;
|
|
1126 |
}
|
|
1127 |
|
|
1128 |
void CFsEmailUiHtmlViewerView::DeleteMailL( TBool aSilentDelete )
|
|
1129 |
{
|
|
1130 |
FUNC_LOG;
|
|
1131 |
|
|
1132 |
if ( !iMessage || iActivationData.iEmbeddedMessageMode )
|
|
1133 |
{
|
|
1134 |
return;
|
|
1135 |
}
|
|
1136 |
|
|
1137 |
TFSMailMsgId currentMsgId = iMessage->GetMessageId();
|
|
1138 |
if ( iLastDeletedMessageID == currentMsgId )
|
|
1139 |
{
|
|
1140 |
return;
|
|
1141 |
}
|
|
1142 |
|
|
1143 |
TInt reallyDelete( ETrue );
|
|
1144 |
|
|
1145 |
if ( iAppUi.GetCRHandler()->WarnBeforeDelete() &&
|
|
1146 |
!aSilentDelete )
|
|
1147 |
{
|
|
1148 |
reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
|
|
1149 |
R_FREESTYLE_EMAIL_UI_DELETE_MESSAGE_CONFIRMATION );
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
if ( reallyDelete )
|
|
1153 |
{
|
|
1154 |
CancelFetchings();
|
|
1155 |
|
|
1156 |
// Reset container content, so that plugins may really delete files
|
|
1157 |
if ( iContainer )
|
|
1158 |
{
|
|
1159 |
HideContainer();
|
|
1160 |
iContainer->ResetContent();
|
|
1161 |
}
|
|
1162 |
|
|
1163 |
RArray<TFSMailMsgId> msgIds;
|
|
1164 |
CleanupClosePushL( msgIds );
|
|
1165 |
|
|
1166 |
msgIds.Append( currentMsgId );
|
|
1167 |
TFSMailMsgId mailBox = iMessage->GetMailBoxId();
|
|
1168 |
TFSMailMsgId folderId = iMessage->GetFolderId();
|
|
1169 |
|
|
1170 |
//Get the id and check if there is a previous message available
|
|
1171 |
TFSMailMsgId prevMsgId;
|
|
1172 |
TFSMailMsgId prevMsgFolderId;
|
|
1173 |
|
|
1174 |
//Get the previous message if it exists
|
|
1175 |
TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId,
|
|
1176 |
prevMsgId,
|
|
1177 |
prevMsgFolderId );
|
|
1178 |
|
|
1179 |
//Delete the message
|
|
1180 |
iLastDeletedMessageID = iMessage->GetMessageId();
|
|
1181 |
iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
|
|
1182 |
CleanupStack::PopAndDestroy( &msgIds );
|
|
1183 |
|
|
1184 |
// Notify appui of deleted mail item
|
|
1185 |
SendEventToAppUiL( TFSEventMailDeletedFromViewer );
|
|
1186 |
|
|
1187 |
|
|
1188 |
if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
|
|
1189 |
{
|
|
1190 |
//Open the previous message or navigate back to list viewer
|
|
1191 |
if ( available )
|
|
1192 |
{
|
|
1193 |
iMessageIsDeleted = ETrue;
|
|
1194 |
TRAPD( err, iAppUi.MoveToPreviousMsgAfterDeleteL( prevMsgId ) );
|
|
1195 |
iMessageIsDeleted = EFalse;
|
|
1196 |
|
|
1197 |
User::LeaveIfError( err );
|
|
1198 |
}
|
|
1199 |
else
|
|
1200 |
{
|
|
1201 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
1202 |
NavigateBackL();
|
|
1203 |
}
|
|
1204 |
}
|
|
1205 |
//inform user that mail is deleted
|
|
1206 |
if (!aSilentDelete)
|
|
1207 |
TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
|
|
1208 |
}
|
|
1209 |
}
|
|
1210 |
|
|
1211 |
// ---------------------------------------------------------------------------
|
|
1212 |
// HandleMailBoxEventL
|
|
1213 |
// Mailbox event handler, responds to events sent by the plugin.
|
|
1214 |
// ---------------------------------------------------------------------------
|
|
1215 |
//
|
|
1216 |
void CFsEmailUiHtmlViewerView::HandleMailBoxEventL( TFSMailEvent aEvent,
|
|
1217 |
TFSMailMsgId aMailbox, TAny* aParam1, TAny* /*aParam2*/, TAny* /*aParam3*/ )
|
|
1218 |
{
|
|
1219 |
FUNC_LOG;
|
|
1220 |
if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
|
|
1221 |
(aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 ) // Safety, in list events that only concern active mailbox are handled
|
|
1222 |
{
|
|
1223 |
TFSMailMsgId curMsgId = iMessage->GetMessageId();
|
|
1224 |
RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
|
|
1225 |
TBool cont = ETrue;
|
|
1226 |
for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
|
|
1227 |
{
|
|
1228 |
if ( ( curMsgId == ( *removedEntries )[i] ) &&
|
|
1229 |
(iDeletedMessageFromMrui != curMsgId) )
|
|
1230 |
{
|
|
1231 |
cont = EFalse;
|
|
1232 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
1233 |
if( aEvent == TFSEventMailDeleted && !iMessageIsDeleted )
|
|
1234 |
{ //Delete event came from server; close the viewer.
|
|
1235 |
HandleCommandL( EAknSoftkeyBack );
|
|
1236 |
// The message we are viewing was deleted => stop here
|
|
1237 |
return;
|
|
1238 |
}
|
|
1239 |
}
|
|
1240 |
}
|
|
1241 |
}
|
|
1242 |
|
|
1243 |
if ( iContainer && iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() )
|
|
1244 |
{
|
|
1245 |
if ( aEvent == TFSEventNewMail ||
|
|
1246 |
aEvent == TFSEventMailDeleted ||
|
|
1247 |
aEvent == TFSEventMailChanged )
|
|
1248 |
{
|
|
1249 |
iContainer->MailListModelUpdatedL();
|
|
1250 |
}
|
|
1251 |
|
|
1252 |
// DSW fix for FAMZ-82YJQ2
|
|
1253 |
// Dismiss the download status dialog after sync has been finished or cancelled
|
|
1254 |
|
|
1255 |
if ( aEvent == TFSEventMailboxSyncStateChanged )
|
|
1256 |
{
|
|
1257 |
TSSMailSyncState* newSyncState = static_cast<TSSMailSyncState*>( aParam1 );
|
|
1258 |
if ( newSyncState && ( *newSyncState == FinishedSuccessfully ||
|
|
1259 |
*newSyncState == SyncCancelled ||
|
|
1260 |
*newSyncState == Idle ||
|
|
1261 |
*newSyncState == SyncError ))
|
|
1262 |
{
|
|
1263 |
iContainer->HideDownloadStatus();
|
|
1264 |
}
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
}
|
|
1268 |
|
|
1269 |
void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
|
|
1270 |
{
|
|
1271 |
FUNC_LOG;
|
|
1272 |
/* -- Pinch zoom only --
|
|
1273 |
TInt zoomLevelIdx = iContainer->ZoomLevelL();
|
|
1274 |
|
|
1275 |
// Set the radio button state to match current zoom level
|
|
1276 |
if ( zoomLevelIdx >= 0 && zoomLevelIdx < iContainer->MaxZoomLevel() )
|
|
1277 |
{
|
|
1278 |
TInt curZoomLevel = zoomLevelIdx + EFsEmailUiCmdZoomSmall;
|
|
1279 |
aMenuPane->SetItemButtonState( curZoomLevel, EEikMenuItemSymbolOn );
|
|
1280 |
}
|
|
1281 |
*/
|
|
1282 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomSmall, ETrue );
|
|
1283 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomNormal, ETrue );
|
|
1284 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomLarge, ETrue );
|
|
1285 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdZoom150Percent, ETrue );
|
|
1286 |
}
|
|
1287 |
|
|
1288 |
// -----------------------------------------------------------------------------
|
|
1289 |
// CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL()
|
|
1290 |
// -----------------------------------------------------------------------------
|
|
1291 |
//
|
|
1292 |
void CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL( TInt aCommand, const TDesC& aEmailAddress )
|
|
1293 |
{
|
|
1294 |
FUNC_LOG;
|
|
1295 |
|
|
1296 |
if ( !iAppUi.ViewSwitchingOngoing() )
|
|
1297 |
{
|
|
1298 |
switch ( aCommand )
|
|
1299 |
{
|
|
1300 |
case EFsEmailUiCmdActionsReply:
|
|
1301 |
{
|
|
1302 |
if ( iMessage )
|
|
1303 |
{
|
|
1304 |
if ( iActivationData.iEmbeddedMessageMode )
|
|
1305 |
{
|
|
1306 |
iCreateNewMsgFromEmbeddedMsg = ETrue;
|
|
1307 |
}
|
|
1308 |
delete iNewMailTempAddress;
|
|
1309 |
iNewMailTempAddress = NULL;
|
|
1310 |
iNewMailTempAddress = CFSMailAddress::NewL();
|
|
1311 |
iNewMailTempAddress->SetEmailAddress( aEmailAddress );
|
|
1312 |
iAppUi.LaunchEditorL( iNewMailTempAddress );
|
|
1313 |
}
|
|
1314 |
}
|
|
1315 |
break;
|
|
1316 |
case FsEActionMenuAddToContacts:
|
|
1317 |
{
|
|
1318 |
SaveEmailAsContactL( aEmailAddress );
|
|
1319 |
}
|
|
1320 |
break;
|
|
1321 |
case EFsEmailUiCmdActionsAddContact:
|
|
1322 |
{
|
|
1323 |
SaveEmailAsContactL( aEmailAddress );
|
|
1324 |
}
|
|
1325 |
break;
|
|
1326 |
case EFsEmailUiCmdActionsCall:
|
|
1327 |
{
|
|
1328 |
CallAdressL( aEmailAddress, EFalse );
|
|
1329 |
}
|
|
1330 |
break;
|
|
1331 |
case EFsEmailUiCmdActionsCreateMessage:
|
|
1332 |
{
|
|
1333 |
CreateMessageL( aEmailAddress );
|
|
1334 |
}
|
|
1335 |
break;
|
|
1336 |
case EFsEmailUiCmdActionsContactDetails:
|
|
1337 |
{
|
|
1338 |
OpenContactDetailsL( aEmailAddress );
|
|
1339 |
}
|
|
1340 |
break;
|
|
1341 |
case EFsEmailUiCmdActionsRemoteLookup:
|
|
1342 |
{
|
|
1343 |
LaunchRemoteLookupL( aEmailAddress );
|
|
1344 |
}
|
|
1345 |
break;
|
|
1346 |
case EFsEmailUiCmdActionsCopyToClipboard:
|
|
1347 |
{
|
|
1348 |
CopyCurrentToClipBoardL( aEmailAddress );
|
|
1349 |
}
|
|
1350 |
break;
|
|
1351 |
default:
|
|
1352 |
//nothing right now?
|
|
1353 |
break;
|
|
1354 |
}
|
|
1355 |
}
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
// -----------------------------------------------------------------------------
|
|
1359 |
// CFsEmailUiHtmlViewerView::HandleWebAddressCommandL()
|
|
1360 |
// -----------------------------------------------------------------------------
|
|
1361 |
//
|
|
1362 |
void CFsEmailUiHtmlViewerView::HandleWebAddressCommandL( TInt aCommand, const TDesC& aUrl )
|
|
1363 |
{
|
|
1364 |
FUNC_LOG;
|
|
1365 |
switch ( aCommand )
|
|
1366 |
{
|
|
1367 |
case EFsEmailUiCmdActionsOpenWeb:
|
|
1368 |
{
|
|
1369 |
OpenLinkInBrowserL( aUrl );
|
|
1370 |
break;
|
|
1371 |
}
|
|
1372 |
case EFsEmailUiCmdActionsAddBookmark:
|
|
1373 |
{
|
|
1374 |
SaveWebAddressToFavouritesL( aUrl );
|
|
1375 |
break;
|
|
1376 |
}
|
|
1377 |
case EFsEmailUiCmdActionsCopyWWWAddressToClipboard:
|
|
1378 |
{
|
|
1379 |
CopyCurrentToClipBoardL( aUrl );
|
|
1380 |
break;
|
|
1381 |
}
|
|
1382 |
}
|
|
1383 |
}
|
|
1384 |
|
|
1385 |
void CFsEmailUiHtmlViewerView::SaveEmailAsContactL(
|
|
1386 |
const TDesC& aEmailAddress )
|
|
1387 |
{
|
|
1388 |
TAddToContactsType type;
|
|
1389 |
|
|
1390 |
// Query to "update existing" or "Create new"
|
|
1391 |
// --> EFALSE = user chose "cancel"
|
|
1392 |
if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->
|
|
1393 |
AddtoContactsQueryL( type ) )
|
|
1394 |
{
|
|
1395 |
// Create buffer and strip scheme data such as mailto: and call:
|
|
1396 |
HBufC* textData = aEmailAddress.AllocLC();
|
|
1397 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL(
|
|
1398 |
*textData, EContactUpdateEmail, type, this );
|
|
1399 |
CleanupStack::PopAndDestroy( textData );
|
|
1400 |
}
|
|
1401 |
}
|
|
1402 |
|
|
1403 |
// ---------------------------------------------------------------------------
|
|
1404 |
// From MFSEmailUiContactHandlerObserver
|
|
1405 |
// The ownership of the CLS items in the contacts array is transferred to the
|
|
1406 |
// observer, and they must be deleted by the observer.
|
|
1407 |
// ---------------------------------------------------------------------------
|
|
1408 |
//
|
|
1409 |
void CFsEmailUiHtmlViewerView::OperationCompleteL(
|
|
1410 |
TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ )
|
|
1411 |
{
|
|
1412 |
FUNC_LOG;
|
|
1413 |
}
|
|
1414 |
|
|
1415 |
// ---------------------------------------------------------------------------
|
|
1416 |
// From MFSEmailUiContactHandlerObserver
|
|
1417 |
// Handles error in contatct handler operation.
|
|
1418 |
// ---------------------------------------------------------------------------
|
|
1419 |
//
|
|
1420 |
void CFsEmailUiHtmlViewerView::OperationErrorL(
|
|
1421 |
TContactHandlerCmd /*aCmd*/, TInt /*aError*/ )
|
|
1422 |
{
|
|
1423 |
FUNC_LOG;
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
|
|
1427 |
TBool CFsEmailUiHtmlViewerView::IsRemoteLookupSupportedL()
|
|
1428 |
{
|
|
1429 |
CFSMailBox* mailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
|
|
1430 |
CleanupStack::PushL( mailBox );
|
|
1431 |
TBool isSupported = ( TFsEmailUiUtility::IsRemoteLookupSupported( *mailBox ) );
|
|
1432 |
CleanupStack::PopAndDestroy( mailBox );
|
|
1433 |
return isSupported;
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
void CFsEmailUiHtmlViewerView::CallAdressL( const TDesC& aEmailAddress, TBool aVideoCall )
|
|
1437 |
{
|
|
1438 |
HBufC* emailAddress = aEmailAddress.AllocLC();
|
|
1439 |
|
|
1440 |
if ( aVideoCall )
|
|
1441 |
{
|
|
1442 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->SetVideoCall(
|
|
1443 |
ETrue );
|
|
1444 |
}
|
|
1445 |
|
|
1446 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( *emailAddress,
|
|
1447 |
iAppUi.GetActiveMailbox(), this, EFalse );
|
|
1448 |
CleanupStack::PopAndDestroy( emailAddress );
|
|
1449 |
}
|
|
1450 |
|
|
1451 |
// -----------------------------------------------------------------------------
|
|
1452 |
// CFsEmailUiHtmlViewerView::OpenContactDetailsL
|
|
1453 |
// -----------------------------------------------------------------------------
|
|
1454 |
void CFsEmailUiHtmlViewerView::OpenContactDetailsL( const TDesC& aEmailAddress )
|
|
1455 |
{
|
|
1456 |
HBufC* emailAddress = aEmailAddress.AllocLC();
|
|
1457 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->ShowContactDetailsL(
|
|
1458 |
*emailAddress, EContactUpdateEmail, NULL );
|
|
1459 |
|
|
1460 |
CleanupStack::PopAndDestroy( emailAddress );
|
|
1461 |
}
|
|
1462 |
|
|
1463 |
// -----------------------------------------------------------------------------
|
|
1464 |
// CFsEmailUiHtmlViewerView::LaunchRemoteLookupL
|
|
1465 |
// -----------------------------------------------------------------------------
|
|
1466 |
void CFsEmailUiHtmlViewerView::LaunchRemoteLookupL( const TDesC& aEmailAddress )
|
|
1467 |
{
|
|
1468 |
// this method assumes that remote lookup is available with current plugin.
|
|
1469 |
HBufC* textData = aEmailAddress.AllocLC();
|
|
1470 |
CFSMailBox* mailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
|
|
1471 |
CleanupStack::PushL( mailBox );
|
|
1472 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupWithQueryL( *mailBox, *textData );
|
|
1473 |
CleanupStack::PopAndDestroy( mailBox );
|
|
1474 |
CleanupStack::PopAndDestroy( textData );
|
|
1475 |
}
|
|
1476 |
|
|
1477 |
// -----------------------------------------------------------------------------
|
|
1478 |
// CFsEmailUiHtmlViewerView::LaunchRemoteLookupL
|
|
1479 |
// -----------------------------------------------------------------------------
|
|
1480 |
void CFsEmailUiHtmlViewerView::CreateMessageL( const TDesC& aEmailAddress )
|
|
1481 |
{
|
|
1482 |
HBufC* emailAddress = aEmailAddress.AllocLC();
|
|
1483 |
CFSEmailUiContactHandler* cntHandlerInstance = CFsDelayedLoader::InstanceL()->GetContactHandlerL();
|
|
1484 |
cntHandlerInstance->FindAndCreateMsgToContactByEmailL( *emailAddress, iAppUi.GetActiveMailbox() );
|
|
1485 |
CleanupStack::PopAndDestroy( emailAddress );
|
|
1486 |
}
|
|
1487 |
|
|
1488 |
CFSMailMessage* CFsEmailUiHtmlViewerView::CurrentMessage()
|
|
1489 |
{
|
|
1490 |
return iMessage;
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
CFSEmailUiAttachmentsListModel* CFsEmailUiHtmlViewerView::CurrentAttachmentsListModel()
|
|
1494 |
{
|
|
1495 |
return iAttachmentsListModel;
|
|
1496 |
}
|
|
1497 |
|
|
1498 |
void CFsEmailUiHtmlViewerView::DownloadStatusChangedL( TInt /*aIndex*/ )
|
|
1499 |
{
|
|
1500 |
}
|
|
1501 |
|
|
1502 |
void CFsEmailUiHtmlViewerView::DownloadAttachmentL( const TAttachmentData& aAttachment )
|
|
1503 |
{
|
|
1504 |
iAttachmentsListModel->StartDownloadL(aAttachment);
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
void CFsEmailUiHtmlViewerView::DownloadAllAttachmentsL()
|
|
1508 |
{
|
|
1509 |
iAttachmentsListModel->DownloadAllAttachmentsL();
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
void CFsEmailUiHtmlViewerView::CancelAttachmentL( const TAttachmentData& aAttachment )
|
|
1513 |
{
|
|
1514 |
iAttachmentsListModel->CancelDownloadL(aAttachment);
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
void CFsEmailUiHtmlViewerView::CancelAllAttachmentsL()
|
|
1518 |
{
|
|
1519 |
FUNC_LOG;
|
|
1520 |
iAttachmentsListModel->CancelAllDownloadsL();
|
|
1521 |
}
|
|
1522 |
|
|
1523 |
void CFsEmailUiHtmlViewerView::OpenAttachmentL( const TAttachmentData& aAttachment )
|
|
1524 |
{
|
|
1525 |
if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
|
|
1526 |
{
|
|
1527 |
TFsEmailUiUtility::ShowInfoNoteL( R_FSE_VIEWER_NOTE_ATTACHMENT_DOWNLOADING_PROGRESS );
|
|
1528 |
}
|
|
1529 |
else if ( aAttachment.downloadProgress != KComplete )
|
|
1530 |
{
|
|
1531 |
DownloadAttachmentL( aAttachment );
|
|
1532 |
if ( iContainer && !iContainer->AttachmentDownloadStatusVisible() )
|
|
1533 |
{
|
|
1534 |
iContainer->ShowAttachmentDownloadStatusL( TFSProgress::EFSStatus_Status, aAttachment );
|
|
1535 |
}
|
|
1536 |
}
|
|
1537 |
else
|
|
1538 |
{
|
|
1539 |
TFsEmailUiUtility::OpenAttachmentL( aAttachment.partData );
|
|
1540 |
}
|
|
1541 |
}
|
|
1542 |
|
|
1543 |
void CFsEmailUiHtmlViewerView::SaveAttachmentL( const TAttachmentData& aAttachment )
|
|
1544 |
{
|
|
1545 |
TFileName fileName;
|
|
1546 |
if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) )
|
|
1547 |
{
|
|
1548 |
TInt savedCount( 0 );
|
|
1549 |
TBool downloadRequired = iAttachmentsListModel->SaveAttachmentL( aAttachment, fileName, savedCount );
|
|
1550 |
if ( downloadRequired && iContainer && !iContainer->AttachmentDownloadStatusVisible() )
|
|
1551 |
{
|
|
1552 |
iContainer->ShowAttachmentDownloadStatusL( TFSProgress::EFSStatus_Status, aAttachment );
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
if ( savedCount )
|
|
1556 |
{
|
|
1557 |
TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( savedCount );
|
|
1558 |
}
|
|
1559 |
}
|
|
1560 |
}
|
|
1561 |
|
|
1562 |
void CFsEmailUiHtmlViewerView::SaveAllAttachmentsL()
|
|
1563 |
{
|
|
1564 |
TFileName fileName;
|
|
1565 |
if ( TFsEmailUiUtility::ShowSaveFolderDialogL( fileName ) )
|
|
1566 |
{
|
|
1567 |
TBool downloadRequired = iAttachmentsListModel->SaveAllAttachmentsL( fileName );
|
|
1568 |
if ( downloadRequired && iContainer && !iContainer->AttachmentDownloadStatusVisible() )
|
|
1569 |
{
|
|
1570 |
for ( TInt i = 0; i < iAttachmentsListModel->GetModel().Count(); i++ )
|
|
1571 |
{
|
|
1572 |
const TAttachmentData& attachment = iAttachmentsListModel->GetModel()[i];
|
|
1573 |
if ( attachment.downloadProgress < KComplete )
|
|
1574 |
{
|
|
1575 |
iContainer->ShowAttachmentDownloadStatusL( TFSProgress::EFSStatus_Status, attachment );
|
|
1576 |
break;
|
|
1577 |
}
|
|
1578 |
}
|
|
1579 |
}
|
|
1580 |
}
|
|
1581 |
}
|
|
1582 |
|
|
1583 |
void CFsEmailUiHtmlViewerView::RemoveAttachmentContentL( const TAttachmentData& aAttachment )
|
|
1584 |
{
|
|
1585 |
FUNC_LOG;
|
|
1586 |
TInt reallyClear = TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CLEAR_FETCHED_QUERY );
|
|
1587 |
if ( reallyClear )
|
|
1588 |
{
|
|
1589 |
iAttachmentsListModel->RemoveContentL( aAttachment );
|
|
1590 |
}
|
|
1591 |
}
|
|
1592 |
|
|
1593 |
void CFsEmailUiHtmlViewerView::OpenAttachmentsListViewL()
|
|
1594 |
{
|
|
1595 |
HandleCommandL( EFsEmailUiCmdOpenAttachmentList );
|
|
1596 |
}
|
|
1597 |
|
|
1598 |
TBool CFsEmailUiHtmlViewerView::IsEmbeddedMsgView()
|
|
1599 |
{
|
|
1600 |
return iActivationData.iEmbeddedMessageMode;
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
TBool CFsEmailUiHtmlViewerView::IsEmbeddedMsgSavingAllowed()
|
|
1604 |
{
|
|
1605 |
return iMailBox->HasCapability(
|
|
1606 |
EFSMboxCapaSupportsSavingOfEmbeddedMessages );
|
|
1607 |
}
|
|
1608 |
|
|
1609 |
void CFsEmailUiHtmlViewerView::UpdateDownloadIndicatorL(
|
|
1610 |
const TPartData& aPart,
|
|
1611 |
const TFSProgress& aEvent )
|
|
1612 |
{
|
|
1613 |
FUNC_LOG;
|
|
1614 |
|
|
1615 |
if ( !iMessage || !iContainer || ( aEvent.iError != KErrNone ) )
|
|
1616 |
return;
|
|
1617 |
|
|
1618 |
TAttachmentData* attachment = NULL;
|
|
1619 |
const RArray<TAttachmentData>& attachments = iAttachmentsListModel->GetModel();
|
|
1620 |
for ( TInt i=0; i < attachments.Count(); i++ )
|
|
1621 |
{
|
|
1622 |
if ( attachments[i].partData == aPart )
|
|
1623 |
{
|
|
1624 |
attachment = CONST_CAST( TAttachmentData*, &iAttachmentsListModel->GetModel()[i] );
|
|
1625 |
break;
|
|
1626 |
}
|
|
1627 |
}
|
|
1628 |
|
|
1629 |
if ( attachment )
|
|
1630 |
{
|
|
1631 |
switch ( aEvent.iProgressStatus )
|
|
1632 |
{
|
|
1633 |
case TFSProgress::EFSStatus_Status:
|
|
1634 |
{
|
|
1635 |
if ( aEvent.iMaxCount > 0 && aEvent.iCounter > 0 )
|
|
1636 |
{
|
|
1637 |
attachment->downloadProgress = KComplete * aEvent.iCounter / aEvent.iMaxCount;
|
|
1638 |
}
|
|
1639 |
else
|
|
1640 |
{
|
|
1641 |
attachment->downloadProgress = KNone;
|
|
1642 |
}
|
|
1643 |
}
|
|
1644 |
break;
|
|
1645 |
|
|
1646 |
case TFSProgress::EFSStatus_RequestComplete:
|
|
1647 |
{
|
|
1648 |
attachment->downloadProgress = KComplete;
|
|
1649 |
}
|
|
1650 |
break;
|
|
1651 |
|
|
1652 |
default:
|
|
1653 |
break;
|
|
1654 |
}
|
|
1655 |
|
|
1656 |
iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
|
|
1657 |
}
|
|
1658 |
}
|
|
1659 |
|
|
1660 |
void CFsEmailUiHtmlViewerView::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
|
|
1661 |
{
|
|
1662 |
FUNC_LOG;
|
|
1663 |
if ( iAppUi.CurrentActiveView() == this )
|
|
1664 |
{
|
|
1665 |
if ( iMessage && ( iMessage->GetMessageId().Id() == aPart.iMessageId.Id() ) )
|
|
1666 |
{
|
|
1667 |
UpdateDownloadIndicatorL( aPart, aEvent );
|
|
1668 |
}
|
|
1669 |
}
|
|
1670 |
}
|
|
1671 |
|
|
1672 |
|
|
1673 |
// -----------------------------------------------------------------------------
|
|
1674 |
// CFsEmailUiHtmlViewerView::PushMessageL
|
|
1675 |
// Message stack handling. Ownership of message is transferred when succesful.
|
|
1676 |
// -----------------------------------------------------------------------------
|
|
1677 |
//
|
|
1678 |
void CFsEmailUiHtmlViewerView::PushMessageL( CFSMailMessage* aMessage, TBool aIsEmbedded )
|
|
1679 |
{
|
|
1680 |
if ( !iOpenMessages || !iEmbeddedMessages )
|
|
1681 |
{
|
|
1682 |
User::Leave( KErrNotReady );
|
|
1683 |
}
|
|
1684 |
|
|
1685 |
// We must ensure that push is done succesfully either to both stacks or to neither one.
|
|
1686 |
if ( aIsEmbedded )
|
|
1687 |
{
|
|
1688 |
iEmbeddedMessages->PushL( aMessage );
|
|
1689 |
}
|
|
1690 |
else
|
|
1691 |
{
|
|
1692 |
iEmbeddedMessages->PushL( NULL );
|
|
1693 |
}
|
|
1694 |
TRAPD( err, iOpenMessages->PushL( aMessage ) );
|
|
1695 |
if ( err )
|
|
1696 |
{
|
|
1697 |
iEmbeddedMessages->Pop();
|
|
1698 |
User::Leave( err );
|
|
1699 |
}
|
|
1700 |
}
|
|
1701 |
|
|
1702 |
// -----------------------------------------------------------------------------
|
|
1703 |
// CFsEmailUiHtmlViewerView::PopMessage
|
|
1704 |
// Message stack handling. Ownership of message is returned.
|
|
1705 |
// -----------------------------------------------------------------------------
|
|
1706 |
//
|
|
1707 |
CFSMailMessage* CFsEmailUiHtmlViewerView::PopMessage()
|
|
1708 |
{
|
|
1709 |
ASSERT( iOpenMessages && iEmbeddedMessages );
|
|
1710 |
ASSERT( iOpenMessages->Count() == iEmbeddedMessages->Count() );
|
|
1711 |
|
|
1712 |
CFSMailMessage* msg = NULL;
|
|
1713 |
if ( !iOpenMessages->IsEmpty() )
|
|
1714 |
{
|
|
1715 |
msg = iOpenMessages->Pop();
|
|
1716 |
}
|
|
1717 |
if ( !iEmbeddedMessages->IsEmpty() )
|
|
1718 |
{
|
|
1719 |
iEmbeddedMessages->Pop();
|
|
1720 |
}
|
|
1721 |
return msg;
|
|
1722 |
}
|
|
1723 |
|
|
1724 |
// -----------------------------------------------------------------------------
|
|
1725 |
// CFsEmailUiHtmlViewerView::EraseMessageStack
|
|
1726 |
// Message stack handling. All messages in stack are deallocated
|
|
1727 |
// -----------------------------------------------------------------------------
|
|
1728 |
//
|
|
1729 |
void CFsEmailUiHtmlViewerView::EraseMessageStack()
|
|
1730 |
{
|
|
1731 |
ASSERT( iOpenMessages && iEmbeddedMessages );
|
|
1732 |
ASSERT( iOpenMessages->Count() == iEmbeddedMessages->Count() );
|
|
1733 |
|
|
1734 |
iOpenMessages->ResetAndDestroy();
|
|
1735 |
iEmbeddedMessages->Reset();
|
|
1736 |
}
|
|
1737 |
|
|
1738 |
// -----------------------------------------------------------------------------
|
|
1739 |
// CFsEmailUiHtmlViewerView::SetMessageFollowupFlagL
|
|
1740 |
// -----------------------------------------------------------------------------
|
|
1741 |
void CFsEmailUiHtmlViewerView::SetMessageFollowupFlagL()
|
|
1742 |
{
|
|
1743 |
FUNC_LOG;
|
|
1744 |
if ( iMessage && TFsEmailUiUtility::IsFollowUpSupported( *iMailBox ) )
|
|
1745 |
{
|
|
1746 |
TFollowUpNewState newState = TFsEmailUiUtility::SetMessageFollowupFlagL( *iMessage );
|
|
1747 |
if ( newState != EFollowUpNoChanges )
|
|
1748 |
{
|
|
1749 |
// Notify appui of changed mail item
|
|
1750 |
UpdateEmailHeaderIndicators();
|
|
1751 |
SendEventToAppUiL( TFSEventMailChanged );
|
|
1752 |
}
|
|
1753 |
}
|
|
1754 |
}
|
|
1755 |
void CFsEmailUiHtmlViewerView::SendEventToAppUiL( TFSMailEvent aEventType )
|
|
1756 |
{
|
|
1757 |
if ( iMessage )
|
|
1758 |
{
|
|
1759 |
RArray<TFSMailMsgId> msgIdArray;
|
|
1760 |
CleanupClosePushL( msgIdArray );
|
|
1761 |
msgIdArray.AppendL( iMessage->GetMessageId() );
|
|
1762 |
TFSMailMsgId folderId = iMessage->GetFolderId();
|
|
1763 |
iAppUi.EventL( aEventType,
|
|
1764 |
iAppUi.GetActiveMailboxId(),
|
|
1765 |
&msgIdArray, &folderId, NULL );
|
|
1766 |
CleanupStack::PopAndDestroy( &msgIdArray );
|
|
1767 |
}
|
|
1768 |
}
|
|
1769 |
// -----------------------------------------------------------------------------
|
|
1770 |
// CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL
|
|
1771 |
// -----------------------------------------------------------------------------
|
|
1772 |
void CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL(
|
|
1773 |
TBool aRead, TBool /*aCmdFromMrui*/ )
|
|
1774 |
{
|
|
1775 |
FUNC_LOG;
|
|
1776 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
1777 |
{
|
|
1778 |
if ( aRead )
|
|
1779 |
{
|
|
1780 |
// Send flags, local and server
|
|
1781 |
iMessage->SetFlag( EFSMsgFlag_Read );
|
|
1782 |
}
|
|
1783 |
else
|
|
1784 |
{
|
|
1785 |
// Send flags, local and server
|
|
1786 |
iMessage->ResetFlag( EFSMsgFlag_Read );
|
|
1787 |
}
|
|
1788 |
iMessage->SaveMessageL(); // Save read status
|
|
1789 |
SendEventToAppUiL( TFSEventMailChanged );
|
|
1790 |
|
|
1791 |
}
|
|
1792 |
}
|
|
1793 |
|
|
1794 |
// -----------------------------------------------------------------------------
|
|
1795 |
// CFsEmailUiHtmlViewerView::ShowNextMessageMenuInOptions
|
|
1796 |
// -----------------------------------------------------------------------------
|
|
1797 |
TBool CFsEmailUiHtmlViewerView::ShowNextMessageMenuInOptions() const
|
|
1798 |
{
|
|
1799 |
FUNC_LOG;
|
|
1800 |
TBool available = EFalse;
|
|
1801 |
// Next/previous message options are inavailable in the embedded mode
|
|
1802 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
1803 |
{
|
|
1804 |
TFSMailMsgId currentMsgId = iMessage->GetMessageId();
|
|
1805 |
TFSMailMsgId nextMsgId;
|
|
1806 |
TFSMailMsgId nextMsgFolderId;
|
|
1807 |
available = iAppUi.IsNextMsgAvailable( currentMsgId, nextMsgId, nextMsgFolderId );
|
|
1808 |
}
|
|
1809 |
return available;
|
|
1810 |
}
|
|
1811 |
|
|
1812 |
// -----------------------------------------------------------------------------
|
|
1813 |
// CFsEmailUiHtmlViewerView::ShowNextMessageL
|
|
1814 |
// -----------------------------------------------------------------------------
|
|
1815 |
void CFsEmailUiHtmlViewerView::ShowNextMessageL()
|
|
1816 |
{
|
|
1817 |
FUNC_LOG;
|
|
1818 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
1819 |
{
|
|
1820 |
TFSMailMsgId currentMsgId = iMessage->GetMessageId();
|
|
1821 |
TFSMailMsgId nextMsgId;
|
|
1822 |
TFSMailMsgId nextMsgFolderId;
|
|
1823 |
if ( iAppUi.IsNextMsgAvailable( currentMsgId, nextMsgId, nextMsgFolderId ) )
|
|
1824 |
{
|
|
1825 |
if (iContainer)
|
|
1826 |
{
|
|
1827 |
iContainer->PrepareForMessageNavigation();
|
|
1828 |
}
|
|
1829 |
|
|
1830 |
// Stop timer and cancel fetchings before showing next message
|
|
1831 |
//iFetchingAnimationTimer->Stop();
|
|
1832 |
CancelFetchings();
|
|
1833 |
|
|
1834 |
// Change empty msk when moving to next
|
|
1835 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
1836 |
|
|
1837 |
iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId );
|
|
1838 |
// Next message is displayed in this view through doactivate, because view is re-activate by mail list
|
|
1839 |
}
|
|
1840 |
}
|
|
1841 |
}
|
|
1842 |
// -----------------------------------------------------------------------------
|
|
1843 |
// CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions
|
|
1844 |
// -----------------------------------------------------------------------------
|
|
1845 |
TBool CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions() const
|
|
1846 |
{
|
|
1847 |
FUNC_LOG;
|
|
1848 |
TBool available = EFalse;
|
|
1849 |
// Next/previous message options are inavailable in the embedded mode
|
|
1850 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
1851 |
{
|
|
1852 |
TFSMailMsgId currentMsgId = iMessage->GetMessageId();
|
|
1853 |
TFSMailMsgId prevMsgId;
|
|
1854 |
TFSMailMsgId prevMsgFolderId;
|
|
1855 |
available = iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId );
|
|
1856 |
}
|
|
1857 |
return available;
|
|
1858 |
}
|
|
1859 |
|
|
1860 |
// -----------------------------------------------------------------------------
|
|
1861 |
// CFsEmailUiHtmlViewerView::ShowPreviousMessageL
|
|
1862 |
// -----------------------------------------------------------------------------
|
|
1863 |
void CFsEmailUiHtmlViewerView::ShowPreviousMessageL()
|
|
1864 |
{
|
|
1865 |
FUNC_LOG;
|
|
1866 |
if ( iMessage && !iActivationData.iEmbeddedMessageMode )
|
|
1867 |
{
|
|
1868 |
TFSMailMsgId currentMsgId = iMessage->GetMessageId();
|
|
1869 |
TFSMailMsgId prevMsgId;
|
|
1870 |
TFSMailMsgId prevMsgFolderId;
|
|
1871 |
if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
|
|
1872 |
{
|
|
1873 |
if (iContainer)
|
|
1874 |
{
|
|
1875 |
iContainer->PrepareForMessageNavigation();
|
|
1876 |
}
|
|
1877 |
|
|
1878 |
// Stop timer and cancel fetchings before showing prev message
|
|
1879 |
CancelFetchings();
|
|
1880 |
|
|
1881 |
// Change empty msk when moving to previous
|
|
1882 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
|
|
1883 |
|
|
1884 |
iAppUi.MoveToPreviousMsgL( currentMsgId, prevMsgId );
|
|
1885 |
// Previous message is displayed in this view through doactivate, because view is re-activate by mail list
|
|
1886 |
}
|
|
1887 |
}
|
|
1888 |
}
|
|
1889 |
|
|
1890 |
|
|
1891 |
// -----------------------------------------------------------------------------
|
|
1892 |
// CFsEmailUiHtmlViewerView::OpenFolderListForMessageMovingL
|
|
1893 |
// -----------------------------------------------------------------------------
|
|
1894 |
TBool CFsEmailUiHtmlViewerView::OpenFolderListForMessageMovingL()
|
|
1895 |
{
|
|
1896 |
FUNC_LOG;
|
|
1897 |
TBool ret = EFalse;
|
|
1898 |
// Ignore if mailbox doesn't support moving or we are viewing embedded message
|
|
1899 |
if ( iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ) &&
|
|
1900 |
!iActivationData.iEmbeddedMessageMode )
|
|
1901 |
{
|
|
1902 |
// Activate folder selection view and handle moving after callback gets destination
|
|
1903 |
iMoveToFolderOngoing = ETrue;
|
|
1904 |
TFolderListActivationData folderListData;
|
|
1905 |
folderListData.iCallback = this;
|
|
1906 |
CFSMailFolder* folder = iAppUi.GetMailClient()->GetFolderByUidL( iMessage->GetMailBoxId(), iMessage->GetFolderId() );
|
|
1907 |
folderListData.iSourceFolderType = TFSFolderType( folder->GetFolderType() );
|
|
1908 |
delete folder;
|
|
1909 |
const TPckgBuf<TFolderListActivationData> pkgOut( folderListData );
|
|
1910 |
iAppUi.EnterFsEmailViewL( FolderListId, KFolderListMoveMessage, pkgOut );
|
|
1911 |
ret = ETrue;
|
|
1912 |
}
|
|
1913 |
return ret;
|
|
1914 |
}
|
|
1915 |
|
|
1916 |
// -----------------------------------------------------------------------------
|
|
1917 |
// CFsEmailUiHtmlViewerView::FolderSelectedL
|
|
1918 |
// -----------------------------------------------------------------------------
|
|
1919 |
void CFsEmailUiHtmlViewerView::FolderSelectedL(
|
|
1920 |
TFSMailMsgId aSelectedFolderId, TFSEmailUiCtrlBarResponse aResponse )
|
|
1921 |
{
|
|
1922 |
FUNC_LOG;
|
|
1923 |
|
|
1924 |
if ( iMoveToFolderOngoing )
|
|
1925 |
{
|
|
1926 |
iMoveToFolderOngoing = EFalse;
|
|
1927 |
if ( !iMovingMeetingRequest )
|
|
1928 |
{
|
|
1929 |
switch ( aResponse )
|
|
1930 |
{
|
|
1931 |
case EFSEmailUiCtrlBarResponseSelect:
|
|
1932 |
{
|
|
1933 |
iMoveDestinationFolder = aSelectedFolderId;
|
|
1934 |
iAsyncCallback->Cancel(); // cancel any outstanding callback just to be safe
|
|
1935 |
iAsyncCallback->Set( TCallBack( MoveToFolderAndExitL, this ) );
|
|
1936 |
iAsyncCallback->SetPriority( CActive::EPriorityLow );
|
|
1937 |
iAsyncCallback->CallBack();
|
|
1938 |
}
|
|
1939 |
break;
|
|
1940 |
case EFSEmailUiCtrlBarResponseCancel:
|
|
1941 |
default:
|
|
1942 |
break;
|
|
1943 |
}
|
|
1944 |
}
|
|
1945 |
else
|
|
1946 |
{
|
|
1947 |
iMovingMeetingRequest = EFalse;
|
|
1948 |
switch ( aResponse )
|
|
1949 |
{
|
|
1950 |
case EFSEmailUiCtrlBarResponseCancel:
|
|
1951 |
iOpResult.iResultCode = KErrCancel;
|
|
1952 |
break;
|
|
1953 |
case EFSEmailUiCtrlBarResponseSelect:
|
|
1954 |
{
|
|
1955 |
// Do moving here, do not exit, because mrui exists itself.
|
|
1956 |
iOpResult.iResultCode = KErrNone;
|
|
1957 |
iMoveDestinationFolder = aSelectedFolderId;
|
|
1958 |
RArray<TFSMailMsgId> messageIds;
|
|
1959 |
CleanupClosePushL( messageIds );
|
|
1960 |
messageIds.Append( iActivationData.iMessageId );
|
|
1961 |
// Trap is needed because protocol might return KErrNotSupported
|
|
1962 |
// if move away from current folder is not supported
|
|
1963 |
TRAPD(errMove, iAppUi.GetActiveMailbox()->MoveMessagesL( messageIds,
|
|
1964 |
iActivationData.iFolderId, iMoveDestinationFolder ));
|
|
1965 |
if ( errMove != KErrNotSupported )
|
|
1966 |
{
|
|
1967 |
if ( errMove == KErrNone )
|
|
1968 |
{
|
|
1969 |
TFsEmailUiUtility::DisplayMsgsMovedNoteL( 1, iMoveDestinationFolder, ETrue );
|
|
1970 |
}
|
|
1971 |
else
|
|
1972 |
{
|
|
1973 |
User::Leave( errMove );
|
|
1974 |
}
|
|
1975 |
}
|
|
1976 |
CleanupStack::PopAndDestroy( &messageIds );
|
|
1977 |
}
|
|
1978 |
break;
|
|
1979 |
|
|
1980 |
default:
|
|
1981 |
break;
|
|
1982 |
}
|
|
1983 |
}
|
|
1984 |
}
|
|
1985 |
}
|
|
1986 |
|
|
1987 |
// -----------------------------------------------------------------------------
|
|
1988 |
// CFsEmailUiHtmlViewerView::MoveToFolderAndExitL
|
|
1989 |
// -----------------------------------------------------------------------------
|
|
1990 |
TInt CFsEmailUiHtmlViewerView::MoveToFolderAndExitL( TAny* aMailViewerVisualiser )
|
|
1991 |
{
|
|
1992 |
FUNC_LOG;
|
|
1993 |
CFsEmailUiHtmlViewerView* self =
|
|
1994 |
static_cast<CFsEmailUiHtmlViewerView*>(aMailViewerVisualiser);
|
|
1995 |
|
|
1996 |
RArray<TFSMailMsgId> messageIds;
|
|
1997 |
CleanupClosePushL( messageIds );
|
|
1998 |
messageIds.Append( self->iMessage->GetMessageId() );
|
|
1999 |
|
|
2000 |
// Trap is needed because protocol might return KErrNotSupported
|
|
2001 |
// if move away from current folder is not supprted
|
|
2002 |
TRAPD(errMove, self->iAppUi.GetActiveMailbox()->MoveMessagesL( messageIds,
|
|
2003 |
self->iMessage->GetFolderId(),
|
|
2004 |
self->iMoveDestinationFolder ) );
|
|
2005 |
if ( errMove != KErrNotSupported )
|
|
2006 |
{
|
|
2007 |
if ( errMove == KErrNone )
|
|
2008 |
{
|
|
2009 |
// move successfull, display note
|
|
2010 |
TFsEmailUiUtility::DisplayMsgsMovedNoteL( 1, self->iMoveDestinationFolder, ETrue );
|
|
2011 |
}
|
|
2012 |
else
|
|
2013 |
{
|
|
2014 |
// Leave with any other err code than KErrNone or KErrNotSupported.
|
|
2015 |
User::Leave( errMove );
|
|
2016 |
}
|
|
2017 |
}
|
|
2018 |
CleanupStack::PopAndDestroy( &messageIds );
|
|
2019 |
|
|
2020 |
// return to previous view
|
|
2021 |
self->HandleCommandL( EAknSoftkeyBack );
|
|
2022 |
|
|
2023 |
return KErrNone;
|
|
2024 |
}
|
|
2025 |
|
|
2026 |
// -----------------------------------------------------------------------------
|
|
2027 |
// CFsEmailUiHtmlViewerView::MessagePartFullyFetchedL
|
|
2028 |
// -----------------------------------------------------------------------------
|
|
2029 |
TBool CFsEmailUiHtmlViewerView::MessagePartFullyFetchedL( TFetchedType aFetchedContentType ) const
|
|
2030 |
{
|
|
2031 |
FUNC_LOG;
|
|
2032 |
TBool retVal = ETrue;
|
|
2033 |
if( aFetchedContentType == EMessagePlainTextBodyPart && iMessage )
|
|
2034 |
{
|
|
2035 |
CFSMailMessagePart* textPart = iMessage->PlainTextBodyPartL();
|
|
2036 |
if( textPart )
|
|
2037 |
{
|
|
2038 |
TFSPartFetchState currentPlainTextFetchState = textPart->FetchLoadState();
|
|
2039 |
if( currentPlainTextFetchState != EFSFull )
|
|
2040 |
{
|
|
2041 |
retVal = EFalse;
|
|
2042 |
}
|
|
2043 |
}
|
|
2044 |
delete textPart;
|
|
2045 |
}
|
|
2046 |
else if( aFetchedContentType == EMessageHtmlBodyPart && iMessage )
|
|
2047 |
{
|
|
2048 |
CFSMailMessagePart* htmlPart = iMessage->HtmlBodyPartL();
|
|
2049 |
if( htmlPart )
|
|
2050 |
{
|
|
2051 |
TFSPartFetchState currentHtmlTextFetchState = htmlPart->FetchLoadState();
|
|
2052 |
if( currentHtmlTextFetchState != EFSFull )
|
|
2053 |
{
|
|
2054 |
retVal = EFalse;
|
|
2055 |
}
|
|
2056 |
}
|
|
2057 |
delete htmlPart;
|
|
2058 |
}
|
|
2059 |
else if( aFetchedContentType == EMessageStructure && iMessage )
|
|
2060 |
{
|
|
2061 |
retVal = MessageStructureKnown( *iMessage );
|
|
2062 |
}
|
|
2063 |
else
|
|
2064 |
{
|
|
2065 |
User::Leave( KErrNotSupported );
|
|
2066 |
}
|
|
2067 |
return retVal;
|
|
2068 |
}
|
|
2069 |
|
|
2070 |
//-----------------------------------------------------------------------------
|
|
2071 |
// CFsEmailUiHtmlViewerView::StartFetchingMessagePartL
|
|
2072 |
// -----------------------------------------------------------------------------
|
|
2073 |
void CFsEmailUiHtmlViewerView::StartFetchingMessagePartL( CFSMailMessage& aMessagePtr,
|
|
2074 |
TFetchedType aFetchedContentType )
|
|
2075 |
{
|
|
2076 |
FUNC_LOG;
|
|
2077 |
iContainer->DisplayStatusIndicatorL();
|
|
2078 |
if( aFetchedContentType == EMessagePlainTextBodyPart )
|
|
2079 |
{
|
|
2080 |
CFSMailMessagePart* textPart = aMessagePtr.PlainTextBodyPartL();
|
|
2081 |
CleanupStack::PushL( textPart );
|
|
2082 |
TFSMailMsgId textPartId = textPart->GetPartId();
|
|
2083 |
iCurrentPlainTextBodyFetchRequestId = textPart->FetchMessagePartL( textPartId, *this, 0 );
|
|
2084 |
iFetchingPlainTextMessageBody = ETrue;
|
|
2085 |
CleanupStack::PopAndDestroy( textPart );
|
|
2086 |
}
|
|
2087 |
else if( aFetchedContentType == EMessageHtmlBodyPart )
|
|
2088 |
{
|
|
2089 |
CFSMailMessagePart* htmlPart = aMessagePtr.HtmlBodyPartL();
|
|
2090 |
CleanupStack::PushL( htmlPart );
|
|
2091 |
TFSMailMsgId htmlPartId = htmlPart->GetPartId();
|
|
2092 |
iCurrentHtmlBodyFetchRequestId = htmlPart->FetchMessagePartL( htmlPartId, *this, 0 );
|
|
2093 |
iFetchingHtmlMessageBody = ETrue;
|
|
2094 |
CleanupStack::PopAndDestroy( htmlPart );
|
|
2095 |
}
|
|
2096 |
else if( aFetchedContentType == EMessageStructure )
|
|
2097 |
{
|
|
2098 |
StartFetchingMessageStructureL( aMessagePtr );
|
|
2099 |
}
|
|
2100 |
else
|
|
2101 |
{
|
|
2102 |
User::Leave( KErrNotSupported );
|
|
2103 |
}
|
|
2104 |
}
|
|
2105 |
|
|
2106 |
// -----------------------------------------------------------------------------
|
|
2107 |
// CFsEmailUiHtmlViewerView::RequestResponseL
|
|
2108 |
// for MFSMailRequestObserver callback
|
|
2109 |
// -----------------------------------------------------------------------------
|
|
2110 |
void CFsEmailUiHtmlViewerView::RequestResponseL( TFSProgress aEvent, TInt aRequestId )
|
|
2111 |
{
|
|
2112 |
FUNC_LOG;
|
|
2113 |
|
|
2114 |
TBool reloadContent ( EFalse );
|
|
2115 |
|
|
2116 |
if ( aRequestId == iCurrentPlainTextBodyFetchRequestId && iFetchingPlainTextMessageBody )
|
|
2117 |
{
|
|
2118 |
if ( aEvent.iError != KErrNone ||
|
|
2119 |
aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled )
|
|
2120 |
{
|
|
2121 |
iAsyncProcessComplete = ETrue;
|
|
2122 |
iFetchingPlainTextMessageBody = EFalse;
|
|
2123 |
//iFetchingAnimationTimer->Stop();
|
|
2124 |
|
|
2125 |
// Clear the "fetching body" text from the end of the message
|
|
2126 |
//iViewerRichText->SetEmptyStatusLayoutTextL();
|
|
2127 |
}
|
|
2128 |
else if ( aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
|
|
2129 |
{
|
|
2130 |
iAsyncProcessComplete = ETrue;
|
|
2131 |
iFetchingPlainTextMessageBody = EFalse;
|
|
2132 |
//iFetchingAnimationTimer->Stop();
|
|
2133 |
|
|
2134 |
// get message again, there might be new information (in case of POP protocol)
|
|
2135 |
if( iMessage )
|
|
2136 |
{
|
|
2137 |
TFSMailMsgId mailboxId = iMessage->GetMailBoxId();
|
|
2138 |
TFSMailMsgId folderId = iMessage->GetFolderId();
|
|
2139 |
TFSMailMsgId messageId = iMessage->GetMessageId();
|
|
2140 |
UpdateMessagePtrL( mailboxId, folderId, messageId );
|
|
2141 |
reloadContent = ETrue;
|
|
2142 |
}
|
|
2143 |
|
|
2144 |
}
|
|
2145 |
}
|
|
2146 |
|
|
2147 |
else if ( aRequestId == iCurrentHtmlBodyFetchRequestId && iFetchingHtmlMessageBody )
|
|
2148 |
{
|
|
2149 |
if ( aEvent.iError != KErrNone ||
|
|
2150 |
aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled )
|
|
2151 |
{
|
|
2152 |
iAsyncProcessComplete = ETrue;
|
|
2153 |
iFetchingHtmlMessageBody = EFalse;
|
|
2154 |
}
|
|
2155 |
else if ( aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
|
|
2156 |
{
|
|
2157 |
iAsyncProcessComplete = ETrue;
|
|
2158 |
iFetchingHtmlMessageBody = EFalse;
|
|
2159 |
|
|
2160 |
reloadContent = ETrue;
|
|
2161 |
|
|
2162 |
}
|
|
2163 |
}
|
|
2164 |
else if ( aRequestId == iCurrentStructureFetchRequestId && iFetchingMessageStructure )
|
|
2165 |
{
|
|
2166 |
if ( aEvent.iError != KErrNone ||
|
|
2167 |
aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled )
|
|
2168 |
{
|
|
2169 |
iAsyncProcessComplete = ETrue;
|
|
2170 |
iFetchingMessageStructure = EFalse;
|
|
2171 |
}
|
|
2172 |
else if ( aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
|
|
2173 |
{
|
|
2174 |
iAsyncProcessComplete = ETrue;
|
|
2175 |
iFetchingMessageStructure = EFalse;
|
|
2176 |
|
|
2177 |
// get message again, there might be new information
|
|
2178 |
if( iMessage )
|
|
2179 |
{
|
|
2180 |
TFSMailMsgId mailboxId = iMessage->GetMailBoxId();
|
|
2181 |
TFSMailMsgId folderId = iMessage->GetFolderId();
|
|
2182 |
TFSMailMsgId messageId = iMessage->GetMessageId();
|
|
2183 |
UpdateMessagePtrL( mailboxId, folderId, messageId );
|
|
2184 |
reloadContent = ETrue;
|
|
2185 |
}
|
|
2186 |
}
|
|
2187 |
}
|
|
2188 |
|
|
2189 |
if ( iContainer )
|
|
2190 |
{
|
|
2191 |
iContainer->HideDownloadStatus();
|
|
2192 |
}
|
|
2193 |
|
|
2194 |
if ( reloadContent )
|
|
2195 |
{
|
|
2196 |
if ( iContainer )
|
|
2197 |
{
|
|
2198 |
iContainer->ResetContent( EFalse, EFalse );
|
|
2199 |
if ( iMessage )
|
|
2200 |
{
|
|
2201 |
LoadContentFromMailMessageL( iMessage , EFalse );
|
|
2202 |
SetMskL();
|
|
2203 |
}
|
|
2204 |
}
|
|
2205 |
}
|
|
2206 |
|
|
2207 |
if ( iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed )
|
|
2208 |
{
|
|
2209 |
iWaitDialog->ProcessFinishedL(); // deletes the dialog
|
|
2210 |
}
|
|
2211 |
}
|
|
2212 |
|
|
2213 |
// -----------------------------------------------------------------------------
|
|
2214 |
// CFsEmailUiHtmlViewerView::DialogDismissedL
|
|
2215 |
// -----------------------------------------------------------------------------
|
|
2216 |
void CFsEmailUiHtmlViewerView::DialogDismissedL( TInt aButtonId )
|
|
2217 |
{
|
|
2218 |
FUNC_LOG;
|
|
2219 |
iDialogNotDismissed = EFalse;
|
|
2220 |
if( aButtonId == EAknSoftkeyCancel )
|
|
2221 |
{
|
|
2222 |
CancelFetchings();
|
|
2223 |
}
|
|
2224 |
|
|
2225 |
}
|
|
2226 |
|
|
2227 |
// -----------------------------------------------------------------------------
|
|
2228 |
// CFsEmailUiHtmlViewerView::UpdateMessagePtrL
|
|
2229 |
// -----------------------------------------------------------------------------
|
|
2230 |
void CFsEmailUiHtmlViewerView::UpdateMessagePtrL( TFSMailMsgId aNewMailboxId,
|
|
2231 |
TFSMailMsgId aNewFolderId,
|
|
2232 |
TFSMailMsgId aNewMessageId )
|
|
2233 |
{
|
|
2234 |
FUNC_LOG;
|
|
2235 |
TBool messageChanged = ETrue;
|
|
2236 |
|
|
2237 |
if ( iMessage )
|
|
2238 |
{
|
|
2239 |
// Check is the message going to be changed or are we just updating the
|
|
2240 |
// same message object which has been previously shown.
|
|
2241 |
messageChanged = ( iMessage->GetMessageId() != aNewMessageId );
|
|
2242 |
|
|
2243 |
// stop observing downloads from the previous message in case the message was changed
|
|
2244 |
if ( iAppUi.DownloadInfoMediator() && messageChanged )
|
|
2245 |
{
|
|
2246 |
iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
|
|
2247 |
}
|
|
2248 |
delete iMessage;
|
|
2249 |
iMessage = NULL;
|
|
2250 |
PopMessage();
|
|
2251 |
}
|
|
2252 |
|
|
2253 |
iMessage = iAppUi.GetMailClient()->GetMessageByUidL( aNewMailboxId,
|
|
2254 |
aNewFolderId,
|
|
2255 |
aNewMessageId,
|
|
2256 |
EFSMsgDataEnvelope );
|
|
2257 |
if ( iMessage )
|
|
2258 |
{
|
|
2259 |
// Opened to viewer -> set message as read
|
|
2260 |
if ( !iMessage->IsFlagSet( EFSMsgFlag_Read ) )
|
|
2261 |
{
|
|
2262 |
iMessage->SetFlag( EFSMsgFlag_Read );
|
|
2263 |
iMessage->SaveMessageL(); // Save read status
|
|
2264 |
// Notify appui of changed mail item, it seems that protocols don't do this
|
|
2265 |
SendEventToAppUiL( TFSEventMailChanged );
|
|
2266 |
}
|
|
2267 |
// Start observing attachment downloads from the new message
|
|
2268 |
if ( iAppUi.DownloadInfoMediator() && messageChanged )
|
|
2269 |
{
|
|
2270 |
iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
|
|
2271 |
}
|
|
2272 |
}
|
|
2273 |
}
|
|
2274 |
|
|
2275 |
// -----------------------------------------------------------------------------
|
|
2276 |
// CFsEmailUiHtmlViewerView::CancelFetchings
|
|
2277 |
// -----------------------------------------------------------------------------
|
|
2278 |
void CFsEmailUiHtmlViewerView::CancelFetchings()
|
|
2279 |
{
|
|
2280 |
FUNC_LOG;
|
|
2281 |
if( iFetchingPlainTextMessageBody )
|
|
2282 |
{
|
|
2283 |
TRAP_IGNORE( iAppUi.GetMailClient()->CancelL( iCurrentPlainTextBodyFetchRequestId ) );
|
|
2284 |
iFetchingPlainTextMessageBody = EFalse;
|
|
2285 |
}
|
|
2286 |
if( iFetchingHtmlMessageBody )
|
|
2287 |
{
|
|
2288 |
TRAP_IGNORE( iAppUi.GetMailClient()->CancelL( iCurrentHtmlBodyFetchRequestId ) );
|
|
2289 |
iFetchingHtmlMessageBody = EFalse;
|
|
2290 |
}
|
|
2291 |
if( iFetchingMessageStructure )
|
|
2292 |
{
|
|
2293 |
TRAP_IGNORE( iAppUi.GetMailClient()->CancelL( iCurrentStructureFetchRequestId ) );
|
|
2294 |
iFetchingMessageStructure = EFalse;
|
|
2295 |
}
|
|
2296 |
iAsyncProcessComplete = ETrue;
|
|
2297 |
|
|
2298 |
//also cancel embedded images download in DownloadInfoMediator
|
|
2299 |
if ( iMailBox )
|
|
2300 |
{
|
|
2301 |
TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelAllDownloadsL( iMailBox->GetId() ) );
|
|
2302 |
}
|
|
2303 |
|
|
2304 |
|
|
2305 |
//<cmail>
|
|
2306 |
if(iWaitDialog && iDialogNotDismissed)
|
|
2307 |
TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); // deletes the dialog
|
|
2308 |
//</cmail>
|
|
2309 |
}
|
|
2310 |
// -----------------------------------------------------------------------------
|
|
2311 |
// CFsEmailUiHtmlViewerView::StartFetchingMessageStructureL
|
|
2312 |
// -----------------------------------------------------------------------------
|
|
2313 |
void CFsEmailUiHtmlViewerView::StartFetchingMessageStructureL( CFSMailMessage& aMsg )
|
|
2314 |
{
|
|
2315 |
FUNC_LOG;
|
|
2316 |
TFSMailMsgId currentMailboxId = aMsg.GetMailBoxId();
|
|
2317 |
TFSMailMsgId currentMessageFolderId = aMsg.GetFolderId();
|
|
2318 |
CFSMailFolder* currentFolder = iAppUi.GetMailClient()->GetFolderByUidL( currentMailboxId, currentMessageFolderId );
|
|
2319 |
CleanupStack::PushL( currentFolder );
|
|
2320 |
RArray<TFSMailMsgId> messageIds;
|
|
2321 |
CleanupClosePushL( messageIds );
|
|
2322 |
messageIds.Append( aMsg.GetMessageId() );
|
|
2323 |
iCurrentStructureFetchRequestId = currentFolder->FetchMessagesL( messageIds, EFSMsgDataStructure, *this );
|
|
2324 |
iFetchingMessageStructure = ETrue;
|
|
2325 |
CleanupStack::PopAndDestroy( &messageIds );
|
|
2326 |
CleanupStack::PopAndDestroy( currentFolder );
|
|
2327 |
}
|
|
2328 |
|
|
2329 |
// -----------------------------------------------------------------------------
|
|
2330 |
// CFsEmailUiHtmlViewerView::MessageStructureKnownL
|
|
2331 |
// -----------------------------------------------------------------------------
|
|
2332 |
TBool CFsEmailUiHtmlViewerView::MessageStructureKnown( CFSMailMessage& aMsg ) const
|
|
2333 |
{
|
|
2334 |
FUNC_LOG;
|
|
2335 |
return TFsEmailUiUtility::IsMessageStructureKnown( aMsg );
|
|
2336 |
}
|
|
2337 |
|
|
2338 |
// -----------------------------------------------------------------------------
|
|
2339 |
// CFsEmailUiHtmlViewerView::StartWaitedFetchingL
|
|
2340 |
// -----------------------------------------------------------------------------
|
|
2341 |
void CFsEmailUiHtmlViewerView::StartWaitedFetchingL( TFetchedType aFetchedContentType )
|
|
2342 |
{
|
|
2343 |
FUNC_LOG;
|
|
2344 |
iAsyncProcessComplete = EFalse;
|
|
2345 |
//iFetchingAlready = EFalse;
|
|
2346 |
iStartAsyncFetchType = aFetchedContentType;
|
|
2347 |
//<cmail> in cmail we are using different wait dialog, since this wrapper dialog gives
|
|
2348 |
// problems in red key exit, when its active
|
|
2349 |
//delete iAsyncWaitNote; iAsyncWaitNote = NULL;
|
|
2350 |
//iAsyncWaitNote = CAknWaitNoteWrapper::NewL();
|
|
2351 |
// surpress start delay to prevent situation where wait note gets visible
|
|
2352 |
// only after the structure has been fetched
|
|
2353 |
//iAsyncWaitNote->ExecuteL( R_FSE_FETCHING_WAIT_DIALOG, *this, ETrue );
|
|
2354 |
//</cmail>
|
|
2355 |
|
|
2356 |
//<cmail>
|
|
2357 |
/*iWaitDialog = new(ELeave)CAknWaitDialog(
|
|
2358 |
(REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), ETrue);
|
|
2359 |
iWaitDialog->SetCallback(this);
|
|
2360 |
iDialogNotDismissed = ETrue;
|
|
2361 |
iWaitDialog->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG);
|
|
2362 |
*/
|
|
2363 |
if( iMessage )
|
|
2364 |
{
|
|
2365 |
StartFetchingMessagePartL( *iMessage, iStartAsyncFetchType );
|
|
2366 |
}
|
|
2367 |
// iFetchingAlready = ETrue;
|
|
2368 |
//</cmail>
|
|
2369 |
}
|
|
2370 |
|
|
2371 |
// ---------------------------------------------------------------------------
|
|
2372 |
// CanProcessCommand
|
|
2373 |
// Callback from meeting request UI. Determines what functionality is provided
|
|
2374 |
// to mrui by this UI
|
|
2375 |
// ---------------------------------------------------------------------------
|
|
2376 |
//
|
|
2377 |
TBool CFsEmailUiHtmlViewerView::CanProcessCommand(
|
|
2378 |
TESMRIcalViewerOperationType aCommandId ) const
|
|
2379 |
{
|
|
2380 |
FUNC_LOG;
|
|
2381 |
TBool ret( EFalse );
|
|
2382 |
TInt numRecipients(0);
|
|
2383 |
switch ( aCommandId )
|
|
2384 |
{
|
|
2385 |
case EESMRCmdMailReply:
|
|
2386 |
ret = ETrue;
|
|
2387 |
break;
|
|
2388 |
case EESMRCmdMailReplyAll:
|
|
2389 |
//Get # of recipients
|
|
2390 |
if ( iMessage )
|
|
2391 |
{
|
|
2392 |
numRecipients=TFsEmailUiUtility::CountRecepients( iMessage );
|
|
2393 |
if ( numRecipients == 1 )
|
|
2394 |
{
|
|
2395 |
//check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
|
|
2396 |
//email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI.
|
|
2397 |
if ( iMessage->GetToRecipients().Count() )
|
|
2398 |
{
|
|
2399 |
if ( iMailBox->OwnMailAddress().GetEmailAddress().Compare(iMessage->GetToRecipients()[0]->GetEmailAddress()) )
|
|
2400 |
{
|
|
2401 |
numRecipients++;
|
|
2402 |
}
|
|
2403 |
}
|
|
2404 |
if ( iMessage->GetCCRecipients().Count() )
|
|
2405 |
{
|
|
2406 |
if ( iMailBox->OwnMailAddress().GetEmailAddress().Compare(iMessage->GetCCRecipients()[0]->GetEmailAddress()) )
|
|
2407 |
{
|
|
2408 |
numRecipients++;
|
|
2409 |
}
|
|
2410 |
}
|
|
2411 |
if ( iMessage->GetBCCRecipients().Count() )
|
|
2412 |
{
|
|
2413 |
if ( iMailBox->OwnMailAddress().GetEmailAddress().Compare(iMessage->GetBCCRecipients()[0]->GetEmailAddress()) )
|
|
2414 |
{
|
|
2415 |
numRecipients++;
|
|
2416 |
}
|
|
2417 |
}
|
|
2418 |
}
|
|
2419 |
}
|
|
2420 |
ret = ( iMessage && numRecipients > 1 );
|
|
2421 |
break;
|
|
2422 |
case EESMRCmdDownloadManager:
|
|
2423 |
//ret = ShowDownloadManagerMenuInOptions();
|
|
2424 |
break;
|
|
2425 |
// <cmail>
|
|
2426 |
case EESMRCmdOpenAttachment:
|
|
2427 |
case EESMRCmdSaveAttachment:
|
|
2428 |
case EESMRCmdSaveAllAttachments:
|
|
2429 |
case EESMRCmdDownloadAttachment:
|
|
2430 |
case EESMRCmdDownloadAllAttachments:
|
|
2431 |
// </cmail>
|
|
2432 |
case EESMRCmdOpenAttachmentView:
|
|
2433 |
ret = ETrue;
|
|
2434 |
break;
|
|
2435 |
case EESMRCmdMailComposeMessage:
|
|
2436 |
ret = ETrue;
|
|
2437 |
break;
|
|
2438 |
case EESMRCmdMailMarkUnread:
|
|
2439 |
{
|
|
2440 |
ret = EFalse;
|
|
2441 |
if ( iMessage && iMessage->IsFlagSet(EFSMsgFlag_Read) )
|
|
2442 |
{
|
|
2443 |
// Read, unread should be available
|
|
2444 |
ret = ETrue;
|
|
2445 |
}
|
|
2446 |
}
|
|
2447 |
break;
|
|
2448 |
case EESMRCmdMailMarkRead:
|
|
2449 |
{
|
|
2450 |
ret = EFalse;
|
|
2451 |
if ( iMessage && !iMessage->IsFlagSet(EFSMsgFlag_Read) )
|
|
2452 |
{
|
|
2453 |
// Read, unread should be available
|
|
2454 |
ret = ETrue;
|
|
2455 |
}
|
|
2456 |
}
|
|
2457 |
break;
|
|
2458 |
case EESMRCmdMailMoveMessage:
|
|
2459 |
{
|
|
2460 |
ret = EFalse;
|
|
2461 |
if ( iMessage )
|
|
2462 |
{
|
|
2463 |
// confirmed pointer exists, check whether mb has capa
|
|
2464 |
ret = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder );
|
|
2465 |
}
|
|
2466 |
}
|
|
2467 |
break;
|
|
2468 |
case EESMRCmdMailForwardAsMessage:
|
|
2469 |
ret = ETrue;
|
|
2470 |
break;
|
|
2471 |
case EESMRCmdMailFlagMessage:
|
|
2472 |
ret = TFsEmailUiUtility::IsFollowUpSupported( *iMailBox );
|
|
2473 |
break;
|
|
2474 |
//Changed to EFalse to fix defect EJZG-83CDRX
|
|
2475 |
case EESMRCmdMailMessageDetails:
|
|
2476 |
ret = EFalse;
|
|
2477 |
break;
|
|
2478 |
case EESMRCmdMailDelete:
|
|
2479 |
ret = ETrue;
|
|
2480 |
break;
|
|
2481 |
case EESMRCmdMailPreviousMessage:
|
|
2482 |
ret = ShowPreviousMessageMenuInOptions();
|
|
2483 |
break;
|
|
2484 |
case EESMRCmdMailNextMessage:
|
|
2485 |
ret = ShowNextMessageMenuInOptions();
|
|
2486 |
break;
|
|
2487 |
default:
|
|
2488 |
ret = EFalse;
|
|
2489 |
break;
|
|
2490 |
}
|
|
2491 |
return ret;
|
|
2492 |
}
|
|
2493 |
|
|
2494 |
|
|
2495 |
void CFsEmailUiHtmlViewerView::ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId,
|
|
2496 |
const CFSMailMessage& aMessage,
|
|
2497 |
MESMRIcalViewerObserver* aObserver )
|
|
2498 |
{
|
|
2499 |
FUNC_LOG;
|
|
2500 |
if ( aObserver )
|
|
2501 |
{
|
|
2502 |
iMrObserverToInform = aObserver;
|
|
2503 |
}
|
|
2504 |
// we must cast constness away from message because of flaws in MRUI API
|
|
2505 |
CFSMailMessage* messagePtr = const_cast<CFSMailMessage*>(&aMessage);
|
|
2506 |
if ( messagePtr )
|
|
2507 |
{
|
|
2508 |
// Fill in result struct
|
|
2509 |
iOpResult.iOpType = aCommandId;
|
|
2510 |
iOpResult.iMessage = messagePtr;
|
|
2511 |
iOpResult.iResultCode = KErrNotFound;
|
|
2512 |
|
|
2513 |
switch ( aCommandId )
|
|
2514 |
{
|
|
2515 |
case EESMRCmdMailMessageDetails:
|
|
2516 |
{
|
|
2517 |
iOpResult.iResultCode = KErrNone;
|
|
2518 |
TMsgDetailsActivationData msgDetailsData;
|
|
2519 |
msgDetailsData.iMailBoxId = messagePtr->GetMailBoxId();
|
|
2520 |
msgDetailsData.iFolderId = messagePtr->GetFolderId();
|
|
2521 |
msgDetailsData.iMessageId = messagePtr->GetMessageId();
|
|
2522 |
const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData );
|
|
2523 |
iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning, pkgOut);
|
|
2524 |
}
|
|
2525 |
break;
|
|
2526 |
case EESMRCmdMailDelete:
|
|
2527 |
{
|
|
2528 |
if ( iMessage )
|
|
2529 |
{
|
|
2530 |
iDeletedMessageFromMrui = iMessage->GetMessageId(); //<cmail>
|
|
2531 |
DeleteMailL(ETrue);
|
|
2532 |
iOpResult.iResultCode = KErrNone; //???? what to pass here
|
|
2533 |
}
|
|
2534 |
|
|
2535 |
// Information is returned immediately after delete has completed.
|
|
2536 |
CompletePendingMrCommand();
|
|
2537 |
}
|
|
2538 |
break;
|
|
2539 |
case EESMRCmdMailMoveMessage:
|
|
2540 |
{
|
|
2541 |
if ( iMessage )
|
|
2542 |
{
|
|
2543 |
if ( OpenFolderListForMessageMovingL() )
|
|
2544 |
{
|
|
2545 |
iOpResult.iResultCode = KErrNone;
|
|
2546 |
iMovingMeetingRequest = ETrue;
|
|
2547 |
}
|
|
2548 |
}
|
|
2549 |
}
|
|
2550 |
break;
|
|
2551 |
// <cmail>
|
|
2552 |
case EESMRCmdOpenAttachment:
|
|
2553 |
{
|
|
2554 |
// Check that message has attachments to display
|
|
2555 |
if ( messagePtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2556 |
{
|
|
2557 |
iOpResult.iResultCode = KErrNone;
|
|
2558 |
//OpenAttachmentL();
|
|
2559 |
CompletePendingMrCommand();
|
|
2560 |
}
|
|
2561 |
}
|
|
2562 |
break;
|
|
2563 |
case EESMRCmdDownloadAttachment:
|
|
2564 |
case EESMRCmdDownloadAllAttachments:
|
|
2565 |
{
|
|
2566 |
if( !iAttachmentsListModel )
|
|
2567 |
{
|
|
2568 |
iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
|
|
2569 |
iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );
|
|
2570 |
}
|
|
2571 |
// Check that message has attachments to display
|
|
2572 |
if ( messagePtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2573 |
{
|
|
2574 |
iOpResult.iResultCode = KErrNone;
|
|
2575 |
DownloadAllAttachmentsL();
|
|
2576 |
CompletePendingMrCommand();
|
|
2577 |
}
|
|
2578 |
}
|
|
2579 |
break;
|
|
2580 |
case EESMRCmdSaveAttachment:
|
|
2581 |
case EESMRCmdSaveAllAttachments:
|
|
2582 |
{
|
|
2583 |
if( !iAttachmentsListModel )
|
|
2584 |
{
|
|
2585 |
iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
|
|
2586 |
iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );
|
|
2587 |
}
|
|
2588 |
// Check that message has attachments to display
|
|
2589 |
if ( messagePtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2590 |
{
|
|
2591 |
iOpResult.iResultCode = KErrNone;
|
|
2592 |
SaveAllAttachmentsL();
|
|
2593 |
CompletePendingMrCommand();
|
|
2594 |
}
|
|
2595 |
}
|
|
2596 |
break;
|
|
2597 |
// </cmail>
|
|
2598 |
case EESMRCmdOpenAttachmentView:
|
|
2599 |
{
|
|
2600 |
// Check that message has attachments to display
|
|
2601 |
if ( messagePtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2602 |
{
|
|
2603 |
iOpResult.iResultCode = KErrNone;
|
|
2604 |
TAttachmentListActivationData params;
|
|
2605 |
params.iMailBoxId = messagePtr->GetMailBoxId();
|
|
2606 |
params.iFolderId = messagePtr->GetFolderId();
|
|
2607 |
params.iMessageId = messagePtr->GetMessageId();
|
|
2608 |
TPckgBuf<TAttachmentListActivationData> buf( params );
|
|
2609 |
TUid emptyCustomMessageId = { 0 };
|
|
2610 |
iAppUi.EnterFsEmailViewL( AttachmentMngrViewId, emptyCustomMessageId, buf );
|
|
2611 |
// <cmail>
|
|
2612 |
CompletePendingMrCommand();
|
|
2613 |
// </cmail>
|
|
2614 |
}
|
|
2615 |
}
|
|
2616 |
break;
|
|
2617 |
case EESMRCmdDownloadManager:
|
|
2618 |
{
|
|
2619 |
// Check that there is something in dwnld manager to show
|
|
2620 |
//if ( ShowDownloadManagerMenuInOptions() )
|
|
2621 |
// {
|
|
2622 |
// iOpResult.iResultCode = KErrNone;
|
|
2623 |
// iAppUi.EnterFsEmailViewL( DownloadManagerViewId );
|
|
2624 |
//}
|
|
2625 |
}
|
|
2626 |
break;
|
|
2627 |
case EESMRCmdMailComposeMessage:
|
|
2628 |
{
|
|
2629 |
iAppUi.CreateNewMailL();
|
|
2630 |
iOpResult.iResultCode = KErrNone;
|
|
2631 |
}
|
|
2632 |
break;
|
|
2633 |
case EESMRCmdMailReply:
|
|
2634 |
case EESMRCmdMailReplyAll:
|
|
2635 |
case EESMRCmdMailForwardAsMessage:
|
|
2636 |
{
|
|
2637 |
// Fill result codes for mrui
|
|
2638 |
iOpResult.iResultCode = KErrNone;
|
|
2639 |
// Fill launc params
|
|
2640 |
TEditorLaunchParams params;
|
|
2641 |
params.iMailboxId = iAppUi.GetActiveMailboxId();
|
|
2642 |
params.iActivatedExternally = EFalse;
|
|
2643 |
params.iMsgId = messagePtr->GetMessageId();
|
|
2644 |
if ( aCommandId == EESMRCmdMailForwardAsMessage )
|
|
2645 |
{
|
|
2646 |
iAppUi.LaunchEditorL( KEditorCmdForward, params );
|
|
2647 |
}
|
|
2648 |
else if ( aCommandId == EESMRCmdMailReply )
|
|
2649 |
{
|
|
2650 |
iAppUi.LaunchEditorL( KEditorCmdReply, params );
|
|
2651 |
}
|
|
2652 |
else if ( aCommandId == EESMRCmdMailReplyAll )
|
|
2653 |
{
|
|
2654 |
iAppUi.LaunchEditorL( KEditorCmdReplyAll, params );
|
|
2655 |
}
|
|
2656 |
}
|
|
2657 |
break;
|
|
2658 |
case EESMRCmdMailPreviousMessage:
|
|
2659 |
{
|
|
2660 |
iNextOrPrevMessageSelected = ETrue; // prevent back navigation when operation completed received
|
|
2661 |
ShowPreviousMessageL();
|
|
2662 |
iOpResult.iResultCode = KErrNone;
|
|
2663 |
CompletePendingMrCommand();
|
|
2664 |
}
|
|
2665 |
break;
|
|
2666 |
case EESMRCmdMailNextMessage:
|
|
2667 |
{
|
|
2668 |
iNextOrPrevMessageSelected = ETrue; // prevent back navigation when operation completed received
|
|
2669 |
ShowNextMessageL();
|
|
2670 |
iOpResult.iResultCode = KErrNone;
|
|
2671 |
CompletePendingMrCommand();
|
|
2672 |
}
|
|
2673 |
break;
|
|
2674 |
default:
|
|
2675 |
break;
|
|
2676 |
}
|
|
2677 |
}
|
|
2678 |
|
|
2679 |
// Complete immediately if handling command failed. It makes no harm if following
|
|
2680 |
// function gets called several times in some case.
|
|
2681 |
if ( iOpResult.iResultCode < 0 )
|
|
2682 |
{
|
|
2683 |
CompletePendingMrCommand();
|
|
2684 |
}
|
|
2685 |
}
|
|
2686 |
void CFsEmailUiHtmlViewerView::ProcessSyncCommandL(
|
|
2687 |
TESMRIcalViewerOperationType aCommandId,
|
|
2688 |
const CFSMailMessage& aMessage )
|
|
2689 |
{
|
|
2690 |
FUNC_LOG;
|
|
2691 |
if ( &aMessage )
|
|
2692 |
{
|
|
2693 |
switch ( aCommandId )
|
|
2694 |
{
|
|
2695 |
case EESMRCmdMailMarkUnread:
|
|
2696 |
{
|
|
2697 |
ChangeMsgReadStatusL( EFalse, ETrue );
|
|
2698 |
}
|
|
2699 |
break;
|
|
2700 |
case EESMRCmdMailMarkRead:
|
|
2701 |
{
|
|
2702 |
ChangeMsgReadStatusL( ETrue, ETrue );
|
|
2703 |
}
|
|
2704 |
break;
|
|
2705 |
case EESMRCmdMailFlagMessage:
|
|
2706 |
{
|
|
2707 |
if ( iMessage )
|
|
2708 |
{
|
|
2709 |
if ( !iFlagSelectionHandler )
|
|
2710 |
{
|
|
2711 |
// Create when used for the first time
|
|
2712 |
iFlagSelectionHandler =
|
|
2713 |
CFlagSelectionNoteHandler::NewL( *this );
|
|
2714 |
}
|
|
2715 |
// Call to LaunchFlagListQueryDialogL will lead
|
|
2716 |
// to CFlagSelectionNoteHandler::RunL() for handling the
|
|
2717 |
// user's selection.
|
|
2718 |
iFlagSelectionHandler->LaunchFlagListQueryDialogL();
|
|
2719 |
}
|
|
2720 |
}
|
|
2721 |
break;
|
|
2722 |
default:
|
|
2723 |
break;
|
|
2724 |
}
|
|
2725 |
}
|
|
2726 |
}
|
|
2727 |
|
|
2728 |
// -----------------------------------------------------------------------------
|
|
2729 |
// CFsEmailUiHtmlViewerView::OperationCompleted()
|
|
2730 |
// From MRUI observer
|
|
2731 |
// -----------------------------------------------------------------------------
|
|
2732 |
//
|
|
2733 |
void CFsEmailUiHtmlViewerView::OperationCompleted( TIcalViewerOperationResult aResult )
|
|
2734 |
{
|
|
2735 |
FUNC_LOG;
|
|
2736 |
if ( aResult.iOpType == EESMRViewLaunch )
|
|
2737 |
{
|
|
2738 |
iMrUiActive = EFalse;
|
|
2739 |
if ( !iNextOrPrevMessageSelected && iAppUi.CurrentActiveView() == this )
|
|
2740 |
{
|
|
2741 |
TRAP_IGNORE( NavigateBackL() );
|
|
2742 |
}
|
|
2743 |
if ( aResult.iAttendeeStatus == EESMRAttendeeStatusAccept ||
|
|
2744 |
aResult.iAttendeeStatus == EESMRAttendeeStatusTentative )
|
|
2745 |
{
|
|
2746 |
TInt noteTextId = R_FREESTYLE_EMAIL_CONFIRM_NOTE_MEETING_ON_CALENDAR_AFTER_SYNC;
|
|
2747 |
TRAP_IGNORE( TFsEmailUiUtility::ShowGlobalInfoNoteL( noteTextId ) );
|
|
2748 |
}
|
|
2749 |
}
|
|
2750 |
}
|
|
2751 |
|
|
2752 |
// -----------------------------------------------------------------------------
|
|
2753 |
// CFsEmailUiHtmlViewerView::OperationError()
|
|
2754 |
// -----------------------------------------------------------------------------
|
|
2755 |
//
|
|
2756 |
void CFsEmailUiHtmlViewerView::OperationError( TIcalViewerOperationResult aResult )
|
|
2757 |
{
|
|
2758 |
FUNC_LOG;
|
|
2759 |
// Show message in standard mail viewer in case launchin MRUI fails for any
|
|
2760 |
// other reason than viewer being cancelled by calling CancelPendingMrCommand().
|
|
2761 |
if ( aResult.iOpType == EESMRViewLaunch )
|
|
2762 |
{
|
|
2763 |
iMrUiActive = EFalse;
|
|
2764 |
|
|
2765 |
// load mr content to viewer so we don't end up with empty view
|
|
2766 |
if ( iContainer )
|
|
2767 |
{
|
|
2768 |
iContainer->ResetContent();
|
|
2769 |
}
|
|
2770 |
|
|
2771 |
if( iMessage )
|
|
2772 |
{
|
|
2773 |
TRAP_IGNORE( LoadContentFromMailMessageL( iMessage ) );
|
|
2774 |
TRAP_IGNORE( SetMskL() );
|
|
2775 |
}
|
|
2776 |
}
|
|
2777 |
}
|
|
2778 |
|
|
2779 |
// -----------------------------------------------------------------------------
|
|
2780 |
// CFsEmailUiHtmlViewerView::CompletePendingMrCommand()
|
|
2781 |
// -----------------------------------------------------------------------------
|
|
2782 |
//
|
|
2783 |
void CFsEmailUiHtmlViewerView::CompletePendingMrCommand()
|
|
2784 |
{
|
|
2785 |
FUNC_LOG;
|
|
2786 |
if ( iMrObserverToInform )
|
|
2787 |
{
|
|
2788 |
iMrObserverToInform->OperationCompleted( iOpResult );
|
|
2789 |
}
|
|
2790 |
iMrObserverToInform = NULL;
|
|
2791 |
}
|
|
2792 |
|
|
2793 |
// -----------------------------------------------------------------------------
|
|
2794 |
// CFsEmailUiHtmlViewerView::CancelPendingMrCommandL()
|
|
2795 |
// -----------------------------------------------------------------------------
|
|
2796 |
//
|
|
2797 |
void CFsEmailUiHtmlViewerView::CancelPendingMrCommandL()
|
|
2798 |
{
|
|
2799 |
FUNC_LOG;
|
|
2800 |
// Be sure not to call cancel if the MRUI is not active. This is because
|
|
2801 |
// calling cancel after closing a newly fetched MR causes the MRUI to
|
|
2802 |
// be reopened.
|
|
2803 |
if ( iMrUiActive && iAppUi.MrViewerInstanceL() )
|
|
2804 |
{
|
|
2805 |
iAppUi.MrViewerInstanceL()->CancelOperation();
|
|
2806 |
}
|
|
2807 |
iMrUiActive = EFalse;
|
|
2808 |
iMrObserverToInform = NULL;
|
|
2809 |
}
|
|
2810 |
|
|
2811 |
// -----------------------------------------------------------------------------
|
|
2812 |
// CFsEmailUiHtmlViewerView::ClearMailViewer
|
|
2813 |
// -----------------------------------------------------------------------------
|
|
2814 |
void CFsEmailUiHtmlViewerView::ClearMailViewer()
|
|
2815 |
{
|
|
2816 |
FUNC_LOG;
|
|
2817 |
if ( iContainer )
|
|
2818 |
{
|
|
2819 |
iContainer->ResetContent();
|
|
2820 |
}
|
|
2821 |
}
|
|
2822 |
|
|
2823 |
// Helper funcitons to get viewed message ID and Folder id
|
|
2824 |
TFSMailMsgId CFsEmailUiHtmlViewerView::ViewedMessageFolderId()
|
|
2825 |
{
|
|
2826 |
FUNC_LOG;
|
|
2827 |
TFSMailMsgId ret;
|
|
2828 |
if ( iMessage )
|
|
2829 |
{
|
|
2830 |
ret = iMessage->GetFolderId();
|
|
2831 |
}
|
|
2832 |
return ret;
|
|
2833 |
}
|
|
2834 |
|
|
2835 |
TFSMailMsgId CFsEmailUiHtmlViewerView::ViewedMessageId()
|
|
2836 |
{
|
|
2837 |
FUNC_LOG;
|
|
2838 |
TFSMailMsgId ret;
|
|
2839 |
if ( iMessage )
|
|
2840 |
{
|
|
2841 |
ret = iMessage->GetMessageId();
|
|
2842 |
}
|
|
2843 |
return ret;
|
|
2844 |
}
|
|
2845 |
|
|
2846 |
void CFsEmailUiHtmlViewerView::PrepareForExit()
|
|
2847 |
{
|
|
2848 |
FUNC_LOG;
|
|
2849 |
delete iNewMailTempAddress;
|
|
2850 |
iNewMailTempAddress = NULL;
|
|
2851 |
|
|
2852 |
if ( iFlagSelectionHandler )
|
|
2853 |
{
|
|
2854 |
iFlagSelectionHandler->Cancel();
|
|
2855 |
delete iFlagSelectionHandler;
|
|
2856 |
iFlagSelectionHandler = NULL;
|
|
2857 |
}
|
|
2858 |
if ( iAppUi.DownloadInfoMediator() && iMessage )
|
|
2859 |
{
|
|
2860 |
iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
|
|
2861 |
}
|
|
2862 |
delete iOpenMessages;
|
|
2863 |
iOpenMessages = NULL;
|
|
2864 |
delete iEmbeddedMessages;
|
|
2865 |
iEmbeddedMessages = NULL;
|
|
2866 |
iMessage = NULL;
|
|
2867 |
CancelFetchings();
|
|
2868 |
|
|
2869 |
delete iMailBox;
|
|
2870 |
iMailBox = NULL;
|
|
2871 |
}
|
|
2872 |
|
|
2873 |
void CFsEmailUiHtmlViewerView::ReloadPageL( )
|
|
2874 |
{
|
|
2875 |
FUNC_LOG;
|
|
2876 |
if( iContainer )
|
|
2877 |
{
|
|
2878 |
iContainer->ReloadPageL();
|
|
2879 |
}
|
|
2880 |
}
|
|
2881 |
|
|
2882 |
TBool CFsEmailUiHtmlViewerView::GetAsyncFetchStatus()
|
|
2883 |
{
|
|
2884 |
return ( iFetchingHtmlMessageBody || iFetchingMessageStructure || iFetchingPlainTextMessageBody );
|
|
2885 |
}
|
|
2886 |
|
|
2887 |
// ---------------------------------------------------------------------------
|
|
2888 |
// CFsEmailUiHtmlViewerView::UpdateEmailHeaderIndicatorsL
|
|
2889 |
// ---------------------------------------------------------------------------
|
|
2890 |
//
|
|
2891 |
void CFsEmailUiHtmlViewerView::UpdateEmailHeaderIndicators()
|
|
2892 |
{
|
|
2893 |
FUNC_LOG;
|
|
2894 |
// Reload mail header.
|
|
2895 |
if ( iContainer )
|
|
2896 |
{
|
|
2897 |
iContainer->RefreshCurrentMailHeader();
|
|
2898 |
}
|
|
2899 |
}
|
|
2900 |
|
|
2901 |
// -----------------------------------------------------------------------------
|
|
2902 |
// CFsEmailUiHtmlViewerView::IsOpenedInMRViewerL
|
|
2903 |
// ---------------------------------------------------------------------------
|
|
2904 |
//
|
|
2905 |
TBool CFsEmailUiHtmlViewerView::IsOpenedInMRViewerL()
|
|
2906 |
{
|
|
2907 |
FUNC_LOG;
|
|
2908 |
TBool retVal( EFalse );
|
|
2909 |
CFSMailMessage* msg = iAppUi.GetMailClient()->GetMessageByUidL(
|
|
2910 |
iActivationData.iMailBoxId, iActivationData.iFolderId,
|
|
2911 |
iActivationData.iMessageId, EFSMsgDataEnvelope );
|
|
2912 |
|
|
2913 |
if ( msg )
|
|
2914 |
{
|
|
2915 |
CleanupStack::PushL( msg );
|
|
2916 |
if ( msg->IsFlagSet( EFSMsgFlag_CalendarMsg ) &&
|
|
2917 |
iAppUi.MrViewerInstanceL() )
|
|
2918 |
{
|
|
2919 |
TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown );
|
|
2920 |
mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( *msg );
|
|
2921 |
// Opened in MR viewer if request/cancellation or unknown MR
|
|
2922 |
retVal =
|
|
2923 |
mrMethod == EESMRMeetingRequestMethodRequest ||
|
|
2924 |
mrMethod == EESMRMeetingRequestMethodCancellation ||
|
|
2925 |
mrMethod == EESMRMeetingRequestMethodUnknown;
|
|
2926 |
}
|
|
2927 |
CleanupStack::PopAndDestroy( msg );
|
|
2928 |
}
|
|
2929 |
return retVal;
|
|
2930 |
}
|
|
2931 |
|
|
2932 |
// -----------------------------------------------------------------------------
|
|
2933 |
// CFsEmailUiHtmlViewerView::CopyToClipBoardL
|
|
2934 |
// -----------------------------------------------------------------------------
|
|
2935 |
void CFsEmailUiHtmlViewerView::CopyCurrentToClipBoardL( const TDesC& aArgument ) const
|
|
2936 |
{
|
|
2937 |
FUNC_LOG;
|
|
2938 |
|
|
2939 |
// Making sure that we are copying something to the clipboard
|
|
2940 |
if ( aArgument.Length() > 0 )
|
|
2941 |
{
|
|
2942 |
HBufC* clipBoardText = aArgument.AllocLC();
|
|
2943 |
CClipboard* cb = CClipboard::NewForWritingLC( CCoeEnv::Static()->FsSession() );
|
|
2944 |
cb->StreamDictionary().At( KClipboardUidTypePlainText );
|
|
2945 |
CPlainText* plainText = CPlainText::NewL();
|
|
2946 |
CleanupStack::PushL( plainText );
|
|
2947 |
plainText->InsertL( 0 , *clipBoardText );
|
|
2948 |
plainText->CopyToStoreL( cb->Store(), cb->StreamDictionary(), 0, plainText->DocumentLength() );
|
|
2949 |
CleanupStack::PopAndDestroy( plainText );
|
|
2950 |
cb->CommitL();
|
|
2951 |
CleanupStack::PopAndDestroy( cb );
|
|
2952 |
CleanupStack::PopAndDestroy( clipBoardText );
|
|
2953 |
}
|
|
2954 |
}
|
|
2955 |
|
|
2956 |
// --------------------------------------------------------------------------------
|
|
2957 |
// CFsEmailUiHtmlViewerView::OpenLinkInBrowserL
|
|
2958 |
// --------------------------------------------------------------------------------
|
|
2959 |
void CFsEmailUiHtmlViewerView::OpenLinkInBrowserL( const TDesC& aUrl ) const
|
|
2960 |
{
|
|
2961 |
FUNC_LOG;
|
|
2962 |
|
|
2963 |
// Create session
|
|
2964 |
RApaLsSession session;
|
|
2965 |
User::LeaveIfError( session.Connect() );
|
|
2966 |
CleanupClosePushL( session );
|
|
2967 |
|
|
2968 |
// Gets the default application UID for for the given MIME type
|
|
2969 |
TUid uid;
|
|
2970 |
TDataType dataType( _L8( "text/html" ) );
|
|
2971 |
session.AppForDataType( dataType, uid );
|
|
2972 |
|
|
2973 |
if (uid != TUid::Uid(0) ) //only open link when default browser exist.
|
|
2974 |
{
|
|
2975 |
TApaTaskList taskList( iEikonEnv->WsSession() );
|
|
2976 |
TApaTask task = taskList.FindApp( uid );
|
|
2977 |
if ( task.Exists() )
|
|
2978 |
{
|
|
2979 |
HBufC8 * param8 = HBufC8::NewLC( aUrl.Length() );
|
|
2980 |
param8->Des().Append( aUrl );
|
|
2981 |
task.SendMessage( TUid::Uid( 0 ), *param8 );
|
|
2982 |
CleanupStack::PopAndDestroy( param8 );
|
|
2983 |
}
|
|
2984 |
else
|
|
2985 |
{
|
|
2986 |
// Runs the default application using the dataType
|
|
2987 |
TThreadId threadId;
|
|
2988 |
User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
|
|
2989 |
}
|
|
2990 |
}
|
|
2991 |
CleanupStack::PopAndDestroy( &session );
|
|
2992 |
}
|
|
2993 |
|
|
2994 |
// --------------------------------------------------------------------------------
|
|
2995 |
// CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL
|
|
2996 |
// --------------------------------------------------------------------------------
|
|
2997 |
void CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL( const TDesC& aUrl ) const
|
|
2998 |
{
|
|
2999 |
FUNC_LOG;
|
|
3000 |
HBufC* url = aUrl.AllocLC();
|
|
3001 |
|
|
3002 |
RFavouritesSession fSession;
|
|
3003 |
User::LeaveIfError( fSession.Connect() );
|
|
3004 |
CleanupClosePushL( fSession );
|
|
3005 |
|
|
3006 |
RFavouritesDb favourites;
|
|
3007 |
User::LeaveIfError( favourites.Open( fSession, KBrowserBookmarks ) );
|
|
3008 |
CleanupClosePushL( favourites );
|
|
3009 |
|
|
3010 |
CFavouritesItem *favouritesItem = CFavouritesItem::NewLC();
|
|
3011 |
favouritesItem->SetType( CFavouritesItem::EItem );
|
|
3012 |
favouritesItem->SetUrlL( aUrl );
|
|
3013 |
// Should be less than KFavouritesMaxName ( 50 )
|
|
3014 |
if ( url->Length() > KFavouritesMaxName )
|
|
3015 |
{
|
|
3016 |
favouritesItem->SetNameL( url->Left( KFavouritesMaxName ) );
|
|
3017 |
}
|
|
3018 |
else
|
|
3019 |
{
|
|
3020 |
favouritesItem->SetNameL( *url );
|
|
3021 |
}
|
|
3022 |
|
|
3023 |
favouritesItem->SetParentFolder( KFavouritesRootUid );
|
|
3024 |
|
|
3025 |
TInt error = favourites.Add( *favouritesItem, ETrue );
|
|
3026 |
|
|
3027 |
CleanupStack::PopAndDestroy( favouritesItem );
|
|
3028 |
CleanupStack::PopAndDestroy( &favourites );
|
|
3029 |
CleanupStack::PopAndDestroy( &fSession );
|
|
3030 |
|
|
3031 |
CleanupStack::PopAndDestroy( url );
|
|
3032 |
|
|
3033 |
if ( error == KErrNone )
|
|
3034 |
{
|
|
3035 |
TFsEmailUiUtility::ShowInfoNoteL(
|
|
3036 |
R_FREESTYLE_EMAIL_UI_VIEWER_BOOKMARK_ADDED, ETrue );
|
|
3037 |
}
|
|
3038 |
else // Error in bookmark creation, show could not complete message
|
|
3039 |
{
|
|
3040 |
TFsEmailUiUtility::ShowErrorNoteL(
|
|
3041 |
R_FREESTYLE_EMAIL_ERROR_GENERAL_UNABLE_TO_COMPLETE, ETrue );
|
|
3042 |
}
|
|
3043 |
}
|
|
3044 |
|
|
3045 |
/*
|
|
3046 |
* Delaying the fetch for MfE till the user scrolls to the bottom of
|
|
3047 |
* the message.
|
|
3048 |
*/
|
|
3049 |
void CFsEmailUiHtmlViewerView::StartFetchingMessageL()
|
|
3050 |
{
|
|
3051 |
if( iMessage )
|
|
3052 |
{
|
|
3053 |
CFSMailMessagePart* htmlBodyPart = iMessage->HtmlBodyPartL();
|
|
3054 |
TFetchedType type;
|
|
3055 |
if( htmlBodyPart )
|
|
3056 |
{
|
|
3057 |
type = EMessageHtmlBodyPart;
|
|
3058 |
}
|
|
3059 |
else
|
|
3060 |
{
|
|
3061 |
type = EMessagePlainTextBodyPart;
|
|
3062 |
}
|
|
3063 |
|
|
3064 |
|
|
3065 |
if ( !MessagePartFullyFetchedL( type ))
|
|
3066 |
{
|
|
3067 |
iAsyncProcessComplete = EFalse;
|
|
3068 |
iStartAsyncFetchType = type;
|
|
3069 |
//check to make sure we don't kick off fetch twice for the cases where bodypart
|
|
3070 |
//not found(OZ)
|
|
3071 |
if(iMessage && !GetAsyncFetchStatus())
|
|
3072 |
{
|
|
3073 |
StartFetchingMessagePartL( *iMessage, type );
|
|
3074 |
}
|
|
3075 |
}
|
|
3076 |
}
|
|
3077 |
}
|
|
3078 |
|
|
3079 |
void CFsEmailUiHtmlViewerView::CheckMessageBodyL( CFSMailMessage& /*aMessage*/, TBool& aMessageBodyStructurePresent, TBool& aMessageBodyContentPresent)
|
|
3080 |
{
|
|
3081 |
if( iMessage )
|
|
3082 |
{
|
|
3083 |
CFSMailMessagePart* bodyPart = iMessage->HtmlBodyPartL();
|
|
3084 |
if ( !bodyPart )
|
|
3085 |
{
|
|
3086 |
bodyPart = iMessage->PlainTextBodyPartL();
|
|
3087 |
}
|
|
3088 |
|
|
3089 |
if ( bodyPart )
|
|
3090 |
{
|
|
3091 |
aMessageBodyStructurePresent = ETrue;
|
|
3092 |
CleanupStack::PushL( bodyPart );
|
|
3093 |
|
|
3094 |
if ( bodyPart->FetchedContentSize() == 0 && bodyPart->ContentSize() != 0 )
|
|
3095 |
{
|
|
3096 |
aMessageBodyContentPresent = EFalse;
|
|
3097 |
}
|
|
3098 |
else
|
|
3099 |
{
|
|
3100 |
aMessageBodyContentPresent = ETrue;
|
|
3101 |
}
|
|
3102 |
|
|
3103 |
CleanupStack::PopAndDestroy( bodyPart );
|
|
3104 |
}
|
|
3105 |
else
|
|
3106 |
{
|
|
3107 |
aMessageBodyStructurePresent = EFalse;
|
|
3108 |
aMessageBodyContentPresent = EFalse;
|
|
3109 |
}
|
|
3110 |
}
|
|
3111 |
}
|
|
3112 |
|
|
3113 |
//////////////////////////////////////////////////////////////////////////////////////
|
|
3114 |
// CLASS IMPLEMENTATION CHANGE TO FLAG DIALOG GLOBAL NOTE
|
|
3115 |
///////////////////////////////////////////////////////////////////////////////////
|
|
3116 |
CFlagSelectionNoteHandler* CFlagSelectionNoteHandler::NewL( CFsEmailUiHtmlViewerView& aViewerVisualiser )
|
|
3117 |
{
|
|
3118 |
FUNC_LOG;
|
|
3119 |
CFlagSelectionNoteHandler* self =
|
|
3120 |
new (ELeave) CFlagSelectionNoteHandler( aViewerVisualiser );
|
|
3121 |
return self;
|
|
3122 |
}
|
|
3123 |
|
|
3124 |
|
|
3125 |
CFlagSelectionNoteHandler::~CFlagSelectionNoteHandler()
|
|
3126 |
{
|
|
3127 |
FUNC_LOG;
|
|
3128 |
delete iPrompt;
|
|
3129 |
delete iGlobalFlagQuery;
|
|
3130 |
}
|
|
3131 |
|
|
3132 |
void CFlagSelectionNoteHandler::Cancel()
|
|
3133 |
{
|
|
3134 |
FUNC_LOG;
|
|
3135 |
}
|
|
3136 |
|
|
3137 |
void CFlagSelectionNoteHandler::LaunchFlagListQueryDialogL()
|
|
3138 |
{
|
|
3139 |
FUNC_LOG;
|
|
3140 |
iSelection = 0;
|
|
3141 |
if ( !iPrompt )
|
|
3142 |
{
|
|
3143 |
iPrompt = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_VIEWER_FLAG_DIALOG_HEADER );
|
|
3144 |
}
|
|
3145 |
if ( !iGlobalFlagQuery )
|
|
3146 |
{
|
|
3147 |
iGlobalFlagQuery = CAknGlobalListQuery::NewL();
|
|
3148 |
iGlobalFlagQuery->SetHeadingL( *iPrompt ); // Set query heading.
|
|
3149 |
}
|
|
3150 |
|
|
3151 |
CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat( 3 );
|
|
3152 |
CleanupStack::PushL( array );
|
|
3153 |
// Add follow up text
|
|
3154 |
HBufC* followUp = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FLAG_FOLLOW_UP );
|
|
3155 |
array->AppendL( *followUp );
|
|
3156 |
CleanupStack::PopAndDestroy( followUp );
|
|
3157 |
|
|
3158 |
// Add flag complete text
|
|
3159 |
HBufC* completeFlag = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FLAG_COMPLETE );
|
|
3160 |
array->AppendL( *completeFlag );
|
|
3161 |
CleanupStack::PopAndDestroy( completeFlag );
|
|
3162 |
|
|
3163 |
// Add clear flag text
|
|
3164 |
HBufC* clearFlag = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FLAG_CLEAR );
|
|
3165 |
array->AppendL( *clearFlag );
|
|
3166 |
CleanupStack::PopAndDestroy( clearFlag );
|
|
3167 |
|
|
3168 |
// Show query
|
|
3169 |
iGlobalFlagQuery->ShowListQueryL( array, iStatus, iSelection );
|
|
3170 |
CleanupStack::PopAndDestroy( array );
|
|
3171 |
|
|
3172 |
// Set active
|
|
3173 |
SetActive();
|
|
3174 |
}
|
|
3175 |
|
|
3176 |
void CFlagSelectionNoteHandler::RunL()
|
|
3177 |
{
|
|
3178 |
FUNC_LOG;
|
|
3179 |
// Convert the selected index to enumeration.
|
|
3180 |
TFollowUpNewState newState = static_cast<TFollowUpNewState>( iStatus.Int() );
|
|
3181 |
// Update the message based on the new state.
|
|
3182 |
CFSMailMessage* message = iViewerView.CurrentMessage();
|
|
3183 |
if ( message )
|
|
3184 |
{
|
|
3185 |
TFsEmailUiUtility::SetMessageFollowupStateL( *message, newState );
|
|
3186 |
}
|
|
3187 |
}
|
|
3188 |
|
|
3189 |
void CFlagSelectionNoteHandler::DoCancel()
|
|
3190 |
{
|
|
3191 |
FUNC_LOG;
|
|
3192 |
}
|
|
3193 |
|
|
3194 |
TInt CFlagSelectionNoteHandler::RunError( TInt /*aError*/ )
|
|
3195 |
{
|
|
3196 |
FUNC_LOG;
|
|
3197 |
TInt err( KErrNone );
|
|
3198 |
return err;
|
|
3199 |
}
|
|
3200 |
|
|
3201 |
CFlagSelectionNoteHandler::CFlagSelectionNoteHandler( CFsEmailUiHtmlViewerView& aViewerVisualiser )
|
|
3202 |
: CActive ( EPriorityHigh ),
|
|
3203 |
iViewerView( aViewerVisualiser )
|
|
3204 |
{
|
|
3205 |
FUNC_LOG;
|
|
3206 |
CActiveScheduler::Add( this );
|
|
3207 |
iSelection = 0;
|
|
3208 |
}
|