|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: FreestyleEmailUi main application UI control implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // SYSTEM INCLUDE FILES |
|
19 #include "emailtrace.h" |
|
20 #include <avkon.hrh> |
|
21 #include <eikmenup.h> |
|
22 #include <AvkonInternalCRKeys.h> |
|
23 #include <AknDef.h> |
|
24 #include <aknnotewrappers.h> |
|
25 #include <AknUtils.h> |
|
26 #include <aknnavide.h> |
|
27 // <cmail> SF |
|
28 #include <alf/alfcontrolgroup.h> |
|
29 // </cmail> |
|
30 #include <apgcli.h> |
|
31 #include <FreestyleEmailUi.rsg> |
|
32 #include <fsmailserver.rsg> |
|
33 #include <StringLoader.h> |
|
34 //<cmail> |
|
35 #include "cfsmailclient.h" |
|
36 #include "cfsmailbox.h" |
|
37 #include "cfsmailfolder.h" |
|
38 #include "cfsmailmessage.h" |
|
39 #include "cfsmailaddress.h" |
|
40 #include "cfsmailcommon.h" |
|
41 #include "cemailsettingsextension.h" |
|
42 //</cmail> |
|
43 #include <freestyleemailui.mbg> |
|
44 #include <AknQueryDialog.h> |
|
45 #include <AknBidiTextUtils.h> |
|
46 #include <gdi.h> |
|
47 #include <s32file.h> |
|
48 #include <AknInfoPopupNoteController.h> |
|
49 //<cmail> |
|
50 // #include <AGMDATE.H> |
|
51 //</cmail> |
|
52 #include <CPbkContactItem.h> |
|
53 #include <CPbkContactEngine.h> |
|
54 #include <CPbkFieldInfo.h> |
|
55 #include <cntviewbase.h> |
|
56 #include <cntdef.h> |
|
57 #include <CVPbkContactManager.h> |
|
58 #include <CVPbkContactStoreUriArray.h> |
|
59 #include <VPbkContactStoreUris.h> // VPbkContactStoreUris |
|
60 #include <TVPbkContactStoreUriPtr.h> // TVPbkContactStoreUriPtr |
|
61 #include <e32uid.h> // For dynamic library UID |
|
62 // Meeting request |
|
63 #include <MeetingRequestUids.hrh> |
|
64 //<cmail> |
|
65 #include "cesmricalviewer.h" |
|
66 #include "fslayoutmanager.h" |
|
67 //</cmail> |
|
68 #include <etelmm.h> |
|
69 |
|
70 #include "FSEmailBuildFlags.h" |
|
71 |
|
72 #include <CPbkPhoneNumberSelect.h> |
|
73 #include <RPbkViewResourceFile.h> |
|
74 #include <commonphoneparser.h> |
|
75 #include <bautils.h> |
|
76 #include <hlplch.h> |
|
77 #include <DocumentHandler.h> |
|
78 #include <centralrepository.h> |
|
79 #include <cstack.h> |
|
80 #include <akntitle.h> |
|
81 #include <eikspane.h> |
|
82 #include <fbs.h> |
|
83 #include <iaupdate.h> // For IAD |
|
84 #include <iaupdateparameters.h> // For IAD |
|
85 #include <iaupdateresult.h> // For IAD |
|
86 #include <featmgr.h> // For FeatureManager |
|
87 //<cmail> |
|
88 #include <data_caging_path_literals.hrh> // hardcoded paths removal from cmail |
|
89 #include "cfsccontactactionmenu.h" |
|
90 //</cmail> |
|
91 #include <layoutmetadata.cdl.h> // for Layout_Meta_Data |
|
92 |
|
93 #include <AknPriv.hrh> |
|
94 #include "freestyleemailcenrepkeys.h" |
|
95 #include <centralrepository.h> |
|
96 |
|
97 // INTERNAL INCLUDE FILES |
|
98 #include "FreestyleEmailUiContactHandler.h" |
|
99 #include "FreestyleEmailUiAppui.h" |
|
100 #include "FreestyleEmailUi.hrh" |
|
101 #include "FreestyleEmailUiLauncherGrid.h" |
|
102 #include "FreestyleEmailUiLayoutHandler.h" |
|
103 #include "FreestyleEmailUiMailListControl.h" |
|
104 #include "FreestyleEmailUiMailListModel.h" |
|
105 #include "FreestyleEmailUiMailListVisualiser.h" |
|
106 #include "FreestyleEmailUiTextureManager.h" |
|
107 #include "FreestyleEmailUiMsgDetailsVisualiser.h" |
|
108 #include "FreestyleEmailUiFolderListVisualiser.h" |
|
109 #include "ncsconstants.h" |
|
110 #include "ncscomposeview.h" |
|
111 #include "FreestyleEmailUiAttachmentsListModel.h" |
|
112 #include "FreestyleEmailUiAttachmentsListVisualiser.h" |
|
113 #include "FreestyleEmailUiAttachmentsListControl.h" |
|
114 #include "freestyleemailcenrephandler.h" |
|
115 #include "FreestyleEmailUiSettingsListView.h" |
|
116 #include "FreestyleEmailUiGlobalSettingsListView.h" |
|
117 #include "FreestyleEmailUiDownloadManagerModel.h" |
|
118 #include "FreestyleEmailUiDownloadManagerVisualiser.h" |
|
119 #include "FreestyleEmailUiDownloadManagerControl.h" |
|
120 #include "FreestyleEmailUiSendAttachmentsListModel.h" |
|
121 #include "FreestyleEmailUiSendAttachmentsListVisualiser.h" |
|
122 #include "FreestyleEmailUiSearchListVisualiser.h" |
|
123 #include "FreestyleEmailUiStatusIndicator.h" |
|
124 #include "FreestyleEmailUiHtmlViewerView.h" |
|
125 #include "FreestyleEmailDownloadInformationMediator.h" |
|
126 #include "FreestyleEmailUiUtilities.h" |
|
127 #include "FreestyleEmailUiShortcutBinding.h" |
|
128 #include "FSDelayedLoader.h" |
|
129 #include "FreestyleEmailUiWizardObserver.h" |
|
130 #include "FSEmail.pan" |
|
131 #include "ceuiexitguardian.h" |
|
132 |
|
133 #include "FreestyleEmailUiNaviPaneControl2MailViewer.h" |
|
134 |
|
135 // CONSTANT VALUES |
|
136 //<cmail> //hard coded paths removed |
|
137 _LIT( KETelCallEngPhCltResourceFile, "PhoneClient.rsc" ); |
|
138 //</cmail> |
|
139 _LIT( KMsgReaderFsDll,"freestylemessagescanner.dll"); // DLL provided by msg reader. |
|
140 _LIT( KPhoneModuleName, "Phonetsy.tsy"); |
|
141 _LIT( KPhoneName, "DefaultPhone"); |
|
142 // Message editor resource file with wild cards |
|
143 _LIT( KMsgEditorAppUiResourceFileName, "msgeditorappui.r*" ); |
|
144 // FSMailServer resource file with path and wild cards |
|
145 _LIT( KFSMailServerResourceFileNameWithPath, "\\resource\\apps\\fsmailserver.r*" ); |
|
146 |
|
147 // 6 seconds |
|
148 const TTimeIntervalMicroSeconds32 KIdleTimeInterval = 6000000; |
|
149 |
|
150 static TBool g_ApplicationExitOnGoing = EFalse; |
|
151 |
|
152 TInt DelayedViewLoaderCallBackL( TAny* aObject ) |
|
153 { |
|
154 return static_cast<CFreestyleEmailUiAppUi*> |
|
155 ( aObject )->ViewLoadIdleCallbackFunctionL(); |
|
156 } |
|
157 |
|
158 const TUint KConnectionStatusIconRotationInterval = 100; |
|
159 const TUint KFakeSyncAnimStopTimerInterval = 3000; // 3 secs |
|
160 const TInt KConnectionStatusIconRotationAmount = 18; |
|
161 // Length of the drive letter descriptor (e.g. "c:") |
|
162 const TInt KDriveDescLength = 2; |
|
163 |
|
164 |
|
165 // TDisplayImagesCache |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // TDisplayImagesCache::~TDisplayImagesCache |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 TDisplayImagesCache::~TDisplayImagesCache() |
|
172 { |
|
173 iCache.Reset(); |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // TDisplayImagesCache::AddMessageL |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void TDisplayImagesCache::AddMessageL( const CFSMailMessageBase& aMsg ) |
|
181 { |
|
182 AddMessageL(aMsg.GetMailBoxId(), aMsg.GetMessageId()); |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // TDisplayImagesCache::RemoveMessage |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 void TDisplayImagesCache::RemoveMessage( const CFSMailMessageBase& aMsg ) |
|
190 { |
|
191 RemoveMessage(aMsg.GetMailBoxId(), aMsg.GetMessageId()); |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // TDisplayImagesCache::Contains |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 TBool TDisplayImagesCache::Contains( const CFSMailMessageBase& aMsg ) const |
|
199 { |
|
200 return Contains(aMsg.GetMailBoxId(), aMsg.GetMessageId()); |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // TDisplayImagesCache::AddMessageL |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void TDisplayImagesCache::AddMessageL( const TFSMailMsgId& aBoxId, const TFSMailMsgId& aMsgId ) |
|
208 { |
|
209 TInt index(MailBoxIndex(aBoxId)); |
|
210 if (index == KErrNotFound) |
|
211 { |
|
212 AddMailBoxL(aBoxId, index); |
|
213 } |
|
214 iCache[index].AddMessageL(aMsgId); |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // TDisplayImagesCache::RemoveMessage |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 void TDisplayImagesCache::RemoveMessage( const TFSMailMsgId& aBoxId, const TFSMailMsgId& aMsgId ) |
|
222 { |
|
223 const TInt index(MailBoxIndex(aBoxId)); |
|
224 if (index != KErrNotFound) |
|
225 { |
|
226 iCache[index].RemoveMessage(aMsgId); |
|
227 } |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // TDisplayImagesCache::RemoveMailbox |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 void TDisplayImagesCache::RemoveMailbox( const TFSMailMsgId& aBoxId ) |
|
235 { |
|
236 const TInt index(MailBoxIndex(aBoxId)); |
|
237 if (index != KErrNotFound) |
|
238 { |
|
239 iCache.Remove(index); |
|
240 } |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------------------------- |
|
244 // TDisplayImagesCache::Contains |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 TBool TDisplayImagesCache::Contains( const TFSMailMsgId& aBoxId, const TFSMailMsgId& aMsgId ) const |
|
248 { |
|
249 const TInt index(MailBoxIndex(aBoxId)); |
|
250 if (index != KErrNotFound) |
|
251 { |
|
252 return iCache[index].Contains(aMsgId); |
|
253 } |
|
254 return EFalse; |
|
255 } |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // TDisplayImagesCache::MailBoxIndex |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 TInt TDisplayImagesCache::MailBoxIndex( const TFSMailMsgId& aBoxId ) const |
|
262 { |
|
263 return iCache.FindInOrder(TItem(aBoxId), TLinearOrder<TItem>(TItem::CompareItem)); |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // TDisplayImagesCache::AddMailBoxL |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void TDisplayImagesCache::AddMailBoxL( const TFSMailMsgId& aBoxId, TInt& aCacheIndex ) |
|
271 { |
|
272 aCacheIndex = KErrNotFound; |
|
273 iCache.InsertInOrderL(TItem(aBoxId), TLinearOrder<TItem>(TItem::CompareItem)); |
|
274 aCacheIndex = MailBoxIndex(aBoxId); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // TDisplayImagesCache::TItem::TItem |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 TDisplayImagesCache::TItem::TItem( const TFSMailMsgId& aBoxId ) |
|
282 : iMailBoxId( aBoxId ) |
|
283 { |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // TDisplayImagesCache::TItem::~TItem |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 TDisplayImagesCache::TItem::~TItem() |
|
291 { |
|
292 iMessageIds.Reset(); |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // TDisplayImagesCache::TItem::Contains |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 TBool TDisplayImagesCache::TItem::Contains( const TFSMailMsgId& aMsgId ) const |
|
300 { |
|
301 return MessageIndex(aMsgId) != KErrNotFound; |
|
302 } |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 // TDisplayImagesCache::TItem::AddMessageL |
|
306 // --------------------------------------------------------------------------- |
|
307 // |
|
308 void TDisplayImagesCache::TItem::AddMessageL( const TFSMailMsgId& aMsgId ) |
|
309 { |
|
310 if (!Contains(aMsgId)) |
|
311 { |
|
312 iMessageIds.InsertInOrderL(aMsgId, TLinearOrder<TFSMailMsgId>(TItem::CompareMsgId)); |
|
313 } |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // TDisplayImagesCache::TItem::RemoveMessage |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 void TDisplayImagesCache::TItem::RemoveMessage( const TFSMailMsgId& aMsgId ) |
|
321 { |
|
322 const TInt index(MessageIndex(aMsgId)); |
|
323 if (index != KErrNotFound) |
|
324 { |
|
325 iMessageIds.Remove(index); |
|
326 } |
|
327 } |
|
328 |
|
329 // --------------------------------------------------------------------------- |
|
330 // TDisplayImagesCache::TItem::MessageIndex |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 TInt TDisplayImagesCache::TItem::MessageIndex( const TFSMailMsgId& aMsgId ) const |
|
334 { |
|
335 return iMessageIds.FindInOrder(aMsgId, TLinearOrder<TFSMailMsgId>(TItem::CompareMsgId)); |
|
336 } |
|
337 |
|
338 // --------------------------------------------------------------------------- |
|
339 // TDisplayImagesCache::TItem::CompareItem |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 TInt TDisplayImagesCache::TItem::CompareItem( const TItem& aItem1, const TItem& aItem2 ) |
|
343 { |
|
344 return CompareMsgId(aItem1.iMailBoxId, aItem2.iMailBoxId); |
|
345 } |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 // TDisplayImagesCache::TItem::CompareMsgId |
|
349 // --------------------------------------------------------------------------- |
|
350 // |
|
351 TInt TDisplayImagesCache::TItem::CompareMsgId( const TFSMailMsgId& aId1, const TFSMailMsgId& aId2 ) |
|
352 { |
|
353 TInt result(aId1.PluginId().iUid - aId2.PluginId().iUid); |
|
354 if (!result) |
|
355 { |
|
356 result = TInt(aId1.Id() - aId2.Id()); |
|
357 } |
|
358 return result; |
|
359 } |
|
360 |
|
361 // --------------------------------------------------------------------------- |
|
362 // C++ constructor. |
|
363 // --------------------------------------------------------------------------- |
|
364 // |
|
365 CFreestyleEmailUiAppUi::CFreestyleEmailUiAppUi( CAlfEnv& aEnv ) |
|
366 : CAknViewAppUi(), |
|
367 iIsForeground( EFalse ), // init foreground flag to "not on foreground" |
|
368 iIsCaptured( EFalse ), // init "end key captured" to false |
|
369 iAutomatedMailBoxOnline( EFalse ), |
|
370 iMsgReaderIsSupported( KErrGeneral ), |
|
371 iSwitchingToBackground( EFalse ), |
|
372 iHasEmbeddedApp( EFalse ), |
|
373 iPreviousAppEmbedded( EFalse ), |
|
374 iEditorStartedFromEmbeddedApp( EFalse ) |
|
375 { |
|
376 FUNC_LOG; |
|
377 iEnv = &aEnv; |
|
378 iHtmlViewerViewId = TUid::Null(); |
|
379 TIMESTAMP( "Application starting" ); |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------------------------- |
|
383 // Load specified resource file, file name may (and should) contain wild cards |
|
384 // --------------------------------------------------------------------------- |
|
385 // |
|
386 TInt CFreestyleEmailUiAppUi::LoadResourceFileL( |
|
387 const TDesC& aFileName, |
|
388 const TDesC& aFilePath ) |
|
389 { |
|
390 FUNC_LOG; |
|
391 |
|
392 TFindFile search( iCoeEnv->FsSession() ); |
|
393 CDir* dirList = NULL; |
|
394 TInt err = search.FindWildByDir( aFileName, aFilePath, dirList ); |
|
395 |
|
396 if ( err == KErrNone ) |
|
397 { |
|
398 // After succesfull FindWildByDir; dirList contains list of found file |
|
399 // names and search.File() returns the drive and path of the file(s) |
|
400 if ( dirList->Count() > 0 ) |
|
401 { |
|
402 TParse parse; |
|
403 parse.Set( (*dirList)[0].iName, &search.File(), NULL ); |
|
404 TFileName nearestFile( parse.FullName() ); |
|
405 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), nearestFile ); |
|
406 delete dirList; |
|
407 |
|
408 INFO_1( "Load resource: %S", &nearestFile ); |
|
409 // Return the resource file offset if file loaded succesfully |
|
410 return iEikonEnv->AddResourceFileL( nearestFile ); |
|
411 } |
|
412 delete dirList; |
|
413 } |
|
414 |
|
415 // Leave if resource file is not found |
|
416 User::Leave( err ); |
|
417 return 0; // To avoid compiler warnings |
|
418 } |
|
419 |
|
420 // --------------------------------------------------------------------------- |
|
421 // ConstructL is called by the application framework |
|
422 // --------------------------------------------------------------------------- |
|
423 // |
|
424 void CFreestyleEmailUiAppUi::ConstructL() |
|
425 { |
|
426 FUNC_LOG; |
|
427 |
|
428 // Load message editor resources (needed for ENote fetch) |
|
429 iMsgEditorResourceOffset = LoadResourceFileL( |
|
430 KMsgEditorAppUiResourceFileName, |
|
431 KDC_RESOURCE_FILES_DIR ); |
|
432 |
|
433 // Load FSMailServer resource file, search first the same drive from where |
|
434 // our process is loaded as FSMailServer should be installed in same drive |
|
435 RProcess ownProcess; |
|
436 TFileName ownProcessName( ownProcess.FileName() ); |
|
437 ownProcess.Close(); |
|
438 iFSMailServerResourceOffset = LoadResourceFileL( |
|
439 KFSMailServerResourceFileNameWithPath, |
|
440 ownProcessName.LeftTPtr( KDriveDescLength ) ); |
|
441 |
|
442 // flag indicating whether we are in AppUi::ConstructL |
|
443 // workaround for compose view loadbackgroundcontext sending skin changed events |
|
444 // and causing texture manager to be reconstructed many times |
|
445 iConstructComplete = EFalse; |
|
446 |
|
447 // <cmail> |
|
448 iIADUpdateCompleted = !FeatureManager::FeatureSupported( KFeatureIdIAUpdate ); |
|
449 // </cmail> |
|
450 |
|
451 // Create the 'Back' stack |
|
452 iNavigationHistory = new (ELeave) CStack<CFsEmailUiViewBase, EFalse>(); |
|
453 |
|
454 // Enable Avkon skins. |
|
455 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); |
|
456 |
|
457 // This MUST be after BaseConstructL |
|
458 MTouchFeedback* touchFeedback(MTouchFeedback::Instance()); |
|
459 if (touchFeedback == NULL) |
|
460 { |
|
461 touchFeedback = MTouchFeedback::CreateInstanceL(); |
|
462 iTouchFeedbackCreated = ETrue; |
|
463 } |
|
464 touchFeedback->SetFeedbackEnabledForThisApp(touchFeedback->TouchFeedbackSupported()); |
|
465 |
|
466 |
|
467 // Create instance for Central repository handler |
|
468 iCRHandler = CFSEmailCRHandler::InstanceL(); |
|
469 |
|
470 // Initialize the flip state and the observer for listening to the flip |
|
471 // state changed events. The initial state will be reported in construction |
|
472 iPropertySubscriber = |
|
473 CFreestyleEmailUiPropertySubscriber::NewL( KPSUidHWRM, KHWRMFlipStatus, *this ); |
|
474 |
|
475 // Create Document Handler instance |
|
476 iDocumentHandler = CDocumentHandler::NewL(); |
|
477 iFileHandleShutter = CFsEmailFileHandleShutter::NewL(*iDocumentHandler); |
|
478 |
|
479 CAlfDisplay& disp = iEnv->NewDisplayL( ClientRect(), CAlfEnv::ENewDisplayAsCoeControl ); // aAppUi-> |
|
480 |
|
481 // SET to use skin bakcground if needed |
|
482 disp.SetClearBackgroundL(CAlfDisplay::EClearWithSkinBackground); |
|
483 |
|
484 // Create and load fs generci layout |
|
485 //<cmail> |
|
486 //iLayoutManager = new( ELeave )CFsLayoutManager(); |
|
487 //iLayoutManager->LoadLayoutL(); |
|
488 //<cmail> |
|
489 |
|
490 // Set up layouthandler |
|
491 iLayoutHandler = CFSEmailUiLayoutHandler::NewL( *iEnv ); |
|
492 |
|
493 // Create mail client, list mailboxes |
|
494 iMailClient = CFSMailClient::NewL(); |
|
495 |
|
496 // Connect to messaging server |
|
497 iMsvSession = CMsvSession::OpenSyncL( *this ); |
|
498 |
|
499 // Create freestyle texture manager |
|
500 iFsTextureManager = CFreestyleEmailUiTextureManager::NewL( *iEnv, this ); |
|
501 CFsDelayedLoader::InstanceL()->Start(); |
|
502 |
|
503 // New mailbox query async callback |
|
504 iNewBoxQueryAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
|
505 iNewBoxQueryAsyncCallback->Set( TCallBack( DisplayCreateQueryL, this ) ); |
|
506 |
|
507 iActionMenuHandler = CFSEmailUiActionMenu::NewL( this ); |
|
508 |
|
509 // Create download info mediator |
|
510 iDwnldMediator = CFSEmailDownloadInfoMediator::NewL( *iMailClient ); |
|
511 |
|
512 // Create a control groups |
|
513 iGridControlGroup = &iEnv->NewControlGroupL( KGridDisplayGroup ); |
|
514 |
|
515 // Create main UI grid and append it to control group |
|
516 TInt gridRows = iLayoutHandler->GridRowsInThisResolution(); |
|
517 TInt gridColumns = iLayoutHandler->GridColumnsInThisResolution(); |
|
518 iMainUiGrid = CFSEmailUiLauncherGrid::NewL(*iEnv, this ); |
|
519 iMainUiGridVisualiser = CFSEmailUiLauncherGridVisualiser::NewL( *iEnv, iMainUiGrid, this, |
|
520 *iGridControlGroup, gridRows, gridColumns ); |
|
521 iMainUiGrid->SetVisualiserL( iMainUiGridVisualiser ); |
|
522 iGridControlGroup->AppendL(iMainUiGrid); |
|
523 //disp.iVisibleAreaObservers.AppendL(*iMainUiGridVisualiser); // Commented out as (hopefully) unnecessary, can't be accessed directly in Alfred anyway |
|
524 AddViewL( iMainUiGridVisualiser ); |
|
525 |
|
526 // Create control groups |
|
527 iMailListControlGroup = &iEnv->NewControlGroupL( KMailListDisplayGroup ); |
|
528 iEmailViewerControlGroup = &iEnv->NewControlGroupL( KEmailViewerDisplayGroup ); |
|
529 iFolderListControlGroup = &iEnv->NewControlGroupL( KFolderListDisplayGroup ); |
|
530 iSettingsListControlGroup = &iEnv->NewControlGroupL( KSettingsListDisplayGroup ); |
|
531 iComposerControlGroup = &iEnv->NewControlGroupL( KEmailEditorDisplayGroup ); |
|
532 iStatusIndicatorControlGroup = &iEnv->NewControlGroupL( KStatusIndicatorDisplayGroup ); |
|
533 |
|
534 // Create settings list views |
|
535 CFsEmailSettingsListView* settingsListView = CFsEmailSettingsListView::NewLC( *iMailClient, this, *iSettingsListControlGroup ); |
|
536 AddViewL( settingsListView ); |
|
537 CleanupStack::Pop( settingsListView ); |
|
538 CFsEmailUiGlobalSettingsListView* globalSettingsView = CFsEmailUiGlobalSettingsListView::NewLC( this, *iSettingsListControlGroup ); |
|
539 AddViewL( globalSettingsView ); |
|
540 CleanupStack::Pop( globalSettingsView ); |
|
541 |
|
542 // Create and start view load in idle. Loads rest of the views when in idle. |
|
543 iViewLoadIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
544 iViewLoadIdleCallback = new (ELeave) TCallBack( DelayedViewLoaderCallBackL, this ); |
|
545 iViewLoadIdle->Start( *iViewLoadIdleCallback ); |
|
546 |
|
547 // Create html viewer |
|
548 iHtmlViewerControlGroup = &iEnv->NewControlGroupL( KHtmlViewerDisplayGroup ); |
|
549 iHtmlViewerView = CFsEmailUiHtmlViewerView::NewL( *iEnv, *this, *iHtmlViewerControlGroup ); |
|
550 AddViewL( iHtmlViewerView ); |
|
551 iHtmlViewerViewId = iHtmlViewerView->Id(); |
|
552 |
|
553 // Create mail list |
|
554 iMailListVisualiser = CFSEmailUiMailListVisualiser::NewL(*iEnv, this, *iMailListControlGroup ); |
|
555 AddViewL( iMailListVisualiser ); |
|
556 |
|
557 // Create mail composing view |
|
558 iComposeView = CNcsComposeView::NewL( *iMailClient, *iEnv, this, |
|
559 *iComposerControlGroup, *iMsvSession ); |
|
560 AddViewL( iComposeView ); |
|
561 |
|
562 // Create folder list view |
|
563 iFolderListVisualiser = CFSEmailUiFolderListVisualiser::NewL( *iEnv, *iFolderListControlGroup, *this ); |
|
564 AddViewL( iFolderListVisualiser ); |
|
565 |
|
566 // Create status indicator |
|
567 iStatusIndicator = CFSEmailUiStatusIndicator::NewL( *iEnv, |
|
568 *iStatusIndicatorControlGroup, |
|
569 this ); |
|
570 |
|
571 |
|
572 iCurrentActiveView = iMainUiGridVisualiser; |
|
573 SetDefaultViewL( *iMainUiGridVisualiser ); |
|
574 |
|
575 |
|
576 // add this class to listen mail events, e.g. TFSEventNewMailbox |
|
577 iMailClient->AddObserverL( *this ); |
|
578 |
|
579 iShortcutBinder = CFSEmailUiShortcutBinding::NewL(); |
|
580 |
|
581 // Try to ensure that FSMailServer is running before creating the mailbox |
|
582 TFsEmailUiUtility::EnsureFsMailServerIsRunning( iEikonEnv->WsSession() ); |
|
583 |
|
584 // If we have no mailboxes yet start a setup wizard. Else, if this app has been launched |
|
585 // by a setup wizard then handle the mailbox data in central repository |
|
586 iWizardObserver = CFSEmailUiWizardObserver::NewL( this, iMainUiGridVisualiser ); |
|
587 iConstructComplete = ETrue; |
|
588 |
|
589 iExitGuardian = CEUiExitGuardian::NewL( *this ); |
|
590 |
|
591 iConnectionStatusVisible = ETrue; |
|
592 // Create custom statuspane indicators object, which shows priority and followup flags |
|
593 CreateStatusPaneIndicatorsL(); |
|
594 iConnectionStatusIconAnimTimer = CFSEmailUiGenericTimer::NewL(this, CActive::EPriorityLow); |
|
595 iFakeSyncAnimStopTimer = CFSEmailUiGenericTimer::NewL(this, CActive::EPriorityLow); |
|
596 |
|
597 // this includes a wait note where code running will be pending |
|
598 // until a certain callback event is received |
|
599 // -> thus keep this last in this method! |
|
600 iWizardObserver->DoWizardStartupActionsL(); |
|
601 TIMESTAMP( "Application started" ); |
|
602 } |
|
603 |
|
604 // Functions loads some views as delayed to reduce startup time |
|
605 TInt CFreestyleEmailUiAppUi::ViewLoadIdleCallbackFunctionL() |
|
606 { |
|
607 FUNC_LOG; |
|
608 // Load the phone resources into this process |
|
609 //<cmail> hard coded paths removal |
|
610 TFileName phCltResPath(KDC_RESOURCE_FILES_DIR); |
|
611 phCltResPath.Append(KETelCallEngPhCltResourceFile); |
|
612 //</cmail> |
|
613 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), phCltResPath ); |
|
614 iPhCltResHandle = iEikonEnv->AddResourceFileL( phCltResPath ); |
|
615 |
|
616 // Create attachment list visualiser and control |
|
617 iAttachmentControlGroup = &iEnv->NewControlGroupL( KAttachmentManagerDisplayGroup ); |
|
618 iAttachmentListVisualiser = CFSEmailUiAttachmentsListVisualiser::NewL( *iEnv, this, *iAttachmentControlGroup ); |
|
619 AddViewL( iAttachmentListVisualiser ); |
|
620 |
|
621 // Download manager removed. |
|
622 |
|
623 // Create search list view |
|
624 iSearchResultControlGroup = &iEnv->NewControlGroupL( KSearchResultDisplayGroup ); |
|
625 iSearchListVisualiser = CFSEmailUiSearchListVisualiser::NewL( *iEnv, this, *iSearchResultControlGroup ); |
|
626 AddViewL( iSearchListVisualiser ); |
|
627 |
|
628 // Create message details view |
|
629 iMsgDetailsControlGroup = &iEnv->NewControlGroupL( KMsgDetailsViewerControlGroup ); |
|
630 iMsgDetailsVisualiser = CFSEmailUiMsgDetailsVisualiser::NewL( *iEnv, *iMsgDetailsControlGroup, *this ); |
|
631 AddViewL( iMsgDetailsVisualiser ); |
|
632 |
|
633 // Check updates from IAD, continue UI launching even if something fails there |
|
634 TRAP_IGNORE( CheckUpdatesL() ); |
|
635 |
|
636 // Make sure there's no temp files left from previous sessions |
|
637 TFsEmailUiUtility::EraseTempDir(); |
|
638 |
|
639 return KErrNone; |
|
640 } |
|
641 |
|
642 CFreestyleEmailUiAppUi::~CFreestyleEmailUiAppUi() |
|
643 { |
|
644 FUNC_LOG; |
|
645 |
|
646 if ( iMsgEditorResourceOffset ) |
|
647 { |
|
648 iEikonEnv->DeleteResourceFile( iMsgEditorResourceOffset ); |
|
649 } |
|
650 if ( iFSMailServerResourceOffset ) |
|
651 { |
|
652 iEikonEnv->DeleteResourceFile( iFSMailServerResourceOffset ); |
|
653 } |
|
654 // Make sure we don't leave any temp files |
|
655 TFsEmailUiUtility::EraseTempDir(); |
|
656 |
|
657 delete iExitGuardian; |
|
658 delete iUpdateClient; |
|
659 delete iUpdateParameters; |
|
660 delete iNewBoxQueryAsyncCallback; |
|
661 delete iVpkContactManager; |
|
662 delete iPropertySubscriber; |
|
663 |
|
664 DeleteStatusPaneIndicators(); |
|
665 |
|
666 if ( iAutoSyncMonitor ) |
|
667 { |
|
668 iAutoSyncMonitor->StopMonitoring(); |
|
669 delete iAutoSyncMonitor; |
|
670 } |
|
671 |
|
672 if ( iViewLoadIdle ) |
|
673 { |
|
674 iViewLoadIdle->Cancel(); |
|
675 delete iViewLoadIdle; |
|
676 } |
|
677 if ( iViewLoadIdleCallback ) |
|
678 { |
|
679 delete iViewLoadIdleCallback; |
|
680 } |
|
681 |
|
682 CCoeEnv::Static()->DeleteResourceFile( iPhCltResHandle ); |
|
683 |
|
684 delete iLayoutHandler; |
|
685 iLayoutHandler = NULL; |
|
686 |
|
687 delete iMsvSession; |
|
688 iMsvSession = NULL; |
|
689 |
|
690 delete iWizardObserver; |
|
691 iWizardObserver = NULL; |
|
692 |
|
693 if ( iCRHandler ) |
|
694 { |
|
695 // just to make sure: |
|
696 // clears the two centrep keys that were passed as parameters to plugins |
|
697 iCRHandler->ClearWizardParams(); |
|
698 delete iCRHandler; |
|
699 iCRHandler = NULL; |
|
700 } |
|
701 |
|
702 if (iCustomMessageToMessageReader) |
|
703 { |
|
704 delete iCustomMessageToMessageReader; |
|
705 } |
|
706 |
|
707 delete iActionMenuHandler; |
|
708 iActionMenuHandler = NULL; |
|
709 |
|
710 delete iShortcutBinder; |
|
711 iShortcutBinder = NULL; |
|
712 |
|
713 delete iDocumentHandler; |
|
714 iDocumentHandler = NULL; |
|
715 |
|
716 delete iFileHandleShutter; |
|
717 |
|
718 delete iFsTextureManager; |
|
719 iFsTextureManager = NULL; |
|
720 //<cmail> layout manager deltion removed </cmail> |
|
721 if ( iFeatureManagerInitialized ) |
|
722 { |
|
723 // We can safely call UnInitializeLib as we have really intialized it! |
|
724 FeatureManager::UnInitializeLib(); // Decreases ref.count |
|
725 iFeatureManagerInitialized = EFalse; |
|
726 } |
|
727 |
|
728 delete iNavigationHistory; |
|
729 iNavigationHistory = NULL; |
|
730 |
|
731 // CAlfEnv creation and deletion was moved from here to Document class |
|
732 // because of cross-dependency between alf and S60 view architecture -> |
|
733 // AlfEnv must still exist when AppUI is destructed. |
|
734 // However, CAlfDisplay's destructor has a dependency to AppUI. That's |
|
735 // why display must be deleted explicitly here, when AppUI still exists. |
|
736 // Otherwise "delete env" in CDocument panics. |
|
737 CAlfDisplay *disp = &iEnv->PrimaryDisplay(); |
|
738 if ( disp ) |
|
739 { |
|
740 delete disp; |
|
741 } |
|
742 |
|
743 TFsEmailUiUtility::DeleteStaticData(); |
|
744 |
|
745 // Cannot rely on framework to delete HTMLVierView as it de-registers from CFSEmailDownloadInfoMediator |
|
746 RemoveView(iHtmlViewerViewId); |
|
747 // destroys the Download Information mediator |
|
748 // Destruction must be done here as other Tls data depends on it. |
|
749 CFSEmailDownloadInfoMediator::Destroy(); |
|
750 |
|
751 delete iNaviDecorator2MailViewer; |
|
752 |
|
753 delete iConnectionStatusIconAnimTimer; |
|
754 delete iFakeSyncAnimStopTimer; |
|
755 |
|
756 MTouchFeedback* touchFeedback( MTouchFeedback::Instance() ); |
|
757 if (touchFeedback && touchFeedback->TouchFeedbackSupported()) |
|
758 { |
|
759 touchFeedback->SetFeedbackEnabledForThisApp(EFalse); |
|
760 } |
|
761 |
|
762 if (iTouchFeedbackCreated) |
|
763 { |
|
764 MTouchFeedback::DestroyInstance(); |
|
765 } |
|
766 |
|
767 TIMESTAMP( "Application exit" ); |
|
768 } |
|
769 |
|
770 |
|
771 void CFreestyleEmailUiAppUi::EnterFsEmailViewL( TUid aViewId ) |
|
772 { |
|
773 FUNC_LOG; |
|
774 if ( AppUiExitOngoing() ) |
|
775 { |
|
776 return; |
|
777 } |
|
778 |
|
779 iPreviousActiveView = iCurrentActiveView; |
|
780 |
|
781 // First check if the view to be activated is the current view. In that case, |
|
782 // the view history stack is not altered. |
|
783 if ( iCurrentActiveView->Id() == aViewId ) |
|
784 { |
|
785 ActivateLocalViewL( aViewId ); |
|
786 } |
|
787 |
|
788 // Then check if the view is in the history stack. In that case, we don't |
|
789 // actually navigate forward but backward. |
|
790 else if ( IsViewInHistoryStack( aViewId ) ) |
|
791 { |
|
792 ReturnToViewL( aViewId ); |
|
793 } |
|
794 |
|
795 // Otherwise this is just the normal case of entering some new view |
|
796 else |
|
797 { |
|
798 iNavigationHistory->PushL( iCurrentActiveView ); |
|
799 ActivateLocalViewL( aViewId ); |
|
800 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(aViewId) ); |
|
801 } |
|
802 } |
|
803 |
|
804 void CFreestyleEmailUiAppUi::EnterFsEmailViewL( TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
805 { |
|
806 FUNC_LOG; |
|
807 if ( AppUiExitOngoing() ) |
|
808 { |
|
809 return; |
|
810 } |
|
811 |
|
812 iPreviousActiveView = iCurrentActiveView; |
|
813 |
|
814 // First check if the view to be activated is the current view. In that case, |
|
815 // the view history stack is not altered. |
|
816 if ( iCurrentActiveView->Id() == aViewId ) |
|
817 { |
|
818 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
819 } |
|
820 |
|
821 // Then check if the view is in the history stack. In that case, we don't |
|
822 // actually navigate forward but backward. |
|
823 else if ( IsViewInHistoryStack( aViewId ) ) |
|
824 { |
|
825 ReturnToViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
826 } |
|
827 |
|
828 // Otherwise this is just the normal case of entering some new view |
|
829 else |
|
830 { |
|
831 iNavigationHistory->PushL( iCurrentActiveView ); |
|
832 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
833 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(aViewId) ); |
|
834 } |
|
835 } |
|
836 |
|
837 void CFreestyleEmailUiAppUi::EnterPluginSettingsViewL( TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
838 { |
|
839 FUNC_LOG; |
|
840 // Plugin settings views need to be handled as special cases, as returning from them does not happen with our |
|
841 // ReturnToPreviousViewL() and they are not iherited from our BaseView. |
|
842 iNavigationHistory->PushL( iCurrentActiveView ); |
|
843 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
844 iSettingsViewActive = ETrue; |
|
845 |
|
846 // Fade out the current view here as it doesn't happen when activating the plugin settings view |
|
847 iCurrentActiveView->DoTransition( ETrue ); |
|
848 } |
|
849 |
|
850 void CFreestyleEmailUiAppUi::ReturnFromPluginSettingsView() |
|
851 { |
|
852 FUNC_LOG; |
|
853 // Check if we just returned from a plugin settings view. In that case, the current active view |
|
854 // and view history must be updated here (because RetrunToPreviousViewL() has not been used). |
|
855 if ( iSettingsViewActive ) |
|
856 { |
|
857 iSettingsViewActive = EFalse; |
|
858 |
|
859 // Set the iCurrentActiveView pointer |
|
860 if ( iNavigationHistory->IsEmpty() ) |
|
861 { |
|
862 // Activate grid view if the view history stack is empty. This happens only |
|
863 // if something has gone wrong. |
|
864 // Note that the grid view may need to be re-drawn, e.g. if the |
|
865 // current orientation is different from the last time it was |
|
866 // displayed. This is because it will not have received dynamic |
|
867 // variant switch notifications while it was not in the history. |
|
868 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) ); |
|
869 iMainUiGridVisualiser->SetRefreshNeeded(); |
|
870 } |
|
871 else |
|
872 { |
|
873 iCurrentActiveView = iNavigationHistory->Pop(); |
|
874 } |
|
875 } |
|
876 // may be tricky; added here to handle activation of composer view from external app when email is plugin settings view |
|
877 // in this case also duplictaed view needs to be poped up, but iSettingsViewActive is already set to EFalse |
|
878 // other solution would need to expand api of this class to handle directly this case |
|
879 else |
|
880 if ( iPreviousActiveView->Id() == SettingsViewId || iPreviousActiveView->Id() == MailListId ) |
|
881 { |
|
882 iCurrentActiveView = iNavigationHistory->Pop(); |
|
883 } |
|
884 } |
|
885 |
|
886 void CFreestyleEmailUiAppUi::ViewActivatedExternallyL( TUid aViewId ) |
|
887 { |
|
888 FUNC_LOG; |
|
889 if ( AppUiExitOngoing() ) |
|
890 { |
|
891 return; |
|
892 } |
|
893 |
|
894 // Do nothing if the externally activated view was already active |
|
895 if ( iCurrentActiveView->Id() != aViewId ) |
|
896 { |
|
897 // this function removes setting view from view stack so |
|
898 // it cannot be active any more |
|
899 iSettingsViewActive = EFalse; |
|
900 |
|
901 iPreviousActiveView = iCurrentActiveView; |
|
902 |
|
903 // Check if the view is in the history stack. In that case, we don't |
|
904 // actually navigate forward but backward. |
|
905 if ( IsViewInHistoryStack( aViewId ) ) |
|
906 { |
|
907 // Remove views from the stack until the desired one is found or the stack becomes empty |
|
908 do |
|
909 { |
|
910 iCurrentActiveView = iNavigationHistory->Pop(); |
|
911 } |
|
912 while ( !iNavigationHistory->IsEmpty() && iCurrentActiveView->Id() != aViewId ); |
|
913 } |
|
914 |
|
915 // Otherwise this is just the normal case of entering some new view |
|
916 else |
|
917 { |
|
918 iNavigationHistory->PushL( iCurrentActiveView ); |
|
919 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(aViewId) ); |
|
920 } |
|
921 } |
|
922 TIMESTAMP( "View activated" ); |
|
923 } |
|
924 |
|
925 void CFreestyleEmailUiAppUi::SetSwitchingToBackground( TBool aValue ) |
|
926 { |
|
927 FUNC_LOG; |
|
928 iSwitchingToBackground = aValue; |
|
929 } |
|
930 |
|
931 TBool CFreestyleEmailUiAppUi::SwitchingToBackground() const |
|
932 { |
|
933 FUNC_LOG; |
|
934 return iSwitchingToBackground; |
|
935 } |
|
936 |
|
937 void CFreestyleEmailUiAppUi::ReturnFromHtmlViewerL( TBool aMessageWasDeleted ) |
|
938 { |
|
939 FUNC_LOG; |
|
940 if ( aMessageWasDeleted ) |
|
941 { |
|
942 // Message deleted, remove mail viewer from the stack |
|
943 // => view returns directly mail list (or any other view where the viewer was started from) |
|
944 |
|
945 TMailListActivationData tmp; |
|
946 tmp.iRequestRefresh = ETrue; |
|
947 const TPckgBuf<TMailListActivationData> pkgOut( tmp ); |
|
948 ReturnToPreviousViewL(pkgOut); |
|
949 } |
|
950 else |
|
951 { |
|
952 ReturnToPreviousViewL(); |
|
953 } |
|
954 TIMESTAMP( "Returned from html viewer view to previous view" ); |
|
955 } |
|
956 |
|
957 TUid CFreestyleEmailUiAppUi::ReturnToPreviousViewL( const TDesC8& aCustomMessage /*= KNullDesC8*/ ) |
|
958 { |
|
959 FUNC_LOG; |
|
960 iPreviousActiveView = iCurrentActiveView; |
|
961 CFsDelayedLoader::InstanceL()->GetContactHandlerL()->Reset(); |
|
962 // Set the iCurrentActiveView pointer |
|
963 if ( iNavigationHistory->IsEmpty() ) |
|
964 { |
|
965 // Activate grid view if the view history stack is empty. This happens only |
|
966 // if something has gone wrong. |
|
967 // Note that the grid view may need to be re-drawn, e.g. if the |
|
968 // current orientation is different from the last time it was |
|
969 // displayed. This is because it will not have received dynamic |
|
970 // variant switch notifications while it was not in the history. |
|
971 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) ); |
|
972 iMainUiGridVisualiser->SetRefreshNeeded(); |
|
973 } |
|
974 else |
|
975 { |
|
976 iCurrentActiveView = iNavigationHistory->Pop(); |
|
977 } |
|
978 |
|
979 TUid viewId = iCurrentActiveView->Id(); |
|
980 |
|
981 // Activate the proper view |
|
982 if ( viewId == AppGridId ) |
|
983 { |
|
984 ActivateLocalViewL( AppGridId ); |
|
985 TIMESTAMP( "Return to application grid view" ); |
|
986 } |
|
987 else if ( viewId == MailListId ) |
|
988 { |
|
989 if ( aCustomMessage.Length() ) |
|
990 { |
|
991 ActivateLocalViewL( MailListId, KStartListReturnToPreviousFolder, aCustomMessage ); |
|
992 } |
|
993 else |
|
994 { |
|
995 const TPckgBuf<TMailListActivationData> pkgOut; |
|
996 ActivateLocalViewL( MailListId, KStartListReturnToPreviousFolder, pkgOut ); |
|
997 } |
|
998 TIMESTAMP( "Return to message list view" ); |
|
999 } |
|
1000 else if ( viewId == SearchListViewId ) |
|
1001 { |
|
1002 TSearchListActivationData tmp; |
|
1003 tmp.iMailBoxId = GetActiveMailbox()->GetId(); |
|
1004 const TPckgBuf<TSearchListActivationData> pkgOut( tmp ); |
|
1005 ActivateLocalViewL( SearchListViewId, KStartWithPreviousResults, pkgOut ); |
|
1006 } |
|
1007 else if ( viewId == HtmlViewerId ) |
|
1008 { |
|
1009 // launch html viewer |
|
1010 const TPckgBuf<THtmlViewerActivationData> pkgOut; |
|
1011 ActivateLocalViewL( HtmlViewerId, KHtmlViewerReturnToPrevious, pkgOut ); |
|
1012 TIMESTAMP( "Return to html viewer view" ); |
|
1013 } |
|
1014 else if ( viewId == MailEditorId ) |
|
1015 { |
|
1016 ActivateLocalViewL( MailEditorId, TUid::Uid(KEditorCmdReturnToPrevious), aCustomMessage ); |
|
1017 TIMESTAMP( "Return to email editor view" ); |
|
1018 } |
|
1019 else if ( viewId == MsgDetailsViewId ) |
|
1020 { |
|
1021 ActivateLocalViewL( MsgDetailsViewId, KStartMsgDetailsReturnToPrevious, aCustomMessage ); |
|
1022 } |
|
1023 else if ( viewId == SettingsViewId ) |
|
1024 { |
|
1025 ActivateLocalViewL( SettingsViewId, TUid::Uid(KMailSettingsReturnToPrevious), aCustomMessage ); |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 // Generic case where the view does not need any startup parameters |
|
1030 ActivateLocalViewL( viewId ); |
|
1031 TIMESTAMP( "Return to previous view" ); |
|
1032 } |
|
1033 |
|
1034 return viewId; |
|
1035 } |
|
1036 |
|
1037 void CFreestyleEmailUiAppUi::EraseViewHistory() |
|
1038 { |
|
1039 FUNC_LOG; |
|
1040 iNavigationHistory->Clear(); |
|
1041 } |
|
1042 |
|
1043 TBool CFreestyleEmailUiAppUi::IsViewInHistoryStack( TUid aViewId ) const |
|
1044 { |
|
1045 FUNC_LOG; |
|
1046 for ( TInt i=0 ; i<iNavigationHistory->Count() ; ++i ) |
|
1047 { |
|
1048 if ( (*iNavigationHistory)[i]->Id() == aViewId ) |
|
1049 { |
|
1050 return ETrue; |
|
1051 } |
|
1052 } |
|
1053 return EFalse; |
|
1054 } |
|
1055 |
|
1056 void CFreestyleEmailUiAppUi::ReturnToViewL( TUid aViewId, |
|
1057 TUid aCustomMessageId /*= TUid::Null()*/, |
|
1058 const TDesC8& aCustomMessage /*= KNullDesC8*/ ) |
|
1059 { |
|
1060 FUNC_LOG; |
|
1061 iPreviousActiveView = iCurrentActiveView; |
|
1062 |
|
1063 // Remove views from the stack until the desired one is found or the stack becomes empty |
|
1064 iCurrentActiveView = iNavigationHistory->Pop(); |
|
1065 while ( !iNavigationHistory->IsEmpty() && iCurrentActiveView->Id() != aViewId ) |
|
1066 { |
|
1067 iCurrentActiveView = iNavigationHistory->Pop(); |
|
1068 } |
|
1069 |
|
1070 // Return to grid in case the desired view was not found |
|
1071 if ( iCurrentActiveView->Id() != aViewId && iCurrentActiveView->Id() != AppGridId ) |
|
1072 { |
|
1073 // For some reason the launcher grid wasn't at the bottom of the |
|
1074 // stack. Activate it now, but also tell it to refresh itself in |
|
1075 // case it wasn't in the stack at all and missed (e.g.) an |
|
1076 // orientation change notification. |
|
1077 iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) ); |
|
1078 iMainUiGridVisualiser->SetRefreshNeeded(); |
|
1079 } |
|
1080 |
|
1081 if ( aCustomMessageId != TUid::Null() || aCustomMessage.Length() ) |
|
1082 { |
|
1083 ActivateLocalViewL( iCurrentActiveView->Id(), aCustomMessageId, aCustomMessage ); |
|
1084 } |
|
1085 else |
|
1086 { |
|
1087 ActivateLocalViewL( iCurrentActiveView->Id() ); |
|
1088 } |
|
1089 TIMESTAMP( "Return to earlier view" ); |
|
1090 } |
|
1091 |
|
1092 void CFreestyleEmailUiAppUi::ShowFolderListInPopupL( |
|
1093 const TFSMailMsgId aFolderId, |
|
1094 MFSEmailUiFolderListCallback* aCallback, |
|
1095 MFsControlButtonInterface* aButton ) |
|
1096 { |
|
1097 FUNC_LOG; |
|
1098 iFolderListVisualiser->ShowInPopupL( aFolderId, aCallback, aButton ); |
|
1099 |
|
1100 iCurrentActiveView->ControlGroup().SetAcceptInput( EFalse ); |
|
1101 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
|
1102 iFolderListControlGroup->SetAcceptInput( ETrue ); |
|
1103 } |
|
1104 |
|
1105 void CFreestyleEmailUiAppUi::ShowSortListInPopupL( |
|
1106 const TFSMailSortCriteria aCurrentSortCriteria, |
|
1107 const TFSFolderType aFolderType, |
|
1108 MFSEmailUiSortListCallback* aCallback, |
|
1109 MFsControlButtonInterface* aButton ) |
|
1110 { |
|
1111 FUNC_LOG; |
|
1112 iFolderListVisualiser->ShowSortListPopupL( aCurrentSortCriteria, aFolderType, aCallback, aButton ); |
|
1113 |
|
1114 iCurrentActiveView->ControlGroup().SetAcceptInput( EFalse ); |
|
1115 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpShow, &Display()), 0 ); |
|
1116 iFolderListControlGroup->SetAcceptInput( ETrue ); |
|
1117 } |
|
1118 |
|
1119 void CFreestyleEmailUiAppUi::FolderPopupClosed() |
|
1120 { |
|
1121 FUNC_LOG; |
|
1122 iFolderListControlGroup->SetAcceptInput( EFalse ); |
|
1123 iEnv->Send( TAlfGroupCommand(*iFolderListControlGroup, EAlfOpHide, &Display()), 0 ); |
|
1124 iCurrentActiveView->ControlGroup().SetAcceptInput( ETrue ); |
|
1125 } |
|
1126 |
|
1127 void CFreestyleEmailUiAppUi::ProcessCommandL( TInt aCommand ) |
|
1128 { |
|
1129 FUNC_LOG; |
|
1130 |
|
1131 // For a reason unknown compose view propagates a leave when the options |
|
1132 // menu open -command is sent to it during the time when it has started |
|
1133 // the view deactivation but not yet completed that. It causes unnecessay |
|
1134 // leave notes in a complete normal use cases in the emulator. To remove |
|
1135 // the notes but keep the regression risk at minimum (ie. not do any major |
|
1136 // refactoring) trap the leave here. Propagate other leaves normally. |
|
1137 TRAPD( err, CAknViewAppUi::ProcessCommandL( aCommand ) ); |
|
1138 |
|
1139 if ( err != KErrNcsComposeViewNotReady ) |
|
1140 { |
|
1141 User::LeaveIfError( err ); |
|
1142 } |
|
1143 } |
|
1144 |
|
1145 void CFreestyleEmailUiAppUi::HandleCommandL( TInt aCommand ) |
|
1146 { |
|
1147 FUNC_LOG; |
|
1148 switch(aCommand) |
|
1149 { |
|
1150 case EEikCmdExit: |
|
1151 case EAknSoftkeyExit: |
|
1152 case EFsEmailUiCmdExit: |
|
1153 Exit(); |
|
1154 break; |
|
1155 default: |
|
1156 break; |
|
1157 } |
|
1158 } |
|
1159 |
|
1160 void CFreestyleEmailUiAppUi::Exit() |
|
1161 { |
|
1162 FUNC_LOG; |
|
1163 TIMESTAMP ("Exiting from email application"); |
|
1164 g_ApplicationExitOnGoing = ETrue; |
|
1165 if ( iExitGuardian->TryExitApplication() == KRequestPending ) |
|
1166 { |
|
1167 SendToBackground(); |
|
1168 } |
|
1169 } |
|
1170 |
|
1171 void CFreestyleEmailUiAppUi::ExitNow() |
|
1172 { |
|
1173 FUNC_LOG; |
|
1174 |
|
1175 //<cmail> |
|
1176 if ( iCurrentActiveView ) |
|
1177 { |
|
1178 // Let active view prepare itself for exit. This may be needed |
|
1179 // if view's destructor is too late to do certain cleanup. |
|
1180 TRAP_IGNORE( iCurrentActiveView->PrepareExitL() ); |
|
1181 } |
|
1182 //</cmail> |
|
1183 // Closing of mail client (and also unsubscribing of mailbox events) |
|
1184 // was moved from destructor to here to avoid panic in case of pressing |
|
1185 // end key during attachment download. Panic arises because of |
|
1186 // MailClient->Close makes plugins to cancel all requests, which means |
|
1187 // also notifying observers -> UI gets DownloadStatusChangedL call and |
|
1188 // tries to e.g. update layout. However, CEikonEnv is needed there but it |
|
1189 // was already destoyed in this phase. Here in Exit() MailClient->Close |
|
1190 // can finish safely before the environment gets destroyed. |
|
1191 |
|
1192 // First, prepare viewer, search list and composer for exit, destroys mailbox object before |
|
1193 // This exit preparation should be moved to base class in the future. |
|
1194 if ( iMsgDetailsVisualiser ) |
|
1195 { |
|
1196 iMsgDetailsVisualiser->PrepareForExit(); |
|
1197 } |
|
1198 if ( iMailListVisualiser ) |
|
1199 { |
|
1200 iMailListVisualiser->PrepareForExit(); |
|
1201 } |
|
1202 if ( iHtmlViewerView ) |
|
1203 { |
|
1204 iHtmlViewerView->PrepareForExit(); |
|
1205 } |
|
1206 if ( iSearchListVisualiser ) |
|
1207 { |
|
1208 iSearchListVisualiser->PrepareForExit(); |
|
1209 } |
|
1210 if ( iComposeView ) |
|
1211 { |
|
1212 iComposeView->PrepareForExit(); |
|
1213 //<cmail> |
|
1214 //if compose view is not prepared, it will exit app by itself |
|
1215 if(!iComposeView->IsPreparedForExit()) |
|
1216 { |
|
1217 return; |
|
1218 } |
|
1219 //</cmail> |
|
1220 } |
|
1221 |
|
1222 delete iMRViewer; |
|
1223 iMRViewer = NULL; |
|
1224 |
|
1225 // Unsubscribe active mailbox events from list visualiser |
|
1226 if ( iActiveMailbox ) |
|
1227 { |
|
1228 iMailClient->UnsubscribeMailboxEvents( iActiveMailboxId, *this ); |
|
1229 delete iActiveMailbox; |
|
1230 iActiveMailbox = NULL; |
|
1231 } |
|
1232 |
|
1233 // Unsubscribe events from mailboxes from appui |
|
1234 for ( TInt i = 0; i < iSubscribedMailBoxes.Count(); i++ ) |
|
1235 { |
|
1236 iMailClient->UnsubscribeMailboxEvents( iSubscribedMailBoxes[i], *this ); |
|
1237 } |
|
1238 iSubscribedMailBoxesIds.Reset(); |
|
1239 iSubscribedMailBoxes.Reset(); |
|
1240 |
|
1241 if ( iMailClient ) |
|
1242 { |
|
1243 iMailClient->RemoveObserver( *this ); |
|
1244 iMailClient->Close(); |
|
1245 iMailClient = NULL; |
|
1246 } |
|
1247 |
|
1248 CAknViewAppUi::Exit(); |
|
1249 } |
|
1250 |
|
1251 void CFreestyleEmailUiAppUi::CreateNewMailL() |
|
1252 { |
|
1253 FUNC_LOG; |
|
1254 // Fill params |
|
1255 TEditorLaunchParams params; |
|
1256 params.iMailboxId = iActiveMailbox->GetId(); |
|
1257 params.iActivatedExternally = EFalse; |
|
1258 LaunchEditorL( KEditorCmdCreateNew, params ); |
|
1259 } |
|
1260 |
|
1261 CFsEmailUiViewBase* CFreestyleEmailUiAppUi::CurrentActiveView() |
|
1262 { |
|
1263 FUNC_LOG; |
|
1264 return iCurrentActiveView; |
|
1265 } |
|
1266 |
|
1267 CFsEmailUiViewBase* CFreestyleEmailUiAppUi::PreviousActiveView() |
|
1268 { |
|
1269 FUNC_LOG; |
|
1270 return iPreviousActiveView; |
|
1271 } |
|
1272 |
|
1273 TBool CFreestyleEmailUiAppUi::IsPluginSettingsViewActive() |
|
1274 { |
|
1275 FUNC_LOG; |
|
1276 return iSettingsViewActive; |
|
1277 } |
|
1278 |
|
1279 TInt CFreestyleEmailUiAppUi::NewEmailsInModelL() |
|
1280 { |
|
1281 FUNC_LOG; |
|
1282 TInt ret(0); |
|
1283 if ( iMailListVisualiser ) |
|
1284 { |
|
1285 ret = iMailListVisualiser->NewEmailsInModelL(); |
|
1286 } |
|
1287 return ret; |
|
1288 } |
|
1289 |
|
1290 TInt CFreestyleEmailUiAppUi::EmailsInModelL() |
|
1291 { |
|
1292 FUNC_LOG; |
|
1293 TInt ret(0); |
|
1294 if ( iMailListVisualiser ) |
|
1295 { |
|
1296 ret = iMailListVisualiser->EmailsInModelL(); |
|
1297 } |
|
1298 return ret; |
|
1299 } |
|
1300 |
|
1301 TInt CFreestyleEmailUiAppUi::EmailIndexInModel() |
|
1302 { |
|
1303 FUNC_LOG; |
|
1304 TInt currentInboxListIndex = iMailListVisualiser->HighlightedIndex(); |
|
1305 TInt ret=0; |
|
1306 for ( TInt i=0;i<currentInboxListIndex;i++ ) |
|
1307 { |
|
1308 CFSEmailUiMailListModelItem* item = |
|
1309 static_cast<CFSEmailUiMailListModelItem*>(iMailListVisualiser->Model()->Item(i+1)); |
|
1310 if ( item && item->ModelItemType() == ETypeMailItem ) |
|
1311 { |
|
1312 ret++; |
|
1313 } |
|
1314 } |
|
1315 return ret; // Plus 1 for the first index, because it is always separator |
|
1316 } |
|
1317 |
|
1318 |
|
1319 TKeyResponse CFreestyleEmailUiAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, |
|
1320 TEventCode /*aType*/) |
|
1321 { |
|
1322 FUNC_LOG; |
|
1323 return EKeyWasNotConsumed; |
|
1324 } |
|
1325 |
|
1326 void CFreestyleEmailUiAppUi::HandleWsEventL(const TWsEvent &aEvent, CCoeControl* aDestination) |
|
1327 { |
|
1328 FUNC_LOG; |
|
1329 #ifndef KAknFullOrPartialForegroundGained |
|
1330 const TInt KAknFullOrPartialForegroundGained = 0x10281F36; |
|
1331 const TInt KAknFullOrPartialForegroundLost = 0x10281F37; |
|
1332 #endif |
|
1333 |
|
1334 TBool closeMenu = EFalse; |
|
1335 |
|
1336 // Let folder list visualizer to handle event first because if the popup |
|
1337 // is showed, that needs to be closed when pointer click happens outside of the |
|
1338 // popup rect and also following pointer up event has to be consumed |
|
1339 if ( iFolderListVisualiser && iFolderListVisualiser->HandleWsEventL( aEvent ) ) |
|
1340 { |
|
1341 return; |
|
1342 } |
|
1343 |
|
1344 if (aEvent.Type() == EEventPointer) |
|
1345 { |
|
1346 TAdvancedPointerEvent* pointerEvent(aEvent.Pointer()); |
|
1347 iLastPointerPosition = pointerEvent->iParentPosition; |
|
1348 iLastWsEventType = EEventPointer; |
|
1349 } |
|
1350 |
|
1351 if (aEvent.Type() == EEventKey) |
|
1352 { |
|
1353 iLastWsEventType = EEventKey; |
|
1354 } |
|
1355 TInt key = aEvent.Key()->iScanCode; |
|
1356 // <cmail> |
|
1357 // to disable voice commands during creating new mail message |
|
1358 if (EStdKeyYes == key && aEvent.Type() == EEventKeyDown && iCurrentActiveView == iComposeView ) |
|
1359 { |
|
1360 return; //"consume" event |
|
1361 } |
|
1362 |
|
1363 // to disable deleting message shortcut (bakspace) when fowarding/replying |
|
1364 if ( EStdKeyBackspace == key && aEvent.Type() == EEventKeyDown |
|
1365 && iCurrentActiveView == iComposeView ) |
|
1366 { |
|
1367 return; // consume event |
|
1368 } |
|
1369 |
|
1370 //</cmail> |
|
1371 if ( EStdKeyNo == key && aEvent.Type() == EEventKeyDown ) |
|
1372 { |
|
1373 // composeview needs this info when exiting |
|
1374 //iAppUiExitOngoing = ETrue;<cmail> set to true in Exit() method |
|
1375 |
|
1376 //<cmail> unnecessary exceptions removed from cmail |
|
1377 /*if ( iCurrentActiveView == iComposeView ) |
|
1378 { |
|
1379 iComposeView->HandleCommandL( ENcsCmdExit ); |
|
1380 } |
|
1381 else |
|
1382 {*/ |
|
1383 if ( !AppUiExitOngoing() ) //avoid multiple red key presses during exiting |
|
1384 { |
|
1385 HandleCommandL( EEikCmdExit ); |
|
1386 } |
|
1387 //} //<cmail> |
|
1388 } |
|
1389 |
|
1390 TInt keyCode = aEvent.Key()->iCode; |
|
1391 |
|
1392 if ( EKeyQwertyOn == keyCode || |
|
1393 EKeyQwertyOff == keyCode ) |
|
1394 { |
|
1395 // Close menu when keyboard is opened or closed. |
|
1396 closeMenu = ETrue; |
|
1397 } |
|
1398 |
|
1399 switch ( aEvent.Type() ) |
|
1400 { |
|
1401 case KAknFullOrPartialForegroundLost: |
|
1402 { |
|
1403 if( iCurrentActiveView ) |
|
1404 { |
|
1405 iCurrentActiveView->HandleAppForegroundEventL( EFalse ); |
|
1406 } |
|
1407 // in case the popupmenu is shown propagate event to it |
|
1408 if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() ) |
|
1409 { |
|
1410 iFolderListVisualiser->HandleAppForegroundEventL( EFalse ); |
|
1411 } |
|
1412 } |
|
1413 break; |
|
1414 case KAknFullOrPartialForegroundGained: |
|
1415 { |
|
1416 if ( iCurrentActiveView && !iSettingsViewActive ) |
|
1417 { |
|
1418 iCurrentActiveView->HandleAppForegroundEventL( ETrue ); |
|
1419 if ( iPendingLayoutSwitch ) |
|
1420 { |
|
1421 iCurrentActiveView->HandleDynamicVariantSwitchL( CFsEmailUiViewBase::EScreenLayoutChanged ); |
|
1422 iPendingLayoutSwitch = EFalse; |
|
1423 } |
|
1424 } |
|
1425 // Call status indicator's foreground event to resize the connection screen after the screensaver |
|
1426 if ( iStatusIndicator ) |
|
1427 { |
|
1428 iStatusIndicator->HandleForegroundEventL(); |
|
1429 } |
|
1430 // in case the popupmenu is shown propagate event to it |
|
1431 if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() ) |
|
1432 { |
|
1433 iFolderListVisualiser->HandleAppForegroundEventL( ETrue ); |
|
1434 } |
|
1435 } |
|
1436 break; |
|
1437 default: |
|
1438 break; |
|
1439 } |
|
1440 |
|
1441 // Close menu |
|
1442 if ( closeMenu && iCurrentActiveView != NULL ) |
|
1443 { |
|
1444 CEikMenuBar* menu = iCurrentActiveView->MenuBar(); |
|
1445 |
|
1446 if ( menu != NULL ) |
|
1447 { |
|
1448 if ( menu->IsDisplayed() ) |
|
1449 { |
|
1450 menu->StopDisplayingMenuBar(); |
|
1451 } |
|
1452 } |
|
1453 } |
|
1454 |
|
1455 if ( aEvent.Key()->iCode == EKeyEscape && |
|
1456 iCurrentActiveView == iComposeView && |
|
1457 iComposeView->IsOpeningWaitNoteVisible() ) |
|
1458 { |
|
1459 return; |
|
1460 } |
|
1461 else |
|
1462 { |
|
1463 CAknAppUi::HandleWsEventL(aEvent, aDestination); |
|
1464 } |
|
1465 } |
|
1466 |
|
1467 CAlfDisplay& CFreestyleEmailUiAppUi::Display() |
|
1468 { |
|
1469 FUNC_LOG; |
|
1470 // Note: Alf doesn't need iCoeDisplay anymore, was return iCoeDisplay->Display(); |
|
1471 return iEnv->PrimaryDisplay(); |
|
1472 } |
|
1473 |
|
1474 CAlfEnv& CFreestyleEmailUiAppUi::AlfEnv() |
|
1475 { |
|
1476 FUNC_LOG; |
|
1477 return *iEnv; |
|
1478 } |
|
1479 |
|
1480 void CFreestyleEmailUiAppUi::HandleResourceChangeL( TInt aType ) |
|
1481 { |
|
1482 FUNC_LOG; |
|
1483 // Workaround fix for JWIS-7KAEFD |
|
1484 // Dismiss action menu before doing dynamic variant switch, as it causes |
|
1485 // a phone reset if theme special effects are used. |
|
1486 // <cmail> |
|
1487 /* |
|
1488 if( aType == KEikDynamicLayoutVariantSwitch ) |
|
1489 { |
|
1490 CFscContactActionMenu* actionMenu = CFSEmailUiActionMenu::GetActionMenu(); |
|
1491 if( actionMenu ) |
|
1492 { |
|
1493 actionMenu->Dismiss( EFalse ); |
|
1494 } |
|
1495 } |
|
1496 */ |
|
1497 // </cmail> |
|
1498 CAknAppUi::HandleResourceChangeL( aType ); |
|
1499 |
|
1500 if ( aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled ) |
|
1501 { |
|
1502 StatusPane()->MakeVisible( aType == KAknSplitInputDisabled ); |
|
1503 if ( iCurrentActiveView != NULL ) |
|
1504 { |
|
1505 iCurrentActiveView->HandleStatusPaneSizeChange(); |
|
1506 } |
|
1507 } |
|
1508 |
|
1509 // Refresh mode is changed to manual to avoid any flickering during |
|
1510 // resource change handling in list views. Trap any leaves so that we set |
|
1511 // the automatic refresh mode back on even in case of error. |
|
1512 iEnv->SetRefreshMode( EAlfRefreshModeManual ); |
|
1513 switch ( aType ) |
|
1514 { |
|
1515 case KEikDynamicLayoutVariantSwitch: |
|
1516 iEnv->NotifyLayoutChangedL(); |
|
1517 break; |
|
1518 case KAknsMessageSkinChange: |
|
1519 iEnv->NotifySkinChangedL(); |
|
1520 break; |
|
1521 } |
|
1522 TRAPD( error, DoHandleResourceChangeL( aType ) ); |
|
1523 iEnv->SetRefreshMode( EAlfRefreshModeAutomatic ); |
|
1524 User::LeaveIfError( error ); |
|
1525 } |
|
1526 |
|
1527 void CFreestyleEmailUiAppUi::DoHandleResourceChangeL( TInt aType ) |
|
1528 { |
|
1529 FUNC_LOG; |
|
1530 // on skin change recreate the texture manager |
|
1531 // ignore skin change events during appui::constructL |
|
1532 // compose screen loadbackgroundcontext sends 2 skin change events |
|
1533 //if( aType == KAknsMessageSkinChange && iConstructComplete ) |
|
1534 // { |
|
1535 // CAlfEnv::Static()->NotifySkinChangedL(); |
|
1536 // } |
|
1537 |
|
1538 if( aType == KEikDynamicLayoutVariantSwitch |
|
1539 || aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled ) |
|
1540 { |
|
1541 // Changing layout for status pane (just in case it is not switched |
|
1542 // correctly), fix for HMNN-82BAGR error |
|
1543 // it's not related with skin change so "moved up" TJOS-83DELP fix |
|
1544 TBool landscape(Layout_Meta_Data::IsLandscapeOrientation()); |
|
1545 CEikStatusPane* statusPane = StatusPane(); |
|
1546 if(landscape) |
|
1547 { |
|
1548 if( statusPane->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT) |
|
1549 { |
|
1550 statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT); |
|
1551 } |
|
1552 } |
|
1553 else |
|
1554 { |
|
1555 if( statusPane->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT) |
|
1556 { |
|
1557 statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT); |
|
1558 } |
|
1559 } |
|
1560 } |
|
1561 |
|
1562 if( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange ) |
|
1563 { |
|
1564 |
|
1565 TRect screenRect; |
|
1566 screenRect = ClientRect(); |
|
1567 StatusPane()->DrawNow(); |
|
1568 if(iEnv) |
|
1569 { |
|
1570 Display().SetVisibleArea( screenRect ); |
|
1571 } |
|
1572 } |
|
1573 |
|
1574 // Notify appropriate views |
|
1575 if ( iCurrentActiveView ) |
|
1576 { |
|
1577 CFsEmailUiViewBase::TDynamicSwitchType type = CFsEmailUiViewBase::EOther; |
|
1578 |
|
1579 switch (aType) |
|
1580 { |
|
1581 case KAknsMessageSkinChange: |
|
1582 type = CFsEmailUiViewBase::ESkinChanged; |
|
1583 break; |
|
1584 case KAknSplitInputEnabled: // fall though |
|
1585 case KAknSplitInputDisabled: // fall though |
|
1586 case KEikDynamicLayoutVariantSwitch: |
|
1587 type = CFsEmailUiViewBase::EScreenLayoutChanged; |
|
1588 break; |
|
1589 default: |
|
1590 break; |
|
1591 } |
|
1592 |
|
1593 // Report only events of known types |
|
1594 if ( type != CFsEmailUiViewBase::EOther ) |
|
1595 { |
|
1596 // In case the FsEmail app is on background, relaying the layout change event to the active view |
|
1597 // is postponed until brought to foreground. This is done because otherwise it doesn't seem to work |
|
1598 // correctly in views which use Generic List component. |
|
1599 |
|
1600 if ( !iIsForeground && type == CFsEmailUiViewBase::EScreenLayoutChanged ) |
|
1601 { |
|
1602 iPendingLayoutSwitch = ETrue; |
|
1603 } |
|
1604 |
|
1605 if ( iCurrentActiveView && !iSettingsViewActive ) |
|
1606 { |
|
1607 iCurrentActiveView->HandleDynamicVariantSwitchL( type ); |
|
1608 } |
|
1609 |
|
1610 // Notify status indicator about layout change |
|
1611 if ( iStatusIndicator ) |
|
1612 { |
|
1613 iStatusIndicator->NotifyLayoutChange(); |
|
1614 } |
|
1615 |
|
1616 // All visible views are notified about resource change, so let's |
|
1617 // change refresh mode back to automatic |
|
1618 iEnv->SetRefreshMode( EAlfRefreshModeAutomatic ); |
|
1619 |
|
1620 // In addition to the current view, the change is notified to all |
|
1621 // the previous views because returning to them often does not |
|
1622 // lead to complete redraw |
|
1623 for ( TInt i = 0; i < iNavigationHistory->Count(); ++i ) |
|
1624 { |
|
1625 CFsEmailUiViewBase* view = (*iNavigationHistory)[i]; |
|
1626 view->HandleDynamicVariantSwitchOnBackgroundL( type ); |
|
1627 } |
|
1628 } |
|
1629 } |
|
1630 } |
|
1631 |
|
1632 void CFreestyleEmailUiAppUi::HandleActionL(const TAlfActionCommand& aActionCommand) |
|
1633 { |
|
1634 FUNC_LOG; |
|
1635 switch(aActionCommand.Id()) |
|
1636 { |
|
1637 case EFsEmailUiCmdHide: |
|
1638 { |
|
1639 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
1640 TApaTask task = taskList.FindApp( KFSEmailUiUid ); |
|
1641 if ( task.Exists() ) |
|
1642 { |
|
1643 task.SendToBackground(); // Send self to background |
|
1644 } |
|
1645 } |
|
1646 break; |
|
1647 case EAknSoftkeyExit: |
|
1648 RunAppShutter(); |
|
1649 break; |
|
1650 } |
|
1651 } |
|
1652 |
|
1653 void CFreestyleEmailUiAppUi::ManualMailBoxConnectAll( TBool aManualMailBoxConnectAll ) |
|
1654 { |
|
1655 FUNC_LOG; |
|
1656 iManualMailBoxConnectAll = aManualMailBoxConnectAll; |
|
1657 } |
|
1658 |
|
1659 void CFreestyleEmailUiAppUi::ManualMailBoxDisconnectAll( TBool aManualMailBoxDisconnectAll ) |
|
1660 { |
|
1661 FUNC_LOG; |
|
1662 iManualMailBoxDisconnectAll = aManualMailBoxDisconnectAll; |
|
1663 } |
|
1664 |
|
1665 CFSEmailUiLayoutHandler* CFreestyleEmailUiAppUi::LayoutHandler() |
|
1666 { |
|
1667 FUNC_LOG; |
|
1668 return iLayoutHandler; |
|
1669 } |
|
1670 |
|
1671 CFreestyleEmailUiTextureManager* CFreestyleEmailUiAppUi::FsTextureManager() |
|
1672 { |
|
1673 FUNC_LOG; |
|
1674 return iFsTextureManager; |
|
1675 } |
|
1676 |
|
1677 /*CFSEmailUiStatusIndicator* CFreestyleEmailUiAppUi::StatusIndicator() |
|
1678 { |
|
1679 FUNC_LOG; |
|
1680 return iStatusIndicator; |
|
1681 }*/ |
|
1682 |
|
1683 void CFreestyleEmailUiAppUi::LaunchEditorL( TEditorLaunchMode aMode, const TEditorLaunchParams& aParams ) |
|
1684 { |
|
1685 FUNC_LOG; |
|
1686 // launch editor view with the given set of parameters |
|
1687 TUid editorCommand = TUid::Uid( aMode ); |
|
1688 TPckgBuf<TEditorLaunchParams> buf( aParams ); |
|
1689 EnterFsEmailViewL( MailEditorId, editorCommand, buf ); |
|
1690 } |
|
1691 |
|
1692 CFSMailClient* CFreestyleEmailUiAppUi::GetMailClient() |
|
1693 { |
|
1694 FUNC_LOG; |
|
1695 return iMailClient; |
|
1696 } |
|
1697 |
|
1698 // Returns pointer to download info mediator, ownership is not transferred |
|
1699 CFSEmailDownloadInfoMediator* CFreestyleEmailUiAppUi::DownloadInfoMediator() |
|
1700 { |
|
1701 FUNC_LOG; |
|
1702 return iDwnldMediator; |
|
1703 } |
|
1704 |
|
1705 // --------------------------------------------------------------------------- |
|
1706 // Returns current screen display mode |
|
1707 // --------------------------------------------------------------------------- |
|
1708 // |
|
1709 TDisplayMode CFreestyleEmailUiAppUi::DisplayMode() const |
|
1710 { |
|
1711 FUNC_LOG; |
|
1712 return iEikonEnv->ScreenDevice()->DisplayMode(); |
|
1713 } |
|
1714 |
|
1715 // --------------------------------------------------------------------------- |
|
1716 // Returns display images cache |
|
1717 // --------------------------------------------------------------------------- |
|
1718 // |
|
1719 TDisplayImagesCache& CFreestyleEmailUiAppUi::DisplayImagesCache() |
|
1720 { |
|
1721 return iDisplayImagesCache; |
|
1722 } |
|
1723 |
|
1724 |
|
1725 // --------------------------------------------------------------------------- |
|
1726 // Returns the current flip status. |
|
1727 // --------------------------------------------------------------------------- |
|
1728 // |
|
1729 TBool CFreestyleEmailUiAppUi::IsFlipOpen() const |
|
1730 { |
|
1731 FUNC_LOG; |
|
1732 return iFlipOpen; |
|
1733 } |
|
1734 |
|
1735 |
|
1736 // --------------------------------------------------------------------------- |
|
1737 // Meeting request viewer instance |
|
1738 // --------------------------------------------------------------------------- |
|
1739 // |
|
1740 CESMRIcalViewer* CFreestyleEmailUiAppUi::MrViewerInstanceL() |
|
1741 { |
|
1742 FUNC_LOG; |
|
1743 if ( !iMRViewer ) |
|
1744 { |
|
1745 // Create meeting request viewer |
|
1746 RImplInfoPtrArray implementations; |
|
1747 CleanupResetAndDestroyClosePushL( implementations ); |
|
1748 |
|
1749 REComSession::ListImplementationsL( |
|
1750 TUid::Uid( KESMRIcalViewerInterfaceUid ), implementations ); |
|
1751 if ( implementations.Count() && iHtmlViewerView ) |
|
1752 { |
|
1753 // Found implementation of meeting request viewer |
|
1754 TRAPD( err, iMRViewer = CESMRIcalViewer::NewL( *iHtmlViewerView ) ); |
|
1755 if ( err != KErrNone ) |
|
1756 { |
|
1757 } |
|
1758 } |
|
1759 CleanupStack::PopAndDestroy( &implementations ); |
|
1760 } |
|
1761 return iMRViewer; |
|
1762 } |
|
1763 /*Changing this since we now use HTML viewer*/ |
|
1764 CFsEmailUiHtmlViewerView& CFreestyleEmailUiAppUi::MailViewer() |
|
1765 { |
|
1766 FUNC_LOG; |
|
1767 return *iHtmlViewerView; |
|
1768 } |
|
1769 |
|
1770 CFSEmailUiFolderListVisualiser& CFreestyleEmailUiAppUi::FolderList() |
|
1771 { |
|
1772 FUNC_LOG; |
|
1773 return *iFolderListVisualiser; |
|
1774 } |
|
1775 |
|
1776 CFSEmailUiLauncherGridVisualiser& CFreestyleEmailUiAppUi::LauncherGrid() |
|
1777 { |
|
1778 FUNC_LOG; |
|
1779 return *iMainUiGridVisualiser; |
|
1780 } |
|
1781 |
|
1782 CFSEmailCRHandler* CFreestyleEmailUiAppUi::GetCRHandler() |
|
1783 { |
|
1784 FUNC_LOG; |
|
1785 return iCRHandler; |
|
1786 } |
|
1787 |
|
1788 CFSMailBox* CFreestyleEmailUiAppUi::GetActiveMailbox() |
|
1789 { |
|
1790 FUNC_LOG; |
|
1791 return iActiveMailbox; |
|
1792 } |
|
1793 |
|
1794 |
|
1795 TFSMailMsgId CFreestyleEmailUiAppUi::GetActiveBoxInboxId() |
|
1796 { |
|
1797 FUNC_LOG; |
|
1798 return iActiveBoxInboxId; |
|
1799 } |
|
1800 |
|
1801 TFSMailMsgId CFreestyleEmailUiAppUi::GetActiveMailboxId() |
|
1802 { |
|
1803 FUNC_LOG; |
|
1804 return iActiveMailboxId; |
|
1805 } |
|
1806 |
|
1807 CMsvSession* CFreestyleEmailUiAppUi::GetMsvSession() |
|
1808 { |
|
1809 FUNC_LOG; |
|
1810 return iMsvSession; |
|
1811 } |
|
1812 |
|
1813 CVPbkContactManager& CFreestyleEmailUiAppUi::GetVPbkManagerL() |
|
1814 { |
|
1815 FUNC_LOG; |
|
1816 CVPbkContactManager* temp = CFsDelayedLoader::InstanceL()-> |
|
1817 GetContactHandlerL()->GetContactManager(); |
|
1818 return *(temp); |
|
1819 } |
|
1820 |
|
1821 // --------------------------------------------------------------------------- |
|
1822 // Launch editor with new message and one address in TO-field |
|
1823 // Address object ownership is not transferred |
|
1824 // --------------------------------------------------------------------------- |
|
1825 // |
|
1826 void CFreestyleEmailUiAppUi::LaunchEditorL( CFSMailAddress* aToAddress ) |
|
1827 { |
|
1828 FUNC_LOG; |
|
1829 // launch editor view with the given set of parameters |
|
1830 TUid editorCommand = TUid::Uid( KEditorCmdInternalMailto ); |
|
1831 TEditorLaunchParams params; |
|
1832 params.iMailboxId = GetActiveMailboxId(); |
|
1833 params.iActivatedExternally = EFalse; |
|
1834 params.iExtra = aToAddress; |
|
1835 TPckgBuf<TEditorLaunchParams> buf( params ); |
|
1836 EnterFsEmailViewL( MailEditorId, editorCommand, buf ); |
|
1837 } |
|
1838 |
|
1839 // --------------------------------------------------------------------------- |
|
1840 // Handle APPUI to subscribe events also for connection info |
|
1841 // Once mailbox has been active, it's events will be handled |
|
1842 // Add mailbox to subscribed array if not already |
|
1843 // --------------------------------------------------------------------------- |
|
1844 void CFreestyleEmailUiAppUi::SubscribeMailboxL( TFSMailMsgId aActiveMailboxId ) |
|
1845 { |
|
1846 FUNC_LOG; |
|
1847 if ( iSubscribedMailBoxesIds.Find( aActiveMailboxId.Id() ) == KErrNotFound ) |
|
1848 { |
|
1849 iSubscribedMailBoxesIds.Append( aActiveMailboxId.Id() ); |
|
1850 iMailClient->SubscribeMailboxEventsL( aActiveMailboxId, *this ); |
|
1851 } |
|
1852 } |
|
1853 |
|
1854 void CFreestyleEmailUiAppUi::SetActiveMailboxL( TFSMailMsgId aActiveMailboxId, TBool aAutoSync ) |
|
1855 { |
|
1856 FUNC_LOG; |
|
1857 // Set flag |
|
1858 iAutomatedMailBoxOnline = EFalse; |
|
1859 |
|
1860 // Try to get the mailbox |
|
1861 CFSMailBox* newActiveBox = iMailClient->GetMailBoxByUidL( aActiveMailboxId ); |
|
1862 User::LeaveIfNull( newActiveBox ); |
|
1863 |
|
1864 // Replace active mailbox of the application if getting the mailbox was succesful |
|
1865 delete iActiveMailbox; |
|
1866 iActiveMailbox = newActiveBox; |
|
1867 |
|
1868 iActiveMailboxId = iActiveMailbox->GetId(); |
|
1869 iActiveBoxInboxId = iActiveMailbox->GetStandardFolderId( EFSInbox ); |
|
1870 |
|
1871 SubscribeMailboxL( iActiveMailboxId ); |
|
1872 |
|
1873 // Start connect automatically if asked by the caller |
|
1874 // Disabled if offline or roaming |
|
1875 if ( aAutoSync ) |
|
1876 { |
|
1877 // check manual online setting |
|
1878 CEmailExtension* ext=NULL; |
|
1879 TBool manualSync = EFalse; |
|
1880 ext = iActiveMailbox->ExtensionL( KEmailSettingExtensionUid ); |
|
1881 if (ext) |
|
1882 { |
|
1883 CEmailSettingsExtension* extension = reinterpret_cast<CEmailSettingsExtension*>( ext ); |
|
1884 extension->SetMailBoxId(iActiveMailbox->GetId()); |
|
1885 manualSync = extension->IsSetL(EmailSyncInterval); |
|
1886 iActiveMailbox->ReleaseExtension(ext); |
|
1887 } |
|
1888 if(!manualSync) |
|
1889 { |
|
1890 StartMonitoringL(); |
|
1891 } |
|
1892 } |
|
1893 } |
|
1894 |
|
1895 void CFreestyleEmailUiAppUi::StartMonitoringL() |
|
1896 { |
|
1897 FUNC_LOG; |
|
1898 // Start connect automatically if asked by the caller |
|
1899 // Disabled if offline or roaming |
|
1900 if ( !TFsEmailUiUtility::IsOfflineModeL() ) |
|
1901 { |
|
1902 // Create at first auto-connect, autosync monitor will check whether |
|
1903 // it is ok to start auto-connect, e.g. phone is not roaming, searching for net, etc |
|
1904 if ( !iAutoSyncMonitor ) |
|
1905 { |
|
1906 // TRAP following since failing to create auto sync monitor should not prevent user |
|
1907 // from opening mail list, leave only in OOM case. |
|
1908 TRAPD( err, iAutoSyncMonitor = CFSEmailUiAutosyncMonitor::NewL( *this ) ); |
|
1909 if ( err == KErrNoMemory ) |
|
1910 { |
|
1911 User::Leave( err ); |
|
1912 } |
|
1913 } |
|
1914 // Request auto sync if allowed in the current network mode and |
|
1915 // autosyncmonitor has been succesfully created |
|
1916 if ( iAutoSyncMonitor ) |
|
1917 { |
|
1918 TIMESTAMP( "Starting auto sync" ); |
|
1919 iAutoSyncMonitor->StartMonitoring(); |
|
1920 } |
|
1921 } |
|
1922 } |
|
1923 |
|
1924 void CFreestyleEmailUiAppUi::DoAutoConnectL() |
|
1925 { |
|
1926 FUNC_LOG; |
|
1927 if ( iActiveMailbox && iActiveMailbox->HasCapability( EFSMBoxCapaSupportsSync ) ) |
|
1928 { |
|
1929 // Start sync automatically if not syncing already |
|
1930 TSSMailSyncState latestSyncstate = iActiveMailbox->CurrentSyncState(); |
|
1931 if( latestSyncstate != InboxSyncing && latestSyncstate != StartingSync && |
|
1932 latestSyncstate != EmailSyncing ) |
|
1933 { |
|
1934 if ( iActiveMailbox->GetMailBoxStatus() != EFSMailBoxOnline ) |
|
1935 { |
|
1936 iActiveMailbox->GoOnlineL(); |
|
1937 } |
|
1938 } |
|
1939 } |
|
1940 else if ( iActiveMailbox )// Go online automatically, e.g, refresh |
|
1941 { |
|
1942 // Check if non sync support mailbox is already online |
|
1943 // Typically this is for Pop |
|
1944 if ( iActiveMailbox->GetMailBoxStatus() == EFSMailBoxOnline ) |
|
1945 { |
|
1946 // Already online, disable next note |
|
1947 iAutomatedMailBoxOnline = ETrue; |
|
1948 } |
|
1949 iActiveMailbox->GoOnlineL(); |
|
1950 } |
|
1951 } |
|
1952 |
|
1953 TBool CFreestyleEmailUiAppUi::AppUiExitOngoing() |
|
1954 { |
|
1955 FUNC_LOG; |
|
1956 return g_ApplicationExitOnGoing; |
|
1957 } |
|
1958 |
|
1959 TBool CFreestyleEmailUiAppUi::MessageReaderSupportsFreestyle() |
|
1960 { |
|
1961 FUNC_LOG; |
|
1962 // Check availability of Reader if necessary. Msg reader cannot be installed |
|
1963 // from sisx so checking is done only once. KErrGeneral at startup. |
|
1964 if ( iMsgReaderIsSupported == KErrGeneral ) |
|
1965 { |
|
1966 RLibrary freestyleMessageScannerLibrary; |
|
1967 TUidType uidType( KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid( 0x10281C61 ) ); |
|
1968 iMsgReaderIsSupported = freestyleMessageScannerLibrary.Load( KMsgReaderFsDll, uidType ); |
|
1969 if ( iMsgReaderIsSupported == KErrNone) |
|
1970 { |
|
1971 freestyleMessageScannerLibrary.Close(); |
|
1972 } |
|
1973 } |
|
1974 TBool ret(EFalse); |
|
1975 if ( iMsgReaderIsSupported == KErrNone ) |
|
1976 { |
|
1977 ret = ETrue; |
|
1978 } |
|
1979 return ret; |
|
1980 } |
|
1981 |
|
1982 void CFreestyleEmailUiAppUi::StartReadingEmailsL() |
|
1983 { |
|
1984 FUNC_LOG; |
|
1985 TVwsViewId viewId( TUid::Uid( 0x10201B00 ), TUid::Uid( 1 ) ); |
|
1986 TUid customMessageId( TUid::Uid( 2 ) ); |
|
1987 CFSMailBox* mb = GetActiveMailbox(); |
|
1988 |
|
1989 // Check if view is in mail list |
|
1990 if ( mb && View(MailListId)->IsForeground() ) |
|
1991 { |
|
1992 RArray<TFSMailMsgId> markedMsgIdArray; |
|
1993 CleanupClosePushL(markedMsgIdArray); |
|
1994 iMailListVisualiser->GetMarkedMessagesL(markedMsgIdArray); |
|
1995 // Read marked items |
|
1996 if (markedMsgIdArray.Count() != 0 ) |
|
1997 { |
|
1998 delete iCustomMessageToMessageReader; |
|
1999 iCustomMessageToMessageReader = NULL; |
|
2000 iCustomMessageToMessageReader = HBufC8::NewL(markedMsgIdArray.Count() * 16); |
|
2001 TPtr8 msgPtr = iCustomMessageToMessageReader->Des(); |
|
2002 RDesWriteStream outStream( msgPtr ); |
|
2003 CleanupClosePushL( outStream ); |
|
2004 |
|
2005 for (int i = 0; i < markedMsgIdArray.Count(); i++) |
|
2006 { |
|
2007 outStream.WriteInt32L( mb->GetId().PluginId().iUid ); |
|
2008 outStream.WriteUint32L( mb->GetId().Id() ); |
|
2009 outStream.WriteUint32L( iMailListVisualiser->FolderId().Id() ); |
|
2010 outStream.WriteUint32L( (markedMsgIdArray.operator[](i)).Id()); |
|
2011 } |
|
2012 CleanupStack::PopAndDestroy( &outStream ); |
|
2013 |
|
2014 ActivateViewL( viewId, customMessageId, |
|
2015 *iCustomMessageToMessageReader ) ; |
|
2016 } |
|
2017 else //Read focused item |
|
2018 { |
|
2019 delete iCustomMessageToMessageReader; |
|
2020 iCustomMessageToMessageReader = NULL; |
|
2021 iCustomMessageToMessageReader = HBufC8::NewL(16); |
|
2022 TPtr8 msgPtr = iCustomMessageToMessageReader->Des(); |
|
2023 RDesWriteStream outStream( msgPtr ); |
|
2024 CleanupClosePushL( outStream ); |
|
2025 |
|
2026 outStream.WriteInt32L( mb->GetId().PluginId().iUid ); |
|
2027 outStream.WriteUint32L( mb->GetId().Id() ); |
|
2028 outStream.WriteUint32L( iMailListVisualiser->FolderId().Id() ); |
|
2029 outStream.WriteUint32L( (iMailListVisualiser->MsgIdFromListId(iMailListVisualiser->GetMailList().FocusedItem())).Id() ); |
|
2030 |
|
2031 CleanupStack::PopAndDestroy( &outStream ); |
|
2032 |
|
2033 if ((iMailListVisualiser->MsgIdFromListId(iMailListVisualiser->GetMailList().FocusedItem())).Id() != NULL) |
|
2034 { |
|
2035 ActivateViewL( viewId, customMessageId, |
|
2036 *iCustomMessageToMessageReader ) ; |
|
2037 } |
|
2038 } |
|
2039 CleanupStack::PopAndDestroy( &markedMsgIdArray ); |
|
2040 } |
|
2041 // Check if view is in mail viewer |
|
2042 else if ( mb && ( View(HtmlViewerId)->IsForeground() || View(SearchListViewId)->IsForeground() ) ) |
|
2043 { |
|
2044 delete iCustomMessageToMessageReader; |
|
2045 iCustomMessageToMessageReader = NULL; |
|
2046 iCustomMessageToMessageReader = HBufC8::NewL(16); |
|
2047 TPtr8 msgPtr = iCustomMessageToMessageReader->Des(); |
|
2048 RDesWriteStream outStream( msgPtr ); |
|
2049 CleanupClosePushL( outStream ); |
|
2050 outStream.WriteInt32L( mb->GetId().PluginId().iUid ); |
|
2051 outStream.WriteUint32L( mb->GetId().Id() ); |
|
2052 TFSMailMsgId folderId; |
|
2053 TFSMailMsgId msgId; |
|
2054 if ( View(HtmlViewerId)->IsForeground() && iHtmlViewerView ) |
|
2055 { |
|
2056 folderId = iHtmlViewerView->ViewedMessageFolderId(); |
|
2057 msgId = iHtmlViewerView->ViewedMessageId(); |
|
2058 } |
|
2059 else if ( View(SearchListViewId)->IsForeground() && iSearchListVisualiser ) |
|
2060 { |
|
2061 folderId = iSearchListVisualiser->HighlightedMessageFolderId(); |
|
2062 msgId = iSearchListVisualiser->HighlightedMessageId(); |
|
2063 } |
|
2064 |
|
2065 outStream.WriteUint32L( folderId.Id() ); |
|
2066 outStream.WriteUint32L( msgId.Id() ); |
|
2067 |
|
2068 CleanupStack::PopAndDestroy( &outStream ); |
|
2069 |
|
2070 if ( msgId.Id() ) |
|
2071 { |
|
2072 ActivateViewL( viewId, customMessageId, |
|
2073 *iCustomMessageToMessageReader ) ; |
|
2074 } |
|
2075 } |
|
2076 } |
|
2077 |
|
2078 TBool CFreestyleEmailUiAppUi::ViewSwitchingOngoing() |
|
2079 { |
|
2080 FUNC_LOG; |
|
2081 return EFalse; |
|
2082 } |
|
2083 |
|
2084 void CFreestyleEmailUiAppUi::RequestResponseL( TFSProgress /*aEvent*/, TInt /*aRequestId*/ ) |
|
2085 { |
|
2086 FUNC_LOG; |
|
2087 |
|
2088 } |
|
2089 |
|
2090 // Force Sync on active mailbox. |
|
2091 void CFreestyleEmailUiAppUi::SyncActiveMailBoxL() |
|
2092 { |
|
2093 FUNC_LOG; |
|
2094 if( iActiveMailbox ) |
|
2095 { |
|
2096 // Start sync automatically if not syncing already |
|
2097 TSSMailSyncState latestSyncstate = iActiveMailbox->CurrentSyncState(); |
|
2098 if( latestSyncstate != InboxSyncing && latestSyncstate != StartingSync && latestSyncstate != EmailSyncing ) |
|
2099 { |
|
2100 iSyncStatusReqId = iActiveMailbox->RefreshNowL( *this ); |
|
2101 } |
|
2102 } |
|
2103 } |
|
2104 void CFreestyleEmailUiAppUi::StopActiveMailBoxSyncL() |
|
2105 { |
|
2106 FUNC_LOG; |
|
2107 if ( iActiveMailbox && iActiveMailbox->GetMailBoxStatus()==EFSMailBoxOnline) |
|
2108 { |
|
2109 TSSMailSyncState latestSyncstate = iActiveMailbox->CurrentSyncState(); |
|
2110 if(latestSyncstate == InboxSyncing || |
|
2111 latestSyncstate == EmailSyncing || |
|
2112 latestSyncstate == OutboxSyncing || |
|
2113 latestSyncstate == SentItemsSyncing || |
|
2114 latestSyncstate == DraftsSyncing || |
|
2115 latestSyncstate == CalendarSyncing || |
|
2116 latestSyncstate == ContactsSyncing || |
|
2117 latestSyncstate == TasksSyncing || |
|
2118 latestSyncstate == NotesSyncing || |
|
2119 latestSyncstate == FilesSyncing || |
|
2120 latestSyncstate == DataSyncStarting ) |
|
2121 { |
|
2122 iActiveMailbox->CancelSyncL(); |
|
2123 } |
|
2124 } |
|
2125 } |
|
2126 |
|
2127 MCoeMessageObserver::TMessageResponse CFreestyleEmailUiAppUi::HandleMessageL( |
|
2128 TUint32 aClientHandleOfTargetWindowGroup, |
|
2129 TUid aMessageUid, |
|
2130 const TDesC8& aMessageParameters ) |
|
2131 { |
|
2132 FUNC_LOG; |
|
2133 |
|
2134 if ( iWizardObserver ) |
|
2135 { |
|
2136 iWizardObserver->HandleMessage( aClientHandleOfTargetWindowGroup, |
|
2137 aMessageUid, |
|
2138 aMessageParameters); |
|
2139 } |
|
2140 |
|
2141 return CAknViewAppUi::HandleMessageL( aClientHandleOfTargetWindowGroup, |
|
2142 aMessageUid, |
|
2143 aMessageParameters); |
|
2144 } |
|
2145 |
|
2146 void CFreestyleEmailUiAppUi::HandleForegroundEventL( TBool aForeground ) |
|
2147 { |
|
2148 FUNC_LOG; |
|
2149 |
|
2150 // store flag indicating whether we are foreground |
|
2151 iIsForeground = aForeground; |
|
2152 |
|
2153 if ( iIsForeground ) |
|
2154 { |
|
2155 if ( View( MailEditorId )->IsForeground() ) |
|
2156 { |
|
2157 StartEndKeyCapture(); |
|
2158 } |
|
2159 } |
|
2160 else |
|
2161 { |
|
2162 StopEndKeyCapture(); |
|
2163 } |
|
2164 |
|
2165 if ( iWizardObserver ) |
|
2166 { |
|
2167 iWizardObserver->HandleForegroundEventL( aForeground ); |
|
2168 } |
|
2169 |
|
2170 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
2171 } |
|
2172 |
|
2173 |
|
2174 void CFreestyleEmailUiAppUi::EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox, |
|
2175 TAny* aParam1, TAny* aParam2, TAny* aParam3 ) |
|
2176 { |
|
2177 FUNC_LOG; |
|
2178 INFO_1( "CMAIL Received event: %d", aEvent ); |
|
2179 |
|
2180 |
|
2181 TBool gridContentsChanged = EFalse; |
|
2182 |
|
2183 switch ( aEvent ) |
|
2184 { |
|
2185 case TFSEventMailboxDeleted: |
|
2186 { |
|
2187 iDisplayImagesCache.RemoveMailbox(aMailbox); |
|
2188 gridContentsChanged = ETrue; |
|
2189 if ( iActiveMailbox && iActiveMailbox->GetId().Id() == aMailbox.Id() && |
|
2190 iCurrentActiveView->Id() != SettingsViewId ) |
|
2191 { |
|
2192 EnterFsEmailViewL( AppGridId ); |
|
2193 EraseViewHistory(); // the previous views probably no longer exist if we've got here |
|
2194 } |
|
2195 } |
|
2196 break; |
|
2197 case TFSEventMailboxOnline: |
|
2198 case TFSEventMailboxOffline: |
|
2199 { |
|
2200 //must check event go to right MailBox |
|
2201 if( aMailbox == GetActiveMailboxId() ) |
|
2202 { |
|
2203 if (aEvent == TFSEventMailboxOnline) |
|
2204 { |
|
2205 UpdateTitlePaneConnectionStatus(EForceToConnected); |
|
2206 } |
|
2207 else if (aEvent == TFSEventMailboxOffline) |
|
2208 { |
|
2209 UpdateTitlePaneConnectionStatus(EForceToDisconnected); |
|
2210 } |
|
2211 } |
|
2212 |
|
2213 // Cancel all ongoing downloads for the disconnected mailbox |
|
2214 if (iDwnldMediator && aEvent == TFSEventMailboxOffline) |
|
2215 { |
|
2216 iDwnldMediator->CancelAllDownloadsL(aMailbox); |
|
2217 } |
|
2218 if ( !iAutomatedMailBoxOnline ) |
|
2219 { |
|
2220 CFSMailBox* mb = iMailClient->GetMailBoxByUidL( aMailbox ); |
|
2221 CleanupStack::PushL( mb ); |
|
2222 TDesC* mbName = &mb->GetName(); |
|
2223 if ( aEvent == TFSEventMailboxOffline ) |
|
2224 { |
|
2225 if ( !(mbName && mbName->Length() && !iManualMailBoxDisconnectAll) ) |
|
2226 { |
|
2227 ManualMailBoxDisconnectAll(EFalse); |
|
2228 } |
|
2229 } |
|
2230 else if ( aEvent == TFSEventMailboxOnline ) |
|
2231 { |
|
2232 if ( !(mbName && mbName->Length() && !iManualMailBoxConnectAll) ) |
|
2233 { |
|
2234 ManualMailBoxConnectAll(EFalse); |
|
2235 } |
|
2236 } |
|
2237 CleanupStack::PopAndDestroy( mb ); |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 iAutomatedMailBoxOnline = EFalse; |
|
2242 } |
|
2243 } |
|
2244 break; |
|
2245 case TFSEventMailboxSyncStateChanged: |
|
2246 { |
|
2247 TBool tryRunningFakeSyncAnim( EFalse ); |
|
2248 TSSMailSyncState* newSyncState = static_cast<TSSMailSyncState*>( aParam1 ); |
|
2249 |
|
2250 //must check event go to right MailBox |
|
2251 if( aMailbox != GetActiveMailboxId() ) |
|
2252 break; |
|
2253 |
|
2254 if ( newSyncState !=0 && *newSyncState ) |
|
2255 { |
|
2256 switch ( *newSyncState ) |
|
2257 { |
|
2258 case StartingSync: |
|
2259 { |
|
2260 TIMESTAMP( "Starting sync" ); |
|
2261 } |
|
2262 break; |
|
2263 case SyncError: |
|
2264 { |
|
2265 // error occured during "Connect" or "Send and receive" operation |
|
2266 TIMESTAMP( "Sync error" ); |
|
2267 } |
|
2268 break; |
|
2269 case FinishedSuccessfully: // fall through |
|
2270 case Idle: |
|
2271 tryRunningFakeSyncAnim = ETrue; |
|
2272 // fall through |
|
2273 case SyncCancelled: |
|
2274 { |
|
2275 TIMESTAMP( "Sync finished" ); |
|
2276 } |
|
2277 break; |
|
2278 case PushChannelOffBecauseBatteryIsLow: |
|
2279 { |
|
2280 } |
|
2281 break; |
|
2282 } //switch |
|
2283 } |
|
2284 |
|
2285 if ( tryRunningFakeSyncAnim ) |
|
2286 { |
|
2287 TRAP_IGNORE( RunFakeSyncAnimL() ); |
|
2288 } |
|
2289 |
|
2290 // update title pane connection status only if fake anim isn't |
|
2291 // ongoing (if it is the update will happen once it's finished) |
|
2292 if ( !iFakeSyncAnimStopTimer->IsActive() ) |
|
2293 { |
|
2294 UpdateTitlePaneConnectionStatus(); |
|
2295 } |
|
2296 } //case |
|
2297 break; |
|
2298 |
|
2299 case TFSEventNewMailbox: |
|
2300 { |
|
2301 gridContentsChanged = ETrue; |
|
2302 iMailClient->GetBrandManagerL().UpdateMailboxNamesL( aMailbox ); |
|
2303 } |
|
2304 // fall through |
|
2305 case TFSEventMailboxCreationFailure: |
|
2306 { |
|
2307 if ( iWizardObserver ) |
|
2308 { |
|
2309 iWizardObserver->EventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2310 } |
|
2311 } |
|
2312 break; |
|
2313 case TFSEventMailboxRenamed: |
|
2314 { |
|
2315 gridContentsChanged = ETrue; |
|
2316 if ( aMailbox == iActiveMailboxId ) |
|
2317 { |
|
2318 // Update active mailbox |
|
2319 delete iActiveMailbox; |
|
2320 iActiveMailbox = NULL; |
|
2321 iActiveMailbox = iMailClient->GetMailBoxByUidL( aMailbox ); |
|
2322 } |
|
2323 } |
|
2324 break; |
|
2325 case TFSEventMailboxCapabilityChanged: |
|
2326 // Refresh grid if mailbox capabilities have changed |
|
2327 case TFSEventMailboxSettingsChanged: |
|
2328 // Refresh grid if mailbox settings are changed, |
|
2329 // name/branding might have changed. |
|
2330 gridContentsChanged = ETrue; |
|
2331 break; |
|
2332 case TFSEventMailDeleted: |
|
2333 case TFSEventMailDeletedFromViewer: |
|
2334 { |
|
2335 RArray<TFSMailMsgId>* entries = reinterpret_cast<RArray<TFSMailMsgId>*>(aParam1); |
|
2336 for (TInt i = entries->Count() - 1; i >= 0; i--) |
|
2337 { |
|
2338 iDisplayImagesCache.RemoveMessage(aMailbox, entries->operator[](i)); |
|
2339 } |
|
2340 } |
|
2341 break; |
|
2342 default: |
|
2343 { |
|
2344 } |
|
2345 } |
|
2346 // Forward events to mail list |
|
2347 if ( iMailListVisualiser ) |
|
2348 { |
|
2349 iMailListVisualiser->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2350 } |
|
2351 // Forward events to Search list |
|
2352 if ( iSearchListVisualiser ) |
|
2353 { |
|
2354 iSearchListVisualiser->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2355 } |
|
2356 if ( gridContentsChanged && iMainUiGridVisualiser ) |
|
2357 { |
|
2358 iMainUiGridVisualiser->HandleContentChangeL(); |
|
2359 } |
|
2360 // <cmail> forward online/offline events also to folder list |
|
2361 if ( iFolderListVisualiser ) |
|
2362 { |
|
2363 iFolderListVisualiser->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2364 } |
|
2365 // </cmail> |
|
2366 |
|
2367 // MAIL DELETED EVENT HANDLING BASED ON VIEW ACTIVE STATE. |
|
2368 // Handle mail deleted event in attachment list, as the viewed mail could be open |
|
2369 if ( iAttachmentListVisualiser && aEvent == TFSEventMailDeleted && |
|
2370 iCurrentActiveView->Id() == AttachmentMngrViewId) |
|
2371 { |
|
2372 iAttachmentListVisualiser->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2373 } |
|
2374 // Handle mail deleted event in Html view list, as the mails might become obsolete |
|
2375 // Pass sync finished event there too in order to dismiss status dialogs |
|
2376 else if ( iHtmlViewerView && (aEvent == TFSEventMailDeleted || |
|
2377 aEvent == TFSEventMailDeletedFromViewer || |
|
2378 aEvent == TFSEventMailboxSyncStateChanged || |
|
2379 aEvent == TFSEventNewMail) && iCurrentActiveView->Id() == HtmlViewerId) |
|
2380 { |
|
2381 iHtmlViewerView->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 ); |
|
2382 } |
|
2383 // Download manager removed |
|
2384 |
|
2385 } |
|
2386 |
|
2387 void CFreestyleEmailUiAppUi::LaunchWizardL() |
|
2388 { |
|
2389 FUNC_LOG; |
|
2390 TRAPD( err, iMainUiGridVisualiser->LaunchWizardL() ); |
|
2391 if ( err != KErrNone ) |
|
2392 { |
|
2393 } |
|
2394 if ( err == KErrNoMemory ) |
|
2395 { |
|
2396 User::Leave( err ); // Leave in OOM, otherwise ignore |
|
2397 } |
|
2398 } |
|
2399 |
|
2400 const CFSEmailUiShortcutBinding& CFreestyleEmailUiAppUi::ShortcutBinding() const |
|
2401 { |
|
2402 FUNC_LOG; |
|
2403 return *iShortcutBinder; |
|
2404 } |
|
2405 |
|
2406 void CFreestyleEmailUiAppUi::HandleSessionEventL( TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ ) |
|
2407 { |
|
2408 FUNC_LOG; |
|
2409 // handle events |
|
2410 } |
|
2411 |
|
2412 // For checking whether next msg is available |
|
2413 TBool CFreestyleEmailUiAppUi::IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
2414 TFSMailMsgId& aFoundNextMsgId, |
|
2415 TFSMailMsgId& aFoundNextMsgFolder ) |
|
2416 { |
|
2417 FUNC_LOG; |
|
2418 TBool ret(EFalse); |
|
2419 if( iNavigationHistory ) |
|
2420 { |
|
2421 if ( !iNavigationHistory->IsEmpty() ) |
|
2422 { |
|
2423 ret = iNavigationHistory->Head()->IsNextMsgAvailable( aCurrentMsgId, aFoundNextMsgId, aFoundNextMsgFolder ); |
|
2424 } |
|
2425 } |
|
2426 return ret; |
|
2427 } |
|
2428 |
|
2429 // For checking whether previous msg is available |
|
2430 TBool CFreestyleEmailUiAppUi::IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
2431 TFSMailMsgId& aFoundPreviousMsgId, |
|
2432 TFSMailMsgId& aFoundPrevMsgFolder ) |
|
2433 { |
|
2434 FUNC_LOG; |
|
2435 TBool ret(EFalse); |
|
2436 if( iNavigationHistory ) |
|
2437 { |
|
2438 if ( !iNavigationHistory->IsEmpty() ) |
|
2439 { |
|
2440 ret = iNavigationHistory->Head()->IsPreviousMsgAvailable( aCurrentMsgId, aFoundPreviousMsgId, aFoundPrevMsgFolder ); |
|
2441 } |
|
2442 } |
|
2443 return ret; |
|
2444 } |
|
2445 |
|
2446 // Move to next msg |
|
2447 TInt CFreestyleEmailUiAppUi::MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, |
|
2448 TFSMailMsgId& aFoundNextMsgId ) |
|
2449 { |
|
2450 FUNC_LOG; |
|
2451 TInt ret(KErrNotFound); |
|
2452 if ( !iNavigationHistory->IsEmpty() ) |
|
2453 { |
|
2454 iNavigationHistory->Head()->MoveToNextMsgL( aCurrentMsgId, aFoundNextMsgId ); |
|
2455 } |
|
2456 return ret; |
|
2457 } |
|
2458 |
|
2459 // Move to previous msg |
|
2460 TInt CFreestyleEmailUiAppUi::MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, |
|
2461 TFSMailMsgId& aFoundPreviousMsgId ) |
|
2462 { |
|
2463 FUNC_LOG; |
|
2464 TInt ret(KErrNotFound); |
|
2465 if ( !iNavigationHistory->IsEmpty() ) |
|
2466 { |
|
2467 iNavigationHistory->Head()->MoveToPreviousMsgL( aCurrentMsgId, aFoundPreviousMsgId ); |
|
2468 } |
|
2469 return ret; |
|
2470 } |
|
2471 |
|
2472 // Move to previous message when the current message is deleted in viewer |
|
2473 TInt CFreestyleEmailUiAppUi::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId ) |
|
2474 { |
|
2475 FUNC_LOG; |
|
2476 TInt ret(KErrNotFound); |
|
2477 if ( !iNavigationHistory->IsEmpty() ) |
|
2478 { |
|
2479 iNavigationHistory->Head()->MoveToPreviousMsgAfterDeleteL( aFoundPreviousMsgId ); |
|
2480 } |
|
2481 return ret; |
|
2482 } |
|
2483 |
|
2484 CDocumentHandler& CFreestyleEmailUiAppUi::DocumentHandler() |
|
2485 { |
|
2486 FUNC_LOG; |
|
2487 return *iDocumentHandler; |
|
2488 } |
|
2489 |
|
2490 CFsEmailFileHandleShutter& CFreestyleEmailUiAppUi::FileHandleShutter() |
|
2491 { |
|
2492 FUNC_LOG; |
|
2493 return *iFileHandleShutter; |
|
2494 } |
|
2495 |
|
2496 const TDesC& CFreestyleEmailUiAppUi::TitlePaneTextL() |
|
2497 { |
|
2498 FUNC_LOG; |
|
2499 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
2500 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
2501 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
2502 |
|
2503 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
2504 { |
|
2505 CAknTitlePane* titlePane = static_cast< CAknTitlePane* >( |
|
2506 StatusPane()->ControlL( titlePaneUid ) ); |
|
2507 return *titlePane->Text(); |
|
2508 } |
|
2509 return KNullDesC; |
|
2510 } |
|
2511 |
|
2512 void CFreestyleEmailUiAppUi::SetTitlePaneTextL( const TDesC& aText ) |
|
2513 { |
|
2514 FUNC_LOG; |
|
2515 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
2516 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
2517 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
2518 |
|
2519 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
2520 { |
|
2521 CAknTitlePane* titlePane = static_cast< CAknTitlePane* >( |
|
2522 StatusPane()->ControlL( titlePaneUid ) ); |
|
2523 titlePane->SetTextL( aText, ETrue ); |
|
2524 } |
|
2525 } |
|
2526 |
|
2527 void CFreestyleEmailUiAppUi::ResetTitlePaneTextL() |
|
2528 { |
|
2529 FUNC_LOG; |
|
2530 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
2531 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
2532 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
2533 |
|
2534 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
2535 { |
|
2536 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( |
|
2537 StatusPane()->ControlL( titlePaneUid ) ); |
|
2538 titlePane->SetTextToDefaultL(); |
|
2539 } |
|
2540 } |
|
2541 |
|
2542 void CFreestyleEmailUiAppUi::SetActiveMailboxNameToStatusPaneL() |
|
2543 { |
|
2544 FUNC_LOG; |
|
2545 // Branded mailbox name is nowadays set in new mailbox event |
|
2546 // handling, so we don't need to use brand manager here anymore. |
|
2547 |
|
2548 // Get pointer to updated mb |
|
2549 CFSMailBox* confirmedMailBox = GetMailClient()->GetMailBoxByUidL( GetActiveMailboxId() ); |
|
2550 CleanupStack::PushL( confirmedMailBox ); |
|
2551 TDesC* mbName(0); |
|
2552 if ( confirmedMailBox ) |
|
2553 { |
|
2554 mbName = &confirmedMailBox->GetName(); |
|
2555 |
|
2556 if ( mbName && mbName->Length() ) |
|
2557 { |
|
2558 SetTitlePaneTextL( *mbName ); |
|
2559 } |
|
2560 } |
|
2561 CleanupStack::PopAndDestroy( confirmedMailBox ); |
|
2562 } |
|
2563 |
|
2564 void CFreestyleEmailUiAppUi::ShowTitlePaneConnectionStatus() |
|
2565 { |
|
2566 FUNC_LOG; |
|
2567 iConnectionStatusVisible = ETrue; |
|
2568 UpdateTitlePaneConnectionStatus(iForcedConnectionStatus); |
|
2569 } |
|
2570 |
|
2571 void CFreestyleEmailUiAppUi::HideTitlePaneConnectionStatus() |
|
2572 { |
|
2573 FUNC_LOG; |
|
2574 iConnectionStatusVisible = EFalse; |
|
2575 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
2576 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
2577 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
2578 |
|
2579 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
2580 { |
|
2581 CAknTitlePane* titlePane = NULL; |
|
2582 TRAP_IGNORE( titlePane = |
|
2583 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
|
2584 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
|
2585 EStatusTextureDisconnectedGeneral, iConnectionIconBitmap, iConnectionIconMask ) ); |
|
2586 if ( iConnectionIconBitmap ) |
|
2587 { |
|
2588 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
|
2589 AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved ); |
|
2590 } |
|
2591 titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconBitmap && iConnectionIconMask); |
|
2592 } |
|
2593 iConnectionStatusIconAnimTimer->Stop(); |
|
2594 } |
|
2595 |
|
2596 void CFreestyleEmailUiAppUi::GetConnectionStatusL( |
|
2597 CConnectionStatusQueryExtension::TConnectionStatus& aConnStatus ) |
|
2598 { |
|
2599 aConnStatus = CConnectionStatusQueryExtension::EDisconnected; |
|
2600 CFSMailBox* mailbox = GetActiveMailbox(); |
|
2601 if ( mailbox ) |
|
2602 { |
|
2603 CConnectionStatusQueryExtension* extension( NULL ); |
|
2604 TRAPD( error, extension = static_cast<CConnectionStatusQueryExtension*>( |
|
2605 mailbox->ExtensionL( KEmailConnectionStatusQueryExtensionUid ) ) ); |
|
2606 |
|
2607 if ( error && error != KErrNotSupported ) |
|
2608 { |
|
2609 User::Leave( error ); |
|
2610 } |
|
2611 |
|
2612 if ( extension ) |
|
2613 { |
|
2614 // Query from extension - the new way |
|
2615 aConnStatus = extension->ConnectionStatus( |
|
2616 mailbox->GetId(), iForcedConnectionStatus); |
|
2617 mailbox->ReleaseExtension( extension ); |
|
2618 } |
|
2619 else |
|
2620 { |
|
2621 // Retain the old way |
|
2622 TFSMailBoxStatus boxStatus( mailbox->GetMailBoxStatus() ); |
|
2623 TSSMailSyncState syncState( mailbox->CurrentSyncState() ); |
|
2624 |
|
2625 if ( ( boxStatus == EFSMailBoxOnline && iForcedConnectionStatus != EForceToDisconnected ) || |
|
2626 (iForcedConnectionStatus == EForceToConnected || iForcedConnectionStatus == EForceToSync) ) |
|
2627 { |
|
2628 if (syncState == EmailSyncing || syncState == InboxSyncing || |
|
2629 syncState == OutboxSyncing || syncState == SentItemsSyncing || |
|
2630 syncState == DraftsSyncing || syncState == CalendarSyncing || |
|
2631 syncState == ContactsSyncing || syncState == TasksSyncing || |
|
2632 syncState == FilesSyncing || iForcedConnectionStatus == EForceToSync ) |
|
2633 { |
|
2634 aConnStatus = CConnectionStatusQueryExtension::ESynchronizing; |
|
2635 } |
|
2636 else |
|
2637 { |
|
2638 aConnStatus = CConnectionStatusQueryExtension::EConnected; |
|
2639 } |
|
2640 } |
|
2641 else // EFSMailBoxOffline |
|
2642 { |
|
2643 aConnStatus = CConnectionStatusQueryExtension::EDisconnected; |
|
2644 } |
|
2645 } |
|
2646 } |
|
2647 } |
|
2648 |
|
2649 void CFreestyleEmailUiAppUi::UpdateTitlePaneConnectionStatus( |
|
2650 TForcedStatus aForcedStatus /*= ENoForce*/ ) |
|
2651 { |
|
2652 FUNC_LOG; |
|
2653 iForcedConnectionStatus = aForcedStatus; |
|
2654 |
|
2655 if ( iConnectionStatusVisible ) |
|
2656 { |
|
2657 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
2658 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
2659 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
2660 |
|
2661 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
2662 { |
|
2663 CAknTitlePane* titlePane = NULL; |
|
2664 TRAP_IGNORE( titlePane = |
|
2665 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
|
2666 |
|
2667 // Set connection icon |
|
2668 iConnectionStatusIconAnimTimer->Stop(); |
|
2669 iConnectionIconBitmap = 0; |
|
2670 iConnectionIconMask = 0; |
|
2671 TBool startTimer = EFalse; |
|
2672 |
|
2673 // Get connection status of the current mailbox |
|
2674 CConnectionStatusQueryExtension::TConnectionStatus connectionStatus; |
|
2675 TRAP_IGNORE( GetConnectionStatusL( connectionStatus ) ); |
|
2676 |
|
2677 switch ( connectionStatus ) |
|
2678 { |
|
2679 case CConnectionStatusQueryExtension::EConnected: |
|
2680 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
|
2681 EStatusTextureConnected, iConnectionIconBitmap, iConnectionIconMask ) ); |
|
2682 break; |
|
2683 case CConnectionStatusQueryExtension::EDisconnected: |
|
2684 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
|
2685 EStatusTextureDisconnectedGeneral, iConnectionIconBitmap, iConnectionIconMask ) ); |
|
2686 break; |
|
2687 case CConnectionStatusQueryExtension::ESynchronizing: |
|
2688 TRAP_IGNORE( FsTextureManager()->ProvideBitmapL( |
|
2689 EStatusTextureSynchronising, iConnectionIconBitmap, iConnectionIconMask ) ); |
|
2690 startTimer = ETrue; |
|
2691 break; |
|
2692 default: |
|
2693 break; |
|
2694 } |
|
2695 |
|
2696 if ( iConnectionIconBitmap ) |
|
2697 { |
|
2698 TSize iconSize( LayoutHandler()->statusPaneIconSize() ); |
|
2699 AknIconUtils::SetSize( iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved ); |
|
2700 } |
|
2701 titlePane->SetSmallPicture( iConnectionIconBitmap, iConnectionIconMask, iConnectionIconMask && iConnectionIconBitmap ); |
|
2702 if (startTimer) |
|
2703 { |
|
2704 iConnectionStatusIconAnimTimer->Start( KConnectionStatusIconRotationInterval ); |
|
2705 } |
|
2706 titlePane->DrawNow(); |
|
2707 } |
|
2708 } |
|
2709 } |
|
2710 |
|
2711 void CFreestyleEmailUiAppUi::CreateStatusPaneIndicatorsL() |
|
2712 { |
|
2713 FUNC_LOG; |
|
2714 // Create custom statuspane with priority and followup indicator support for email editor |
|
2715 iStatusPaneIndicators = CCustomStatuspaneIndicators::NewL( StatusPane() ); |
|
2716 AddToStackL( iStatusPaneIndicators, |
|
2717 ECoeStackPriorityDefault, |
|
2718 ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus ); |
|
2719 } |
|
2720 |
|
2721 void CFreestyleEmailUiAppUi::DeleteStatusPaneIndicators() |
|
2722 { |
|
2723 FUNC_LOG; |
|
2724 if ( iStatusPaneIndicators ) |
|
2725 { |
|
2726 RemoveFromStack( iStatusPaneIndicators ); |
|
2727 delete iStatusPaneIndicators; |
|
2728 iStatusPaneIndicators = NULL; |
|
2729 } |
|
2730 } |
|
2731 |
|
2732 CCustomStatuspaneIndicators* CFreestyleEmailUiAppUi::GetStatusPaneIndicatorContainer() |
|
2733 { |
|
2734 FUNC_LOG; |
|
2735 return iStatusPaneIndicators; |
|
2736 } |
|
2737 |
|
2738 void CFreestyleEmailUiAppUi::StartEndKeyCapture() |
|
2739 { |
|
2740 FUNC_LOG; |
|
2741 if ( !iIsCaptured ) |
|
2742 { |
|
2743 iEndCaptureHandle = iEikonEnv->RootWin().CaptureKey( EStdKeyNo, 0, 0 ); |
|
2744 iEndUpDownCaptureHandle = iEikonEnv->RootWin().CaptureKeyUpAndDowns( EStdKeyNo, 0, 0 ); |
|
2745 } |
|
2746 iIsCaptured = ETrue; |
|
2747 } |
|
2748 |
|
2749 void CFreestyleEmailUiAppUi::StopEndKeyCapture() |
|
2750 { |
|
2751 FUNC_LOG; |
|
2752 if ( iIsCaptured ) |
|
2753 { |
|
2754 iEikonEnv->RootWin().CancelCaptureKey( iEndCaptureHandle ); |
|
2755 iEikonEnv->RootWin().CancelCaptureKeyUpAndDowns( iEndUpDownCaptureHandle ); |
|
2756 } |
|
2757 iIsCaptured = EFalse; |
|
2758 } |
|
2759 |
|
2760 void CFreestyleEmailUiAppUi::CheckUpdatesL() |
|
2761 { |
|
2762 FUNC_LOG; |
|
2763 // Initialize feature manager, if not yet initialized |
|
2764 if( !iFeatureManagerInitialized ) |
|
2765 { |
|
2766 FeatureManager::InitializeLibL(); // Successfull call increases reference count! |
|
2767 iFeatureManagerInitialized = ETrue; // We can now call UnInitializeLib() |
|
2768 } |
|
2769 |
|
2770 // Simple test to check whether we run against API stub or "real" IAD |
|
2771 // implementation. Normal applications should use FeatureManager to check |
|
2772 // whether KFeatureIdIAUpdate is on before using any IAUpdate API function. |
|
2773 if( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) |
|
2774 { |
|
2775 TRAP_IGNORE( iUpdateClient = CIAUpdate::NewL( *this ) ); |
|
2776 if ( iUpdateClient ) // IAUpdate is supported in the phone |
|
2777 { |
|
2778 iUpdateParameters = CIAUpdateParameters::NewL(); |
|
2779 // Search for updates to IAUpdateExampleClient, We know that the |
|
2780 // SIS package uid is KIAParamUid, so let's use that as a |
|
2781 // search criteria. |
|
2782 iUpdateParameters->SetUid( KFSEmailUiUid ); |
|
2783 // Free-form search criteria is not supported in |
|
2784 // IAUpdateExampleClient packages. |
|
2785 //iUpdateParameters->SetSearchCriteriaL( KIAParamSearch ); |
|
2786 // We want iaupdateexampleclient.exe to be started after update is |
|
2787 // finished |
|
2788 iUpdateParameters->SetCommandLineExecutableL( KFSEmailUiExec ); |
|
2789 //iUpdateParameters->SetCommandLineArgumentsL( KIAParamArg ); |
|
2790 // We don't want any wait dialog to be shown, let's keep everything |
|
2791 // silent. |
|
2792 // EFalse is the default, so no need to call this. |
|
2793 //iUpdateParameters->SetShowProgress( EFalse ); |
|
2794 // Check the updates |
|
2795 iUpdateClient->CheckUpdates( *iUpdateParameters ); |
|
2796 } |
|
2797 } |
|
2798 } |
|
2799 |
|
2800 void CFreestyleEmailUiAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) |
|
2801 { |
|
2802 FUNC_LOG; |
|
2803 if ( aErrorCode == KErrNone ) |
|
2804 { |
|
2805 if ( aAvailableUpdates > 0 ) |
|
2806 { |
|
2807 // There were some updates available. Let's ask if the user wants to update them. |
|
2808 iUpdateClient->UpdateQuery(); |
|
2809 } |
|
2810 else |
|
2811 { |
|
2812 // No updates available. CIAUpdate object should be deleted already now, since we are not |
|
2813 // going to call anything else from the API. This will also close down the IAUpdate server. |
|
2814 AllUpdateActivitiesCompleted(); |
|
2815 } |
|
2816 } |
|
2817 } |
|
2818 |
|
2819 void CFreestyleEmailUiAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) |
|
2820 { |
|
2821 FUNC_LOG; |
|
2822 if ( aErrorCode == KErrNone ) |
|
2823 { |
|
2824 if ( aUpdateNow ) |
|
2825 { |
|
2826 // User choosed to update now, so let's launch the IAUpdate UI. |
|
2827 iUpdateClient->ShowUpdates( *iUpdateParameters ); |
|
2828 } |
|
2829 else |
|
2830 { |
|
2831 // The answer was 'Later'. CIAUpdate object could be deleted already now, since we are not |
|
2832 // going to call anything else from the API. This will also close down the IAUpdate server. |
|
2833 AllUpdateActivitiesCompleted(); |
|
2834 } |
|
2835 } |
|
2836 } |
|
2837 |
|
2838 void CFreestyleEmailUiAppUi::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ) |
|
2839 { |
|
2840 FUNC_LOG; |
|
2841 if ( aErrorCode == KErrNone ) |
|
2842 { |
|
2843 // The update process that the user started from IAUpdate UI is now completed. |
|
2844 // If the client application itself was updated in the update process, this callback |
|
2845 // is never called, since the client is not running anymore. |
|
2846 TInt successCount = aResult->SuccessCount(); |
|
2847 |
|
2848 // Should we restart our application somehow if we come here? |
|
2849 // Basically this can happen only when not doing a whole |
|
2850 // update, so e.g. if only some plugin is updated. |
|
2851 } |
|
2852 |
|
2853 delete aResult; // Ownership was transferred, so this must be deleted by the client |
|
2854 // We do not need the client-server session anymore, let's delete the object to close the session |
|
2855 AllUpdateActivitiesCompleted(); |
|
2856 } |
|
2857 |
|
2858 void CFreestyleEmailUiAppUi::AllUpdateActivitiesCompleted() |
|
2859 { |
|
2860 FUNC_LOG; |
|
2861 delete iUpdateClient; |
|
2862 iUpdateClient = NULL; |
|
2863 delete iUpdateParameters; |
|
2864 iUpdateParameters = NULL; |
|
2865 iIADUpdateCompleted = ETrue; |
|
2866 |
|
2867 // After completed all update activities, check is there any mailboxes |
|
2868 // defined. If not, show a query to ask if user wants to create one. |
|
2869 TRAP_IGNORE( ShowMailboxQueryL() ); |
|
2870 } |
|
2871 |
|
2872 |
|
2873 void CFreestyleEmailUiAppUi::GridStarted( TBool aStartedFromOds ) |
|
2874 { |
|
2875 FUNC_LOG; |
|
2876 iGridStarted = ETrue; |
|
2877 if ( aStartedFromOds ) |
|
2878 { |
|
2879 iGridFirstStartFromOds = ETrue; |
|
2880 } |
|
2881 } |
|
2882 |
|
2883 // This is combined show mailbox query that can be displayed either when |
|
2884 // upcate client has finished or when laucnher grid has completed its construction |
|
2885 // Launches async callback so that wizard will not block UI creation. |
|
2886 void CFreestyleEmailUiAppUi::ShowMailboxQueryL() |
|
2887 { |
|
2888 FUNC_LOG; |
|
2889 if ( !iStartupQueryShown && iGridStarted && !iGridFirstStartFromOds && iIADUpdateCompleted ) |
|
2890 { |
|
2891 RPointerArray<CFSMailBox> mailboxes; |
|
2892 CleanupResetAndDestroyClosePushL( mailboxes ); |
|
2893 TFSMailMsgId id; |
|
2894 GetMailClient()->ListMailBoxes( id, mailboxes ); |
|
2895 if( mailboxes.Count() == 0 && iNewBoxQueryAsyncCallback ) |
|
2896 { |
|
2897 iNewBoxQueryAsyncCallback->CallBack(); |
|
2898 } |
|
2899 CleanupStack::PopAndDestroy( &mailboxes ); |
|
2900 |
|
2901 // NULL FLAG, not to be shown again |
|
2902 iStartupQueryShown = ETrue; |
|
2903 } |
|
2904 } |
|
2905 |
|
2906 |
|
2907 // ----------------------------------------------------------------------------- |
|
2908 // CFreestyleEmailUiAppUi::DisplayCreateQueryL |
|
2909 // Async callback is needed since the UI and launcher grid construction cannot jam |
|
2910 // if wizard is launched |
|
2911 // ----------------------------------------------------------------------------- |
|
2912 TInt CFreestyleEmailUiAppUi::DisplayCreateQueryL( TAny* aSelfPtr ) |
|
2913 { |
|
2914 FUNC_LOG; |
|
2915 CFreestyleEmailUiAppUi* self = static_cast<CFreestyleEmailUiAppUi*>( aSelfPtr ); |
|
2916 |
|
2917 if (self->AppUiExitOngoing()) |
|
2918 { |
|
2919 return KErrNone; |
|
2920 } |
|
2921 |
|
2922 if (!self->iMainUiGridVisualiser || self->iMainUiGridVisualiser->UiOperationLaunched()) |
|
2923 { |
|
2924 return KErrNone; |
|
2925 } |
|
2926 |
|
2927 TRAPD( err, self->DisplayCreateMailboxQueryL() ); |
|
2928 |
|
2929 if (err == KLeaveExit) |
|
2930 { |
|
2931 User::Leave(err); |
|
2932 } |
|
2933 |
|
2934 return err; |
|
2935 } |
|
2936 |
|
2937 void CFreestyleEmailUiAppUi::DisplayCreateMailboxQueryL() |
|
2938 { |
|
2939 FUNC_LOG; |
|
2940 if ( TFsEmailUiUtility::ShowConfirmationQueryL( R_FS_EMAIL_SETTINGS_ADD_MAILBOX_TXT ) ) |
|
2941 { |
|
2942 // Launch wizard if user selected Yes to create new mailbox query |
|
2943 LaunchWizardL(); |
|
2944 } |
|
2945 } |
|
2946 |
|
2947 // ----------------------------------------------------------------------------- |
|
2948 // CFreestyleEmailUiAppUi::SendToBackground |
|
2949 // Send self to background. |
|
2950 // ----------------------------------------------------------------------------- |
|
2951 void CFreestyleEmailUiAppUi::SendToBackground() |
|
2952 { |
|
2953 FUNC_LOG; |
|
2954 |
|
2955 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
2956 TApaTask task = taskList.FindApp( KFSEmailUiUid ); |
|
2957 if ( task.Exists() ) |
|
2958 { |
|
2959 // Send self to background |
|
2960 task.SendToBackground(); |
|
2961 } |
|
2962 |
|
2963 iSwitchingToBackground = EFalse; |
|
2964 } |
|
2965 |
|
2966 // ----------------------------------------------------------------------------- |
|
2967 // CFreestyleEmailUiAppUi::SetEmbeddedApp |
|
2968 // Set flag for judging if there is a embedded app in FSEmail. |
|
2969 // ----------------------------------------------------------------------------- |
|
2970 void CFreestyleEmailUiAppUi::SetEmbeddedApp( TBool aEmbeddedApp ) |
|
2971 { |
|
2972 iHasEmbeddedApp = aEmbeddedApp; |
|
2973 } |
|
2974 |
|
2975 // ----------------------------------------------------------------------------- |
|
2976 // CFreestyleEmailUiAppUi::EmbeddedApp |
|
2977 // Get embedded app flag. |
|
2978 // ----------------------------------------------------------------------------- |
|
2979 TBool CFreestyleEmailUiAppUi::EmbeddedApp() const |
|
2980 { |
|
2981 return iHasEmbeddedApp; |
|
2982 } |
|
2983 |
|
2984 // ----------------------------------------------------------------------------- |
|
2985 // CFreestyleEmailUiAppUi::SetEmbeddedAppToPreviousApp |
|
2986 // ----------------------------------------------------------------------------- |
|
2987 void CFreestyleEmailUiAppUi::SetEmbeddedAppToPreviousApp( TBool aEmbeddedApp ) |
|
2988 { |
|
2989 iPreviousAppEmbedded = aEmbeddedApp; |
|
2990 } |
|
2991 |
|
2992 // ----------------------------------------------------------------------------- |
|
2993 // CFreestyleEmailUiAppUi::EmbeddedAppIsPreviousApp |
|
2994 // ----------------------------------------------------------------------------- |
|
2995 TBool CFreestyleEmailUiAppUi::EmbeddedAppIsPreviousApp() const |
|
2996 { |
|
2997 return iPreviousAppEmbedded; |
|
2998 } |
|
2999 |
|
3000 // ----------------------------------------------------------------------------- |
|
3001 // CFreestyleEmailUiAppUi::SetEditorStartedFromEmbeddedApp |
|
3002 // ----------------------------------------------------------------------------- |
|
3003 void CFreestyleEmailUiAppUi::SetEditorStartedFromEmbeddedApp( TBool aEmbeddedApp ) |
|
3004 { |
|
3005 iEditorStartedFromEmbeddedApp = aEmbeddedApp; |
|
3006 } |
|
3007 |
|
3008 // ----------------------------------------------------------------------------- |
|
3009 // CFreestyleEmailUiAppUi::EditorStartedFromEmbeddedApp |
|
3010 // ----------------------------------------------------------------------------- |
|
3011 TBool CFreestyleEmailUiAppUi::EditorStartedFromEmbeddedApp() const |
|
3012 { |
|
3013 return iEditorStartedFromEmbeddedApp; |
|
3014 } |
|
3015 |
|
3016 // ----------------------------------------------------------------------------- |
|
3017 // CFreestyleEmailUiAppUi::LastSeenPointerPosition |
|
3018 // ----------------------------------------------------------------------------- |
|
3019 const TPoint& CFreestyleEmailUiAppUi::LastSeenPointerPosition() const |
|
3020 { |
|
3021 return iLastPointerPosition; |
|
3022 } |
|
3023 |
|
3024 // ----------------------------------------------------------------------------- |
|
3025 // CFreestyleEmailUiAppUi::LastSeenWsEventType |
|
3026 // ----------------------------------------------------------------------------- |
|
3027 TInt CFreestyleEmailUiAppUi::LastSeenWsEventType() |
|
3028 { |
|
3029 return iLastWsEventType; |
|
3030 } |
|
3031 // CFreestyleEmailUiAppUi::RunFakeSyncAnimL |
|
3032 // ----------------------------------------------------------------------------- |
|
3033 void CFreestyleEmailUiAppUi::RunFakeSyncAnimL() |
|
3034 { |
|
3035 FUNC_LOG; |
|
3036 |
|
3037 if ( iConnectionStatusVisible ) |
|
3038 { |
|
3039 // don't run if animation already ongoing |
|
3040 if ( !iConnectionStatusIconAnimTimer->IsActive() ) |
|
3041 { |
|
3042 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
3043 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
3044 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
3045 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
3046 { |
|
3047 CAknTitlePane* titlePane = |
|
3048 static_cast<CAknTitlePane*>( |
|
3049 StatusPane()->ControlL( titlePaneUid ) ); |
|
3050 if ( titlePane ) |
|
3051 { |
|
3052 iConnectionIconBitmap = NULL; |
|
3053 iConnectionIconMask = NULL; |
|
3054 FsTextureManager()->ProvideBitmapL( |
|
3055 EStatusTextureSynchronising, |
|
3056 iConnectionIconBitmap, |
|
3057 iConnectionIconMask ); |
|
3058 if ( iConnectionIconBitmap && iConnectionIconMask ) |
|
3059 { |
|
3060 AknIconUtils::SetSize( |
|
3061 iConnectionIconBitmap, |
|
3062 LayoutHandler()->statusPaneIconSize(), |
|
3063 EAspectRatioNotPreserved ); |
|
3064 titlePane->SetSmallPicture( |
|
3065 iConnectionIconBitmap, |
|
3066 iConnectionIconMask, |
|
3067 ETrue ); |
|
3068 iConnectionStatusIconAnimTimer->Start( |
|
3069 KConnectionStatusIconRotationInterval ); |
|
3070 iFakeSyncAnimStopTimer->Start( |
|
3071 KFakeSyncAnimStopTimerInterval ); |
|
3072 titlePane->DrawNow(); |
|
3073 } |
|
3074 } |
|
3075 } |
|
3076 } |
|
3077 } |
|
3078 } |
|
3079 |
|
3080 // ----------------------------------------------------------------------------- |
|
3081 // |
|
3082 // ----------------------------------------------------------------------------- |
|
3083 void CFreestyleEmailUiAppUi::ConstructNaviPaneL() |
|
3084 { |
|
3085 FUNC_LOG; |
|
3086 |
|
3087 CAknNavigationControlContainer* naviPaneContainer = |
|
3088 static_cast<CAknNavigationControlContainer*>( |
|
3089 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
3090 |
|
3091 // Following navipane is for mailviewer view |
|
3092 if ( !iNaviDecorator2MailViewer ) |
|
3093 { |
|
3094 // Constructing a decorator with own decorated control, |
|
3095 // which is (currently an empty) container. |
|
3096 CFreestyleEmailUiNaviPaneControlContainer2MailViewer* c = |
|
3097 CFreestyleEmailUiNaviPaneControlContainer2MailViewer::NewL(); |
|
3098 c->SetContainerWindowL( *naviPaneContainer ); |
|
3099 iNaviDecorator2MailViewer = CAknNavigationDecorator::NewL( |
|
3100 naviPaneContainer, |
|
3101 c, |
|
3102 CAknNavigationDecorator::ENotSpecified ); |
|
3103 |
|
3104 // In order to get navi arrows visible, they must be set visible AND not dimmed... |
|
3105 iNaviDecorator2MailViewer->SetContainerWindowL( *naviPaneContainer ); |
|
3106 iNaviDecorator2MailViewer->MakeScrollButtonVisible( ETrue ); |
|
3107 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, EFalse ); |
|
3108 iNaviDecorator2MailViewer->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, EFalse ); |
|
3109 |
|
3110 iNaviDecorator2MailViewer->SetComponentsToInheritVisibility( ETrue ); |
|
3111 naviPaneContainer->PushL( *iNaviDecorator2MailViewer ); |
|
3112 } |
|
3113 } |
|
3114 |
|
3115 // ----------------------------------------------------------------------------- |
|
3116 // |
|
3117 // ----------------------------------------------------------------------------- |
|
3118 CAknNavigationDecorator* CFreestyleEmailUiAppUi::NaviDecoratorL( const TUid aViewId ) |
|
3119 { |
|
3120 FUNC_LOG; |
|
3121 CAknNavigationDecorator* decorator( NULL ); |
|
3122 // Depending on who's asking, return proper navipane instance |
|
3123 if ( aViewId.iUid == MailViewerId.iUid ) |
|
3124 { |
|
3125 if ( !iNaviDecorator2MailViewer ) |
|
3126 { |
|
3127 ConstructNaviPaneL(); |
|
3128 } |
|
3129 decorator = iNaviDecorator2MailViewer; |
|
3130 } |
|
3131 return decorator; |
|
3132 } |
|
3133 |
|
3134 void CFreestyleEmailUiAppUi::TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer ) |
|
3135 { |
|
3136 if ( aTriggeredTimer == iConnectionStatusIconAnimTimer ) |
|
3137 { |
|
3138 if ( iConnectionStatusVisible ) |
|
3139 { |
|
3140 TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); |
|
3141 CEikStatusPaneBase::TPaneCapabilities subPaneTitle = |
|
3142 StatusPane()->PaneCapabilities( titlePaneUid ); |
|
3143 |
|
3144 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
3145 { |
|
3146 CAknTitlePane* titlePane = NULL; |
|
3147 TRAP_IGNORE( titlePane = |
|
3148 (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) ); |
|
3149 |
|
3150 TSize iconSize = LayoutHandler()->statusPaneIconSize(); |
|
3151 iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount; |
|
3152 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle); |
|
3153 titlePane->DrawNow(); |
|
3154 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval); |
|
3155 } |
|
3156 } |
|
3157 } |
|
3158 if ( aTriggeredTimer == iFakeSyncAnimStopTimer ) |
|
3159 { |
|
3160 // Just call the UpdateTitlePaneConnectionStatus. |
|
3161 // The method will put the correct sync icon to title pane |
|
3162 UpdateTitlePaneConnectionStatus(); |
|
3163 } |
|
3164 } |
|
3165 |
|
3166 // ----------------------------------------------------------------------------- |
|
3167 // CFreestyleEmailUiAppUi::SetFocusVisibility |
|
3168 // ----------------------------------------------------------------------------- |
|
3169 |
|
3170 TBool CFreestyleEmailUiAppUi::SetFocusVisibility( TBool aVisible ) |
|
3171 { |
|
3172 FUNC_LOG; |
|
3173 TBool oldFocusState( iFocusVisible ); |
|
3174 iFocusVisible = aVisible; |
|
3175 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
|
3176 if ( activeView ) |
|
3177 { |
|
3178 activeView->FocusVisibilityChange( aVisible ); |
|
3179 } |
|
3180 // If popup is visible inform it also. |
|
3181 if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() ) |
|
3182 { |
|
3183 iFolderListVisualiser->FocusVisibilityChange( aVisible ); |
|
3184 } |
|
3185 return oldFocusState; |
|
3186 } |
|
3187 |
|
3188 // ----------------------------------------------------------------------------- |
|
3189 // |
|
3190 // ----------------------------------------------------------------------------- |
|
3191 TBool CFreestyleEmailUiAppUi::IsFocusShown() const |
|
3192 { |
|
3193 FUNC_LOG; |
|
3194 return iFocusVisible; |
|
3195 } |
|
3196 |
|
3197 // PUBLIC METHODS FROM MFREESTYLEEMAILUIPROPERTYCHANGEDOBSERVER |
|
3198 |
|
3199 // ----------------------------------------------------------------------------- |
|
3200 // From MFreestyleEmailUiPropertyChangedObserver. |
|
3201 // ----------------------------------------------------------------------------- |
|
3202 // |
|
3203 void CFreestyleEmailUiAppUi::PropertyChangedL( TInt aValue ) |
|
3204 { |
|
3205 EPSHWRMFlipStatus flipStatus = ( EPSHWRMFlipStatus )aValue; |
|
3206 |
|
3207 if( flipStatus == EPSHWRMFlipOpen ) |
|
3208 { |
|
3209 iFlipOpen = ETrue; |
|
3210 } |
|
3211 else |
|
3212 { |
|
3213 iFlipOpen = EFalse; |
|
3214 } |
|
3215 |
|
3216 CFsEmailUiViewBase* activeView = CurrentActiveView(); |
|
3217 if ( activeView ) |
|
3218 { |
|
3219 activeView->FlipStateChangedL( iFlipOpen ); |
|
3220 } |
|
3221 } |
|
3222 |
|
3223 |
|
3224 |
|
3225 //////////////////////////////////////////////////////////////////////////////// |
|
3226 // |
|
3227 ///////////////////////////////////////////////////////////////////////////////// |
|
3228 // ----------------------------------------------------------------------------- |
|
3229 // CFSEmailUiAutosyncMonitor::CFSEmailUiAutosyncMonitor |
|
3230 // C++ default constructor can NOT contain any code, that |
|
3231 // might leave. |
|
3232 // ----------------------------------------------------------------------------- |
|
3233 // |
|
3234 CFSEmailUiAutosyncMonitor::CFSEmailUiAutosyncMonitor( CFreestyleEmailUiAppUi& aAppUi ) : |
|
3235 CActive( CActive::EPriorityStandard ), |
|
3236 iMonitoringStatus( EInactive ), |
|
3237 iAppUi( aAppUi ), |
|
3238 iRegisterationStatus( RMobilePhone::ERegistrationUnknown ) |
|
3239 { |
|
3240 FUNC_LOG; |
|
3241 } |
|
3242 |
|
3243 |
|
3244 // ----------------------------------------------------------------------------- |
|
3245 // CCMRegistrationMonitor::ConstructL |
|
3246 // Symbian 2nd phase constructor can leave. |
|
3247 // ----------------------------------------------------------------------------- |
|
3248 // |
|
3249 void CFSEmailUiAutosyncMonitor::ConstructL() |
|
3250 { |
|
3251 FUNC_LOG; |
|
3252 User::LeaveIfError( iServer.Connect() ); |
|
3253 User::LeaveIfError( iServer.LoadPhoneModule( KPhoneModuleName ) ); |
|
3254 iServer.SetExtendedErrorGranularity( RTelServer::EErrorBasic ); |
|
3255 User::LeaveIfError( iPhone.Open( iServer, KPhoneName ) ); |
|
3256 CActiveScheduler::Add(this); |
|
3257 } |
|
3258 |
|
3259 // ----------------------------------------------------------------------------- |
|
3260 // CFSEmailUiAutosyncMonitor::NewL |
|
3261 // Two-phased constructor. |
|
3262 // ----------------------------------------------------------------------------- |
|
3263 // |
|
3264 CFSEmailUiAutosyncMonitor* CFSEmailUiAutosyncMonitor::NewL( CFreestyleEmailUiAppUi& aAppUi ) |
|
3265 { |
|
3266 FUNC_LOG; |
|
3267 CFSEmailUiAutosyncMonitor* self = new( ELeave ) CFSEmailUiAutosyncMonitor( aAppUi ); |
|
3268 CleanupStack::PushL( self ); |
|
3269 self->ConstructL(); |
|
3270 CleanupStack::Pop(); |
|
3271 return self; |
|
3272 } |
|
3273 |
|
3274 // Destructor |
|
3275 CFSEmailUiAutosyncMonitor::~CFSEmailUiAutosyncMonitor() |
|
3276 { |
|
3277 FUNC_LOG; |
|
3278 if( IsActive() ) |
|
3279 { |
|
3280 Cancel(); |
|
3281 } |
|
3282 iPhone.Close(); |
|
3283 iServer.Close(); |
|
3284 } |
|
3285 |
|
3286 |
|
3287 // ----------------------------------------------------------------------------- |
|
3288 // CCMRegistrationMonitor::StartMonitoring() |
|
3289 // Starts monitoring of the network registeration status |
|
3290 // (other items were commented in a header). |
|
3291 // ----------------------------------------------------------------------------- |
|
3292 // |
|
3293 void CFSEmailUiAutosyncMonitor::StartMonitoring() |
|
3294 { |
|
3295 FUNC_LOG; |
|
3296 if ( IsActive() ) |
|
3297 { |
|
3298 Cancel(); |
|
3299 } |
|
3300 #ifdef __WINS__ // do not try to connect on the emulator |
|
3301 iRegisterationStatus = RMobilePhone::ERegisteredOnHomeNetwork; |
|
3302 TRequestStatus* status = &iStatus; |
|
3303 User::RequestComplete( status, KErrNone ); |
|
3304 #else |
|
3305 iPhone.GetNetworkRegistrationStatus( iStatus, iRegisterationStatus ); |
|
3306 #endif |
|
3307 iMonitoringStatus = ERequestingNetworkStatus; |
|
3308 SetActive(); |
|
3309 } |
|
3310 |
|
3311 // ----------------------------------------------------------------------------- |
|
3312 // CFSEmailUiAutosyncMonitor::StopMonitoring() |
|
3313 // Stops the registeration monitor |
|
3314 // (other items were commented in a header). |
|
3315 // ----------------------------------------------------------------------------- |
|
3316 // |
|
3317 void CFSEmailUiAutosyncMonitor::StopMonitoring() |
|
3318 { |
|
3319 FUNC_LOG; |
|
3320 if ( IsActive() ) |
|
3321 { |
|
3322 Cancel(); |
|
3323 } |
|
3324 } |
|
3325 |
|
3326 // ----------------------------------------------------------------------------- |
|
3327 // CFSEmailUiAutosyncMonitor::DoCancel() |
|
3328 // Cancels the monitoring |
|
3329 // (other items were commented in a header). |
|
3330 // ----------------------------------------------------------------------------- |
|
3331 // |
|
3332 void CFSEmailUiAutosyncMonitor::DoCancel() |
|
3333 { |
|
3334 FUNC_LOG; |
|
3335 iPhone.CancelAsyncRequest( EMobilePhoneGetNetworkRegistrationStatus ); |
|
3336 } |
|
3337 |
|
3338 TInt CFSEmailUiAutosyncMonitor::RunError( TInt /*aError*/ ) |
|
3339 { |
|
3340 FUNC_LOG; |
|
3341 return KErrNone; |
|
3342 } |
|
3343 |
|
3344 // ----------------------------------------------------------------------------- |
|
3345 // CFSEmailUiAutosyncMonitor::RunL() |
|
3346 // Handles object’s request completion event |
|
3347 // (other items were commented in a header). |
|
3348 // ----------------------------------------------------------------------------- |
|
3349 // |
|
3350 void CFSEmailUiAutosyncMonitor::RunL() |
|
3351 { |
|
3352 FUNC_LOG; |
|
3353 switch ( iMonitoringStatus ) |
|
3354 { |
|
3355 case ERequestingNetworkStatus: |
|
3356 { |
|
3357 switch( iRegisterationStatus ) |
|
3358 { |
|
3359 // Not Ok cases |
|
3360 case RMobilePhone::ERegistrationUnknown: |
|
3361 case RMobilePhone::ENotRegisteredNoService: |
|
3362 case RMobilePhone::ENotRegisteredEmergencyOnly: |
|
3363 case RMobilePhone::ENotRegisteredSearching: |
|
3364 case RMobilePhone::ERegisteredBusy: |
|
3365 case RMobilePhone::ERegistrationDenied: |
|
3366 //case RMobilePhone::ERegisteredRoaming: |
|
3367 // No autoconnect in these cases |
|
3368 break; |
|
3369 // This is ok |
|
3370 case RMobilePhone::ERegisteredOnHomeNetwork: |
|
3371 case RMobilePhone::ERegisteredRoaming: |
|
3372 // TRAP autoconnect, because list UI must open regardless success |
|
3373 // or failure of the auto-connect |
|
3374 TRAP_IGNORE( iAppUi.DoAutoConnectL() ); |
|
3375 break; |
|
3376 default: |
|
3377 break; |
|
3378 } |
|
3379 break; |
|
3380 } |
|
3381 default: |
|
3382 break; |
|
3383 } |
|
3384 } |
|
3385 |
|
3386 // End of file |
|
3387 |