25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description : General utilities for FS Email UI.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "emailtrace.h"
|
|
20 |
#include <msvapi.h>
|
|
21 |
#include <msvids.h>
|
|
22 |
#include <eikenv.h>
|
|
23 |
#include <gulicon.h>
|
|
24 |
#include <SendUiConsts.h>
|
|
25 |
#include <MuiuMsvUiServiceUtilities.h>
|
|
26 |
#include <StringLoader.h>
|
|
27 |
#include <AknIconUtils.h>
|
|
28 |
#include <aknlists.h>
|
|
29 |
#include <aknPopup.h>
|
|
30 |
#include <akndiscreetpopup.h>
|
|
31 |
#include <AknGlobalConfirmationQuery.h>
|
|
32 |
#include <aknnotewrappers.h>
|
|
33 |
#include <AknWaitDialog.h>
|
|
34 |
#include <AknGlobalNote.h>
|
|
35 |
#include <commonphoneparser.h>
|
|
36 |
#include <apgcli.h> // RApaLsSession
|
|
37 |
|
|
38 |
#ifndef FF_CMAIL_INTEGRATION
|
|
39 |
#include <txtclipboard.h>
|
|
40 |
#endif // FF_CMAIL_INTEGRATION
|
|
41 |
|
|
42 |
// <cmail>
|
|
43 |
//#ifdef __SERIES60_32__
|
|
44 |
// </cmail>
|
|
45 |
#include <AiwDialDataTypes.h>
|
|
46 |
#include <AiwGenericParam.h>
|
|
47 |
#include <AiwServiceHandler.h>
|
|
48 |
#include <settingsinternalcrkeys.h>
|
|
49 |
|
|
50 |
// <cmail>
|
|
51 |
//#else
|
|
52 |
//#include <CPhCltDialer.h>
|
|
53 |
//#include <TPhCltExtPhoneDialData.h>
|
|
54 |
//#endif
|
|
55 |
// </cmail>
|
|
56 |
|
|
57 |
#include <aknPopup.h>
|
|
58 |
#include <AknCommonDialogsDynMem.h>
|
|
59 |
#include <CommonDialogs.rsg>
|
|
60 |
#include <pathinfo.h>
|
|
61 |
#include <AknIconArray.h>
|
|
62 |
#include <baclipb.h> // for clipboard copy
|
|
63 |
#include <DocumentHandler.h>
|
|
64 |
#include <bautils.h>
|
|
65 |
|
|
66 |
#include <sendui.h> // CSendUi
|
|
67 |
#include <coreapplicationuisdomainpskeys.h> // P&S key for email notification
|
|
68 |
#include <e32property.h> // RPoperty
|
|
69 |
#include <SendUiConsts.h> // Constants for sendui
|
|
70 |
#include <CMessageData.h> // CMessageData
|
|
71 |
#include <CSendingServiceInfo.h>
|
|
72 |
#include <CoreApplicationUIsSDKCRKeys.h> // offline mode keys
|
|
73 |
#include <data_caging_path_literals.hrh>
|
|
74 |
#include "cmailwidgetcenrepkeys.h"
|
|
75 |
|
|
76 |
// <cmail> Removed DISABLE_DEFAULT_EMAIL
|
|
77 |
//#ifndef DISABLE_DEFAULT_EMAIL
|
|
78 |
//#include <MessagingDomainCRKeys.h>
|
|
79 |
//#include <centralrepository.h>
|
|
80 |
//#endif
|
|
81 |
//</cmail>
|
|
82 |
|
|
83 |
//<cmail>
|
|
84 |
#include "cfsccontactactionservice.h"
|
|
85 |
#include "cfsccontactactionmenu.h"
|
|
86 |
#include "cfsccontactactionmenuitem.h"
|
|
87 |
#include "mfsccontactactionmenumodel.h"
|
|
88 |
//</cmail>
|
|
89 |
|
|
90 |
#include <FreestyleEmailUi.rsg>
|
|
91 |
#include <freestyleemailui.mbg>
|
|
92 |
|
|
93 |
//<cmail>
|
|
94 |
#include "cfsmailcommon.h"
|
|
95 |
#include "cfsmailclient.h"
|
|
96 |
#include "cfsmailbox.h"
|
|
97 |
#include "cfsmailmessage.h"
|
|
98 |
#include "cesmricalviewer.h"
|
|
99 |
//</cmail>
|
|
100 |
|
|
101 |
#include "FreestyleEmailUiUtilities.h"
|
|
102 |
#include "FreestyleEmailUiConstants.h"
|
|
103 |
#include "FreestyleEmailUiLiterals.h"
|
|
104 |
#include "FreestyleEmailUiAppui.h"
|
|
105 |
#include "FSDelayedLoader.h"
|
|
106 |
#include "FSEmail.pan"
|
|
107 |
|
|
108 |
// CONSTANTS
|
|
109 |
_LIT( KFsEmailIconFileName, "FreestyleEmailUi.mif" );
|
|
110 |
_LIT( KFsEmailTempDirName, "temp\\" );
|
|
111 |
static const TUint KSecondSeparator = 1;
|
|
112 |
_LIT( KTimeFormatBefore, "%-B" );
|
|
113 |
_LIT( KTimeFormatAfter, "%+B" );
|
|
114 |
_LIT( KTimeFormatHour, "%J" );
|
|
115 |
_LIT( KTimeFormatMinutes, "%T" );
|
|
116 |
_LIT( KTimeFormatSpace, " ");
|
|
117 |
|
|
118 |
// MIME types
|
|
119 |
_LIT( KPdfMimeString, "application/pdf" );
|
|
120 |
_LIT( KRtfMimeString, "application/rtf" );
|
|
121 |
_LIT( KDocMimeString, "application/msword" );
|
|
122 |
_LIT( KDocMimeString2, "application/vnd.ms-word" );
|
|
123 |
_LIT( KPptMimeString, "application/vnd.ms-powerpoint" );
|
|
124 |
_LIT( KXlsMimeString, "application/vnd.ms-excel" );
|
|
125 |
_LIT( KImageMimeString, "image/" );
|
|
126 |
_LIT( KHtmlMimeString, "text/html" );
|
|
127 |
_LIT( KPlainTextMimeString, "text/plain" );
|
|
128 |
_LIT( KVCalMimeString, "text/x-vcalendar" );
|
|
129 |
_LIT( KMessageMimeString, "message/rfc822" );
|
|
130 |
|
|
131 |
// File name extensions
|
|
132 |
_LIT( KDocFileExtension, ".doc" );
|
|
133 |
_LIT( KRtfFileExtension, ".rtf" );
|
|
134 |
_LIT( KPptFileExtension, ".ppt" );
|
|
135 |
_LIT( KXlsFileExtension, ".xls" );
|
|
136 |
_LIT( KPdfFileExtension, ".pdf" );
|
|
137 |
_LIT( KJpgFileExtension, ".jpg" );
|
|
138 |
_LIT( KJpegFileExtension, ".jpeg" );
|
|
139 |
_LIT( KJpgeFileExtension, ".jpge" );
|
|
140 |
_LIT( KPngFileExtension, ".png" );
|
|
141 |
_LIT( KGifFileExtension, ".gif" );
|
|
142 |
_LIT( KBmpFileExtension, ".bmp" );
|
|
143 |
_LIT( KHtmlFileExtension, ".html" );
|
|
144 |
_LIT( KHtmFileExtension, ".htm" );
|
|
145 |
_LIT( KTxtFileExtension, ".txt" );
|
|
146 |
_LIT( KVCalFileExtension, ".vcs" );
|
|
147 |
_LIT( KEmailFileExtension, ".eml" );
|
|
148 |
|
|
149 |
// If the fetched body size (in bytes) is more than these limits,
|
|
150 |
// a wait note is used when opening, replying, or forwarding the message
|
|
151 |
static const TInt KLargePlainTextSizeLimit = 20000;
|
|
152 |
static const TInt KLargeHtmlTextSizeLimit = 50000;
|
|
153 |
|
|
154 |
//<cmail> id is different in cmail
|
|
155 |
const TUid KFSMailServerUid = { 0x2001F40A };
|
|
156 |
_LIT( KFSMailServerExe, "\\sys\\bin\\fsmailserver.exe" );
|
|
157 |
//</cmail>
|
|
158 |
|
|
159 |
// Define static members
|
|
160 |
CAknGlobalNote* TFsEmailUiUtility::iGlobalWaitNote = NULL;
|
|
161 |
TBool TFsEmailUiUtility::iSaveSelect = ETrue;
|
|
162 |
TBool TFsEmailUiUtility::iDownloadSave = EFalse;
|
|
163 |
// <cmail>
|
|
164 |
CESMRIcalViewer* TFsEmailUiUtility::iMrViewer = NULL;
|
|
165 |
TFsEmailUiUtility::CMrViewerEmptyCallback* TFsEmailUiUtility::iMrViewerCallback = NULL;
|
|
166 |
CAknWaitDialog* TFsEmailUiUtility::iOpeningWaitNote = NULL;
|
|
167 |
// </cmail>
|
|
168 |
|
|
169 |
// FUNCTION DEFINITIONS
|
|
170 |
void TFsEmailUiUtility::LaunchHelpL( const TDesC& aContext )
|
|
171 |
{
|
|
172 |
FUNC_LOG;
|
|
173 |
CArrayFix< TCoeHelpContext >* cntx = new( ELeave ) CArrayFixFlat< TCoeHelpContext >( 1 );
|
|
174 |
CleanupStack::PushL( cntx );
|
|
175 |
cntx->AppendL( TCoeHelpContext( KFSEmailUiUid, aContext ) );
|
|
176 |
CleanupStack::Pop( cntx );
|
|
177 |
HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), cntx );
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
// Two-phased constructor.
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
CFsEmailFileHandleShutter* CFsEmailFileHandleShutter::NewL(
|
|
185 |
CDocumentHandler& aDocumentHandler )
|
|
186 |
{
|
|
187 |
FUNC_LOG;
|
|
188 |
CFsEmailFileHandleShutter* self = new (ELeave) CFsEmailFileHandleShutter;
|
|
189 |
CleanupStack::PushL( self );
|
|
190 |
self->ConstructL( aDocumentHandler );
|
|
191 |
CleanupStack::Pop( self );
|
|
192 |
return self;
|
|
193 |
}
|
|
194 |
|
|
195 |
// ---------------------------------------------------------------------------
|
|
196 |
// Destructor. File handle is closed, if it has been left open.
|
|
197 |
// ---------------------------------------------------------------------------
|
|
198 |
//
|
|
199 |
CFsEmailFileHandleShutter::~CFsEmailFileHandleShutter()
|
|
200 |
{
|
|
201 |
FUNC_LOG;
|
|
202 |
if (iHandleOpen)
|
|
203 |
{
|
|
204 |
iFileHandle.Close();
|
|
205 |
}
|
|
206 |
}
|
|
207 |
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
// Stores the give file handle.
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
void CFsEmailFileHandleShutter::SetFile( RFile aFile )
|
|
213 |
{
|
|
214 |
FUNC_LOG;
|
|
215 |
// Close previously set handle, if necessary.
|
|
216 |
if ( iHandleOpen )
|
|
217 |
{
|
|
218 |
iFileHandle.Close();
|
|
219 |
}
|
|
220 |
|
|
221 |
iFileHandle = aFile;
|
|
222 |
iHandleOpen = ETrue;
|
|
223 |
}
|
|
224 |
|
|
225 |
// ---------------------------------------------------------------------------
|
|
226 |
// Handles the exit of embedded viewer application.
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
void CFsEmailFileHandleShutter::HandleServerAppExit( TInt aReason )
|
|
230 |
{
|
|
231 |
FUNC_LOG;
|
|
232 |
if (iHandleOpen)
|
|
233 |
{
|
|
234 |
// Close open file handle.
|
|
235 |
iFileHandle.Close();
|
|
236 |
iHandleOpen = EFalse;
|
|
237 |
}
|
|
238 |
MAknServerAppExitObserver::HandleServerAppExit( aReason );
|
|
239 |
|
|
240 |
// Get current AppUi.
|
|
241 |
CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
|
|
242 |
if( appUi->EmbeddedApp() )
|
|
243 |
{
|
|
244 |
// Set embedded application flag to false when embedded application exit.
|
|
245 |
appUi->SetEmbeddedApp( EFalse );
|
|
246 |
}
|
|
247 |
|
|
248 |
// if email editor is not started from embedded app.
|
|
249 |
if( !appUi->EditorStartedFromEmbeddedApp() )
|
|
250 |
{
|
|
251 |
// Do not set embedded app to previous app.
|
|
252 |
appUi->SetEmbeddedAppToPreviousApp( EFalse );
|
|
253 |
}
|
|
254 |
else
|
|
255 |
{
|
|
256 |
// Set flag for judging if email editor started from embedded app to false.
|
|
257 |
appUi->SetEditorStartedFromEmbeddedApp( EFalse );
|
|
258 |
}
|
|
259 |
|
|
260 |
// Clear the temp directory since the closed file might have been copied there
|
|
261 |
TFsEmailUiUtility::EraseTempDir();
|
|
262 |
}
|
|
263 |
|
|
264 |
CFsEmailFileHandleShutter::CFsEmailFileHandleShutter()
|
|
265 |
: iHandleOpen(EFalse)
|
|
266 |
{
|
|
267 |
FUNC_LOG;
|
|
268 |
}
|
|
269 |
|
|
270 |
void CFsEmailFileHandleShutter::ConstructL(
|
|
271 |
CDocumentHandler& aDocumentHandler )
|
|
272 |
{
|
|
273 |
FUNC_LOG;
|
|
274 |
aDocumentHandler.SetExitObserver(this);
|
|
275 |
}
|
|
276 |
|
|
277 |
// ---------------------------------------------------------------------------
|
|
278 |
// Clean up any static variables of the class
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
//
|
|
281 |
void TFsEmailUiUtility::DeleteStaticData()
|
|
282 |
{
|
|
283 |
FUNC_LOG;
|
|
284 |
delete iGlobalWaitNote;
|
|
285 |
iGlobalWaitNote = NULL;
|
|
286 |
|
|
287 |
// <cmail>
|
|
288 |
delete iMrViewer;
|
|
289 |
iMrViewer = NULL;
|
|
290 |
|
|
291 |
delete iMrViewerCallback;
|
|
292 |
iMrViewerCallback = NULL;
|
|
293 |
// </cmail>
|
|
294 |
}
|
|
295 |
|
|
296 |
// ---------------------------------------------------------------------------
|
|
297 |
// GetMceDefaultMailboxL
|
|
298 |
// Returrn the default mailbox. If one the FS account is set as default return
|
|
299 |
// it else return the first FS account. If no FS account then returns NULL.
|
|
300 |
// ---------------------------------------------------------------------------
|
|
301 |
//
|
|
302 |
CFSMailBox* TFsEmailUiUtility::GetMceDefaultMailboxL( CFSMailClient& aClient, CMsvSession& aMsvSession )
|
|
303 |
{
|
|
304 |
FUNC_LOG;
|
|
305 |
// <cmail> S60 UID update
|
|
306 |
const TUid KUidMsgValTypeFsMtmVal = { 0x2001F406 };
|
|
307 |
// </cmail> S60 UID update
|
|
308 |
TFSMailMsgId id;
|
|
309 |
TBool getFirstInList = EFalse;
|
|
310 |
|
|
311 |
CMsvEntry* root = CMsvEntry::NewL( aMsvSession, KMsvRootIndexEntryId,
|
|
312 |
TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
|
|
313 |
CleanupStack::PushL( root );
|
|
314 |
|
|
315 |
// <cmail> Removed DISABLE_DEFAULT_EMAIL
|
|
316 |
/*#ifndef DISABLE_DEFAULT_EMAIL
|
|
317 |
TInt entryId;
|
|
318 |
TInt rval;
|
|
319 |
CRepository* repository = NULL;
|
|
320 |
TRAPD( ret, repository = CRepository::NewL(KCRUidSelectableDefaultEmailSettings) );
|
|
321 |
if ( ret == KErrNone )
|
|
322 |
{
|
|
323 |
CleanupStack::PushL( repository );
|
|
324 |
rval = repository->Get( KSelectableDefaultMailAccount, entryId );
|
|
325 |
if( rval == KErrNone && entryId != -1 )
|
|
326 |
{
|
|
327 |
root->SetEntryL( entryId );
|
|
328 |
if ( root->Entry().iMtm == KUidMsgValTypeFsMtmVal )
|
|
329 |
{
|
|
330 |
// One of The FS is default e-mail account.
|
|
331 |
id = TFSMailMsgId( root->Entry().iMtmData1, root->Entry().iMtmData2 );
|
|
332 |
}
|
|
333 |
else
|
|
334 |
{
|
|
335 |
// If FS is not default then get the first one in the list
|
|
336 |
getFirstInList = ETrue;
|
|
337 |
}
|
|
338 |
}
|
|
339 |
else
|
|
340 |
{
|
|
341 |
// If no mail box is set as default, then get the first one in the list
|
|
342 |
getFirstInList = ETrue;
|
|
343 |
}
|
|
344 |
CleanupStack::PopAndDestroy( repository );
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
// If Failed to create repository, then get the first one in the list
|
|
349 |
getFirstInList = ETrue;
|
|
350 |
}
|
|
351 |
#else*/
|
|
352 |
// If the SDK doesn't have default mail box concept.
|
|
353 |
getFirstInList = ETrue;
|
|
354 |
//#endif
|
|
355 |
// </cmail>
|
|
356 |
if( getFirstInList )
|
|
357 |
{
|
|
358 |
// Get the list and return the first one.
|
|
359 |
root->SetEntryL( KMsvRootIndexEntryId );
|
|
360 |
CMsvEntrySelection* childSelection = root->ChildrenWithMtmL(
|
|
361 |
KUidMsgValTypeFsMtmVal );
|
|
362 |
CleanupStack::PushL( childSelection );
|
|
363 |
|
|
364 |
if ( childSelection->Count() > 0)
|
|
365 |
{
|
|
366 |
root->SetEntryL( childSelection->At( 0 ) );
|
|
367 |
id = TFSMailMsgId( root->Entry().iMtmData1, root->Entry().iMtmData2 );
|
|
368 |
}
|
|
369 |
else
|
|
370 |
{
|
|
371 |
// No FS Mail box.
|
|
372 |
//id.SetNullId();
|
|
373 |
}
|
|
374 |
CleanupStack::PopAndDestroy( childSelection );
|
|
375 |
}
|
|
376 |
CleanupStack::PopAndDestroy( root );
|
|
377 |
if( id.IsNullId() )
|
|
378 |
{
|
|
379 |
// If No FS Mailbox then return NULL.
|
|
380 |
return NULL;
|
|
381 |
}
|
|
382 |
else
|
|
383 |
{
|
|
384 |
CFSMailBox* mailbox = aClient.GetMailBoxByUidL( id );
|
|
385 |
return mailbox;
|
|
386 |
}
|
|
387 |
}
|
|
388 |
|
|
389 |
// ---------------------------------------------------------------------------
|
|
390 |
// GetMailboxForMtmIdL
|
|
391 |
// Return the mailbox based on mtm id. If there is an mtm account with aMtmId
|
|
392 |
// return the mail box of it else returns NULL
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
//
|
|
395 |
CFSMailBox* TFsEmailUiUtility::GetMailboxForMtmIdL( CFSMailClient& aClient,
|
|
396 |
CMsvSession& aMsvSession, TMsvId aMtmId )
|
|
397 |
{
|
|
398 |
FUNC_LOG;
|
|
399 |
// <cmail> S60 UID update
|
|
400 |
const TUid KUidMsgValTypeFsMtmVal = { 0x2001F406 };
|
|
401 |
// </cmail> S60 UID update
|
|
402 |
CMsvEntry* accountEntry = NULL;
|
|
403 |
TRAPD(err, accountEntry = CMsvEntry::NewL( aMsvSession, aMtmId,
|
|
404 |
TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue )));
|
|
405 |
if(err == KErrNotFound || err == KErrNoMemory ||
|
|
406 |
accountEntry->Entry().iMtm != KUidMsgValTypeFsMtmVal)
|
|
407 |
{
|
|
408 |
// This Mtm Id is not found or the found entry is not FS entry
|
|
409 |
return NULL;
|
|
410 |
}
|
|
411 |
CleanupStack::PushL( accountEntry );
|
|
412 |
TFSMailMsgId id = TFSMailMsgId( accountEntry->Entry().MtmData1(),
|
|
413 |
accountEntry->Entry().MtmData2() );
|
|
414 |
CleanupStack::PopAndDestroy( accountEntry );
|
|
415 |
CFSMailBox* mailbox = aClient.GetMailBoxByUidL( id );
|
|
416 |
return mailbox;
|
|
417 |
}
|
|
418 |
|
|
419 |
// -----------------------------------------------------------------------------
|
|
420 |
// TFsEmailUiUtility::IsRemoteLookupSupported
|
|
421 |
// -----------------------------------------------------------------------------
|
|
422 |
TBool TFsEmailUiUtility::IsRemoteLookupSupported( CFSMailBox& aMailBox )
|
|
423 |
{
|
|
424 |
FUNC_LOG;
|
|
425 |
|
|
426 |
TBool r = aMailBox.HasCapability( EFSMBoxCapaSupportsRCL );
|
|
427 |
|
|
428 |
return r;
|
|
429 |
}
|
|
430 |
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
// TFsEmailUiUtility::ShowConfirmationQuery
|
|
433 |
// -----------------------------------------------------------------------------
|
|
434 |
TInt TFsEmailUiUtility::ShowConfirmationQueryL( TInt aResourceStringId,
|
|
435 |
const TDesC& aResourceParameter )
|
|
436 |
{
|
|
437 |
FUNC_LOG;
|
|
438 |
CFSEmailUiCallDialog* queryNote = new ( ELeave ) CFSEmailUiCallDialog();
|
|
439 |
CleanupStack::PushL( queryNote );
|
|
440 |
HBufC* resourceString = NULL;
|
|
441 |
if ( aResourceParameter != KNullDesC )
|
|
442 |
{
|
|
443 |
resourceString = StringLoader::LoadLC( aResourceStringId,
|
|
444 |
aResourceParameter );
|
|
445 |
}
|
|
446 |
else
|
|
447 |
{
|
|
448 |
resourceString = StringLoader::LoadLC( aResourceStringId );
|
|
449 |
}
|
|
450 |
queryNote->SetPromptL( *resourceString );
|
|
451 |
CleanupStack::PopAndDestroy( resourceString );
|
|
452 |
CleanupStack::Pop( queryNote );
|
|
453 |
return queryNote->ExecuteLD( R_FSEMAIL_QUERY_DIALOG );
|
|
454 |
}
|
|
455 |
|
|
456 |
// -----------------------------------------------------------------------------
|
|
457 |
// TFsEmailUiUtility::ShowConfirmationQuery
|
|
458 |
// -----------------------------------------------------------------------------
|
|
459 |
TInt TFsEmailUiUtility::ShowConfirmationQueryL( const TDesC& aPromptText )
|
|
460 |
{
|
|
461 |
FUNC_LOG;
|
|
462 |
CFSEmailUiCallDialog* queryNote = new ( ELeave ) CFSEmailUiCallDialog();
|
|
463 |
CleanupStack::PushL( queryNote );
|
|
464 |
queryNote->SetPromptL( aPromptText );
|
|
465 |
CleanupStack::Pop( queryNote );
|
|
466 |
return queryNote->ExecuteLD( R_FSEMAIL_QUERY_DIALOG );
|
|
467 |
}
|
|
468 |
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
// TFsEmailUiUtility::ShowErrorNoteL
|
|
471 |
// -----------------------------------------------------------------------------
|
|
472 |
void TFsEmailUiUtility::ShowErrorNoteL( TInt aResourceStringId, TBool aWaitingDialog )
|
|
473 |
{
|
|
474 |
FUNC_LOG;
|
|
475 |
HBufC* errMessage = StringLoader::LoadLC( aResourceStringId );
|
|
476 |
CAknErrorNote* note = new (ELeave) CAknErrorNote( aWaitingDialog );
|
|
477 |
note->ExecuteLD( *errMessage );
|
|
478 |
CleanupStack::PopAndDestroy( errMessage );
|
|
479 |
}
|
|
480 |
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
// TFsEmailUiUtility::ShowInfoNoteL
|
|
483 |
// -----------------------------------------------------------------------------
|
|
484 |
void TFsEmailUiUtility::ShowInfoNoteL( TInt aResourceStringId, TBool aWaitingDialog )
|
|
485 |
{
|
|
486 |
FUNC_LOG;
|
|
487 |
HBufC* message = StringLoader::LoadLC( aResourceStringId );
|
|
488 |
CAknInformationNote* note = new (ELeave) CAknInformationNote( aWaitingDialog );
|
|
489 |
note->ExecuteLD( *message );
|
|
490 |
CleanupStack::PopAndDestroy( message );
|
|
491 |
}
|
|
492 |
|
|
493 |
// -----------------------------------------------------------------------------
|
|
494 |
// TFsEmailUiUtility::ShowGlobalErrorNoteL
|
|
495 |
// -----------------------------------------------------------------------------
|
|
496 |
void TFsEmailUiUtility::ShowGlobalErrorNoteL( TInt aResourceStringId )
|
|
497 |
{
|
|
498 |
FUNC_LOG;
|
|
499 |
HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
|
|
500 |
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
|
|
501 |
globalNote->ShowNoteL( EAknGlobalErrorNote, *noteText );
|
|
502 |
CleanupStack::PopAndDestroy( globalNote );
|
|
503 |
CleanupStack::PopAndDestroy( noteText );
|
|
504 |
}
|
|
505 |
|
|
506 |
// -----------------------------------------------------------------------------
|
|
507 |
// TFsEmailUiUtility::ShowGlobalInfoNoteL
|
|
508 |
// -----------------------------------------------------------------------------
|
|
509 |
void TFsEmailUiUtility::ShowGlobalInfoNoteL( TInt aResourceStringId )
|
|
510 |
{
|
|
511 |
FUNC_LOG;
|
|
512 |
HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
|
|
513 |
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
|
|
514 |
globalNote->ShowNoteL( EAknGlobalInformationNote, *noteText );
|
|
515 |
CleanupStack::PopAndDestroy( globalNote );
|
|
516 |
CleanupStack::PopAndDestroy( noteText );
|
|
517 |
}
|
|
518 |
|
|
519 |
// -----------------------------------------------------------------------------
|
|
520 |
// TFsEmailUiUtility::ShowDiscreetInfoNoteL
|
|
521 |
// -----------------------------------------------------------------------------
|
|
522 |
void TFsEmailUiUtility::ShowDiscreetInfoNoteL( TInt aResourceStringId )
|
|
523 |
{
|
|
524 |
FUNC_LOG;
|
|
525 |
HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
|
|
526 |
ShowDiscreetInfoNoteL( *noteText );
|
|
527 |
CleanupStack::PopAndDestroy( noteText );
|
|
528 |
}
|
|
529 |
|
|
530 |
// -----------------------------------------------------------------------------
|
|
531 |
// TFsEmailUiUtility::ShowDiscreetInfoNoteL
|
|
532 |
// -----------------------------------------------------------------------------
|
|
533 |
void TFsEmailUiUtility::ShowDiscreetInfoNoteL( const TDesC& aNoteText )
|
|
534 |
{
|
|
535 |
FUNC_LOG;
|
|
536 |
//create a host of dummy parameters in order to change the popup duration flag...
|
|
537 |
const TDesC& dummyText = KNullDesC;
|
|
538 |
CGulIcon* dummyIcon = NULL;
|
|
539 |
const TAknsItemID& dummySkinId = KAknsIIDNone;
|
|
540 |
const TDesC& dummyBitmapFile = KNullDesC;
|
|
541 |
const TInt dummyBitmapId = 0;
|
|
542 |
const TInt dummyMaskId = 0;
|
|
543 |
|
|
544 |
//Set timeout flag
|
|
545 |
TInt flags = 0;
|
|
546 |
flags |= KAknDiscreetPopupDurationLong;
|
|
547 |
|
|
548 |
CAknDiscreetPopup::ShowLocalPopupL( aNoteText,
|
|
549 |
dummyText,
|
|
550 |
dummyIcon,
|
|
551 |
dummySkinId,
|
|
552 |
dummyBitmapFile,
|
|
553 |
dummyBitmapId,
|
|
554 |
dummyMaskId,
|
|
555 |
flags);
|
|
556 |
}
|
|
557 |
|
|
558 |
// -----------------------------------------------------------------------------
|
|
559 |
// TFsEmailUiUtility::ShowWaitNoteL
|
|
560 |
// -----------------------------------------------------------------------------
|
|
561 |
void TFsEmailUiUtility::ShowWaitNoteL( CAknWaitDialog*& aDialog, TInt aTextResourceId,
|
|
562 |
TBool aAllowCancel, TBool aVisibilityDelayOff /*= EFalse*/ )
|
|
563 |
{
|
|
564 |
FUNC_LOG;
|
|
565 |
if ( !aDialog )
|
|
566 |
{
|
|
567 |
aDialog = new (ELeave) CAknWaitDialog(
|
|
568 |
reinterpret_cast<CEikDialog**>(&aDialog), aVisibilityDelayOff );
|
|
569 |
}
|
|
570 |
|
|
571 |
if ( aAllowCancel )
|
|
572 |
{
|
|
573 |
aDialog->PrepareLC( R_FSE_WAIT_DIALOG );
|
|
574 |
}
|
|
575 |
else
|
|
576 |
{
|
|
577 |
aDialog->PrepareLC( R_FSE_WAIT_DIALOG_NO_CANCEL );
|
|
578 |
}
|
|
579 |
|
|
580 |
HBufC* noteText = StringLoader::LoadLC( aTextResourceId );
|
|
581 |
aDialog->SetTextL( *noteText );
|
|
582 |
CleanupStack::PopAndDestroy( noteText );
|
|
583 |
|
|
584 |
aDialog->RunLD();
|
|
585 |
}
|
|
586 |
|
|
587 |
// -----------------------------------------------------------------------------
|
|
588 |
// TFsEmailUiUtility::ShowGlobalWaitNoteLC
|
|
589 |
// -----------------------------------------------------------------------------
|
|
590 |
TInt TFsEmailUiUtility::ShowGlobalWaitNoteLC( TInt aTextResourceId )
|
|
591 |
{
|
|
592 |
FUNC_LOG;
|
|
593 |
if ( !iGlobalWaitNote )
|
|
594 |
{
|
|
595 |
iGlobalWaitNote = CAknGlobalNote::NewL();
|
|
596 |
iGlobalWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );
|
|
597 |
}
|
|
598 |
|
|
599 |
HBufC* noteText = StringLoader::LoadLC( aTextResourceId );
|
|
600 |
TInt waitNoteId = iGlobalWaitNote->ShowNoteL( EAknGlobalWaitNote, *noteText );
|
|
601 |
CleanupStack::PopAndDestroy( noteText );
|
|
602 |
|
|
603 |
TCleanupItem closeNoteItem( CloseGlobalWaitNote,
|
|
604 |
reinterpret_cast<TAny*>(waitNoteId) );
|
|
605 |
CleanupStack::PushL( closeNoteItem );
|
|
606 |
|
|
607 |
return waitNoteId;
|
|
608 |
}
|
|
609 |
|
|
610 |
// -----------------------------------------------------------------------------
|
|
611 |
// TFsEmailUiUtility::CloseGlobalWaitNote
|
|
612 |
// -----------------------------------------------------------------------------
|
|
613 |
void TFsEmailUiUtility::CloseGlobalWaitNote( TAny* aNoteId )
|
|
614 |
{
|
|
615 |
FUNC_LOG;
|
|
616 |
if ( iGlobalWaitNote )
|
|
617 |
{
|
|
618 |
TInt noteId = reinterpret_cast<TInt>( aNoteId );
|
|
619 |
TRAP_IGNORE( iGlobalWaitNote->CancelNoteL( noteId ) );
|
|
620 |
}
|
|
621 |
}
|
|
622 |
|
|
623 |
// -----------------------------------------------------------------------------
|
|
624 |
// TFsEmailUiUtility::ShowSelectFileDialogL
|
|
625 |
// -----------------------------------------------------------------------------
|
|
626 |
//
|
|
627 |
TBool TFsEmailUiUtility::ShowSelectFileDialogL( TDes& aFileName )
|
|
628 |
{
|
|
629 |
FUNC_LOG;
|
|
630 |
return ShowFileDialogL( ECFDDialogTypeSelect, aFileName );
|
|
631 |
}
|
|
632 |
|
|
633 |
// -----------------------------------------------------------------------------
|
|
634 |
// TFsEmailUiUtility::ShowSaveFolderDialogL
|
|
635 |
// -----------------------------------------------------------------------------
|
|
636 |
TBool TFsEmailUiUtility::ShowSaveFolderDialogL( TDes& aFileName )
|
|
637 |
{
|
|
638 |
FUNC_LOG;
|
|
639 |
return ShowFileDialogL( ECFDDialogTypeSave, aFileName );
|
|
640 |
}
|
|
641 |
|
|
642 |
// -----------------------------------------------------------------------------
|
|
643 |
// TFsEmailUiUtility::ShowSaveFolderDialogL
|
|
644 |
// -----------------------------------------------------------------------------
|
|
645 |
TBool TFsEmailUiUtility::ShowFileDialogL( TInt aType, TDes& aFileName )
|
|
646 |
{
|
|
647 |
FUNC_LOG;
|
|
648 |
TInt retVal = EFalse;
|
|
649 |
|
|
650 |
TInt allDrives =
|
|
651 |
AknCommonDialogsDynMem::EMemoryTypePhone |
|
|
652 |
AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
|
|
653 |
AknCommonDialogsDynMem::EMemoryTypeMMCExternal |
|
|
654 |
AknCommonDialogsDynMem::EMemoryTypeRemote;
|
|
655 |
|
|
656 |
if ( aType == ECFDDialogTypeSelect )
|
|
657 |
{
|
|
658 |
retVal = AknCommonDialogsDynMem::RunSelectDlgLD( allDrives, aFileName, 0 );
|
|
659 |
}
|
|
660 |
else if ( aType == ECFDDialogTypeSave )
|
|
661 |
{
|
|
662 |
// We can't use the SaveDlg of CommonDialogs because it launches also the file name query
|
|
663 |
// which we do not want. Instead, we use move-to-folder dialog with the title and softkeys
|
|
664 |
// of the save dialog.
|
|
665 |
retVal = AknCommonDialogsDynMem::RunMoveDlgLD( allDrives, aFileName,
|
|
666 |
R_CFD_DEFAULT_SAVE_MEMORY_SELECTION, R_CFD_DEFAULT_SAVE_FILE_SELECTION );
|
|
667 |
}
|
|
668 |
else
|
|
669 |
{
|
|
670 |
__ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) );
|
|
671 |
}
|
|
672 |
|
|
673 |
return retVal;
|
|
674 |
}
|
|
675 |
|
|
676 |
|
|
677 |
// -----------------------------------------------------------------------------
|
|
678 |
// TFsEmailUiUtility::OkToSaveFileL
|
|
679 |
// -----------------------------------------------------------------------------
|
|
680 |
TBool TFsEmailUiUtility::OkToSaveFileL( const TDesC& aFilePath, CFSMailMessagePart& aAttachmentPart )
|
|
681 |
{
|
|
682 |
FUNC_LOG;
|
|
683 |
TBool ret( ETrue );
|
|
684 |
TDesC& name = aAttachmentPart.AttachmentNameL();
|
|
685 |
HBufC* realFilePath = HBufC::NewLC( aFilePath.Length() + name.Length() );
|
|
686 |
realFilePath->Des().Append( aFilePath);
|
|
687 |
realFilePath->Des().Append( name);
|
|
688 |
if ( BaflUtils::FileExists( CEikonEnv::Static()->FsSession(), *realFilePath ) )
|
|
689 |
{
|
|
690 |
if ( !TFsEmailUiUtility::ShowConfirmationQueryL( R_FREESTYLE_EMAIL_UI_OVERWRITE_QUERY, name ) )
|
|
691 |
{
|
|
692 |
ret = EFalse;
|
|
693 |
}
|
|
694 |
}
|
|
695 |
CleanupStack::PopAndDestroy( realFilePath );
|
|
696 |
TFsEmailUiUtility::SetSaveSelect( ret );
|
|
697 |
return ret;
|
|
698 |
}
|
|
699 |
|
|
700 |
// -----------------------------------------------------------------------------
|
|
701 |
// <cmail>
|
|
702 |
// TFsEmailUiUtility::ShowFileSavedToFolderNoteL
|
|
703 |
// -----------------------------------------------------------------------------
|
|
704 |
void TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( TInt aCount )
|
|
705 |
{
|
|
706 |
FUNC_LOG;
|
|
707 |
if ( !iDownloadSave || iSaveSelect )
|
|
708 |
{
|
|
709 |
if ( aCount == 1 )
|
|
710 |
{
|
|
711 |
HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_ONE_ATTACHMENT_SAVED );
|
|
712 |
ShowDiscreetInfoNoteL( *noteText );
|
|
713 |
CleanupStack::PopAndDestroy( noteText );
|
|
714 |
}
|
|
715 |
else if ( aCount > 1 )
|
|
716 |
{
|
|
717 |
HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MULTIPLE_ATTACHMENT_SAVED, aCount );
|
|
718 |
ShowDiscreetInfoNoteL( *noteText );
|
|
719 |
CleanupStack::PopAndDestroy( noteText );
|
|
720 |
}
|
|
721 |
}
|
|
722 |
TFsEmailUiUtility::SetSaveSelect( ETrue );
|
|
723 |
TFsEmailUiUtility::SetDownloadSave( EFalse );
|
|
724 |
}
|
|
725 |
|
|
726 |
void TFsEmailUiUtility::SetDownloadSave( TBool aValue )
|
|
727 |
{
|
|
728 |
FUNC_LOG;
|
|
729 |
iDownloadSave = aValue;
|
|
730 |
}
|
|
731 |
void TFsEmailUiUtility::SetSaveSelect( TBool aValue )
|
|
732 |
{
|
|
733 |
FUNC_LOG;
|
|
734 |
iSaveSelect = aValue;
|
|
735 |
}
|
|
736 |
// -----------------------------------------------------------------------------
|
|
737 |
// TFsEmailUiUtility::OpenFileL
|
|
738 |
// -----------------------------------------------------------------------------
|
|
739 |
void TFsEmailUiUtility::OpenFileL( RFile& aFileToOpen, TBool aAllowSave )
|
|
740 |
{
|
|
741 |
FUNC_LOG;
|
|
742 |
TDataType emptyDataType;
|
|
743 |
OpenFileL( aFileToOpen, emptyDataType,aAllowSave );
|
|
744 |
}
|
|
745 |
|
|
746 |
// -----------------------------------------------------------------------------
|
|
747 |
// TFsEmailUiUtility::OpenFileL
|
|
748 |
// -----------------------------------------------------------------------------
|
|
749 |
void TFsEmailUiUtility::OpenFileL( RFile& aFileToOpen, TDataType& aDataType, TBool /* aAllowSave */)
|
|
750 |
{
|
|
751 |
FUNC_LOG;
|
|
752 |
CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
|
|
753 |
|
|
754 |
// Set file handle shutter to close the file handle after the embedded
|
|
755 |
// viewer application exits.
|
|
756 |
appUi->FileHandleShutter().SetFile( aFileToOpen );
|
|
757 |
|
|
758 |
CDocumentHandler& docHandler = appUi->DocumentHandler();
|
|
759 |
|
|
760 |
TInt res = KErrNone;
|
|
761 |
TRAPD( err, res = docHandler.OpenFileEmbeddedL( aFileToOpen, aDataType ) );
|
|
762 |
|
|
763 |
// Try again with an empty data type if opening using the given data type fails
|
|
764 |
if ( err != KErrNone || res != KErrNone )
|
|
765 |
{
|
|
766 |
TDataType emptyType;
|
|
767 |
|
|
768 |
// Open file embedded
|
|
769 |
TRAP( err, res = docHandler.OpenFileEmbeddedL( aFileToOpen, emptyType ) );
|
|
770 |
|
|
771 |
// Show an error note if opening the file still didn't succeed
|
|
772 |
// Ensure also that the file handle got closed.
|
|
773 |
if ( err != KErrNone || res != KErrNone )
|
|
774 |
{
|
|
775 |
ShowErrorNoteL( R_FREESTYLE_EMAIL_INFO_NOTE_UNABLE_TO_OPEN, EFalse );
|
|
776 |
appUi->FileHandleShutter().HandleServerAppExit( KErrCancel );
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
// Set embedded app flag to true when embedded app start up.
|
|
781 |
appUi->SetEmbeddedApp( ETrue );
|
|
782 |
// Set flag for judging if previous app is embedded app.
|
|
783 |
appUi->SetEmbeddedAppToPreviousApp( ETrue );
|
|
784 |
}
|
|
785 |
}
|
|
786 |
else
|
|
787 |
{
|
|
788 |
// Set embedded app flag to true when embedded app start up.
|
|
789 |
appUi->SetEmbeddedApp( ETrue );
|
|
790 |
// Set flag for judging if previous app is embedded app.
|
|
791 |
appUi->SetEmbeddedAppToPreviousApp( ETrue );
|
|
792 |
}
|
|
793 |
}
|
|
794 |
|
|
795 |
// -----------------------------------------------------------------------------
|
|
796 |
// TFsEmailUiUtility::OpenAttachmentL
|
|
797 |
// -----------------------------------------------------------------------------
|
|
798 |
void TFsEmailUiUtility::OpenAttachmentL( const TPartData& aAttachmentPart )
|
|
799 |
{
|
|
800 |
FUNC_LOG;
|
|
801 |
CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
|
|
802 |
CFSMailMessage* mailMessage = appUi->GetMailClient()->GetMessageByUidL(
|
|
803 |
aAttachmentPart.iMailBoxId, aAttachmentPart.iFolderId,
|
|
804 |
aAttachmentPart.iMessageId, EFSMsgDataStructure );
|
|
805 |
|
|
806 |
CleanupStack::PushL( mailMessage );
|
|
807 |
CFSMailMessagePart* messagePart = mailMessage->ChildPartL(
|
|
808 |
aAttachmentPart.iMessagePartId );
|
|
809 |
CleanupStack::PushL( messagePart );
|
|
810 |
|
|
811 |
OpenAttachmentL( *messagePart );
|
|
812 |
|
|
813 |
CleanupStack::PopAndDestroy( messagePart );
|
|
814 |
CleanupStack::PopAndDestroy( mailMessage );
|
|
815 |
}
|
|
816 |
|
|
817 |
// -----------------------------------------------------------------------------
|
|
818 |
// TFsEmailUiUtility::OpenAttachmentL
|
|
819 |
// -----------------------------------------------------------------------------
|
|
820 |
void TFsEmailUiUtility::OpenAttachmentL( CFSMailMessagePart& aAttachmentPart,
|
|
821 |
TBool aAllowSave /*= ETrue*/)
|
|
822 |
{
|
|
823 |
FUNC_LOG;
|
|
824 |
const TDesC& attName = aAttachmentPart.AttachmentNameL();
|
|
825 |
const TDesC* mimeType16 = &aAttachmentPart.GetContentType();
|
|
826 |
TFileType fileType = GetFileType( attName, *mimeType16 );
|
|
827 |
|
|
828 |
// Check if attachment is actually an embedded message object. In that case we try to
|
|
829 |
// open it using mail viewer.
|
|
830 |
TBool openedAsMessage = EFalse;
|
|
831 |
if ( fileType == EMessageType )
|
|
832 |
{
|
|
833 |
CFreestyleEmailUiAppUi* appUi =
|
|
834 |
static_cast<CFreestyleEmailUiAppUi*>( CCoeEnv::Static()->AppUi() );
|
|
835 |
|
|
836 |
// First, try to get the message object directly from mail client using the UIDs.
|
|
837 |
CFSMailMessage* message = NULL;
|
|
838 |
TRAP_IGNORE( message = appUi->GetMailClient()->GetMessageByUidL(
|
|
839 |
aAttachmentPart.GetMailBoxId(),
|
|
840 |
aAttachmentPart.GetFolderId(),
|
|
841 |
aAttachmentPart.GetPartId(),
|
|
842 |
EFSMsgDataEnvelope ) );
|
|
843 |
|
|
844 |
// If we still have no message, then try to convert the attachment file to message object (Activesync case).
|
|
845 |
if ( !message )
|
|
846 |
{
|
|
847 |
// This takes some time so we show a wait dialog.
|
|
848 |
if ( iOpeningWaitNote )
|
|
849 |
{
|
|
850 |
iOpeningWaitNote->ProcessFinishedL();
|
|
851 |
iOpeningWaitNote = NULL;
|
|
852 |
}
|
|
853 |
ShowWaitNoteL( iOpeningWaitNote, R_FSE_WAIT_OPENING_TEXT, EFalse, ETrue );
|
|
854 |
|
|
855 |
RFile attFile = aAttachmentPart.GetContentFileL();
|
|
856 |
CleanupClosePushL( attFile );
|
|
857 |
CFSMailBox* mailbox = appUi->GetMailClient()->GetMailBoxByUidL( aAttachmentPart.GetMailBoxId() );
|
|
858 |
CleanupStack::PushL( mailbox );
|
|
859 |
TRAP_IGNORE( message = mailbox->CreateMessageFromFileL( attFile ) );
|
|
860 |
CleanupStack::PopAndDestroy( mailbox );
|
|
861 |
CleanupStack::PopAndDestroy( &attFile );
|
|
862 |
|
|
863 |
iOpeningWaitNote->ProcessFinishedL();
|
|
864 |
}
|
|
865 |
|
|
866 |
// Open message to viewer if we got it. Otherwise continue with the standard file opening logic.
|
|
867 |
if ( message )
|
|
868 |
{
|
|
869 |
// Check that the embedded message has text body part or html body part.
|
|
870 |
// Otherwise we cannot display it viewer and needs to be handled as a normal attachment.
|
|
871 |
|
|
872 |
CFSMailMessagePart* htmlPart = message->HtmlBodyPartL();
|
|
873 |
CFSMailMessagePart* textPart = message->PlainTextBodyPartL();
|
|
874 |
|
|
875 |
if ( htmlPart || textPart )
|
|
876 |
{
|
|
877 |
THtmlViewerActivationData htmlData;
|
|
878 |
htmlData.iActivationDataType = THtmlViewerActivationData::EmbeddedEmailMessage;
|
|
879 |
htmlData.iMailBoxId = aAttachmentPart.GetMailBoxId();
|
|
880 |
htmlData.iFolderId = aAttachmentPart.GetFolderId();
|
|
881 |
htmlData.iMessageId = aAttachmentPart.GetPartId();
|
|
882 |
// ownership of message gets transfered to html viewer.
|
|
883 |
htmlData.iEmbeddedMessage = message;
|
|
884 |
htmlData.iEmbeddedMessageMode = ETrue;
|
|
885 |
TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
|
|
886 |
|
|
887 |
appUi->EnterFsEmailViewL( HtmlViewerId, KStartViewerWithEmbeddedMsgPtr, pckgData );
|
|
888 |
openedAsMessage = ETrue;
|
|
889 |
}
|
|
890 |
else
|
|
891 |
{
|
|
892 |
//delete message object owned by us.
|
|
893 |
delete message;
|
|
894 |
}
|
|
895 |
|
|
896 |
if( htmlPart )
|
|
897 |
{
|
|
898 |
delete htmlPart;
|
|
899 |
}
|
|
900 |
if( textPart )
|
|
901 |
{
|
|
902 |
delete textPart;
|
|
903 |
}
|
|
904 |
|
|
905 |
}
|
|
906 |
}
|
|
907 |
|
|
908 |
// Normal attachment file opening
|
|
909 |
if ( !openedAsMessage )
|
|
910 |
{
|
|
911 |
RFile attachmentFile;
|
|
912 |
|
|
913 |
// Get the temp file provided by plugin
|
|
914 |
RFile pluginTempFile = aAttachmentPart.GetContentFileL();
|
|
915 |
CleanupClosePushL( pluginTempFile );
|
|
916 |
|
|
917 |
// Check if the temp file has diffrent file extension than the attachment name.
|
|
918 |
TFileName tempFileName;
|
|
919 |
pluginTempFile.Name( tempFileName );
|
|
920 |
const TDesC& attName = aAttachmentPart.AttachmentNameL();
|
|
921 |
if ( !DoFileExtensionsMatchL( tempFileName, attName ) )
|
|
922 |
{
|
|
923 |
// Make a new temporary copy of the attachment file if the temp file
|
|
924 |
// provided by the plugin does not have a proper file extension.
|
|
925 |
// This is needed because some applications may not
|
|
926 |
// allow opening files with improper file extension.
|
|
927 |
attachmentFile = CopyFileToTempDirL( pluginTempFile, attName );
|
|
928 |
CleanupStack::PopAndDestroy( &pluginTempFile );
|
|
929 |
}
|
|
930 |
else
|
|
931 |
{
|
|
932 |
// Otherwise we may use the temp file provided by plugin directly
|
|
933 |
attachmentFile = pluginTempFile;
|
|
934 |
CleanupStack::Pop( &pluginTempFile );
|
|
935 |
}
|
|
936 |
CleanupClosePushL( attachmentFile );
|
|
937 |
|
|
938 |
// Use given MIME type if present
|
|
939 |
TDataType dataType;
|
|
940 |
const TDesC* mimeType16 = &aAttachmentPart.GetContentType();
|
|
941 |
if ( mimeType16->Length() )
|
|
942 |
{
|
|
943 |
// V-calendar attachments sent from MS Outlook seem to have wrong MIME type. Work around
|
|
944 |
// this by overriding the MIME type in case the file can be identified to be VCal object
|
|
945 |
if ( GetFileType( attName, *mimeType16 ) == EVCalType )
|
|
946 |
{
|
|
947 |
mimeType16 = &KVCalMimeString;
|
|
948 |
}
|
|
949 |
|
|
950 |
// The MIME type must be converted to 8 bit buffer. Just assume it's ASCII data
|
|
951 |
// and forget the upper bytes.
|
|
952 |
HBufC8* mimeType8 = HBufC8::NewLC( mimeType16->Length() );
|
|
953 |
mimeType8->Des().Append( *mimeType16 );
|
|
954 |
//cut extra data from MIME string
|
|
955 |
TInt pos = mimeType8->Locate( ';' );
|
|
956 |
if ( pos >= 0 )
|
|
957 |
{
|
|
958 |
mimeType8->Des().SetLength(pos);
|
|
959 |
}
|
|
960 |
dataType = TDataType( *mimeType8 );
|
|
961 |
CleanupStack::PopAndDestroy( mimeType8 );
|
|
962 |
}
|
|
963 |
|
|
964 |
CleanupStack::Pop( &attachmentFile ); // next function takes ownershp of the handle
|
|
965 |
OpenFileL( attachmentFile, dataType, aAllowSave );
|
|
966 |
}
|
|
967 |
}
|
|
968 |
|
|
969 |
// -----------------------------------------------------------------------------
|
|
970 |
// TFsEmailUiUtility::SetMessageFollowupFlagL
|
|
971 |
// -----------------------------------------------------------------------------
|
|
972 |
TFollowUpNewState TFsEmailUiUtility::SetMessageFollowupFlagL( CFSMailMessage& aMsg,
|
|
973 |
TBool aShowFlagCompleted )
|
|
974 |
{
|
|
975 |
FUNC_LOG;
|
|
976 |
TFollowUpNewState newFollowUpState = EFollowUpNoChanges;
|
|
977 |
if ( TFsEmailUiUtility::RunFollowUpListDialogL( newFollowUpState, aShowFlagCompleted ) )
|
|
978 |
{
|
|
979 |
SetMessageFollowupStateL( aMsg, newFollowUpState );
|
|
980 |
}
|
|
981 |
return newFollowUpState;
|
|
982 |
}
|
|
983 |
|
|
984 |
// -----------------------------------------------------------------------------
|
|
985 |
// TFsEmailUiUtility::SetssageFollowupStateL
|
|
986 |
// -----------------------------------------------------------------------------
|
|
987 |
void TFsEmailUiUtility::SetMessageFollowupStateL( CFSMailMessage& aMsg,
|
|
988 |
TFollowUpNewState aNewFollowUpState )
|
|
989 |
{
|
|
990 |
FUNC_LOG;
|
|
991 |
switch ( aNewFollowUpState )
|
|
992 |
{
|
|
993 |
case EFollowUp:
|
|
994 |
{
|
|
995 |
aMsg.SetFlag( EFSMsgFlag_FollowUp );
|
|
996 |
aMsg.ResetFlag( EFSMsgFlag_FollowUpComplete );
|
|
997 |
}
|
|
998 |
break;
|
|
999 |
case EFollowUpComplete:
|
|
1000 |
{
|
|
1001 |
aMsg.SetFlag( EFSMsgFlag_FollowUpComplete );
|
|
1002 |
aMsg.ResetFlag( EFSMsgFlag_FollowUp );
|
|
1003 |
}
|
|
1004 |
break;
|
|
1005 |
case EFollowUpClear:
|
|
1006 |
{
|
|
1007 |
aMsg.ResetFlag( EFSMsgFlag_FollowUp | EFSMsgFlag_FollowUpComplete );
|
|
1008 |
}
|
|
1009 |
break;
|
|
1010 |
}
|
|
1011 |
aMsg.SaveMessageL(); // Save flag status
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
// -----------------------------------------------------------------------------
|
|
1015 |
// TFsEmailUiUtility::RunFollowUpListDialogL
|
|
1016 |
// -----------------------------------------------------------------------------
|
|
1017 |
TBool TFsEmailUiUtility::RunFollowUpListDialogL( TFollowUpNewState& aSelectedOption,
|
|
1018 |
TBool aShowFlagCompleted )
|
|
1019 |
{
|
|
1020 |
FUNC_LOG;
|
|
1021 |
aSelectedOption = EFollowUpNoChanges;
|
|
1022 |
|
|
1023 |
CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat( 2 );
|
|
1024 |
CleanupStack::PushL( array );
|
|
1025 |
|
|
1026 |
// Add follow up text
|
|
1027 |
_LIT( KListItemIcon0, "0\t" );
|
|
1028 |
|
|
1029 |
// aShowFlagCompleted is false when we are in the editor/composer view
|
|
1030 |
TInt followUpResId =
|
|
1031 |
( aShowFlagCompleted ? R_FREESTYLE_EMAIL_UI_FLAG_FOLLOW_UP :
|
|
1032 |
R_NCS_FLAG_FOLLOW_UP );
|
|
1033 |
|
|
1034 |
HBufC* followUp = StringLoader::LoadLC( followUpResId );
|
|
1035 |
|
|
1036 |
HBufC* followUpText = HBufC::NewLC( KListItemIcon0().Length() + followUp->Length() );
|
|
1037 |
followUpText->Des().Append( KListItemIcon0 );
|
|
1038 |
followUpText->Des().Append( *followUp );
|
|
1039 |
array->AppendL( *followUpText );
|
|
1040 |
CleanupStack::PopAndDestroy( 2, followUp );
|
|
1041 |
|
|
1042 |
// Add flag complete text if requested
|
|
1043 |
if ( aShowFlagCompleted )
|
|
1044 |
{
|
|
1045 |
_LIT( KListItemIcon1, "1\t" );
|
|
1046 |
HBufC* completeFlag = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FLAG_COMPLETE );
|
|
1047 |
HBufC* completeFlagText = HBufC::NewLC( KListItemIcon1().Length() + completeFlag->Length() );
|
|
1048 |
completeFlagText->Des().Append( KListItemIcon1 );
|
|
1049 |
completeFlagText->Des().Append( *completeFlag );
|
|
1050 |
array->AppendL( *completeFlagText );
|
|
1051 |
CleanupStack::PopAndDestroy( 2, completeFlag );
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
// Add clear flag text
|
|
1055 |
_LIT( KListItemNoIcon, "\t" );
|
|
1056 |
|
|
1057 |
// aShowFlagCompleted is false when we are in the editor/composer view
|
|
1058 |
TInt clearResId = ( aShowFlagCompleted ? R_FREESTYLE_EMAIL_UI_FLAG_CLEAR :
|
|
1059 |
R_NCS_FLAG_CLEAR );
|
|
1060 |
|
|
1061 |
HBufC* clearFlag = StringLoader::LoadLC( clearResId );
|
|
1062 |
HBufC* clearFlagText = HBufC::NewLC( KListItemNoIcon().Length() + clearFlag->Length() );
|
|
1063 |
clearFlagText->Des().Append( KListItemNoIcon );
|
|
1064 |
clearFlagText->Des().Append( *clearFlag );
|
|
1065 |
array->AppendL( *clearFlagText );
|
|
1066 |
CleanupStack::PopAndDestroy( 2, clearFlag );
|
|
1067 |
|
|
1068 |
TInt selectedOption;
|
|
1069 |
CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedOption );
|
|
1070 |
|
|
1071 |
// aShowFlagCompleted is false when we are in the editor/composer view
|
|
1072 |
TInt dlgResId = ( aShowFlagCompleted ? R_MAIL_FLAG_QUERY_DIALOG :
|
|
1073 |
R_NCS_MAIL_FLAG_QUERY_DIALOG );
|
|
1074 |
|
|
1075 |
dlg->PrepareLC( dlgResId );
|
|
1076 |
|
|
1077 |
//Create icon array from correct icons
|
|
1078 |
TFileName iconFileName;
|
|
1079 |
GetFullIconFileNameL( iconFileName );
|
|
1080 |
|
|
1081 |
CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray( 2 );
|
|
1082 |
CleanupStack::PushL(icons);
|
|
1083 |
CFbsBitmap* iconBitmap;
|
|
1084 |
CFbsBitmap* iconMaskBitmap;
|
|
1085 |
TSize defaultIconSize(20,20);
|
|
1086 |
|
|
1087 |
// <cmail> icons changed
|
|
1088 |
// Flag icon "followup"
|
|
1089 |
AknsUtils::CreateColorIconLC(
|
|
1090 |
AknsUtils::SkinInstance(),
|
|
1091 |
KAknsIIDNone,
|
|
1092 |
KAknsIIDQsnIconColors,
|
|
1093 |
EAknsCIQsnIconColorsCG7,
|
|
1094 |
iconBitmap,
|
|
1095 |
iconMaskBitmap,
|
|
1096 |
iconFileName,
|
|
1097 |
EMbmFreestyleemailuiQgn_indi_navi_follow_up,
|
|
1098 |
EMbmFreestyleemailuiQgn_indi_navi_follow_up_mask,
|
|
1099 |
KRgbBlack );
|
|
1100 |
AknIconUtils::SetSize(iconBitmap, defaultIconSize );
|
|
1101 |
AknIconUtils::SetSize(iconMaskBitmap, defaultIconSize);
|
|
1102 |
CGulIcon* flagIcon = CGulIcon::NewL(iconBitmap, iconMaskBitmap);
|
|
1103 |
CleanupStack::Pop( 2, iconBitmap );
|
|
1104 |
CleanupStack::PushL( flagIcon );
|
|
1105 |
icons->AppendL( flagIcon );
|
|
1106 |
CleanupStack::Pop( flagIcon );
|
|
1107 |
|
|
1108 |
// Flag icon "completed"
|
|
1109 |
AknsUtils::CreateColorIconLC(
|
|
1110 |
AknsUtils::SkinInstance(),
|
|
1111 |
KAknsIIDNone,
|
|
1112 |
KAknsIIDQsnIconColors,
|
|
1113 |
EAknsCIQsnIconColorsCG7,
|
|
1114 |
iconBitmap,
|
|
1115 |
iconMaskBitmap,
|
|
1116 |
iconFileName,
|
|
1117 |
EMbmFreestyleemailuiQgn_indi_navi_follow_up_complete,
|
|
1118 |
EMbmFreestyleemailuiQgn_indi_navi_follow_up_complete_mask,
|
|
1119 |
KRgbBlack );
|
|
1120 |
AknIconUtils::SetSize(iconBitmap, defaultIconSize );
|
|
1121 |
AknIconUtils::SetSize(iconMaskBitmap, defaultIconSize);
|
|
1122 |
CGulIcon* flagCompleteIcon = CGulIcon::NewL(iconBitmap, iconMaskBitmap);
|
|
1123 |
CleanupStack::Pop( 2, iconBitmap );
|
|
1124 |
CleanupStack::PushL( flagCompleteIcon );
|
|
1125 |
icons->AppendL( flagCompleteIcon );
|
|
1126 |
CleanupStack::Pop( flagCompleteIcon );
|
|
1127 |
// </cmail>
|
|
1128 |
|
|
1129 |
// Run the dialog
|
|
1130 |
dlg->SetItemTextArray( array );
|
|
1131 |
dlg->SetIconArrayL( icons );
|
|
1132 |
CleanupStack::Pop( icons );
|
|
1133 |
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
1134 |
TBool retVal = dlg->RunLD();
|
|
1135 |
CleanupStack::PopAndDestroy( array );
|
|
1136 |
|
|
1137 |
if ( retVal )
|
|
1138 |
{
|
|
1139 |
// Convert the returned index to enumeration. This mapping is different depending
|
|
1140 |
// if "flag completed" is shown or not
|
|
1141 |
aSelectedOption = static_cast<TFollowUpNewState>( selectedOption );
|
|
1142 |
if ( !aShowFlagCompleted && aSelectedOption == EFollowUpComplete )
|
|
1143 |
{
|
|
1144 |
aSelectedOption = EFollowUpClear;
|
|
1145 |
}
|
|
1146 |
}
|
|
1147 |
|
|
1148 |
return retVal;
|
|
1149 |
}
|
|
1150 |
|
|
1151 |
|
|
1152 |
// -----------------------------------------------------------------------------
|
|
1153 |
// TFsEmailUiUtility::ShowCreateMessageQueryL
|
|
1154 |
// -----------------------------------------------------------------------------
|
|
1155 |
void TFsEmailUiUtility::ShowCreateMessageQueryL( const TDesC& aAddressData, TBool aSendingToEmail )
|
|
1156 |
{
|
|
1157 |
FUNC_LOG;
|
|
1158 |
if ( aAddressData.Length() ) // Sending needs address data in any case
|
|
1159 |
{
|
|
1160 |
CSendUi* sendUi = CSendUi::NewLC();
|
|
1161 |
TSendingCapabilities noCapabilities(0,0,0);
|
|
1162 |
|
|
1163 |
CArrayFix<TUid>* showedServicesUidArray = new( ELeave ) CArrayFixFlat<TUid>(4);
|
|
1164 |
CleanupStack::PushL( showedServicesUidArray );
|
|
1165 |
|
|
1166 |
CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( 2 );
|
|
1167 |
CleanupStack::PushL( array );
|
|
1168 |
|
|
1169 |
if( !aSendingToEmail && sendUi->ValidateServiceL( KSenduiMtmSmsUid, noCapabilities ) )
|
|
1170 |
{
|
|
1171 |
HBufC* textMessage = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_TEXT_MESSAGE );
|
|
1172 |
array->AppendL( *textMessage );
|
|
1173 |
CleanupStack::PopAndDestroy( textMessage );
|
|
1174 |
showedServicesUidArray->AppendL( KSenduiMtmSmsUid );
|
|
1175 |
}
|
|
1176 |
if( sendUi->ValidateServiceL( KSenduiMtmMmsUid, noCapabilities ) )
|
|
1177 |
{
|
|
1178 |
HBufC* multimediaMessage = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_MULTIMEDIA_MESSAGE );
|
|
1179 |
array->AppendL( *multimediaMessage );
|
|
1180 |
CleanupStack::PopAndDestroy( multimediaMessage );
|
|
1181 |
showedServicesUidArray->AppendL( KSenduiMtmMmsUid );
|
|
1182 |
}
|
|
1183 |
if( sendUi->ValidateServiceL( KSenduiMtmAudioMessageUid, noCapabilities ) )
|
|
1184 |
{
|
|
1185 |
HBufC* voiceMessage = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_VOICE_MESSAGE );
|
|
1186 |
array->AppendL( *voiceMessage );
|
|
1187 |
CleanupStack::PopAndDestroy( voiceMessage );
|
|
1188 |
showedServicesUidArray->AppendL( KSenduiMtmAudioMessageUid );
|
|
1189 |
}
|
|
1190 |
|
|
1191 |
TInt selectedOption;
|
|
1192 |
CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedOption );
|
|
1193 |
dlg->PrepareLC( R_MAIL_VIEWER_CREATE_MESSAGE_DIALOG );
|
|
1194 |
dlg->SetItemTextArray( array );
|
|
1195 |
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
1196 |
if( dlg->RunLD() )
|
|
1197 |
{
|
|
1198 |
CMessageData* messageData = CMessageData::NewLC();
|
|
1199 |
messageData->AppendToAddressL( aAddressData );
|
|
1200 |
// safety check.
|
|
1201 |
if( showedServicesUidArray->Count() > selectedOption )
|
|
1202 |
{
|
|
1203 |
sendUi->CreateAndSendMessageL( showedServicesUidArray->At( selectedOption ),
|
|
1204 |
messageData );
|
|
1205 |
}
|
|
1206 |
CleanupStack::PopAndDestroy( messageData );
|
|
1207 |
}
|
|
1208 |
|
|
1209 |
CleanupStack::PopAndDestroy( array );
|
|
1210 |
CleanupStack::PopAndDestroy( showedServicesUidArray );
|
|
1211 |
CleanupStack::PopAndDestroy( sendUi );
|
|
1212 |
}
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
// -----------------------------------------------------------------------------
|
|
1216 |
// TFsEmailUiUtility::GetFileType
|
|
1217 |
// Figures out the file type based on the MIME type and the file name extension.
|
|
1218 |
// The MIME type is used first and if that doesn't help, then the file extension
|
|
1219 |
// is used as backup solution.
|
|
1220 |
// -----------------------------------------------------------------------------
|
|
1221 |
TFileType TFsEmailUiUtility::GetFileType( const TDesC& aFileName, const TDesC& aMimeType )
|
|
1222 |
{
|
|
1223 |
FUNC_LOG;
|
|
1224 |
TFileType fileType = EUnidentifiedType;
|
|
1225 |
TPtrC ext = TParsePtrC( aFileName ).Ext();
|
|
1226 |
|
|
1227 |
// here we make sure that content type does not have extra parameters
|
|
1228 |
TPtrC mimeType( aMimeType );
|
|
1229 |
TInt semiColonPos( aMimeType.Locate(';') );
|
|
1230 |
if( semiColonPos != KErrNotFound )
|
|
1231 |
{
|
|
1232 |
mimeType.Set( aMimeType.Left(semiColonPos) );
|
|
1233 |
}
|
|
1234 |
|
|
1235 |
if ( !mimeType.CompareF(KPdfMimeString) )
|
|
1236 |
{
|
|
1237 |
fileType = EPdfType;
|
|
1238 |
}
|
|
1239 |
else if ( !mimeType.CompareF(KDocMimeString) ||
|
|
1240 |
!mimeType.CompareF(KDocMimeString2) )
|
|
1241 |
{
|
|
1242 |
fileType = EDocType;
|
|
1243 |
}
|
|
1244 |
else if ( !mimeType.CompareF(KRtfMimeString) )
|
|
1245 |
{
|
|
1246 |
fileType = ERtfType;
|
|
1247 |
}
|
|
1248 |
else if ( !mimeType.CompareF(KPptMimeString) )
|
|
1249 |
{
|
|
1250 |
fileType = EPptType;
|
|
1251 |
}
|
|
1252 |
else if ( !mimeType.CompareF(KXlsMimeString) )
|
|
1253 |
{
|
|
1254 |
fileType = EXlsType;
|
|
1255 |
}
|
|
1256 |
else if ( !mimeType.Left( KImageMimeString().Length() ).CompareF(KImageMimeString) )
|
|
1257 |
{
|
|
1258 |
fileType = EImageType;
|
|
1259 |
}
|
|
1260 |
else if ( !mimeType.CompareF(KHtmlMimeString) )
|
|
1261 |
{
|
|
1262 |
fileType = EHtmlType;
|
|
1263 |
}
|
|
1264 |
else if ( !mimeType.CompareF(KPlainTextMimeString) )
|
|
1265 |
{
|
|
1266 |
fileType = EPlainTextType;
|
|
1267 |
// When v-cal attachment is sent from MS Outlook, it's received with wrong MIME type.
|
|
1268 |
// Following is a workaround for this problem
|
|
1269 |
if ( !ext.CompareF(KVCalFileExtension) )
|
|
1270 |
{
|
|
1271 |
fileType = EVCalType;
|
|
1272 |
}
|
|
1273 |
}
|
|
1274 |
else if ( !mimeType.CompareF(KVCalMimeString) )
|
|
1275 |
{
|
|
1276 |
fileType = EVCalType;
|
|
1277 |
}
|
|
1278 |
else if ( !mimeType.CompareF(KMessageMimeString) )
|
|
1279 |
{
|
|
1280 |
fileType = EMessageType;
|
|
1281 |
}
|
|
1282 |
else
|
|
1283 |
{
|
|
1284 |
// File type couldn't be identified from the MIME type. Use the file extension.
|
|
1285 |
|
|
1286 |
if ( !ext.CompareF(KDocFileExtension) )
|
|
1287 |
{
|
|
1288 |
fileType = EDocType;
|
|
1289 |
}
|
|
1290 |
else if ( !ext.CompareF(KRtfFileExtension) )
|
|
1291 |
{
|
|
1292 |
fileType = ERtfType;
|
|
1293 |
}
|
|
1294 |
else if ( !ext.CompareF(KPptFileExtension) )
|
|
1295 |
{
|
|
1296 |
fileType = EPptType;
|
|
1297 |
}
|
|
1298 |
else if ( !ext.CompareF(KXlsFileExtension) )
|
|
1299 |
{
|
|
1300 |
fileType = EXlsType;
|
|
1301 |
}
|
|
1302 |
else if ( !ext.CompareF(KPdfFileExtension) )
|
|
1303 |
{
|
|
1304 |
fileType = EPdfType;
|
|
1305 |
}
|
|
1306 |
else if ( !ext.CompareF(KHtmlFileExtension) ||
|
|
1307 |
!ext.CompareF(KHtmFileExtension) )
|
|
1308 |
{
|
|
1309 |
fileType = EHtmlType;
|
|
1310 |
}
|
|
1311 |
else if ( !ext.CompareF(KJpgFileExtension)
|
|
1312 |
|| !ext.CompareF(KJpgeFileExtension)
|
|
1313 |
|| !ext.CompareF(KJpegFileExtension)
|
|
1314 |
|| !ext.CompareF(KPngFileExtension)
|
|
1315 |
|| !ext.CompareF(KGifFileExtension)
|
|
1316 |
|| !ext.CompareF(KBmpFileExtension) )
|
|
1317 |
{
|
|
1318 |
fileType = EImageType;
|
|
1319 |
}
|
|
1320 |
else if ( !ext.CompareF(KTxtFileExtension) )
|
|
1321 |
{
|
|
1322 |
fileType = EPlainTextType;
|
|
1323 |
}
|
|
1324 |
else if ( !ext.CompareF(KVCalFileExtension) )
|
|
1325 |
{
|
|
1326 |
fileType = EVCalType;
|
|
1327 |
}
|
|
1328 |
else if ( !ext.CompareF(KEmailFileExtension) )
|
|
1329 |
{
|
|
1330 |
fileType = EMessageType;
|
|
1331 |
}
|
|
1332 |
else
|
|
1333 |
{
|
|
1334 |
fileType = EUnidentifiedType;
|
|
1335 |
}
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
return fileType;
|
|
1339 |
}
|
|
1340 |
|
|
1341 |
// -----------------------------------------------------------------------------
|
|
1342 |
// TFsEmailUiUtility::GetAttachmentIcon
|
|
1343 |
// Funtion for getting correct attachment icon
|
|
1344 |
// -----------------------------------------------------------------------------
|
|
1345 |
CAlfTexture& TFsEmailUiUtility::GetAttachmentIcon( TFileType aAttachmentType, CFreestyleEmailUiTextureManager& aTextureManager )
|
|
1346 |
{
|
|
1347 |
FUNC_LOG;
|
|
1348 |
TFSEmailUiTextures textureId = GetAttachmentIconTextureId( aAttachmentType );
|
|
1349 |
return aTextureManager.TextureByIndex( textureId );
|
|
1350 |
}
|
|
1351 |
|
|
1352 |
TFSEmailUiTextures TFsEmailUiUtility::GetAttachmentIconTextureId( TFileType aAttachmentType )
|
|
1353 |
{
|
|
1354 |
FUNC_LOG;
|
|
1355 |
switch( aAttachmentType )
|
|
1356 |
{
|
|
1357 |
case EDocType:
|
|
1358 |
return EAttachmentsDocFile;
|
|
1359 |
case ERtfType:
|
|
1360 |
return EAttachmentsRtfFile;
|
|
1361 |
case EPptType:
|
|
1362 |
return EAttachmentsPptFile;
|
|
1363 |
case EXlsType:
|
|
1364 |
return EAttachmentsXls;
|
|
1365 |
case EPdfType:
|
|
1366 |
return EAttachmentsPdfFile;
|
|
1367 |
case EImageType:
|
|
1368 |
return EAttachmentsImageFile;
|
|
1369 |
case EHtmlType:
|
|
1370 |
return EAttachmentsHtmlFile;
|
|
1371 |
case EPlainTextType:
|
|
1372 |
case EVCalType:
|
|
1373 |
case EMessageType:
|
|
1374 |
case EUnidentifiedType:
|
|
1375 |
return EAttachmentsUnknownFile;
|
|
1376 |
default:
|
|
1377 |
ASSERT( EFalse );
|
|
1378 |
}
|
|
1379 |
return EAttachmentsUnknownFile;
|
|
1380 |
}
|
|
1381 |
|
|
1382 |
// -----------------------------------------------------------------------------
|
|
1383 |
// TFsEmailUiUtility::GetMsgIcon
|
|
1384 |
// Funtion for getting correct msg icon, divides into read and unread icons
|
|
1385 |
// -----------------------------------------------------------------------------
|
|
1386 |
CAlfTexture& TFsEmailUiUtility::GetMsgIcon( CFSMailMessage* aMsgPtr,
|
|
1387 |
CFreestyleEmailUiTextureManager& aTextureManager )
|
|
1388 |
{
|
|
1389 |
FUNC_LOG;
|
|
1390 |
TFSEmailUiTextures textureId = GetMsgIconTextureId( aMsgPtr );
|
|
1391 |
return aTextureManager.TextureByIndex( textureId );
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
TFSEmailUiTextures TFsEmailUiUtility::GetMsgIconTextureId( CFSMailMessage* aMsgPtr )
|
|
1395 |
{
|
|
1396 |
FUNC_LOG;
|
|
1397 |
if ( !aMsgPtr->IsFlagSet( EFSMsgFlag_Read ) )
|
|
1398 |
{
|
|
1399 |
return GetUnreadMsgIcon( aMsgPtr );
|
|
1400 |
}
|
|
1401 |
else
|
|
1402 |
{
|
|
1403 |
return GetReadMsgIcon( aMsgPtr );
|
|
1404 |
}
|
|
1405 |
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
// -----------------------------------------------------------------------------
|
|
1409 |
// TFsEmailUiUtility::MoveMessageToDraftsL
|
|
1410 |
// -----------------------------------------------------------------------------
|
|
1411 |
void TFsEmailUiUtility::MoveMessageToDraftsL( CFSMailBox& aMailBox, CFSMailMessage& aMsg )
|
|
1412 |
{
|
|
1413 |
FUNC_LOG;
|
|
1414 |
|
|
1415 |
// check that msg is not in drafts folder already
|
|
1416 |
TFSMailMsgId draftsFolderId = aMailBox.GetStandardFolderId( EFSDraftsFolder );
|
|
1417 |
TFSMailMsgId msgFolderId = aMsg.GetFolderId();
|
|
1418 |
if ( draftsFolderId != msgFolderId )
|
|
1419 |
{
|
|
1420 |
RArray<TFSMailMsgId> ids;
|
|
1421 |
ids.Append( aMsg.GetMessageId() );
|
|
1422 |
aMailBox.MoveMessagesL( ids, msgFolderId, draftsFolderId );
|
|
1423 |
ids.Reset();
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
// -----------------------------------------------------------------------------
|
|
1429 |
// TFsEmailUiUtility::IsMessagePartFullyFetched
|
|
1430 |
// -----------------------------------------------------------------------------
|
|
1431 |
TBool TFsEmailUiUtility::IsMessagePartFullyFetched( const CFSMailMessagePart& aPart )
|
|
1432 |
{
|
|
1433 |
FUNC_LOG;
|
|
1434 |
|
|
1435 |
TFSPartFetchState fetchState = aPart.FetchLoadState();
|
|
1436 |
TBool isFetched = ( fetchState == EFSFull );
|
|
1437 |
|
|
1438 |
return isFetched;
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
// -----------------------------------------------------------------------------
|
|
1442 |
// TFsEmailUiUtility::IsMessageStructureKnown
|
|
1443 |
// -----------------------------------------------------------------------------
|
|
1444 |
TBool TFsEmailUiUtility::IsMessageStructureKnown( const CFSMailMessagePart& aPart )
|
|
1445 |
{
|
|
1446 |
FUNC_LOG;
|
|
1447 |
|
|
1448 |
TFSPartFetchState fetchState = aPart.FetchLoadState();
|
|
1449 |
TBool isKnown = !( fetchState == EFSEmailStructureUnknown );//( fetchState == EFSFull || fetchState == EFSMessagePartsKnown );
|
|
1450 |
|
|
1451 |
return isKnown;
|
|
1452 |
}
|
|
1453 |
|
|
1454 |
// -----------------------------------------------------------------------------
|
|
1455 |
// TFsEmailUiUtility::CreatePlainTextPartL
|
|
1456 |
// -----------------------------------------------------------------------------
|
|
1457 |
void TFsEmailUiUtility::CreatePlainTextPartL( CFSMailMessage& aMsg, CFSMailMessagePart*& aPart )
|
|
1458 |
{
|
|
1459 |
FUNC_LOG;
|
|
1460 |
|
|
1461 |
aPart = aMsg.PlainTextBodyPartL();
|
|
1462 |
if ( !aPart )
|
|
1463 |
{
|
|
1464 |
// Do message contain HTML body part
|
|
1465 |
CFSMailMessagePart* htmlPart = aMsg.HtmlBodyPartL();
|
|
1466 |
if ( htmlPart )
|
|
1467 |
{
|
|
1468 |
CleanupStack::PushL( htmlPart );
|
|
1469 |
HBufC* htmlData = HBufC::NewLC( htmlPart->FetchedContentSize() );
|
|
1470 |
TPtr pointer = htmlData->Des();
|
|
1471 |
htmlPart->GetContentToBufferL( pointer, 0 );
|
|
1472 |
|
|
1473 |
HBufC* txtData = TFsEmailUiUtility::ConvertHtmlToTxtL( *htmlData );
|
|
1474 |
|
|
1475 |
CleanupStack::PopAndDestroy( htmlData );
|
|
1476 |
|
|
1477 |
CleanupStack::PushL( txtData );
|
|
1478 |
|
|
1479 |
// create new message part for body text
|
|
1480 |
TFSMailMsgId id;
|
|
1481 |
aPart = aMsg.NewChildPartL( id, KFSMailContentTypeTextPlain );
|
|
1482 |
if ( aPart )
|
|
1483 |
{
|
|
1484 |
aPart->SetContentType( KFSMailContentTypeTextPlain );
|
|
1485 |
pointer.Set( txtData->Des() );
|
|
1486 |
aPart->SetContent( pointer );
|
|
1487 |
aPart->SaveL();
|
|
1488 |
}
|
|
1489 |
|
|
1490 |
CleanupStack::PopAndDestroy( txtData );
|
|
1491 |
CleanupStack::PopAndDestroy( htmlPart );
|
|
1492 |
}
|
|
1493 |
else
|
|
1494 |
{
|
|
1495 |
// create new message part for body text
|
|
1496 |
TFSMailMsgId id;
|
|
1497 |
aPart = aMsg.NewChildPartL( id, KFSMailContentTypeTextPlain );
|
|
1498 |
if ( aPart )
|
|
1499 |
{
|
|
1500 |
aPart->SetContentType( KFSMailContentTypeTextPlain );
|
|
1501 |
aPart->SaveL();
|
|
1502 |
}
|
|
1503 |
}
|
|
1504 |
}
|
|
1505 |
|
|
1506 |
}
|
|
1507 |
|
|
1508 |
// -----------------------------------------------------------------------------
|
|
1509 |
// TFsEmailUiUtility::IsCompleteOrCancelEvent
|
|
1510 |
// -----------------------------------------------------------------------------
|
|
1511 |
TBool TFsEmailUiUtility::IsCompleteOrCancelEvent( TFSProgress aEvent )
|
|
1512 |
{
|
|
1513 |
FUNC_LOG;
|
|
1514 |
return ( TFSProgress::EFSStatus_RequestComplete == aEvent.iProgressStatus ||
|
|
1515 |
TFSProgress::EFSStatus_RequestCancelled == aEvent.iProgressStatus );
|
|
1516 |
}
|
|
1517 |
|
|
1518 |
// -----------------------------------------------------------------------------
|
|
1519 |
// TFsEmailUiUtility::HasUnfetchedAttachmentsL
|
|
1520 |
// -----------------------------------------------------------------------------
|
|
1521 |
TBool TFsEmailUiUtility::HasUnfetchedAttachmentsL( CFSMailMessage& aMsg )
|
|
1522 |
{
|
|
1523 |
FUNC_LOG;
|
|
1524 |
RPointerArray<CFSMailMessagePart> attachments;
|
|
1525 |
CleanupResetAndDestroyClosePushL( attachments );
|
|
1526 |
aMsg.AttachmentListL( attachments );
|
|
1527 |
TBool found = EFalse;
|
|
1528 |
for ( TInt i=0; i<attachments.Count(); i++ )
|
|
1529 |
{
|
|
1530 |
if ( !IsMessagePartFullyFetched( *attachments[i] ) )
|
|
1531 |
{
|
|
1532 |
found = ETrue;
|
|
1533 |
break;
|
|
1534 |
}
|
|
1535 |
}
|
|
1536 |
CleanupStack::PopAndDestroy( &attachments);
|
|
1537 |
return found;
|
|
1538 |
}
|
|
1539 |
|
|
1540 |
// -----------------------------------------------------------------------------
|
|
1541 |
// TFsEmailUiUtility::IsFollowUpSupported
|
|
1542 |
// -----------------------------------------------------------------------------
|
|
1543 |
TBool TFsEmailUiUtility::IsFollowUpSupported( const CFSMailBox& aMailBox )
|
|
1544 |
{
|
|
1545 |
FUNC_LOG;
|
|
1546 |
TBool supported = aMailBox.HasCapability( EFSMBoxCapaSupportsFollowUp );
|
|
1547 |
return supported;
|
|
1548 |
}
|
|
1549 |
|
|
1550 |
// -----------------------------------------------------------------------------
|
|
1551 |
// TFsEmailUiUtility::DateTextFromMsgLC
|
|
1552 |
// -----------------------------------------------------------------------------
|
|
1553 |
HBufC* TFsEmailUiUtility::DateTextFromMsgLC( const CFSMailMessage* aMessage,
|
|
1554 |
TBool aAddYearNumer )
|
|
1555 |
{
|
|
1556 |
FUNC_LOG;
|
|
1557 |
HBufC* ret = HBufC::NewLC( 20 );
|
|
1558 |
TTime eventTimeInHomeTime = aMessage->GetDate();
|
|
1559 |
TLocale currentLocaleSettings;
|
|
1560 |
eventTimeInHomeTime = eventTimeInHomeTime +
|
|
1561 |
(currentLocaleSettings.UniversalTimeOffset());
|
|
1562 |
eventTimeInHomeTime += currentLocaleSettings.QueryHomeHasDaylightSavingOn()
|
|
1563 |
? TTimeIntervalHours(1) : TTimeIntervalHours(0);
|
|
1564 |
TDateFormat dateFormat = currentLocaleSettings.DateFormat();
|
|
1565 |
TChar secondDateSeparator = currentLocaleSettings.DateSeparator( 1 );
|
|
1566 |
TChar thirdDateSeparator = currentLocaleSettings.DateSeparator( 2 );
|
|
1567 |
|
|
1568 |
if ( aAddYearNumer )
|
|
1569 |
{
|
|
1570 |
switch ( dateFormat )
|
|
1571 |
{
|
|
1572 |
case EDateAmerican: // US format (mm/dd/yyyy)
|
|
1573 |
{
|
|
1574 |
ret->Des().Format(_L("%02d%c%02d%c%4d"),
|
|
1575 |
eventTimeInHomeTime.DateTime().Month()+1,
|
|
1576 |
(TUint)secondDateSeparator,
|
|
1577 |
eventTimeInHomeTime.DateTime().Day()+1,
|
|
1578 |
(TUint)thirdDateSeparator,
|
|
1579 |
eventTimeInHomeTime.DateTime().Year());
|
|
1580 |
}
|
|
1581 |
break;
|
|
1582 |
case EDateJapanese: // Japanese format (yyyy/mm/dd)
|
|
1583 |
{
|
|
1584 |
ret->Des().Format( _L("%4d%c%02d%c%02d"),
|
|
1585 |
eventTimeInHomeTime.DateTime().Year(),
|
|
1586 |
(TUint)secondDateSeparator,
|
|
1587 |
eventTimeInHomeTime.DateTime().Month()+1,
|
|
1588 |
(TUint)thirdDateSeparator,
|
|
1589 |
eventTimeInHomeTime.DateTime().Day()+1 );
|
|
1590 |
}
|
|
1591 |
break;
|
|
1592 |
case EDateEuropean: // European format (dd/mm/yyyy)
|
|
1593 |
default:
|
|
1594 |
{
|
|
1595 |
ret->Des().Format(_L("%02d%c%02d%c%4d"),
|
|
1596 |
eventTimeInHomeTime.DateTime().Day()+1,
|
|
1597 |
(TUint)secondDateSeparator,
|
|
1598 |
eventTimeInHomeTime.DateTime().Month()+1,
|
|
1599 |
(TUint)thirdDateSeparator,
|
|
1600 |
eventTimeInHomeTime.DateTime().Year());
|
|
1601 |
}
|
|
1602 |
break;
|
|
1603 |
}
|
|
1604 |
}
|
|
1605 |
else
|
|
1606 |
{
|
|
1607 |
switch ( dateFormat )
|
|
1608 |
{
|
|
1609 |
case EDateAmerican: // US format (mm/dd/yyyy)
|
|
1610 |
{
|
|
1611 |
ret->Des().Format(_L("%02d%c%02d"),
|
|
1612 |
eventTimeInHomeTime.DateTime().Month()+1,
|
|
1613 |
(TUint)secondDateSeparator,
|
|
1614 |
eventTimeInHomeTime.DateTime().Day()+1 );
|
|
1615 |
}
|
|
1616 |
break;
|
|
1617 |
case EDateJapanese: // Japanese format (yyyy/mm/dd)
|
|
1618 |
{
|
|
1619 |
ret->Des().Format( _L("%02d%c%02d"),
|
|
1620 |
eventTimeInHomeTime.DateTime().Month()+1,
|
|
1621 |
(TUint)thirdDateSeparator,
|
|
1622 |
eventTimeInHomeTime.DateTime().Day()+1 );
|
|
1623 |
}
|
|
1624 |
break;
|
|
1625 |
case EDateEuropean: // European format (dd/mm/yyyy)
|
|
1626 |
default:
|
|
1627 |
{
|
|
1628 |
ret->Des().Format(_L("%02d%c%02d"),
|
|
1629 |
eventTimeInHomeTime.DateTime().Day()+1,
|
|
1630 |
(TUint)secondDateSeparator,
|
|
1631 |
eventTimeInHomeTime.DateTime().Month()+1 );
|
|
1632 |
}
|
|
1633 |
break;
|
|
1634 |
}
|
|
1635 |
}
|
|
1636 |
TPtr dataPtr( ret->Des() );
|
|
1637 |
AknTextUtils::LanguageSpecificNumberConversion( dataPtr );
|
|
1638 |
return ret;
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
// -----------------------------------------------------------------------------
|
|
1642 |
// TFsEmailUiUtility::TimeTextFromMsgLC
|
|
1643 |
// -----------------------------------------------------------------------------
|
|
1644 |
HBufC* TFsEmailUiUtility::TimeTextFromMsgLC( const CFSMailMessage* aMessage )
|
|
1645 |
{
|
|
1646 |
FUNC_LOG;
|
|
1647 |
TBuf<20> timeStr;
|
|
1648 |
TBuf<20> timeStrFormat;
|
|
1649 |
TTime eventTimeInHomeTime = aMessage->GetDate();
|
|
1650 |
TLocale currentLocaleSettings;
|
|
1651 |
eventTimeInHomeTime = eventTimeInHomeTime +
|
|
1652 |
(currentLocaleSettings.UniversalTimeOffset());
|
|
1653 |
eventTimeInHomeTime += currentLocaleSettings.QueryHomeHasDaylightSavingOn()
|
|
1654 |
? TTimeIntervalHours(1) : TTimeIntervalHours(0);
|
|
1655 |
if( currentLocaleSettings.AmPmSymbolPosition() == ELocaleBefore )
|
|
1656 |
{
|
|
1657 |
timeStrFormat.Append( KTimeFormatBefore );
|
|
1658 |
timeStrFormat.Append( KTimeFormatSpace );
|
|
1659 |
timeStrFormat.Append( KTimeFormatHour );
|
|
1660 |
timeStrFormat.Append( currentLocaleSettings.TimeSeparator( KSecondSeparator ) );
|
|
1661 |
timeStrFormat.Append( KTimeFormatMinutes );
|
|
1662 |
eventTimeInHomeTime.FormatL( timeStr, timeStrFormat );
|
|
1663 |
}
|
|
1664 |
else
|
|
1665 |
{
|
|
1666 |
timeStrFormat.Append( KTimeFormatHour );
|
|
1667 |
timeStrFormat.Append( currentLocaleSettings.TimeSeparator( KSecondSeparator ) );
|
|
1668 |
timeStrFormat.Append( KTimeFormatMinutes );
|
|
1669 |
timeStrFormat.Append( KTimeFormatSpace );
|
|
1670 |
timeStrFormat.Append( KTimeFormatAfter );
|
|
1671 |
eventTimeInHomeTime.FormatL( timeStr, timeStrFormat );
|
|
1672 |
}
|
|
1673 |
HBufC* dataStr = HBufC::NewL( 1 + timeStr.Length() );
|
|
1674 |
TPtr dataPtr( dataStr->Des() );
|
|
1675 |
dataPtr.Append( timeStr );
|
|
1676 |
CleanupStack::PushL( dataStr );
|
|
1677 |
AknTextUtils::LanguageSpecificNumberConversion( dataPtr );
|
|
1678 |
return dataStr;
|
|
1679 |
}
|
|
1680 |
|
|
1681 |
|
|
1682 |
// -----------------------------------------------------------------------------
|
|
1683 |
// TFsEmailUiUtility::ListMsgTimeTextFromMsgLC
|
|
1684 |
// -----------------------------------------------------------------------------
|
|
1685 |
HBufC* TFsEmailUiUtility::ListMsgTimeTextFromMsgLC( const CFSMailMessage* aMessage, TBool aDividersInUse )
|
|
1686 |
{
|
|
1687 |
FUNC_LOG;
|
|
1688 |
// If dividers are in use, returjn normal time text
|
|
1689 |
if ( aDividersInUse )
|
|
1690 |
{
|
|
1691 |
return TimeTextFromMsgLC( aMessage );
|
|
1692 |
}
|
|
1693 |
|
|
1694 |
// If dividers are not in use, today's emails need to use time, others need to use date.
|
|
1695 |
TTime eventTimeInHomeTime = aMessage->GetDate();
|
|
1696 |
TTime currentTime;
|
|
1697 |
currentTime.HomeTime();
|
|
1698 |
TLocale currentLocaleSettings;
|
|
1699 |
eventTimeInHomeTime = eventTimeInHomeTime +
|
|
1700 |
(currentLocaleSettings.UniversalTimeOffset());
|
|
1701 |
eventTimeInHomeTime += currentLocaleSettings.QueryHomeHasDaylightSavingOn()
|
|
1702 |
? TTimeIntervalHours(1) : TTimeIntervalHours(0);
|
|
1703 |
if ( currentTime.DayNoInYear() == eventTimeInHomeTime.DayNoInYear() &&
|
|
1704 |
currentTime.DateTime().Year() == eventTimeInHomeTime.DateTime().Year() )
|
|
1705 |
{
|
|
1706 |
// Event is today, use time text from msg
|
|
1707 |
return TimeTextFromMsgLC( aMessage );
|
|
1708 |
}
|
|
1709 |
else
|
|
1710 |
{
|
|
1711 |
// Event is not from today, use date text without year number
|
|
1712 |
return DateTextFromMsgLC( aMessage, EFalse );
|
|
1713 |
}
|
|
1714 |
}
|
|
1715 |
|
|
1716 |
|
|
1717 |
// -----------------------------------------------------------------------------
|
|
1718 |
// TFsEmailUiUtility::WeekDayTextFromMsgLC
|
|
1719 |
// -----------------------------------------------------------------------------
|
|
1720 |
HBufC* TFsEmailUiUtility::WeekDayTextFromMsgLC( const CFSMailMessage* aMessage,
|
|
1721 |
TBool aUseToday,
|
|
1722 |
TBool aUseYesterday,
|
|
1723 |
TBool& aWasToday,
|
|
1724 |
TBool& aWasYesterday )
|
|
1725 |
{
|
|
1726 |
FUNC_LOG;
|
|
1727 |
HBufC* ret(0);
|
|
1728 |
TTime eventTimeInHomeTime = aMessage->GetDate();
|
|
1729 |
TTime currentTime;
|
|
1730 |
currentTime.HomeTime();
|
|
1731 |
TLocale currentLocaleSettings;
|
|
1732 |
|
|
1733 |
// Correct current time and event time UTC offset and daylight saving time
|
|
1734 |
eventTimeInHomeTime = eventTimeInHomeTime +
|
|
1735 |
(currentLocaleSettings.UniversalTimeOffset());
|
|
1736 |
eventTimeInHomeTime += currentLocaleSettings.QueryHomeHasDaylightSavingOn()
|
|
1737 |
? TTimeIntervalHours(1) : TTimeIntervalHours(0);
|
|
1738 |
|
|
1739 |
TBool eventTimeIsToday(EFalse);
|
|
1740 |
TBool eventTimeIsYesterday(EFalse);
|
|
1741 |
// Check if year and day number in year are the same, e.g. today
|
|
1742 |
if ( currentTime.DayNoInYear() == eventTimeInHomeTime.DayNoInYear() &&
|
|
1743 |
currentTime.DateTime().Year() == eventTimeInHomeTime.DateTime().Year() )
|
|
1744 |
{
|
|
1745 |
eventTimeIsToday = ETrue;
|
|
1746 |
}
|
|
1747 |
// Check if year and current day number minus one in year are the same, e.g. yesterday
|
|
1748 |
else if ( currentTime.DayNoInYear()-1 == eventTimeInHomeTime.DayNoInYear() &&
|
|
1749 |
currentTime.DateTime().Year() == eventTimeInHomeTime.DateTime().Year() )
|
|
1750 |
{
|
|
1751 |
eventTimeIsYesterday = ETrue;
|
|
1752 |
}
|
|
1753 |
if ( aUseToday && eventTimeIsToday )
|
|
1754 |
{
|
|
1755 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_TODAY );
|
|
1756 |
aWasToday = ETrue;
|
|
1757 |
}
|
|
1758 |
else if ( aUseYesterday && eventTimeIsYesterday )
|
|
1759 |
{
|
|
1760 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_YESTERDAY );
|
|
1761 |
aWasYesterday = ETrue;
|
|
1762 |
}
|
|
1763 |
else
|
|
1764 |
{
|
|
1765 |
switch ( eventTimeInHomeTime.DayNoInWeek() )
|
|
1766 |
{
|
|
1767 |
case EMonday:
|
|
1768 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_MONDAY );
|
|
1769 |
break;
|
|
1770 |
case ETuesday:
|
|
1771 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_TUESDAY );
|
|
1772 |
break;
|
|
1773 |
case EWednesday:
|
|
1774 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_WEDNESDAY );
|
|
1775 |
break;
|
|
1776 |
case EThursday:
|
|
1777 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_THURSDAY );
|
|
1778 |
break;
|
|
1779 |
case EFriday:
|
|
1780 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_FRIDAY );
|
|
1781 |
break;
|
|
1782 |
case ESaturday:
|
|
1783 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_SATURDAY );
|
|
1784 |
break;
|
|
1785 |
case ESunday:
|
|
1786 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_WEEEKDAY_SUNDAY );
|
|
1787 |
break;
|
|
1788 |
}
|
|
1789 |
}
|
|
1790 |
return ret;
|
|
1791 |
}
|
|
1792 |
|
|
1793 |
|
|
1794 |
// -----------------------------------------------------------------------------
|
|
1795 |
// TFsEmailUiUtility::CreateSizeDescLC
|
|
1796 |
// -----------------------------------------------------------------------------
|
|
1797 |
HBufC* TFsEmailUiUtility::CreateSizeDescLC( TInt aSizeInBytes,
|
|
1798 |
TBool aShowSizeInBytes )
|
|
1799 |
{
|
|
1800 |
FUNC_LOG;
|
|
1801 |
HBufC* sizeDesc = NULL;
|
|
1802 |
|
|
1803 |
if ( aSizeInBytes >= KMega ) // Show in MB with one decimal
|
|
1804 |
{
|
|
1805 |
// The largest possible file size in 32bit architecture is 2^32 bytes = 4096 MB.
|
|
1806 |
// Thus, we need to reserve 4 characters for the megabyte part, one for decimal
|
|
1807 |
// separator, and one for decimal part.
|
|
1808 |
HBufC* numberBuf = HBufC::NewLC(4+1+1);
|
|
1809 |
TPtr numberDes = numberBuf->Des();
|
|
1810 |
|
|
1811 |
TInt megaBytePart = aSizeInBytes / KMega;
|
|
1812 |
TInt remainder = aSizeInBytes % KMega;
|
|
1813 |
TInt decimalPart = (remainder*10 + KMega/2) / KMega; // The +KMega/2 is used to get normal rounding rules
|
|
1814 |
// if decimal part gets rounded up to 10, we need to increment the megabyte part
|
|
1815 |
if ( decimalPart == 10 )
|
|
1816 |
{
|
|
1817 |
megaBytePart++;
|
|
1818 |
decimalPart = 0;
|
|
1819 |
}
|
|
1820 |
|
|
1821 |
TLocale locale;
|
|
1822 |
TChar decimalSeparator = locale.DecimalSeparator();
|
|
1823 |
|
|
1824 |
numberDes.Num( megaBytePart );
|
|
1825 |
numberDes.Append( decimalSeparator );
|
|
1826 |
numberDes.AppendNum( decimalPart );
|
|
1827 |
|
|
1828 |
if( aShowSizeInBytes )
|
|
1829 |
{
|
|
1830 |
sizeDesc = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_SIZE_IN_MB_WITH_BYTES,
|
|
1831 |
*numberBuf, aSizeInBytes );
|
|
1832 |
}
|
|
1833 |
else
|
|
1834 |
{
|
|
1835 |
sizeDesc = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_SIZE_IN_MB, *numberBuf );
|
|
1836 |
}
|
|
1837 |
CleanupStack::PopAndDestroy( numberBuf );
|
|
1838 |
CleanupStack::PushL( sizeDesc );
|
|
1839 |
}
|
|
1840 |
else if ( aSizeInBytes >= KKilo || aSizeInBytes == 0 ) // Show in kB without decimals
|
|
1841 |
{
|
|
1842 |
TInt sizeInKB = (aSizeInBytes + KKilo/2) / KKilo; // The +KKilo/2 is used to get normal rounding rules
|
|
1843 |
if( aShowSizeInBytes )
|
|
1844 |
{
|
|
1845 |
HBufC* numberBuf = HBufC::NewLC(8);
|
|
1846 |
TPtr numberDes = numberBuf->Des();
|
|
1847 |
numberDes.Num( sizeInKB );
|
|
1848 |
|
|
1849 |
sizeDesc = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_SIZE_IN_KB_WITH_BYTES,
|
|
1850 |
*numberBuf, aSizeInBytes );
|
|
1851 |
CleanupStack::PopAndDestroy( numberBuf );
|
|
1852 |
CleanupStack::PushL( sizeDesc );
|
|
1853 |
}
|
|
1854 |
else
|
|
1855 |
{
|
|
1856 |
sizeDesc = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SIZE_IN_KB, sizeInKB );
|
|
1857 |
}
|
|
1858 |
}
|
|
1859 |
else if ( aSizeInBytes > 0 ) // show "less than kilobyte"
|
|
1860 |
{
|
|
1861 |
if( aShowSizeInBytes )
|
|
1862 |
{
|
|
1863 |
sizeDesc = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SIZE_LESS_THAN_KB_WITH_BYTES,
|
|
1864 |
aSizeInBytes );
|
|
1865 |
}
|
|
1866 |
else
|
|
1867 |
{
|
|
1868 |
sizeDesc = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SIZE_LESS_THAN_KB );
|
|
1869 |
}
|
|
1870 |
}
|
|
1871 |
else // negative numbers are not supported
|
|
1872 |
{
|
|
1873 |
__ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) );
|
|
1874 |
sizeDesc = KNullDesC().AllocLC();
|
|
1875 |
}
|
|
1876 |
|
|
1877 |
// Do number conversion to Arabic/Eastern Arabic/Indic digits when necessary
|
|
1878 |
TPtr des = sizeDesc->Des();
|
|
1879 |
AknTextUtils::LanguageSpecificNumberConversion( des );
|
|
1880 |
|
|
1881 |
return sizeDesc;
|
|
1882 |
}
|
|
1883 |
|
|
1884 |
// -----------------------------------------------------------------------------
|
|
1885 |
// TFsEmailUiUtility::CompareMailSubjectsL
|
|
1886 |
// -----------------------------------------------------------------------------
|
|
1887 |
TInt TFsEmailUiUtility::CompareMailSubjectsL( const CFSMailMessage* aMessage1,
|
|
1888 |
const CFSMailMessage* aMessage2 )
|
|
1889 |
{
|
|
1890 |
FUNC_LOG;
|
|
1891 |
TInt result( 0 );
|
|
1892 |
|
|
1893 |
if ( aMessage1 && aMessage2 )
|
|
1894 |
{
|
|
1895 |
HBufC* compareSubject1 = CreateSubjectWithoutLocalisedPrefixLC( aMessage1, ETrue );
|
|
1896 |
compareSubject1->Des().LowerCase();
|
|
1897 |
HBufC* compareSubject2 = CreateSubjectWithoutLocalisedPrefixLC( aMessage2, ETrue );
|
|
1898 |
compareSubject2->Des().LowerCase();
|
|
1899 |
|
|
1900 |
result = compareSubject1->CompareC( *compareSubject2 );
|
|
1901 |
|
|
1902 |
CleanupStack::PopAndDestroy( compareSubject2 );
|
|
1903 |
CleanupStack::PopAndDestroy( compareSubject1 );
|
|
1904 |
}
|
|
1905 |
// Check if one subject pointer is valid instead of other -> result is non-zero.
|
|
1906 |
else if ( aMessage1 && !aMessage2 )
|
|
1907 |
{
|
|
1908 |
result = 1;
|
|
1909 |
}
|
|
1910 |
else if ( !aMessage1 && aMessage2 )
|
|
1911 |
{
|
|
1912 |
result = -1;
|
|
1913 |
}
|
|
1914 |
return result;
|
|
1915 |
}
|
|
1916 |
|
|
1917 |
// -----------------------------------------------------------------------------
|
|
1918 |
// TFsEmailUiUtility::CreateSubjectWithoutLocalisedPrefixLC
|
|
1919 |
// -----------------------------------------------------------------------------
|
|
1920 |
HBufC* TFsEmailUiUtility::CreateSubjectWithoutLocalisedPrefixLC(
|
|
1921 |
const CFSMailMessage* aMessage,
|
|
1922 |
TBool aSuppressNotAvailableText /*= EFalse*/ )
|
|
1923 |
{
|
|
1924 |
FUNC_LOG;
|
|
1925 |
TDesC* subject = &aMessage->GetSubject();
|
|
1926 |
TPtrC croppedSubject;
|
|
1927 |
if ( subject )
|
|
1928 |
{
|
|
1929 |
croppedSubject.Set( *subject );
|
|
1930 |
}
|
|
1931 |
|
|
1932 |
TBool prefixFound = EFalse;
|
|
1933 |
|
|
1934 |
do
|
|
1935 |
{
|
|
1936 |
prefixFound = EFalse;
|
|
1937 |
|
|
1938 |
// Remove leading white space before trying to find the prefix
|
|
1939 |
while( croppedSubject.Length() &&
|
|
1940 |
TChar(croppedSubject[0]).IsSpace() )
|
|
1941 |
{
|
|
1942 |
croppedSubject.Set( croppedSubject.Mid(1) );
|
|
1943 |
}
|
|
1944 |
|
|
1945 |
// try to find ":" at the beginning
|
|
1946 |
// Locate : character on location 1,2 and 3
|
|
1947 |
static const TInt KPrefixMinLength = 1;
|
|
1948 |
static const TInt KPrefixMaxLength = 3;
|
|
1949 |
static const TText KPrefixSeparator = ':';
|
|
1950 |
TInt separatorPosition = croppedSubject.Locate( KPrefixSeparator );
|
|
1951 |
if ( separatorPosition >= KPrefixMinLength &&
|
|
1952 |
separatorPosition <= KPrefixMaxLength )
|
|
1953 |
{
|
|
1954 |
TPtrC prefixCandidate = croppedSubject.Left( separatorPosition );
|
|
1955 |
// Only fully alphabetic prefixes are cropped
|
|
1956 |
TBool isAlpha = ETrue;
|
|
1957 |
for ( TInt i = 0 ; i < prefixCandidate.Length() ; ++i )
|
|
1958 |
{
|
|
1959 |
if ( !TChar( prefixCandidate[i] ).IsAlpha() )
|
|
1960 |
{
|
|
1961 |
isAlpha = EFalse;
|
|
1962 |
}
|
|
1963 |
}
|
|
1964 |
if ( isAlpha )
|
|
1965 |
{
|
|
1966 |
croppedSubject.Set( croppedSubject.Mid( separatorPosition+1 ) );
|
|
1967 |
prefixFound = ETrue;
|
|
1968 |
}
|
|
1969 |
}
|
|
1970 |
}
|
|
1971 |
while ( prefixFound );
|
|
1972 |
|
|
1973 |
HBufC* ret = croppedSubject.AllocLC();
|
|
1974 |
|
|
1975 |
// Filter out undesirable characters and remove extra white space
|
|
1976 |
TPtr retPtr = ret->Des();
|
|
1977 |
FilterListItemTextL( retPtr );
|
|
1978 |
|
|
1979 |
// Use "(no subject available)" text if subject is emtpy and this is not forbidden by caller
|
|
1980 |
if ( !ret->Length() && !aSuppressNotAvailableText )
|
|
1981 |
{
|
|
1982 |
CleanupStack::PopAndDestroy( ret );
|
|
1983 |
ret = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_NO_SUBJECT );
|
|
1984 |
}
|
|
1985 |
|
|
1986 |
return ret;
|
|
1987 |
}
|
|
1988 |
|
|
1989 |
// -----------------------------------------------------------------------------
|
|
1990 |
// TFsEmailUiUtility::CreateSubjectTextLC
|
|
1991 |
// -----------------------------------------------------------------------------
|
|
1992 |
HBufC* TFsEmailUiUtility::CreateSubjectTextLC( const CFSMailMessage* aMessage )
|
|
1993 |
{
|
|
1994 |
FUNC_LOG;
|
|
1995 |
HBufC* subjectText = NULL;
|
|
1996 |
|
|
1997 |
if ( aMessage )
|
|
1998 |
{
|
|
1999 |
const TDesC* subject = &aMessage->GetSubject();
|
|
2000 |
if ( subject )
|
|
2001 |
{
|
|
2002 |
subjectText = subject->AllocLC();
|
|
2003 |
TPtr ptr( subjectText->Des() );
|
|
2004 |
FilterListItemTextL( ptr );
|
|
2005 |
// discard the subject text if it's empty after the filtering
|
|
2006 |
if ( !subjectText->Length() )
|
|
2007 |
{
|
|
2008 |
CleanupStack::PopAndDestroy( subjectText );
|
|
2009 |
subjectText = NULL;
|
|
2010 |
}
|
|
2011 |
}
|
|
2012 |
}
|
|
2013 |
|
|
2014 |
// Use "(no subject available)" text if no other visible subject got
|
|
2015 |
if ( !subjectText )
|
|
2016 |
{
|
|
2017 |
subjectText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_NO_SUBJECT );
|
|
2018 |
}
|
|
2019 |
|
|
2020 |
return subjectText;
|
|
2021 |
}
|
|
2022 |
|
|
2023 |
|
|
2024 |
// -----------------------------------------------------------------------------
|
|
2025 |
// TFsEmailUiUtility::CreateBodyTextLC
|
|
2026 |
// -----------------------------------------------------------------------------
|
|
2027 |
HBufC* TFsEmailUiUtility::CreateBodyTextLC( const CFSMailMessage* aMessage )
|
|
2028 |
{
|
|
2029 |
FUNC_LOG;
|
|
2030 |
HBufC* bodyText = NULL;
|
|
2031 |
|
|
2032 |
if ( aMessage )
|
|
2033 |
{
|
|
2034 |
CFSMailMessage* msg = const_cast<CFSMailMessage*> (aMessage);
|
|
2035 |
CFSMailMessagePart* bodyPart = msg->PlainTextBodyPartL();
|
|
2036 |
if ( bodyPart )
|
|
2037 |
{
|
|
2038 |
CleanupStack::PushL( bodyPart );
|
|
2039 |
bodyText = HBufC::NewLC(bodyPart->ContentSize());
|
|
2040 |
TPtr ptr = bodyText->Des();
|
|
2041 |
bodyPart->GetContentToBufferL(ptr, 0);
|
|
2042 |
|
|
2043 |
FilterListItemTextL( ptr );
|
|
2044 |
// discard the subject text if it's empty after the filtering
|
|
2045 |
if ( !bodyText->Length() )
|
|
2046 |
{
|
|
2047 |
CleanupStack::PopAndDestroy( bodyText );
|
|
2048 |
bodyText = NULL;
|
|
2049 |
}
|
|
2050 |
CleanupStack::PopAndDestroy( bodyPart );
|
|
2051 |
}
|
|
2052 |
}
|
|
2053 |
|
|
2054 |
// Use "(no subject available)" text if no other visible subject got
|
|
2055 |
if ( !bodyText )
|
|
2056 |
{
|
|
2057 |
bodyText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_NO_SUBJECT );
|
|
2058 |
}
|
|
2059 |
|
|
2060 |
return bodyText;
|
|
2061 |
}
|
|
2062 |
|
|
2063 |
|
|
2064 |
|
|
2065 |
// ---------------------------------------------------------------------------
|
|
2066 |
// TFsEmailUiUtility::FilterPreviewPaneTextL
|
|
2067 |
// This function crops out tabulator and line feed characters from the given data.
|
|
2068 |
// After that, it will makes sure that there are no consecutive space characters for
|
|
2069 |
// preview pane text
|
|
2070 |
// ---------------------------------------------------------------------------
|
|
2071 |
//
|
|
2072 |
void TFsEmailUiUtility::FilterListItemTextL( TDes& aText )
|
|
2073 |
{
|
|
2074 |
FUNC_LOG;
|
|
2075 |
_LIT( KCharsToReplace, "\r\n\t\x2028\x2029" );
|
|
2076 |
|
|
2077 |
AknTextUtils::ReplaceCharacters( aText, KCharsToReplace, ' ' );
|
|
2078 |
aText.TrimAll();
|
|
2079 |
}
|
|
2080 |
|
|
2081 |
// -----------------------------------------------------------------------------
|
|
2082 |
// TFsEmailUiUtility::MessageSizeClass
|
|
2083 |
// -----------------------------------------------------------------------------
|
|
2084 |
TMessageSizeClass TFsEmailUiUtility::MessageSizeClass( const CFSMailMessage& aMessage )
|
|
2085 |
{
|
|
2086 |
FUNC_LOG;
|
|
2087 |
TUint msgSize = aMessage.ContentSize();
|
|
2088 |
TMessageSizeClass sizeClass;
|
|
2089 |
|
|
2090 |
if ( msgSize < ETiny )
|
|
2091 |
{
|
|
2092 |
sizeClass = ETiny;
|
|
2093 |
}
|
|
2094 |
else if ( msgSize < ESmall )
|
|
2095 |
{
|
|
2096 |
sizeClass = ESmall;
|
|
2097 |
}
|
|
2098 |
else if ( msgSize < EMedium )
|
|
2099 |
{
|
|
2100 |
sizeClass = EMedium;
|
|
2101 |
}
|
|
2102 |
else if ( msgSize < ELarge )
|
|
2103 |
{
|
|
2104 |
sizeClass = ELarge;
|
|
2105 |
}
|
|
2106 |
else if ( msgSize < EVeryLarge )
|
|
2107 |
{
|
|
2108 |
sizeClass = EVeryLarge;
|
|
2109 |
}
|
|
2110 |
else if ( msgSize < EHuge )
|
|
2111 |
{
|
|
2112 |
sizeClass = EHuge;
|
|
2113 |
}
|
|
2114 |
else
|
|
2115 |
{
|
|
2116 |
sizeClass = EColossal;
|
|
2117 |
}
|
|
2118 |
|
|
2119 |
return sizeClass;
|
|
2120 |
}
|
|
2121 |
|
|
2122 |
// -----------------------------------------------------------------------------
|
|
2123 |
// TFsEmailUiUtility::ConvertHtmlToTxtL
|
|
2124 |
// -----------------------------------------------------------------------------
|
|
2125 |
HBufC* TFsEmailUiUtility::ConvertHtmlToTxtL( const TDesC& aHtml )
|
|
2126 |
{
|
|
2127 |
FUNC_LOG;
|
|
2128 |
enum TPrevious
|
|
2129 |
{
|
|
2130 |
ENone, // Nothing special in previous character
|
|
2131 |
EHeadTag, // We are in head tag
|
|
2132 |
ETagEnd, // Previous character contained tag ending
|
|
2133 |
ESpace // Previous character contained space
|
|
2134 |
};
|
|
2135 |
|
|
2136 |
_LIT( KTagStart, "<" );
|
|
2137 |
_LIT( KTagEnd, ">" );
|
|
2138 |
_LIT( KHeadStart, "head" );
|
|
2139 |
_LIT( KHeadEnd, "/head>" );
|
|
2140 |
|
|
2141 |
TInt tagCount = 0; // Amount of nested tags
|
|
2142 |
TInt sizeToParse = aHtml.Length(); // How much we have to parse
|
|
2143 |
TPrevious previous = ENone; // Previous characters type.
|
|
2144 |
HBufC* txtBuffer = HBufC::NewLC( sizeToParse );
|
|
2145 |
|
|
2146 |
// HTML parsing.
|
|
2147 |
TInt lineFeedCount = 0;
|
|
2148 |
TInt index = 0; // Parsing index
|
|
2149 |
for ( index = 0; index < sizeToParse; index++ )
|
|
2150 |
{
|
|
2151 |
// Get the next character
|
|
2152 |
TPtrC ptr = aHtml.Mid( index, 1 );
|
|
2153 |
|
|
2154 |
// Are we in header
|
|
2155 |
if ( previous == EHeadTag )
|
|
2156 |
{
|
|
2157 |
// Is this a start of end tag
|
|
2158 |
if ( ptr.Compare( KTagStart ) == 0 &&
|
|
2159 |
index + KHeadEnd().Length() < sizeToParse )
|
|
2160 |
{
|
|
2161 |
ptr.Set( aHtml.Mid( index + 1, KHeadEnd().Length() ) );
|
|
2162 |
if ( ptr.Compare( KHeadEnd ) == 0 )
|
|
2163 |
{
|
|
2164 |
previous = ETagEnd;
|
|
2165 |
index += KHeadEnd().Length();
|
|
2166 |
}
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
}
|
|
2170 |
// Is this a start of the tag
|
|
2171 |
else if ( ptr.Compare( KTagStart ) == 0 )
|
|
2172 |
{
|
|
2173 |
lineFeedCount = 0;
|
|
2174 |
|
|
2175 |
if ( index + KHeadStart().Length() < sizeToParse )
|
|
2176 |
{
|
|
2177 |
ptr.Set( aHtml.Mid( index + 1, KHeadStart().Length() ) );
|
|
2178 |
if ( ptr.Compare( KHeadStart ) == 0 )
|
|
2179 |
{
|
|
2180 |
previous = EHeadTag;
|
|
2181 |
index += KHeadStart().Length();
|
|
2182 |
}
|
|
2183 |
}
|
|
2184 |
|
|
2185 |
if ( previous != EHeadTag )
|
|
2186 |
{
|
|
2187 |
// Increase the number of nested tags
|
|
2188 |
tagCount++;
|
|
2189 |
previous = ENone;
|
|
2190 |
}
|
|
2191 |
}
|
|
2192 |
// Are we inside of the tag
|
|
2193 |
else if ( tagCount > 0 )
|
|
2194 |
{
|
|
2195 |
// Is this the end of the tag
|
|
2196 |
if ( ptr.Compare( KTagEnd ) == 0 )
|
|
2197 |
{
|
|
2198 |
tagCount--;
|
|
2199 |
if ( tagCount < 0 )
|
|
2200 |
{
|
|
2201 |
// To avoid unnecessary errors convert negative
|
|
2202 |
// values to zero.
|
|
2203 |
tagCount = 0;
|
|
2204 |
}
|
|
2205 |
if ( tagCount == 0 )
|
|
2206 |
{
|
|
2207 |
previous = ETagEnd;
|
|
2208 |
}
|
|
2209 |
}
|
|
2210 |
}
|
|
2211 |
// We are not inside of the tag
|
|
2212 |
else
|
|
2213 |
{
|
|
2214 |
if ( previous == ETagEnd )
|
|
2215 |
{
|
|
2216 |
// Skip multiple line feed and carriage return characters
|
|
2217 |
if ( ptr.Compare( KCarriageReturn ) != 0 &&
|
|
2218 |
ptr.Compare( KLineFeed ) != 0 )
|
|
2219 |
{
|
|
2220 |
if ( lineFeedCount > 0 )
|
|
2221 |
{
|
|
2222 |
txtBuffer->Des().Append( KLineFeed );
|
|
2223 |
lineFeedCount = 0;
|
|
2224 |
}
|
|
2225 |
txtBuffer->Des().Append( ptr );
|
|
2226 |
previous = ENone;
|
|
2227 |
}
|
|
2228 |
else if ( ptr.Compare( KLineFeed ) == 0 )
|
|
2229 |
{
|
|
2230 |
lineFeedCount++;
|
|
2231 |
}
|
|
2232 |
}
|
|
2233 |
else
|
|
2234 |
{
|
|
2235 |
if ( previous == ESpace )
|
|
2236 |
{
|
|
2237 |
// Skip consecutive spaces
|
|
2238 |
// if ( ptr.Compare( KSpace ) != 0 )
|
|
2239 |
// {
|
|
2240 |
txtBuffer->Des().Append( ptr );
|
|
2241 |
// }
|
|
2242 |
}
|
|
2243 |
else
|
|
2244 |
{
|
|
2245 |
txtBuffer->Des().Append( ptr );
|
|
2246 |
}
|
|
2247 |
if ( ptr.Compare( KSpace ) == 0 )
|
|
2248 |
{
|
|
2249 |
previous = ESpace;
|
|
2250 |
}
|
|
2251 |
else
|
|
2252 |
{
|
|
2253 |
previous = ENone;
|
|
2254 |
}
|
|
2255 |
}
|
|
2256 |
}
|
|
2257 |
}
|
|
2258 |
|
|
2259 |
CleanupStack::Pop( txtBuffer );
|
|
2260 |
|
|
2261 |
return txtBuffer;
|
|
2262 |
}
|
|
2263 |
|
|
2264 |
// -----------------------------------------------------------------------------
|
|
2265 |
// TFsEmailUiUtility::CompareMailAddressesL
|
|
2266 |
// -----------------------------------------------------------------------------
|
|
2267 |
TInt TFsEmailUiUtility::CompareMailAddressesL( CFSMailAddress* aAddr1,
|
|
2268 |
CFSMailAddress* aAddr2 )
|
|
2269 |
{
|
|
2270 |
FUNC_LOG;
|
|
2271 |
TInt result( 0 );
|
|
2272 |
if ( aAddr1 && aAddr2 )
|
|
2273 |
{
|
|
2274 |
HBufC* compareName1 = CreateCompareNameForAddressLC( *aAddr1 );
|
|
2275 |
HBufC* compareName2 = CreateCompareNameForAddressLC( *aAddr2 );
|
|
2276 |
|
|
2277 |
result = compareName1->CompareC( *compareName2 );
|
|
2278 |
|
|
2279 |
CleanupStack::PopAndDestroy( compareName2 );
|
|
2280 |
CleanupStack::PopAndDestroy( compareName1 );
|
|
2281 |
}
|
|
2282 |
// Check if one address pointer is valid instead of other -> result is non-zero.
|
|
2283 |
else if ( ( aAddr1 && !aAddr2 ) )
|
|
2284 |
{
|
|
2285 |
result = 1;
|
|
2286 |
}
|
|
2287 |
else if ( !aAddr1 && aAddr2 )
|
|
2288 |
{
|
|
2289 |
result = -1;
|
|
2290 |
}
|
|
2291 |
return result;
|
|
2292 |
}
|
|
2293 |
|
|
2294 |
// -----------------------------------------------------------------------------
|
|
2295 |
// TFsEmailUiUtility::CreateCompareNameForAddressLC
|
|
2296 |
// -----------------------------------------------------------------------------
|
|
2297 |
HBufC* TFsEmailUiUtility::CreateCompareNameForAddressLC( const CFSMailAddress& aAddress )
|
|
2298 |
{
|
|
2299 |
FUNC_LOG;
|
|
2300 |
HBufC* result = NULL;
|
|
2301 |
|
|
2302 |
TDesC* displayName = &aAddress.GetDisplayName();
|
|
2303 |
TDesC* emailAddress = &aAddress.GetEmailAddress();
|
|
2304 |
|
|
2305 |
if ( displayName && displayName->Length() )
|
|
2306 |
{
|
|
2307 |
result = displayName->AllocLC();
|
|
2308 |
}
|
|
2309 |
else if ( emailAddress && emailAddress->Length() )
|
|
2310 |
{
|
|
2311 |
result = emailAddress->AllocLC();
|
|
2312 |
}
|
|
2313 |
else
|
|
2314 |
{
|
|
2315 |
result = KNullDesC().AllocLC();
|
|
2316 |
}
|
|
2317 |
|
|
2318 |
result->Des().LowerCase();
|
|
2319 |
return result;
|
|
2320 |
}
|
|
2321 |
|
|
2322 |
// -----------------------------------------------------------------------------
|
|
2323 |
// TFsEmailUiUtility::CountRecepients
|
|
2324 |
// -----------------------------------------------------------------------------
|
|
2325 |
TInt TFsEmailUiUtility::CountRecepients( CFSMailMessage* aMsgPtr )
|
|
2326 |
{
|
|
2327 |
FUNC_LOG;
|
|
2328 |
return aMsgPtr->GetToRecipients().Count() + aMsgPtr->GetCCRecipients().Count();
|
|
2329 |
}
|
|
2330 |
|
|
2331 |
// -----------------------------------------------------------------------------
|
|
2332 |
// TFsEmailUiUtility::CountRecipientsSmart
|
|
2333 |
// Calculates recipient count from To and Cc recipient as well as tries to
|
|
2334 |
// see if the message is sent via message list.
|
|
2335 |
// -----------------------------------------------------------------------------
|
|
2336 |
TInt TFsEmailUiUtility::CountRecipientsSmart( CFreestyleEmailUiAppUi& aAppUi, CFSMailMessage* aMsgPtr )
|
|
2337 |
{
|
|
2338 |
FUNC_LOG;
|
|
2339 |
TInt numRecipients( CountRecepients( aMsgPtr ) );
|
|
2340 |
if ( numRecipients == 1 )
|
|
2341 |
{
|
|
2342 |
CFSMailBox* mailBox = NULL;
|
|
2343 |
|
|
2344 |
TRAPD( error, mailBox = aAppUi.GetMailClient()->GetMailBoxByUidL( aMsgPtr->GetMailBoxId() ) );
|
|
2345 |
|
|
2346 |
if (mailBox && !error)
|
|
2347 |
{
|
|
2348 |
//check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
|
|
2349 |
//email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI.
|
|
2350 |
if ( aMsgPtr->GetToRecipients().Count() )
|
|
2351 |
{
|
|
2352 |
if ( mailBox->OwnMailAddress().GetEmailAddress().CompareF(aMsgPtr->GetToRecipients()[0]->GetEmailAddress()) )
|
|
2353 |
{
|
|
2354 |
numRecipients++;
|
|
2355 |
}
|
|
2356 |
}
|
|
2357 |
if ( aMsgPtr->GetCCRecipients().Count() )
|
|
2358 |
{
|
|
2359 |
if ( mailBox->OwnMailAddress().GetEmailAddress().CompareF(aMsgPtr->GetCCRecipients()[0]->GetEmailAddress()) )
|
|
2360 |
{
|
|
2361 |
numRecipients++;
|
|
2362 |
}
|
|
2363 |
}
|
|
2364 |
if ( aMsgPtr->GetBCCRecipients().Count() )
|
|
2365 |
{
|
|
2366 |
if ( mailBox->OwnMailAddress().GetEmailAddress().CompareF(aMsgPtr->GetBCCRecipients()[0]->GetEmailAddress()) )
|
|
2367 |
{
|
|
2368 |
numRecipients++;
|
|
2369 |
}
|
|
2370 |
}
|
|
2371 |
}
|
|
2372 |
|
|
2373 |
delete mailBox;
|
|
2374 |
}
|
|
2375 |
|
|
2376 |
return numRecipients;
|
|
2377 |
}
|
|
2378 |
|
|
2379 |
// -----------------------------------------------------------------------------
|
|
2380 |
// TFsEmailUiUtility::IsMessageBodyLargeL
|
|
2381 |
// -----------------------------------------------------------------------------
|
|
2382 |
TBool TFsEmailUiUtility::IsMessageBodyLargeL( CFSMailMessage* aMessage )
|
|
2383 |
{
|
|
2384 |
FUNC_LOG;
|
|
2385 |
TBool ret = EFalse;
|
|
2386 |
if ( aMessage )
|
|
2387 |
{
|
|
2388 |
CFSMailMessagePart* plainTextBodyPart = aMessage->PlainTextBodyPartL();
|
|
2389 |
CleanupStack::PushL( plainTextBodyPart );
|
|
2390 |
CFSMailMessagePart* htmlBodyPart = aMessage->HtmlBodyPartL();
|
|
2391 |
CleanupStack::PushL( htmlBodyPart );
|
|
2392 |
|
|
2393 |
if ( (plainTextBodyPart && plainTextBodyPart->FetchedContentSize() > KLargePlainTextSizeLimit) ||
|
|
2394 |
(htmlBodyPart && htmlBodyPart->FetchedContentSize() > KLargeHtmlTextSizeLimit) )
|
|
2395 |
{
|
|
2396 |
ret = ETrue;
|
|
2397 |
}
|
|
2398 |
|
|
2399 |
CleanupStack::PopAndDestroy( htmlBodyPart );
|
|
2400 |
CleanupStack::PopAndDestroy( plainTextBodyPart );
|
|
2401 |
}
|
|
2402 |
return ret;
|
|
2403 |
}
|
|
2404 |
|
|
2405 |
// -----------------------------------------------------------------------------
|
|
2406 |
// TFsEmailUiUtility::GetUnreadMsgIconL
|
|
2407 |
// -----------------------------------------------------------------------------
|
|
2408 |
TFSEmailUiTextures TFsEmailUiUtility::GetUnreadMsgIcon( CFSMailMessage* aMsgPtr )
|
|
2409 |
{
|
|
2410 |
FUNC_LOG;
|
|
2411 |
TFSEmailUiTextures textureId;
|
|
2412 |
// Unread calendar invitation
|
|
2413 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_CalendarMsg ))
|
|
2414 |
{
|
|
2415 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important ) )
|
|
2416 |
{
|
|
2417 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2418 |
{
|
|
2419 |
textureId = EMessageCalInvitationAttachmentsHighPrio ;
|
|
2420 |
}
|
|
2421 |
else
|
|
2422 |
{
|
|
2423 |
textureId = EMessageCalInvitationHighPrio;
|
|
2424 |
}
|
|
2425 |
}
|
|
2426 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) )
|
|
2427 |
{
|
|
2428 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2429 |
{
|
|
2430 |
textureId = EMessageCalInvitationAttachmentsLowPrio;
|
|
2431 |
}
|
|
2432 |
else
|
|
2433 |
{
|
|
2434 |
textureId = EMessageCalInvitationLowPrio;
|
|
2435 |
}
|
|
2436 |
}
|
|
2437 |
else
|
|
2438 |
{
|
|
2439 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2440 |
{
|
|
2441 |
textureId = EMessageCalInvitationAttachments;
|
|
2442 |
}
|
|
2443 |
else
|
|
2444 |
{
|
|
2445 |
textureId = EMessageCalInvitation;
|
|
2446 |
}
|
|
2447 |
}
|
|
2448 |
// <cmail>
|
|
2449 |
TBool cancellationMsg = EFalse;
|
|
2450 |
//TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
|
|
2451 |
if ( cancellationMsg )
|
|
2452 |
{
|
|
2453 |
textureId = EMessageCalInvitationCancelled;
|
|
2454 |
}
|
|
2455 |
// </cmail>
|
|
2456 |
}
|
|
2457 |
else // Normal message icons
|
|
2458 |
{
|
|
2459 |
// Check whether msg has attachment or not
|
|
2460 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments )) // Has attachments
|
|
2461 |
{
|
|
2462 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important )) // High priority, has attachments
|
|
2463 |
{
|
|
2464 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2465 |
{
|
|
2466 |
textureId = EMessageUnreadRepliedHighPrioIconAttachment;
|
|
2467 |
}
|
|
2468 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2469 |
{
|
|
2470 |
textureId = EMessageUnreadForwardedHighPrioIconAttachment;
|
|
2471 |
}
|
|
2472 |
else
|
|
2473 |
{
|
|
2474 |
textureId = EMessageHighPrioUnreadIconAttachment;
|
|
2475 |
}
|
|
2476 |
}
|
|
2477 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, has attachments
|
|
2478 |
{
|
|
2479 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2480 |
{
|
|
2481 |
textureId = EMessageUnreadRepliedLowPrioIconAttachment;
|
|
2482 |
}
|
|
2483 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2484 |
{
|
|
2485 |
textureId = EMessageUnreadForwardedLowPrioIconAttachment;
|
|
2486 |
}
|
|
2487 |
else
|
|
2488 |
{
|
|
2489 |
textureId = EMessageLowPrioUnreadIconAttachment;
|
|
2490 |
}
|
|
2491 |
}
|
|
2492 |
else // Normal priority, has attachments
|
|
2493 |
{
|
|
2494 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2495 |
{
|
|
2496 |
textureId = EMessageUnreadRepliedIconAttachment;
|
|
2497 |
}
|
|
2498 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2499 |
{
|
|
2500 |
textureId = EMessageUnreadForwardedIconAttachment;
|
|
2501 |
}
|
|
2502 |
else
|
|
2503 |
{
|
|
2504 |
textureId = EMessageUnreadIconAttachment;
|
|
2505 |
}
|
|
2506 |
}
|
|
2507 |
}
|
|
2508 |
|
|
2509 |
else // No attachments
|
|
2510 |
{
|
|
2511 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important )) // High priority, no attachments
|
|
2512 |
{
|
|
2513 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2514 |
{
|
|
2515 |
textureId = EMessageUnreadRepliedHighPrioIcon;
|
|
2516 |
}
|
|
2517 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2518 |
{
|
|
2519 |
textureId = EMessageUnreadForwardedHighPrioIcon;
|
|
2520 |
}
|
|
2521 |
else
|
|
2522 |
{
|
|
2523 |
textureId = EMessageHighPrioUnreadIcon;
|
|
2524 |
}
|
|
2525 |
}
|
|
2526 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, no attachments
|
|
2527 |
{
|
|
2528 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2529 |
{
|
|
2530 |
textureId = EMessageUnreadRepliedLowPrioIcon;
|
|
2531 |
}
|
|
2532 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2533 |
{
|
|
2534 |
textureId = EMessageUnreadForwardedLowPrioIcon;
|
|
2535 |
}
|
|
2536 |
else
|
|
2537 |
{
|
|
2538 |
textureId = EMessageLowPrioUnreadIcon;
|
|
2539 |
}
|
|
2540 |
}
|
|
2541 |
else // Normal priority, no attachments
|
|
2542 |
{
|
|
2543 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2544 |
{
|
|
2545 |
textureId = EMessageUnreadRepliedIcon;
|
|
2546 |
}
|
|
2547 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2548 |
{
|
|
2549 |
textureId = EMessageUnreadForwardedIcon;
|
|
2550 |
}
|
|
2551 |
else
|
|
2552 |
{
|
|
2553 |
textureId = EMessageUnreadIcon;
|
|
2554 |
}
|
|
2555 |
}
|
|
2556 |
}
|
|
2557 |
}
|
|
2558 |
return textureId;
|
|
2559 |
}
|
|
2560 |
|
|
2561 |
|
|
2562 |
// -----------------------------------------------------------------------------
|
|
2563 |
// TFsEmailUiUtility::GetReadMsgIconL
|
|
2564 |
// -----------------------------------------------------------------------------
|
|
2565 |
TFSEmailUiTextures TFsEmailUiUtility::GetReadMsgIcon( CFSMailMessage* aMsgPtr )
|
|
2566 |
{
|
|
2567 |
FUNC_LOG;
|
|
2568 |
TFSEmailUiTextures textureId;
|
|
2569 |
// Check for calendar invitation first
|
|
2570 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_CalendarMsg ))
|
|
2571 |
{
|
|
2572 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important ) )
|
|
2573 |
{
|
|
2574 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2575 |
{
|
|
2576 |
textureId = EMessageCalInvitationReadAttachmentsHighPrio ;
|
|
2577 |
}
|
|
2578 |
else
|
|
2579 |
{
|
|
2580 |
textureId = EMessageCalInvitationReadHighPrio;
|
|
2581 |
}
|
|
2582 |
}
|
|
2583 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) )
|
|
2584 |
{
|
|
2585 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2586 |
{
|
|
2587 |
textureId = EMessageCalInvitationReadAttachmentsLowPrio;
|
|
2588 |
}
|
|
2589 |
else
|
|
2590 |
{
|
|
2591 |
textureId = EMessageCalInvitationReadLowPrio;
|
|
2592 |
}
|
|
2593 |
}
|
|
2594 |
else
|
|
2595 |
{
|
|
2596 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments ) )
|
|
2597 |
{
|
|
2598 |
textureId = EMessageCalInvitationReadAttachments;
|
|
2599 |
}
|
|
2600 |
else
|
|
2601 |
{
|
|
2602 |
textureId = EMessageCalInvitationRead;
|
|
2603 |
}
|
|
2604 |
}
|
|
2605 |
// <cmail>
|
|
2606 |
TBool cancellationMsg = EFalse;
|
|
2607 |
//TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
|
|
2608 |
if ( cancellationMsg )
|
|
2609 |
{
|
|
2610 |
textureId = EMessageCalInvitationCancelled;
|
|
2611 |
}
|
|
2612 |
// </cmail>
|
|
2613 |
}
|
|
2614 |
else // Normal message icons
|
|
2615 |
{
|
|
2616 |
// Check whether msg has attachment or not
|
|
2617 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Attachments )) // Has attachments
|
|
2618 |
{
|
|
2619 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important )) // High priority, has attachments
|
|
2620 |
{
|
|
2621 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2622 |
{
|
|
2623 |
textureId = EMessageReadRepliedHighPrioIconAttachment;
|
|
2624 |
}
|
|
2625 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2626 |
{
|
|
2627 |
textureId = EMessageReadForwardedHighPrioIconAttachment;
|
|
2628 |
}
|
|
2629 |
else
|
|
2630 |
{
|
|
2631 |
textureId = EMessageHighPrioReadIconAttachment;
|
|
2632 |
}
|
|
2633 |
}
|
|
2634 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, has attachments
|
|
2635 |
{
|
|
2636 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2637 |
{
|
|
2638 |
textureId = EMessageReadRepliedLowPrioIconAttachment;
|
|
2639 |
}
|
|
2640 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2641 |
{
|
|
2642 |
textureId = EMessageReadForwardedLowPrioIconAttachment;
|
|
2643 |
}
|
|
2644 |
else
|
|
2645 |
{
|
|
2646 |
textureId = EMessageLowPrioReadIconAttachment;
|
|
2647 |
}
|
|
2648 |
}
|
|
2649 |
else // Normal priority, has attachments
|
|
2650 |
{
|
|
2651 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2652 |
{
|
|
2653 |
textureId = EMessageReadRepliedIconAttachment;
|
|
2654 |
}
|
|
2655 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2656 |
{
|
|
2657 |
textureId = EMessageReadForwardedIconAttachment;
|
|
2658 |
}
|
|
2659 |
else
|
|
2660 |
{
|
|
2661 |
textureId = EMessageReadIconAttachment;
|
|
2662 |
}
|
|
2663 |
}
|
|
2664 |
}
|
|
2665 |
else // No attachments
|
|
2666 |
{
|
|
2667 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Important )) // High priority, no attachments
|
|
2668 |
{
|
|
2669 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2670 |
{
|
|
2671 |
textureId = EMessageReadRepliedHighPrioIcon;
|
|
2672 |
}
|
|
2673 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2674 |
{
|
|
2675 |
textureId = EMessageReadForwardedHighPrioIcon;
|
|
2676 |
}
|
|
2677 |
else
|
|
2678 |
{
|
|
2679 |
textureId = EMessageHighPrioReadIcon;
|
|
2680 |
}
|
|
2681 |
}
|
|
2682 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Low ) ) // Low priority, no attachments
|
|
2683 |
{
|
|
2684 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2685 |
{
|
|
2686 |
textureId = EMessageReadRepliedLowPrioIcon;
|
|
2687 |
}
|
|
2688 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2689 |
{
|
|
2690 |
textureId = EMessageReadForwardedLowPrioIcon;
|
|
2691 |
}
|
|
2692 |
else
|
|
2693 |
{
|
|
2694 |
textureId = EMessageLowPrioReadIcon;
|
|
2695 |
}
|
|
2696 |
}
|
|
2697 |
else // Normal priority, no attachments
|
|
2698 |
{
|
|
2699 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Answered ) )
|
|
2700 |
{
|
|
2701 |
textureId = EMessageReadRepliedIcon;
|
|
2702 |
}
|
|
2703 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_Forwarded ) )
|
|
2704 |
{
|
|
2705 |
textureId = EMessageReadForwardedIcon;
|
|
2706 |
}
|
|
2707 |
else
|
|
2708 |
{
|
|
2709 |
textureId = EMessageReadIcon;
|
|
2710 |
}
|
|
2711 |
}
|
|
2712 |
}
|
|
2713 |
}
|
|
2714 |
return textureId;
|
|
2715 |
}
|
|
2716 |
|
|
2717 |
// <cmail>
|
|
2718 |
// -----------------------------------------------------------------------------
|
|
2719 |
// TFsEmailUiUtility::IsMrCancellationMsgL
|
|
2720 |
// -----------------------------------------------------------------------------
|
|
2721 |
TBool TFsEmailUiUtility::IsMrCancellationMsgL( CFSMailMessage* aMsgPtr )
|
|
2722 |
{
|
|
2723 |
FUNC_LOG;
|
|
2724 |
TBool isCancel = EFalse;
|
|
2725 |
|
|
2726 |
if ( !iMrViewer )
|
|
2727 |
{
|
|
2728 |
if ( !iMrViewerCallback )
|
|
2729 |
{
|
|
2730 |
iMrViewerCallback = new (ELeave) CMrViewerEmptyCallback;
|
|
2731 |
}
|
|
2732 |
iMrViewer = CESMRIcalViewer::NewL( *iMrViewerCallback );
|
|
2733 |
}
|
|
2734 |
|
|
2735 |
TESMRMeetingRequestMethod method = iMrViewer->ResolveMeetingRequestMethodL(*aMsgPtr);
|
|
2736 |
if ( method == EESMRMeetingRequestMethodCancellation )
|
|
2737 |
{
|
|
2738 |
isCancel = ETrue;
|
|
2739 |
}
|
|
2740 |
|
|
2741 |
return isCancel;
|
|
2742 |
}
|
|
2743 |
// </cmail>
|
|
2744 |
|
|
2745 |
// -----------------------------------------------------------------------------
|
|
2746 |
// TFsEmailUiUtility::CopyToClipboardL
|
|
2747 |
// -----------------------------------------------------------------------------
|
|
2748 |
void TFsEmailUiUtility::CopyToClipboardL( const TDesC &aBuf )
|
|
2749 |
{
|
|
2750 |
FUNC_LOG;
|
|
2751 |
CClipboard* cb = CClipboard::NewForWritingLC( CCoeEnv::Static()->FsSession() );
|
|
2752 |
|
|
2753 |
cb->StreamDictionary().At( KClipboardUidTypePlainText );
|
|
2754 |
|
|
2755 |
CPlainText* plainText = CPlainText::NewL();
|
|
2756 |
CleanupStack::PushL( plainText );
|
|
2757 |
|
|
2758 |
plainText->InsertL( 0 , aBuf );
|
|
2759 |
|
|
2760 |
plainText->CopyToStoreL( cb->Store(), cb->StreamDictionary(), 0, plainText->DocumentLength() );
|
|
2761 |
|
|
2762 |
CleanupStack::PopAndDestroy( plainText );
|
|
2763 |
cb->CommitL();
|
|
2764 |
CleanupStack::PopAndDestroy( cb );
|
|
2765 |
}
|
|
2766 |
|
|
2767 |
// -----------------------------------------------------------------------------
|
|
2768 |
// TFsEmailUiUtility::ToggleEmailIconL
|
|
2769 |
// -----------------------------------------------------------------------------
|
|
2770 |
void TFsEmailUiUtility::ToggleEmailIconL(TBool aIconOn )
|
|
2771 |
{
|
|
2772 |
FUNC_LOG;
|
|
2773 |
//Toggle email status indicator
|
|
2774 |
if(aIconOn)
|
|
2775 |
{
|
|
2776 |
RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsNewEmailStatus, ECoreAppUIsNewEmail );
|
|
2777 |
}
|
|
2778 |
else
|
|
2779 |
{
|
|
2780 |
RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsNewEmailStatus, ECoreAppUIsNoNewEmail );
|
|
2781 |
}
|
|
2782 |
}
|
|
2783 |
|
|
2784 |
// -----------------------------------------------------------------------------
|
|
2785 |
// TFsEmailUiUtility::ToggleEmailIconL
|
|
2786 |
// -----------------------------------------------------------------------------
|
|
2787 |
void TFsEmailUiUtility::ToggleEmailIconL( TBool aIconOn, const TFSMailMsgId& aMailBox )
|
|
2788 |
{
|
|
2789 |
FUNC_LOG;
|
|
2790 |
//Toggle email status indicator
|
|
2791 |
//This is only used for mailwidget status updating
|
|
2792 |
/*if(aIconOn)
|
|
2793 |
{
|
|
2794 |
RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsNewEmailStatus, ECoreAppUIsNewEmail );
|
|
2795 |
}
|
|
2796 |
else
|
|
2797 |
{
|
|
2798 |
RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsNewEmailStatus, ECoreAppUIsNoNewEmail );
|
|
2799 |
}*/
|
|
2800 |
|
|
2801 |
//Toggle new mail icon in widget
|
|
2802 |
if (aMailBox.Id())
|
|
2803 |
{
|
|
2804 |
CRepository* repository(NULL);
|
|
2805 |
TRAPD( err, repository = CRepository::NewL( KCRUidCmailWidget ) );
|
|
2806 |
if ( err == KErrNone )
|
|
2807 |
{
|
|
2808 |
TBuf<256> mailbox;
|
|
2809 |
mailbox.Num(aMailBox.Id());
|
|
2810 |
|
|
2811 |
TBuf<256> str;
|
|
2812 |
str.Copy(_L("<"));
|
|
2813 |
str.Append(mailbox);
|
|
2814 |
str.Append(_L(">"));
|
|
2815 |
|
|
2816 |
TBuf<256> stored;
|
|
2817 |
TUint32 key(KCMailMailboxesWithNewMail);
|
|
2818 |
repository->Get( key, stored );
|
|
2819 |
|
|
2820 |
TInt result = stored.Find(str);
|
|
2821 |
|
|
2822 |
if (aIconOn)
|
|
2823 |
{
|
|
2824 |
if (result < 0) // Not found
|
|
2825 |
{
|
|
2826 |
stored.Append(str);
|
|
2827 |
repository->Set( key, stored );
|
|
2828 |
}
|
|
2829 |
}
|
|
2830 |
else
|
|
2831 |
{
|
|
2832 |
if (result >= 0)
|
|
2833 |
{
|
|
2834 |
stored.Delete(result, str.Length());
|
|
2835 |
repository->Set( key, stored );
|
|
2836 |
}
|
|
2837 |
}
|
|
2838 |
}
|
|
2839 |
delete repository;
|
|
2840 |
}
|
|
2841 |
}
|
|
2842 |
|
|
2843 |
// -----------------------------------------------------------------------------
|
|
2844 |
// TFsEmailUiUtility::DisplayMsgsMovedNoteL
|
|
2845 |
// -----------------------------------------------------------------------------
|
|
2846 |
void TFsEmailUiUtility::DisplayMsgsMovedNoteL( TInt aMsgCount, const TFSMailMsgId aDestinationFolderId,
|
|
2847 |
TBool /*aIsWaitingNote*/ )
|
|
2848 |
{
|
|
2849 |
FUNC_LOG;
|
|
2850 |
if ( aDestinationFolderId.Id() != 0 )
|
|
2851 |
{
|
|
2852 |
CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
|
|
2853 |
CFSMailFolder* folder = appUi->GetMailClient()->GetFolderByUidL( appUi->GetActiveMailboxId(), aDestinationFolderId );
|
|
2854 |
if ( folder )
|
|
2855 |
{
|
|
2856 |
CleanupStack::PushL( folder );
|
|
2857 |
HBufC* folderName(0);
|
|
2858 |
TInt folderType = folder->GetFolderType();
|
|
2859 |
switch ( folderType )
|
|
2860 |
{
|
|
2861 |
case EFSInbox:
|
|
2862 |
{
|
|
2863 |
folderName = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_INBOX );
|
|
2864 |
}
|
|
2865 |
break;
|
|
2866 |
case EFSOutbox:
|
|
2867 |
{
|
|
2868 |
folderName = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_OUTBOX );
|
|
2869 |
}
|
|
2870 |
break;
|
|
2871 |
case EFSDraftsFolder:
|
|
2872 |
{
|
|
2873 |
folderName = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_DRAFTS );
|
|
2874 |
}
|
|
2875 |
break;
|
|
2876 |
case EFSSentFolder:
|
|
2877 |
{
|
|
2878 |
folderName = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_SENT );
|
|
2879 |
}
|
|
2880 |
break;
|
|
2881 |
case EFSDeleted:
|
|
2882 |
{
|
|
2883 |
folderName = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_FOLDER_LIST_DELETED );
|
|
2884 |
}
|
|
2885 |
break;
|
|
2886 |
default:
|
|
2887 |
{
|
|
2888 |
folderName = HBufC::NewLC( folder->GetFolderName().Length() );
|
|
2889 |
folderName->Des().Append( folder->GetFolderName() );
|
|
2890 |
}
|
|
2891 |
break;
|
|
2892 |
}
|
|
2893 |
if ( aMsgCount == 1)
|
|
2894 |
{
|
|
2895 |
HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MESSAGE_TO_FOLDER, *folderName );
|
|
2896 |
// <cmail> replace global note with aknnote to allow exiting with red key
|
|
2897 |
//CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
|
|
2898 |
//globalNote->ShowNoteL( EAknGlobalInformationNote, *noteText );
|
|
2899 |
CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
|
|
2900 |
note->ExecuteLD( *noteText );
|
|
2901 |
CleanupStack::PopAndDestroy( noteText );
|
|
2902 |
//CleanupStack::PopAndDestroy( 2 );
|
|
2903 |
// </cmail>
|
|
2904 |
}
|
|
2905 |
else if ( aMsgCount > 1 )
|
|
2906 |
{
|
|
2907 |
HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MESSAGES_TO_FOLDER, *folderName, aMsgCount );
|
|
2908 |
// <cmail> replace global note with aknnote to allow exiting with red key
|
|
2909 |
//CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
|
|
2910 |
//globalNote->ShowNoteL( EAknGlobalInformationNote, *noteText );
|
|
2911 |
CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
|
|
2912 |
note->ExecuteLD( *noteText );
|
|
2913 |
CleanupStack::PopAndDestroy( noteText );
|
|
2914 |
// CleanupStack::PopAndDestroy( 2 );
|
|
2915 |
// </cmail>
|
|
2916 |
}
|
|
2917 |
CleanupStack::PopAndDestroy( folderName );
|
|
2918 |
CleanupStack::PopAndDestroy( folder );
|
|
2919 |
}
|
|
2920 |
}
|
|
2921 |
}
|
|
2922 |
|
|
2923 |
// ---------------------------------------------------------------------------
|
|
2924 |
// TFsEmailUiUtility::IsOfflineModeL
|
|
2925 |
// ---------------------------------------------------------------------------
|
|
2926 |
//
|
|
2927 |
TBool TFsEmailUiUtility::IsOfflineModeL()
|
|
2928 |
{
|
|
2929 |
FUNC_LOG;
|
|
2930 |
TBool isOffline( EFalse );
|
|
2931 |
TInt status( ECoreAppUIsNetworkConnectionAllowed );
|
|
2932 |
|
|
2933 |
CRepository* cenRep = CRepository::NewL( KCRUidCoreApplicationUIs );
|
|
2934 |
if ( cenRep )
|
|
2935 |
{
|
|
2936 |
cenRep->Get( KCoreAppUIsNetworkConnectionAllowed, status );
|
|
2937 |
}
|
|
2938 |
delete cenRep;
|
|
2939 |
|
|
2940 |
if ( status == ECoreAppUIsNetworkConnectionNotAllowed )
|
|
2941 |
{
|
|
2942 |
isOffline = ETrue;
|
|
2943 |
}
|
|
2944 |
|
|
2945 |
return isOffline;
|
|
2946 |
}
|
|
2947 |
|
|
2948 |
// ---------------------------------------------------------------------------
|
|
2949 |
// TFsEmailUiUtility::StripDisplayName
|
|
2950 |
// Drop out unwanted characters from display name such as <> and ""
|
|
2951 |
// ---------------------------------------------------------------------------
|
|
2952 |
void TFsEmailUiUtility::StripDisplayName( HBufC& aDisplayName )
|
|
2953 |
{
|
|
2954 |
FUNC_LOG;
|
|
2955 |
// Drop out unwanted chars from display name
|
|
2956 |
if ( aDisplayName.Length() > 2)
|
|
2957 |
{
|
|
2958 |
// Drop out <> and "" characters.
|
|
2959 |
if ( aDisplayName.Locate('"') == 0 ) // check if first char is quation mark
|
|
2960 |
{
|
|
2961 |
if ( aDisplayName.LocateReverse('"') == aDisplayName.Length()-1 ) // last char
|
|
2962 |
{
|
|
2963 |
// Remove first and last
|
|
2964 |
aDisplayName.Des().Delete(0,1);
|
|
2965 |
aDisplayName.Des().Delete(aDisplayName.Length()-1,1);
|
|
2966 |
}
|
|
2967 |
}
|
|
2968 |
else if ( aDisplayName.Locate('<') == 0 ) // Else check if first char is bracket
|
|
2969 |
{
|
|
2970 |
if ( aDisplayName.LocateReverse('>') == aDisplayName.Length()-1 ) // last char bracket
|
|
2971 |
{
|
|
2972 |
// Remove first and last
|
|
2973 |
aDisplayName.Des().Delete(0,1);
|
|
2974 |
aDisplayName.Des().Delete(aDisplayName.Length()-1,1);
|
|
2975 |
}
|
|
2976 |
}
|
|
2977 |
}
|
|
2978 |
}
|
|
2979 |
|
|
2980 |
// ---------------------------------------------------------------------------
|
|
2981 |
// TFsEmailUiUtility::DisplayCreateMailboxQueryL
|
|
2982 |
// @return ETrue if user answered "Yes", EFalse if user answered "No"
|
|
2983 |
// ---------------------------------------------------------------------------
|
|
2984 |
//
|
|
2985 |
TBool TFsEmailUiUtility::DisplayCreateMailboxQueryL()
|
|
2986 |
{
|
|
2987 |
FUNC_LOG;
|
|
2988 |
// load text from resource
|
|
2989 |
HBufC* question = StringLoader::LoadLC( R_FS_EMAIL_SETTINGS_ADD_MAILBOX_TXT );
|
|
2990 |
|
|
2991 |
// show dialog
|
|
2992 |
TRequestStatus status = KRequestPending;
|
|
2993 |
CAknGlobalConfirmationQuery* query = CAknGlobalConfirmationQuery::NewL();
|
|
2994 |
CleanupStack::PushL( query );
|
|
2995 |
query->ShowConfirmationQueryL( status, *question, R_AVKON_SOFTKEYS_YES_NO );
|
|
2996 |
User::WaitForRequest( status );
|
|
2997 |
|
|
2998 |
CleanupStack::PopAndDestroy( 2 ); // query question
|
|
2999 |
|
|
3000 |
return ( status.Int() == EAknSoftkeyYes );
|
|
3001 |
}
|
|
3002 |
|
|
3003 |
// -----------------------------------------------------------------------------
|
|
3004 |
// TFsEmailUiUtility::BringFsEmailToForeground
|
|
3005 |
// -----------------------------------------------------------------------------
|
|
3006 |
//
|
|
3007 |
void TFsEmailUiUtility::BringFsEmailToForeground()
|
|
3008 |
{
|
|
3009 |
FUNC_LOG;
|
|
3010 |
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
|
|
3011 |
TApaTask task = taskList.FindApp( KFSEmailUiUid );
|
|
3012 |
if ( task.Exists() )
|
|
3013 |
{
|
|
3014 |
task.BringToForeground();
|
|
3015 |
}
|
|
3016 |
}
|
|
3017 |
|
|
3018 |
// -----------------------------------------------------------------------------
|
|
3019 |
// Creates a displayname of firstname and lastname components
|
|
3020 |
// -----------------------------------------------------------------------------
|
|
3021 |
//
|
|
3022 |
HBufC* TFsEmailUiUtility::CreateDisplayNameLC( const TDesC& aFirstname,
|
|
3023 |
const TDesC& aLastname )
|
|
3024 |
{
|
|
3025 |
FUNC_LOG;
|
|
3026 |
return CreateDisplayNameLC( aFirstname, aLastname, KNullDesC );
|
|
3027 |
}
|
|
3028 |
|
|
3029 |
// -----------------------------------------------------------------------------
|
|
3030 |
// TFsEmailUiUtility::CreateDisplayNameLC
|
|
3031 |
// -----------------------------------------------------------------------------
|
|
3032 |
//
|
|
3033 |
HBufC* TFsEmailUiUtility::CreateDisplayNameLC( const TDesC& aFirstname,
|
|
3034 |
const TDesC& aLastname, const TDesC& aEmailField )
|
|
3035 |
{
|
|
3036 |
FUNC_LOG;
|
|
3037 |
HBufC* displayname = NULL;
|
|
3038 |
|
|
3039 |
if ( aFirstname.Length() == 0 )
|
|
3040 |
{
|
|
3041 |
if ( aLastname.Length() == 0 )
|
|
3042 |
{
|
|
3043 |
//There's just the email address for Displayname
|
|
3044 |
displayname = aEmailField.AllocLC();
|
|
3045 |
}
|
|
3046 |
else
|
|
3047 |
{
|
|
3048 |
//Lastname = displayname
|
|
3049 |
displayname = aLastname.AllocLC();
|
|
3050 |
}
|
|
3051 |
}
|
|
3052 |
|
|
3053 |
else if ( aLastname.Length() == 0 )
|
|
3054 |
{
|
|
3055 |
//Firstname = displayname
|
|
3056 |
displayname = aFirstname.AllocLC();
|
|
3057 |
}
|
|
3058 |
|
|
3059 |
else
|
|
3060 |
{
|
|
3061 |
//Displayname="firstname lastname" or "LastnameFirstname" for Chinese
|
|
3062 |
|
|
3063 |
if( TFsEmailUiUtility::IsChineseWord( aFirstname )
|
|
3064 |
|| TFsEmailUiUtility::IsChineseWord( aLastname ) )
|
|
3065 |
{
|
|
3066 |
TInt length = aFirstname.Length() + aLastname.Length();
|
|
3067 |
displayname = HBufC::NewLC( length );
|
|
3068 |
displayname->Des().Copy( aLastname );
|
|
3069 |
displayname->Des().Append( aFirstname );
|
|
3070 |
}
|
|
3071 |
else
|
|
3072 |
{
|
|
3073 |
TInt length = aFirstname.Length() + KSpace().Length()
|
|
3074 |
+ aLastname.Length();
|
|
3075 |
displayname = HBufC::NewLC( length );
|
|
3076 |
displayname->Des().Copy( aFirstname );
|
|
3077 |
displayname->Des().Append( KSpace );
|
|
3078 |
displayname->Des().Append( aLastname );
|
|
3079 |
}
|
|
3080 |
}
|
|
3081 |
|
|
3082 |
return displayname;
|
|
3083 |
}
|
|
3084 |
|
|
3085 |
|
|
3086 |
// ---------------------------------------------------------
|
|
3087 |
// Find if text is including Chinese word
|
|
3088 |
// ---------------------------------------------------------
|
|
3089 |
//
|
|
3090 |
TBool TFsEmailUiUtility::IsChineseWord( const TDesC& aWord )
|
|
3091 |
{
|
|
3092 |
TBool isChineseSearchStr = EFalse;
|
|
3093 |
const TUint KChineseUnicodeSpanBegin = 0x3400;
|
|
3094 |
const TUint KChineseUnicodeSpanEnd = 0x9fff;
|
|
3095 |
const TInt len = aWord.Length();
|
|
3096 |
|
|
3097 |
for ( TInt ii = 0; ii < len; ii++ )
|
|
3098 |
{
|
|
3099 |
if ( (TInt) aWord[ii] >= KChineseUnicodeSpanBegin
|
|
3100 |
&& (TInt) aWord[ii] <= KChineseUnicodeSpanEnd )
|
|
3101 |
{
|
|
3102 |
isChineseSearchStr = ETrue;
|
|
3103 |
break;
|
|
3104 |
}
|
|
3105 |
}
|
|
3106 |
return isChineseSearchStr;
|
|
3107 |
}
|
|
3108 |
|
|
3109 |
|
|
3110 |
// -----------------------------------------------------------------------------
|
|
3111 |
// TFsEmailUiUtility::GetFullIconFileNameL
|
|
3112 |
// -----------------------------------------------------------------------------
|
|
3113 |
void TFsEmailUiUtility::GetFullIconFileNameL( TDes& aFileName )
|
|
3114 |
{
|
|
3115 |
FUNC_LOG;
|
|
3116 |
aFileName.Zero();
|
|
3117 |
aFileName.Copy( KDC_APP_BITMAP_DIR );
|
|
3118 |
aFileName.Append( KFsEmailIconFileName );
|
|
3119 |
User::LeaveIfError( CompleteWithAppPath( aFileName ) );
|
|
3120 |
}
|
|
3121 |
|
|
3122 |
// -----------------------------------------------------------------------------
|
|
3123 |
// TFsEmailUiUtility::DoFileExtensionsMatchL
|
|
3124 |
// -----------------------------------------------------------------------------
|
|
3125 |
TBool TFsEmailUiUtility::DoFileExtensionsMatchL( const TDesC& aFileName1,
|
|
3126 |
const TDesC& aFileName2 )
|
|
3127 |
{
|
|
3128 |
FUNC_LOG;
|
|
3129 |
TParse parse1;
|
|
3130 |
TParse parse2;
|
|
3131 |
|
|
3132 |
parse1.Set( aFileName1, NULL, NULL );
|
|
3133 |
parse2.Set( aFileName2, NULL, NULL );
|
|
3134 |
|
|
3135 |
HBufC* ext1 = parse1.Ext().AllocLC();
|
|
3136 |
HBufC* ext2 = parse2.Ext().AllocLC();
|
|
3137 |
|
|
3138 |
ext1->Des().LowerCase();
|
|
3139 |
ext2->Des().LowerCase();
|
|
3140 |
|
|
3141 |
TBool match = (*ext1 == *ext2);
|
|
3142 |
|
|
3143 |
CleanupStack::PopAndDestroy( ext2 );
|
|
3144 |
CleanupStack::PopAndDestroy( ext1 );
|
|
3145 |
|
|
3146 |
return match;
|
|
3147 |
}
|
|
3148 |
|
|
3149 |
// -----------------------------------------------------------------------------
|
|
3150 |
// TFsEmailUiUtility::CopyFileToTempDirL
|
|
3151 |
// Makes a copy of given file to the temp directory of FsEmailUI.
|
|
3152 |
// Caller is reponsible of closing the returned file handle.
|
|
3153 |
// -----------------------------------------------------------------------------
|
|
3154 |
RFile TFsEmailUiUtility::CopyFileToTempDirL( const RFile& aSourceFile,
|
|
3155 |
const TDesC& aTargetFileName )
|
|
3156 |
{
|
|
3157 |
FUNC_LOG;
|
|
3158 |
RFs fs( CEikonEnv::Static()->FsSession() );
|
|
3159 |
|
|
3160 |
// Remove any illegal characters from the target file name
|
|
3161 |
TFileName targetFileName = aTargetFileName.Right( KMaxFileName ); // truncate just in case; make sure that any file extension remains
|
|
3162 |
_LIT( KIllegalCharacters, "*?\\<>:\"/|\r\n\t\x2028\x2029" );
|
|
3163 |
const TText KReplacementChar = '_';
|
|
3164 |
AknTextUtils::ReplaceCharacters( targetFileName, KIllegalCharacters, KReplacementChar );
|
|
3165 |
targetFileName.Trim();
|
|
3166 |
// File name can't begin nor end with dot (.) and cannot be empty
|
|
3167 |
if ( !targetFileName.Length() )
|
|
3168 |
{
|
|
3169 |
targetFileName.Append( KReplacementChar );
|
|
3170 |
}
|
|
3171 |
else
|
|
3172 |
{
|
|
3173 |
if ( targetFileName[0] == '.' )
|
|
3174 |
{
|
|
3175 |
targetFileName[0] = KReplacementChar;
|
|
3176 |
}
|
|
3177 |
if ( targetFileName[ targetFileName.Length()-1 ] == '.' )
|
|
3178 |
{
|
|
3179 |
targetFileName[ targetFileName.Length()-1 ] = KReplacementChar;
|
|
3180 |
}
|
|
3181 |
}
|
|
3182 |
|
|
3183 |
// If we still couldn't create a legal name, then use the original name as fallback solution
|
|
3184 |
if ( !fs.IsValidName( targetFileName ) )
|
|
3185 |
{
|
|
3186 |
aSourceFile.Name( targetFileName );
|
|
3187 |
}
|
|
3188 |
|
|
3189 |
// Construct target file full name
|
|
3190 |
TFileName targetFilePath;
|
|
3191 |
GetTempPathL( fs, targetFilePath );
|
|
3192 |
targetFilePath.Append( targetFileName );
|
|
3193 |
|
|
3194 |
CFileMan* fileMan = CFileMan::NewL( fs );
|
|
3195 |
TInt err = fileMan->Copy( aSourceFile, targetFilePath );
|
|
3196 |
delete fileMan;
|
|
3197 |
// KErrInUse ignoring check is needed because copying might not succeed
|
|
3198 |
// if file already exists and handle remains open.
|
|
3199 |
if ( err != KErrNone && err != KErrInUse )
|
|
3200 |
{
|
|
3201 |
User::LeaveIfError( err );
|
|
3202 |
}
|
|
3203 |
|
|
3204 |
// Open the copied file
|
|
3205 |
RFile resultFile;
|
|
3206 |
err = resultFile.Open( fs, targetFilePath, EFileRead | EFileShareReadersOnly );
|
|
3207 |
User::LeaveIfError( err );
|
|
3208 |
|
|
3209 |
return resultFile;
|
|
3210 |
}
|
|
3211 |
|
|
3212 |
// -----------------------------------------------------------------------------
|
|
3213 |
// TFsEmailUiUtility::EraseTempDir
|
|
3214 |
// Deletes all files from our temporary directory
|
|
3215 |
// -----------------------------------------------------------------------------
|
|
3216 |
void TFsEmailUiUtility::EraseTempDir()
|
|
3217 |
{
|
|
3218 |
FUNC_LOG;
|
|
3219 |
RFs fs( CEikonEnv::Static()->FsSession() );
|
|
3220 |
|
|
3221 |
TFileName deleteNamePattern;
|
|
3222 |
TRAPD( err, GetTempPathL( fs, deleteNamePattern ) );
|
|
3223 |
if ( !err )
|
|
3224 |
{
|
|
3225 |
deleteNamePattern.Append( '*' );
|
|
3226 |
BaflUtils::DeleteFile( fs, deleteNamePattern );
|
|
3227 |
}
|
|
3228 |
}
|
|
3229 |
|
|
3230 |
// -----------------------------------------------------------------------------
|
|
3231 |
// TFsEmailUiUtility::GetTempPathL
|
|
3232 |
// Get EmailUI temp directory path. Creates the directory if it does not exist.
|
|
3233 |
// -----------------------------------------------------------------------------
|
|
3234 |
void TFsEmailUiUtility::GetTempPathL( RFs& aFs, TDes& aPath )
|
|
3235 |
{
|
|
3236 |
FUNC_LOG;
|
|
3237 |
_LIT( KDriveCPath, "C:" );
|
|
3238 |
|
|
3239 |
TInt err = aFs.PrivatePath( aPath );
|
|
3240 |
User::LeaveIfError( err );
|
|
3241 |
|
|
3242 |
aPath.Insert( 0, KDriveCPath );
|
|
3243 |
aPath.Append( KFsEmailTempDirName );
|
|
3244 |
BaflUtils::EnsurePathExistsL( aFs, aPath );
|
|
3245 |
}
|
|
3246 |
|
|
3247 |
// -----------------------------------------------------------------------------
|
|
3248 |
// TFsEmailUiUtility::EnsureFsMailServerIsRunning
|
|
3249 |
// Checks if FSMailServer is running. If not, then launches it.
|
|
3250 |
// -----------------------------------------------------------------------------
|
|
3251 |
void TFsEmailUiUtility::EnsureFsMailServerIsRunning( RWsSession& aWsSession )
|
|
3252 |
{
|
|
3253 |
FUNC_LOG;
|
|
3254 |
TRAP_IGNORE( EnsureFsMailServerIsRunningL( aWsSession ) );
|
|
3255 |
}
|
|
3256 |
|
|
3257 |
// -----------------------------------------------------------------------------
|
|
3258 |
// TFsEmailUiUtility::EnsureFsMailServerIsRunningL
|
|
3259 |
// Checks if FSMailServer is running. If not, then launches it.
|
|
3260 |
// -----------------------------------------------------------------------------
|
|
3261 |
void TFsEmailUiUtility::EnsureFsMailServerIsRunningL( RWsSession& aWsSession )
|
|
3262 |
{
|
|
3263 |
FUNC_LOG;
|
|
3264 |
|
|
3265 |
TApaTaskList taskList( aWsSession );
|
|
3266 |
TApaTask task = taskList.FindApp( KFSMailServerUid );
|
|
3267 |
|
|
3268 |
if ( !task.Exists() )
|
|
3269 |
{
|
|
3270 |
// FSMailServer is not running, try to launch it
|
|
3271 |
|
|
3272 |
// Get this process' file name to get the correct drive letter
|
|
3273 |
RProcess process;
|
|
3274 |
TFileName processFileName = process.FileName();
|
|
3275 |
process.Close();
|
|
3276 |
|
|
3277 |
// Parse the full path to FSMailServer exe
|
|
3278 |
TParse parse;
|
|
3279 |
User::LeaveIfError( parse.Set( KFSMailServerExe, &processFileName, NULL) );
|
|
3280 |
|
|
3281 |
// Store the full path
|
|
3282 |
processFileName = parse.FullName();
|
|
3283 |
|
|
3284 |
CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
|
|
3285 |
cmdLine->SetExecutableNameL( processFileName );
|
|
3286 |
// Launch FSMailServer in background so that it doesn't steal
|
|
3287 |
// the focus during it's construction
|
|
3288 |
cmdLine->SetCommandL( EApaCommandBackground );
|
|
3289 |
|
|
3290 |
RApaLsSession ls;
|
|
3291 |
User::LeaveIfError( ls.Connect() );
|
|
3292 |
CleanupClosePushL( ls );
|
|
3293 |
|
|
3294 |
TThreadId threadId;
|
|
3295 |
// Is there anything we can do in case of error?
|
|
3296 |
// Try to launch from another drive etc.?
|
|
3297 |
TInt error = ls.StartApp( *cmdLine, threadId );
|
|
3298 |
|
|
3299 |
CleanupStack::PopAndDestroy( &ls );
|
|
3300 |
CleanupStack::PopAndDestroy( cmdLine );
|
|
3301 |
}
|
|
3302 |
}
|
|
3303 |
|
|
3304 |
|
|
3305 |
|
|
3306 |
/////////////////////////////////////////////////////////////////////////////////
|
|
3307 |
// ACTION MENU HANDLER
|
|
3308 |
//
|
|
3309 |
|
|
3310 |
//Singleton* Singleton::pinstance = 0;
|
|
3311 |
// Initialize static member variables
|
|
3312 |
CFscContactActionMenu* CFSEmailUiActionMenu::iActionMenu = NULL;
|
|
3313 |
TFileName CFSEmailUiActionMenu::iIconFilePath;
|
|
3314 |
RPointerArray<CGulIcon> CFSEmailUiActionMenu::iIconArray;
|
|
3315 |
|
|
3316 |
CFSEmailUiActionMenu* CFSEmailUiActionMenu::NewL( CFreestyleEmailUiAppUi* aAppUi )
|
|
3317 |
{
|
|
3318 |
FUNC_LOG;
|
|
3319 |
CFSEmailUiActionMenu* self = new (ELeave) CFSEmailUiActionMenu( aAppUi );
|
|
3320 |
CleanupStack::PushL( self );
|
|
3321 |
self->ConstructL();
|
|
3322 |
CleanupStack::Pop( self );
|
|
3323 |
return self;
|
|
3324 |
}
|
|
3325 |
|
|
3326 |
CFSEmailUiActionMenu::CFSEmailUiActionMenu( CFreestyleEmailUiAppUi* aAppUi )
|
|
3327 |
: iAppUi( aAppUi )
|
|
3328 |
{
|
|
3329 |
|
|
3330 |
}
|
|
3331 |
|
|
3332 |
CFSEmailUiActionMenu::~CFSEmailUiActionMenu()
|
|
3333 |
{
|
|
3334 |
FUNC_LOG;
|
|
3335 |
if( iActionMenu )
|
|
3336 |
{
|
|
3337 |
delete iActionMenu;
|
|
3338 |
}
|
|
3339 |
if ( iService )
|
|
3340 |
{
|
|
3341 |
delete iService;
|
|
3342 |
}
|
|
3343 |
iIconArray.ResetAndDestroy();
|
|
3344 |
}
|
|
3345 |
|
|
3346 |
void CFSEmailUiActionMenu::ConstructL()
|
|
3347 |
{
|
|
3348 |
FUNC_LOG;
|
|
3349 |
if( !iActionMenu )
|
|
3350 |
{
|
|
3351 |
iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() );
|
|
3352 |
iActionMenu = CFscContactActionMenu::NewL( *iService );
|
|
3353 |
}
|
|
3354 |
TFsEmailUiUtility::GetFullIconFileNameL( iIconFilePath );
|
|
3355 |
}
|
|
3356 |
|
|
3357 |
CFscContactActionMenu* CFSEmailUiActionMenu::GetActionMenu()
|
|
3358 |
{
|
|
3359 |
return iActionMenu;
|
|
3360 |
}
|
|
3361 |
|
|
3362 |
void CFSEmailUiActionMenu::RemoveAllL()
|
|
3363 |
{
|
|
3364 |
FUNC_LOG;
|
|
3365 |
if ( iIconArray.Count() == 0 )
|
|
3366 |
{
|
|
3367 |
CreateIconsL();
|
|
3368 |
}
|
|
3369 |
iActionMenu->Model().RemoveAll( ETrue );
|
|
3370 |
}
|
|
3371 |
|
|
3372 |
void CFSEmailUiActionMenu::AddCustomItemL( TActionMenuCustomItemId aItemId )
|
|
3373 |
{
|
|
3374 |
FUNC_LOG;
|
|
3375 |
if ( iIconArray.Count() == 0 )
|
|
3376 |
{
|
|
3377 |
CreateIconsL();
|
|
3378 |
}
|
|
3379 |
HBufC* itemText = NULL;
|
|
3380 |
CGulIcon* itemIcon = iIconArray[aItemId-1];
|
|
3381 |
switch( aItemId )
|
|
3382 |
{
|
|
3383 |
case FsEActionMenuOpen:
|
|
3384 |
{
|
|
3385 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_OPEN );
|
|
3386 |
}
|
|
3387 |
break;
|
|
3388 |
case FsEActionMenuOpenCalendarEvent:
|
|
3389 |
{
|
|
3390 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_OPEN );
|
|
3391 |
}
|
|
3392 |
break;
|
|
3393 |
case FsEActionMenuReply:
|
|
3394 |
{
|
|
3395 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_REPLY );
|
|
3396 |
}
|
|
3397 |
break;
|
|
3398 |
|
|
3399 |
case FsEActionMenuReplyAll:
|
|
3400 |
{
|
|
3401 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_REPLY_ALL );
|
|
3402 |
}
|
|
3403 |
break;
|
|
3404 |
|
|
3405 |
case FsEActionMenuForward:
|
|
3406 |
{
|
|
3407 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_FORWARD );
|
|
3408 |
}
|
|
3409 |
break;
|
|
3410 |
|
|
3411 |
case FsEActionMenuDelete:
|
|
3412 |
{
|
|
3413 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_DELETE );
|
|
3414 |
}
|
|
3415 |
break;
|
|
3416 |
|
|
3417 |
case FsEActionMenuAccept:
|
|
3418 |
{
|
|
3419 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ACCEPT );
|
|
3420 |
}
|
|
3421 |
break;
|
|
3422 |
|
|
3423 |
case FsEActionMenuTentative:
|
|
3424 |
{
|
|
3425 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_TENTATIVE );
|
|
3426 |
}
|
|
3427 |
break;
|
|
3428 |
|
|
3429 |
case FsEActionMenuDecline:
|
|
3430 |
{
|
|
3431 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_DECLINE );
|
|
3432 |
}
|
|
3433 |
break;
|
|
3434 |
|
|
3435 |
case FsEActionMenuRemoveFormCal:
|
|
3436 |
{
|
|
3437 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_REM_FROM_CAL );
|
|
3438 |
}
|
|
3439 |
break;
|
|
3440 |
|
|
3441 |
case FsEActionMenuMarkRead:
|
|
3442 |
{
|
|
3443 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_MARK_READ );
|
|
3444 |
}
|
|
3445 |
break;
|
|
3446 |
|
|
3447 |
case FsEActionMenuMarkUnread:
|
|
3448 |
{
|
|
3449 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_MARK_UNREAD );
|
|
3450 |
}
|
|
3451 |
break;
|
|
3452 |
|
|
3453 |
case FsEActionMenuCall:
|
|
3454 |
{
|
|
3455 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_CALL );
|
|
3456 |
}
|
|
3457 |
break;
|
|
3458 |
// <cmail> video call
|
|
3459 |
case FsEActionMenuCallVideo:
|
|
3460 |
{
|
|
3461 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_CALL_VIDEO );
|
|
3462 |
}
|
|
3463 |
break;
|
|
3464 |
// </cmail>
|
|
3465 |
case FsEActionMenuCreateMessage:
|
|
3466 |
{
|
|
3467 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_CREATE_MESSAGE );
|
|
3468 |
}
|
|
3469 |
break;
|
|
3470 |
case FsEActionMenuCreateEmail:
|
|
3471 |
{
|
|
3472 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_CREATE_EMAIL );
|
|
3473 |
}
|
|
3474 |
break;
|
|
3475 |
case FsEActionMenuContactDetails:
|
|
3476 |
{
|
|
3477 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_CONTACT_DETAILS );
|
|
3478 |
}
|
|
3479 |
break;
|
|
3480 |
|
|
3481 |
case FsEActionMenuAddToContacts:
|
|
3482 |
{
|
|
3483 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ADD_TO_CONTACTS );
|
|
3484 |
}
|
|
3485 |
break;
|
|
3486 |
|
|
3487 |
case FsEActionMenuRemoteLookup:
|
|
3488 |
{
|
|
3489 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_REMOTE_LOOKUP );
|
|
3490 |
}
|
|
3491 |
break;
|
|
3492 |
|
|
3493 |
case FsEActionMenuMove:
|
|
3494 |
{
|
|
3495 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_MOVE );
|
|
3496 |
}
|
|
3497 |
break;
|
|
3498 |
|
|
3499 |
case FsEActionMenuMoveToDrafts:
|
|
3500 |
{
|
|
3501 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_MOVE_TO_DRAFTS );
|
|
3502 |
}
|
|
3503 |
break;
|
|
3504 |
case FsEActionMenuOpenInWeb:
|
|
3505 |
{
|
|
3506 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_OPEN_IN_WEB );
|
|
3507 |
}
|
|
3508 |
break;
|
|
3509 |
case FsEActionMenuOpenInIntranet:
|
|
3510 |
{
|
|
3511 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_OPEN_IN_INTRA );
|
|
3512 |
}
|
|
3513 |
break;
|
|
3514 |
case FsEActionMenuBookmark:
|
|
3515 |
{
|
|
3516 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_BOOKMARK );
|
|
3517 |
}
|
|
3518 |
break;
|
|
3519 |
case FsEActionAttachmentOpen:
|
|
3520 |
{
|
|
3521 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_OPEN );
|
|
3522 |
}
|
|
3523 |
break;
|
|
3524 |
case FsEActionAttachmentDownload:
|
|
3525 |
{
|
|
3526 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_DOWNLOAD );
|
|
3527 |
}
|
|
3528 |
break;
|
|
3529 |
case FsEActionAttachmentCancelDownload:
|
|
3530 |
{
|
|
3531 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_CANCEL );
|
|
3532 |
}
|
|
3533 |
break;
|
|
3534 |
case FsEActionAttachmentSave:
|
|
3535 |
{
|
|
3536 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_SAVE );
|
|
3537 |
}
|
|
3538 |
break;
|
|
3539 |
case FsEActionAttachmentAdd:
|
|
3540 |
{
|
|
3541 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_ADD );
|
|
3542 |
}
|
|
3543 |
break;
|
|
3544 |
case FsEActionAttachmentRemove:
|
|
3545 |
{
|
|
3546 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_REMOVE );
|
|
3547 |
}
|
|
3548 |
break;
|
|
3549 |
case FsEActionAttachmentViewAll:
|
|
3550 |
{
|
|
3551 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_VIEW_ALL );
|
|
3552 |
}
|
|
3553 |
break;
|
|
3554 |
case FsEActionAttachmentDownloadAll:
|
|
3555 |
{
|
|
3556 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_DOWNLOAD_ALL );
|
|
3557 |
}
|
|
3558 |
break;
|
|
3559 |
|
|
3560 |
case FsEActionAttachmentCancelAllDownloads:
|
|
3561 |
{
|
|
3562 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_CANCEL_ALL );
|
|
3563 |
}
|
|
3564 |
break;
|
|
3565 |
case FsEActionAttachmentSaveAll:
|
|
3566 |
{
|
|
3567 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_SAVE_ALL );
|
|
3568 |
}
|
|
3569 |
break;
|
|
3570 |
case FsEActionAttachmentRemoveAll:
|
|
3571 |
{
|
|
3572 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_REMOVE_ALL );
|
|
3573 |
}
|
|
3574 |
break;
|
|
3575 |
case FsEActionAttachmentClearFetchedContent:
|
|
3576 |
{
|
|
3577 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_CLEAR_FETCHED );
|
|
3578 |
}
|
|
3579 |
break;
|
|
3580 |
case FsEActionAttachmentRemoveUnfetchedAttachment:
|
|
3581 |
{
|
|
3582 |
itemText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_AM_ATTACH_REMOVE_UNFETCHED );
|
|
3583 |
}
|
|
3584 |
break;
|
|
3585 |
default:
|
|
3586 |
{
|
|
3587 |
itemText = KNullDesC().AllocLC();
|
|
3588 |
}
|
|
3589 |
break;
|
|
3590 |
}
|
|
3591 |
|
|
3592 |
TUid itemUid;
|
|
3593 |
itemUid.iUid = TInt(aItemId);
|
|
3594 |
|
|
3595 |
CleanupStack::PushL( itemIcon );
|
|
3596 |
CFscContactActionMenuItem* menuItem = iActionMenu->Model().NewMenuItemL( *itemText, itemIcon, KActionMenuItemNormalPriority, EFalse, itemUid);
|
|
3597 |
CleanupStack::PushL( menuItem );
|
|
3598 |
iActionMenu->Model().AddItemL( menuItem );
|
|
3599 |
CleanupStack::Pop( menuItem );
|
|
3600 |
CleanupStack::Pop( itemIcon );
|
|
3601 |
CleanupStack::PopAndDestroy( itemText );
|
|
3602 |
}
|
|
3603 |
|
|
3604 |
void CFSEmailUiActionMenu::AddCustomItemsL( RFsEActionMenuIdList aItemList )
|
|
3605 |
{
|
|
3606 |
FUNC_LOG;
|
|
3607 |
for( TInt i = 0; i < aItemList.Count(); i++ )
|
|
3608 |
{
|
|
3609 |
AddCustomItemL( aItemList[i] );
|
|
3610 |
}
|
|
3611 |
}
|
|
3612 |
|
|
3613 |
// <cmail>
|
|
3614 |
void CFSEmailUiActionMenu::Dismiss( TBool aSlide )
|
|
3615 |
{
|
|
3616 |
FUNC_LOG;
|
|
3617 |
if( iActionMenu )
|
|
3618 |
{
|
|
3619 |
iActionMenu->Dismiss( aSlide );
|
|
3620 |
}
|
|
3621 |
}
|
|
3622 |
// </cmail>
|
|
3623 |
|
|
3624 |
TActionMenuCustomItemId CFSEmailUiActionMenu::ExecuteL(
|
|
3625 |
TFscContactActionMenuPosition aPosition,
|
|
3626 |
TInt aIndex,
|
|
3627 |
MFsActionMenuPositionGiver* aPositionGiver)
|
|
3628 |
{
|
|
3629 |
FUNC_LOG;
|
|
3630 |
if ( iIconArray.Count() == 0 )
|
|
3631 |
{
|
|
3632 |
CreateIconsL();
|
|
3633 |
}
|
|
3634 |
TFscActionMenuResult menuResult = iActionMenu->ExecuteL( aPosition, aIndex, aPositionGiver );
|
|
3635 |
if ( menuResult == EFscCustomItemSelected )
|
|
3636 |
{
|
|
3637 |
return ResolveSelectedCustomItemIdL();
|
|
3638 |
}
|
|
3639 |
else if( menuResult == EFscCasItemSelectedAndExecuted )
|
|
3640 |
{
|
|
3641 |
return FsEActionMenuCasItemSelectedAndExecuted;
|
|
3642 |
}
|
|
3643 |
else
|
|
3644 |
{
|
|
3645 |
return FsEActionMenuDismissed;
|
|
3646 |
}
|
|
3647 |
}
|
|
3648 |
|
|
3649 |
TActionMenuCustomItemId CFSEmailUiActionMenu::ExecuteL(
|
|
3650 |
RFsEActionMenuIdList aItemList,
|
|
3651 |
TFscContactActionMenuPosition aPosition,
|
|
3652 |
TInt aIndex,
|
|
3653 |
MFsActionMenuPositionGiver* aPositionGiver)
|
|
3654 |
{
|
|
3655 |
FUNC_LOG;
|
|
3656 |
if ( iIconArray.Count() == 0 )
|
|
3657 |
{
|
|
3658 |
CreateIconsL();
|
|
3659 |
}
|
|
3660 |
RemoveAllL();
|
|
3661 |
AddCustomItemsL( aItemList );
|
|
3662 |
return ExecuteL( aPosition, aIndex, aPositionGiver );
|
|
3663 |
}
|
|
3664 |
// </cmail>
|
|
3665 |
|
|
3666 |
|
|
3667 |
TActionMenuCustomItemId CFSEmailUiActionMenu::ResolveSelectedCustomItemIdL()
|
|
3668 |
{
|
|
3669 |
FUNC_LOG;
|
|
3670 |
if ( iIconArray.Count() == 0 )
|
|
3671 |
{
|
|
3672 |
CreateIconsL();
|
|
3673 |
}
|
|
3674 |
TInt itemIndex = iActionMenu->FocusedItemIndex();
|
|
3675 |
TUid itemUid = iActionMenu->Model().ItemL( itemIndex ).ImplementationUid();
|
|
3676 |
|
|
3677 |
return TActionMenuCustomItemId( itemUid.iUid );
|
|
3678 |
}
|
|
3679 |
|
|
3680 |
void CFSEmailUiActionMenu::CreateIconsL()
|
|
3681 |
{
|
|
3682 |
FUNC_LOG;
|
|
3683 |
iIconArray.ResetAndDestroy();
|
|
3684 |
|
|
3685 |
// UPDATE ICONS!
|
|
3686 |
// <cmail> icons changed
|
|
3687 |
// NOTE: Must be appended same order as are in TActionMenuCustomItemIds!
|
|
3688 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_read, EMbmFreestyleemailuiQgn_indi_cmail_read_mask ) ); // FsEActionMenuOpen
|
|
3689 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_calendar_event_read, EMbmFreestyleemailuiQgn_indi_cmail_calendar_event_read_mask ) ); // FsEActionMenuOpen
|
|
3690 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_reply, EMbmFreestyleemailuiQgn_prop_cmail_action_reply_mask ) ); // FsEActionMenuReply
|
|
3691 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_reply_all, EMbmFreestyleemailuiQgn_prop_cmail_action_reply_all_mask ) ); // FsEActionMenuReplyAll
|
|
3692 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_forward, EMbmFreestyleemailuiQgn_prop_cmail_action_forward_mask ) ); // FsEActionMenuForward
|
|
3693 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_delete, EMbmFreestyleemailuiQgn_prop_cmail_action_delete_mask ) ); // FsEActionMenuDelete
|
|
3694 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_accept, EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_accept_mask ) ); // FsEActionMenuAccept
|
|
3695 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_tentative, EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_tentative_mask ) ); // FsEActionMenuTentative
|
|
3696 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_reject, EMbmFreestyleemailuiQgn_indi_cmail_calendar_tracking_reject_mask ) ); // FsEActionMenuDecline
|
|
3697 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_indi_cmail_calendar_delete, EMbmFreestyleemailuiQgn_indi_cmail_calendar_delete_mask ) ); // FsEActionMenuDecline
|
|
3698 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_mark_read, EMbmFreestyleemailuiQgn_prop_cmail_action_mark_read_mask ) ); // FsEActionMenuMarkRead
|
|
3699 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_mark_unread, EMbmFreestyleemailuiQgn_prop_cmail_action_mark_unread_mask ) ); // FsEActionMenuMarkUnread
|
|
3700 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_call, EMbmFreestyleemailuiQgn_prop_cmail_action_call_mask ) ); // FsEActionMenuCall
|
|
3701 |
// <cmail> video call
|
|
3702 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_call_video, EMbmFreestyleemailuiQgn_prop_cmail_action_call_video_mask ) ); // FsEActionMenuCallVideo
|
|
3703 |
// </cmail>
|
|
3704 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_create_msg, EMbmFreestyleemailuiQgn_prop_cmail_action_create_msg_mask ) ); // FsEActionMenuCreateMessage
|
|
3705 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_email, EMbmFreestyleemailuiQgn_prop_cmail_action_email_mask) ); // FsEActionMenuCreateEmail
|
|
3706 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_contact_detail, EMbmFreestyleemailuiQgn_prop_cmail_action_contact_detail_mask ) ); // FsEActionMenuContactDetails
|
|
3707 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_add_to_contacts, EMbmFreestyleemailuiQgn_prop_cmail_action_add_to_contacts_mask ) ); // FsEActionMenuAddToContacts
|
|
3708 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_remote_lookup, EMbmFreestyleemailuiQgn_prop_cmail_action_remote_lookup_mask ) ); // FsEActionMenuRemoteLookup
|
|
3709 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_move_msg, EMbmFreestyleemailuiQgn_prop_cmail_action_move_msg_mask ) ); // FsEActionMenuMove
|
|
3710 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_move_to_drafts, EMbmFreestyleemailuiQgn_prop_cmail_action_move_to_drafts_mask ) ); // FsEActionMenuMoveToDrafts
|
|
3711 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_menu_browserng, EMbmFreestyleemailuiQgn_menu_browserng_mask ) ); // FsEActionMenuOpenInWeb
|
|
3712 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_menu_intranet, EMbmFreestyleemailuiQgn_menu_intranet_mask ) ); // FsEActionMenuOpenInIntranet
|
|
3713 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_wml_bookmark, EMbmFreestyleemailuiQgn_prop_cmail_wml_bookmark_mask ) ); // FsEActionMenuBookmark
|
|
3714 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_open, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_open_mask ) ); // FsEActionAttachmentOpen
|
|
3715 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_mask ) ); // FsEActionAttachmentDownload
|
|
3716 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download_mask ) ); // FsEActionAttachmentCancelDownload
|
|
3717 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_mask ) ); // FsEActionAttachmentSave
|
|
3718 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_add, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_add_mask ) ); // FsEActionAttachmentAdd
|
|
3719 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete_mask ) ); // FsEActionAttachmentRemove
|
|
3720 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_view_all, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_view_all_mask ) ); // FsEActionAttachmentViewAll
|
|
3721 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all_mask ) ); // FsEActionAttachmentDownloadAll
|
|
3722 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_cancel_all, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_cancel_all_mask ) ); // FsEActionAttachmentCancelAllDownloads
|
|
3723 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all_mask ) ); // FsEActionAttachmentSaveAll
|
|
3724 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete_all, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete_all_mask ) ); // FsEActionAttachmentRemoveAll
|
|
3725 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete_mask ) ); // FsEActionAttachmentClearFetchedContent
|
|
3726 |
iIconArray.AppendL( CreateIconL( EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete, EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_list_options_delete_mask ) ); // FsEActionAttachmentRemoveUnfetchedAttachment
|
|
3727 |
// </cmail>
|
|
3728 |
}
|
|
3729 |
|
|
3730 |
CGulIcon* CFSEmailUiActionMenu::CreateIconL( TInt aBitmapId, TInt aMaskId )
|
|
3731 |
{
|
|
3732 |
FUNC_LOG;
|
|
3733 |
// Define default icon object
|
|
3734 |
CFbsBitmap* iconBitmap;
|
|
3735 |
CFbsBitmap* iconMaskBitmap;
|
|
3736 |
TSize defaultIconSize(30,30);
|
|
3737 |
|
|
3738 |
// Create "CALL" Item
|
|
3739 |
AknIconUtils::CreateIconLC(iconBitmap, iconMaskBitmap, iIconFilePath, aBitmapId, aMaskId );
|
|
3740 |
AknIconUtils::SetSize(iconBitmap, defaultIconSize);
|
|
3741 |
AknIconUtils::SetSize(iconMaskBitmap, defaultIconSize);
|
|
3742 |
CGulIcon* icon = CGulIcon::NewL(iconBitmap, iconMaskBitmap);
|
|
3743 |
CleanupStack::Pop(2);
|
|
3744 |
return icon;
|
|
3745 |
}
|
|
3746 |
|
|
3747 |
/////////////////////////////////////////////////////////////////////////////////
|
|
3748 |
// GENERIC TIMER
|
|
3749 |
//
|
|
3750 |
|
|
3751 |
// -----------------------------------------------------------------------------
|
|
3752 |
// CFSEmailUiGenericTimer::NewL
|
|
3753 |
// NewL function. Returns timer object.
|
|
3754 |
// -----------------------------------------------------------------------------
|
|
3755 |
//
|
|
3756 |
CFSEmailUiGenericTimer* CFSEmailUiGenericTimer::NewL(
|
|
3757 |
MFSEmailUiGenericTimerCallback* aCallback,
|
|
3758 |
const TInt aPriority )
|
|
3759 |
{
|
|
3760 |
FUNC_LOG;
|
|
3761 |
CFSEmailUiGenericTimer* self = NewLC( aCallback, aPriority );
|
|
3762 |
CleanupStack::Pop( self );
|
|
3763 |
return self;
|
|
3764 |
}
|
|
3765 |
|
|
3766 |
// -----------------------------------------------------------------------------
|
|
3767 |
// CFSEmailUiGenericTimer::NewL
|
|
3768 |
// NewL function. Returns timer object.
|
|
3769 |
// -----------------------------------------------------------------------------
|
|
3770 |
//
|
|
3771 |
CFSEmailUiGenericTimer* CFSEmailUiGenericTimer::NewLC(
|
|
3772 |
MFSEmailUiGenericTimerCallback* aCallback,
|
|
3773 |
const TInt aPriority )
|
|
3774 |
{
|
|
3775 |
FUNC_LOG;
|
|
3776 |
CFSEmailUiGenericTimer* self = new (ELeave) CFSEmailUiGenericTimer( aCallback, aPriority );
|
|
3777 |
CleanupStack::PushL( self );
|
|
3778 |
self->ConstructL();
|
|
3779 |
return self;
|
|
3780 |
}
|
|
3781 |
|
|
3782 |
// -----------------------------------------------------------------------------
|
|
3783 |
// CFSEmailUiGenericTimer::NewL
|
|
3784 |
// NewL function. Returns timer object.
|
|
3785 |
// -----------------------------------------------------------------------------
|
|
3786 |
//
|
|
3787 |
void CFSEmailUiGenericTimer::ConstructL()
|
|
3788 |
{
|
|
3789 |
FUNC_LOG;
|
|
3790 |
CTimer::ConstructL();
|
|
3791 |
CActiveScheduler::Add( this );
|
|
3792 |
}
|
|
3793 |
|
|
3794 |
// -----------------------------------------------------------------------------
|
|
3795 |
// CFSEmailUiGenericTimer::~CFSEmailUiGenericTimer
|
|
3796 |
// D'tor
|
|
3797 |
// -----------------------------------------------------------------------------
|
|
3798 |
//
|
|
3799 |
CFSEmailUiGenericTimer::~CFSEmailUiGenericTimer()
|
|
3800 |
{
|
|
3801 |
FUNC_LOG;
|
|
3802 |
Cancel();
|
|
3803 |
iCallback = NULL;
|
|
3804 |
}
|
|
3805 |
|
|
3806 |
// -----------------------------------------------------------------------------
|
|
3807 |
// CFSEmailUiGenericTimer::CFSEmailUiGenericTimer
|
|
3808 |
// C'tor
|
|
3809 |
// -----------------------------------------------------------------------------
|
|
3810 |
//
|
|
3811 |
CFSEmailUiGenericTimer::CFSEmailUiGenericTimer(
|
|
3812 |
MFSEmailUiGenericTimerCallback* aCallback,
|
|
3813 |
const TInt aPriority )
|
|
3814 |
: CTimer( aPriority ),
|
|
3815 |
iCallback( aCallback )
|
|
3816 |
{
|
|
3817 |
}
|
|
3818 |
|
|
3819 |
// -----------------------------------------------------------------------------
|
|
3820 |
// CFSEmailUiGenericTimer::RunL
|
|
3821 |
// Timer trigger function.
|
|
3822 |
// -----------------------------------------------------------------------------
|
|
3823 |
//
|
|
3824 |
void CFSEmailUiGenericTimer::RunL()
|
|
3825 |
{
|
|
3826 |
FUNC_LOG;
|
|
3827 |
if ( iCallback )
|
|
3828 |
{
|
|
3829 |
iCallback->TimerEventL( this );
|
|
3830 |
}
|
|
3831 |
}
|
|
3832 |
|
|
3833 |
// -----------------------------------------------------------------------------
|
|
3834 |
// CFSEmailUiGenericTimer::Start
|
|
3835 |
// Timer starting function.
|
|
3836 |
// -----------------------------------------------------------------------------
|
|
3837 |
//
|
|
3838 |
void CFSEmailUiGenericTimer::Start( TInt aInterval )
|
|
3839 |
{
|
|
3840 |
FUNC_LOG;
|
|
3841 |
Cancel();
|
|
3842 |
if( aInterval < 0 )
|
|
3843 |
{
|
|
3844 |
aInterval = KGenericTimerDefaultInterval;
|
|
3845 |
}
|
|
3846 |
After( TTimeIntervalMicroSeconds32( aInterval * 1000 ) );
|
|
3847 |
}
|
|
3848 |
|
|
3849 |
// -----------------------------------------------------------------------------
|
|
3850 |
// CFSEmailUiGenericTimer::Stop
|
|
3851 |
// Timer stopping function
|
|
3852 |
// -----------------------------------------------------------------------------
|
|
3853 |
//
|
|
3854 |
void CFSEmailUiGenericTimer::Stop()
|
|
3855 |
{
|
|
3856 |
FUNC_LOG;
|
|
3857 |
Cancel();
|
|
3858 |
}
|
|
3859 |
|
|
3860 |
TKeyResponse CFSEmailUiCallDialog::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
|
|
3861 |
{
|
|
3862 |
if (aKeyEvent.iScanCode == EStdKeyYes )
|
|
3863 |
{
|
|
3864 |
TKeyEvent newEvent;
|
|
3865 |
newEvent.iScanCode = EStdKeyEnter;
|
|
3866 |
newEvent.iCode = EKeyEnter;
|
|
3867 |
return CAknQueryDialog::OfferKeyEventL(newEvent, aType);
|
|
3868 |
}
|
|
3869 |
else
|
|
3870 |
{
|
|
3871 |
return CAknQueryDialog::OfferKeyEventL(aKeyEvent, aType);
|
|
3872 |
}
|
|
3873 |
}
|
|
3874 |
|
|
3875 |
|