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