author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:48:24 +0300 | |
branch | RCL_3 |
changeset 26 | 968773a0b6ef |
parent 25 | 3533d4323edc |
permissions | -rw-r--r-- |
25 | 1 |
/* |
2 |
* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: This file implements classes CFSEmailUiMailListVisualiser, CMailListUpdater, CMsgMovedNoteTimer, CDateChangeTimer. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// SYSTEM INCLUDES |
|
20 |
#include "emailtrace.h" |
|
21 |
#include <freestyleemailui.mbg> |
|
22 |
#include <AknUtils.h> |
|
23 |
#include <gulicon.h> |
|
24 |
#include <StringLoader.h> |
|
25 |
#include <FreestyleEmailUi.rsg> |
|
26 |
#include <featmgr.h> |
|
27 |
#include "cfsmailclient.h" |
|
28 |
#include "cfsmailbox.h" |
|
29 |
#include "cfsmailfolder.h" |
|
30 |
#include "fscontrolbar.h" |
|
31 |
#include "fscontrolbuttoninterface.h" |
|
32 |
#include "fstreelist.h" |
|
33 |
#include "fstreevisualizerbase.h" |
|
34 |
#include "fstreeplainonelinenodedata.h" |
|
35 |
#include "fstreeplainonelinenodevisualizer.h" |
|
36 |
#include "fstreeplaintwolineitemdata.h" |
|
37 |
#include "fstreeplaintwolineitemvisualizer.h" |
|
38 |
#include "cfsmailcommon.h" |
|
39 |
#include "ceuiemaillisttouchmanager.h" |
|
40 |
#include "FSEmailBuildFlags.h" |
|
41 |
#include "cfsccontactactionmenu.h" |
|
42 |
#include "mfsccontactactionmenumodel.h" |
|
43 |
||
44 |
#include <hlplch.h> |
|
45 |
#include <AknIconArray.h> |
|
46 |
#include <alf/alfdecklayout.h> |
|
47 |
#include <alf/alfcontrolgroup.h> |
|
48 |
#include <alf/alfframebrush.h> |
|
49 |
#include <alf/alfevent.h> |
|
50 |
#include <alf/alfstatic.h> |
|
51 |
||
52 |
#include <aknnotewrappers.h> |
|
53 |
#include <msvapi.h> |
|
54 |
#include <akntitle.h> |
|
55 |
#include "esmailsettingspluginuids.hrh" |
|
56 |
#include "esmailsettingsplugin.h" |
|
57 |
#include "mfsmailbrandmanager.h" |
|
58 |
#include <AknWaitDialog.h> |
|
59 |
#include <aknlayoutscalable_apps.cdl.h> |
|
60 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
61 |
#include <layoutmetadata.cdl.h> |
|
62 |
#include <csxhelp/cmail.hlp.hrh> |
|
63 |
// Meeting request |
|
64 |
#include <MeetingRequestUids.hrh> |
|
65 |
#include "cesmricalviewer.h" |
|
66 |
#include <aknstyluspopupmenu.h> |
|
67 |
#include <akntoolbar.h> |
|
68 |
||
69 |
// INTERNAL INCLUDES |
|
70 |
#include "FreestyleEmailUiUtilities.h" |
|
71 |
#include "FreestyleEmailUiLiterals.h" |
|
72 |
#include "FreestyleEmailUiLayoutHandler.h" |
|
73 |
#include "FreestyleEmailUiMailListModel.h" |
|
74 |
#include "FreestyleEmailUiMailListVisualiser.h" |
|
75 |
#include "FreestyleEmailUiFileSystemInfo.h" |
|
76 |
#include "FreestyleEmailUiAppui.h" |
|
77 |
#include "FreestyleEmailUi.hrh" |
|
78 |
#include "FreestyleEmailUiTextureManager.h" |
|
79 |
#include "FreestyleEmailUiMailListControl.h" |
|
80 |
#include "FreestyleEmailUiStatusIndicator.h" |
|
81 |
#include "freestyleemailcenrephandler.h" |
|
82 |
#include "FreestyleEmailUiFolderListVisualiser.h" |
|
83 |
#include "FreestyleEmailUiShortcutBinding.h" |
|
84 |
#include "FreestyleEmailUiMsgDetailsVisualiser.h" |
|
85 |
#include "FreestyleEmailDownloadInformationMediator.h" |
|
86 |
#include "FreestyleEmailUiContactHandler.h" |
|
87 |
#include "FreestyleEmailUiLauncherGridVisualiser.h" |
|
88 |
#include "FreestyleEmailUiHtmlViewerView.h" |
|
89 |
#include "FSDelayedLoader.h" |
|
90 |
#include "FSEmail.pan" |
|
91 |
||
92 |
#include "ipsplgcommon.h" |
|
93 |
#include "cemailsettingsextension.h" |
|
94 |
||
95 |
// CONST VALUES |
|
96 |
const TInt KControlBarTransitionTime = 250; |
|
97 |
const TInt KMaxPreviewPaneLength = 60; |
|
98 |
const TInt KMsgUpdaterTimerDelay = 2500000; // Time to update list, 2,5sec |
|
99 |
const TInt KNewMailTimerDelay = 20; // sleeping timer to start processing new messages |
|
100 |
const TInt KSortTimerDelay = 40; // sleeping timer to start sorting ( delay should be longer than abowe ) |
|
101 |
const TInt KSortCountdown = 5; // number how many times will be tried do start sorting when it's forbidden |
|
102 |
const TInt KNewMailMaxBatch = 7; // number of new mails inserted into list at once |
|
103 |
static const TInt KMsgDeletionWaitNoteAmount = 5; |
|
104 |
_LIT( KMissingPreviewDataMarker, "..." ); |
|
105 |
||
106 |
static const TInt KMaxItemsFethed = 1000; |
|
107 |
static const TInt KCMsgBlock = 15; |
|
108 |
static const TInt KCMsgBlockSort = 50; |
|
109 |
||
110 |
// --------------------------------------------------------------------------- |
|
111 |
// Generic method for deleting a pointer and setting it NULL. |
|
112 |
// --------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
template <class T> void SafeDelete(T*& ptr) |
|
115 |
{ |
|
116 |
delete ptr; |
|
117 |
ptr = NULL; |
|
118 |
} |
|
119 |
||
120 |
// TDeleteTask |
|
121 |
// Task class for deleting mail |
|
122 |
// --------------------------------------------------------------------------- |
|
123 |
// Class definition |
|
124 |
// --------------------------------------------------------------------------- |
|
125 |
template <class T> struct TDeleteTask |
|
126 |
{ |
|
127 |
||
128 |
public: |
|
129 |
||
130 |
typedef void ( T::*TDeleteMethod )( const RFsTreeItemIdList& aEntries ); |
|
131 |
||
132 |
public: |
|
133 |
||
134 |
TDeleteTask(T& aObject, TDeleteMethod aMethod); |
|
135 |
~TDeleteTask(); |
|
136 |
void ExecuteL(); |
|
137 |
RFsTreeItemIdList& Entries(); |
|
138 |
void Reset(); |
|
139 |
||
140 |
private: |
|
141 |
||
142 |
T& iObject; |
|
143 |
TDeleteMethod iMethod; |
|
144 |
RFsTreeItemIdList iEntries; |
|
145 |
||
146 |
}; |
|
147 |
||
148 |
// --------------------------------------------------------------------------- |
|
149 |
// TDeleteTask<T>::TDeleteTask |
|
150 |
// --------------------------------------------------------------------------- |
|
151 |
// |
|
152 |
template <class T> TDeleteTask<T>::TDeleteTask( T& aObject, TDeleteMethod aMethod ) |
|
153 |
: iObject(aObject), iMethod(aMethod) |
|
154 |
{ |
|
155 |
} |
|
156 |
||
157 |
// --------------------------------------------------------------------------- |
|
158 |
// TDeleteTask<T>::~TDeleteTask |
|
159 |
// --------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
template <class T> TDeleteTask<T>::~TDeleteTask() |
|
162 |
{ |
|
163 |
iEntries.Close(); |
|
164 |
} |
|
165 |
||
166 |
// --------------------------------------------------------------------------- |
|
167 |
// TDeleteTask<T>::ExecuteL |
|
168 |
// --------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
template <class T> void TDeleteTask<T>::ExecuteL() |
|
171 |
{ |
|
172 |
(iObject.*iMethod)(iEntries); |
|
173 |
Reset(); |
|
174 |
} |
|
175 |
||
176 |
// --------------------------------------------------------------------------- |
|
177 |
// TDeleteTask<T>::Entries |
|
178 |
// --------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
template <class T> RFsTreeItemIdList& TDeleteTask<T>::Entries() |
|
181 |
{ |
|
182 |
return iEntries; |
|
183 |
} |
|
184 |
||
185 |
// --------------------------------------------------------------------------- |
|
186 |
// TDeleteTask<T>::Reset |
|
187 |
// --------------------------------------------------------------------------- |
|
188 |
// |
|
189 |
template <class T> void TDeleteTask<T>::Reset() |
|
190 |
{ |
|
191 |
iEntries.Reset(); |
|
192 |
} |
|
193 |
||
194 |
||
195 |
// CMailListModelUpdater |
|
196 |
||
197 |
||
198 |
// --------------------------------------------------------------------------- |
|
199 |
// CMailListModelUpdater::NewL |
|
200 |
// --------------------------------------------------------------------------- |
|
201 |
// |
|
202 |
CMailListModelUpdater* CMailListModelUpdater::NewL() |
|
203 |
{ |
|
204 |
CMailListModelUpdater* self = new (ELeave) CMailListModelUpdater(); |
|
205 |
CleanupStack::PushL( self ); |
|
206 |
self->ConstructL(); |
|
207 |
CleanupStack::Pop( self ); |
|
208 |
||
209 |
return self; |
|
210 |
} |
|
211 |
||
212 |
// --------------------------------------------------------------------------- |
|
213 |
// CMailListModelUpdater::ConstructL |
|
214 |
// --------------------------------------------------------------------------- |
|
215 |
// |
|
216 |
void CMailListModelUpdater::ConstructL() |
|
217 |
{ |
|
218 |
User::LeaveIfError( iTimer.CreateLocal() ); |
|
219 |
} |
|
220 |
||
221 |
// --------------------------------------------------------------------------- |
|
222 |
// CMailListModelUpdater::CMailListModelUpdater |
|
223 |
// --------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
CMailListModelUpdater::CMailListModelUpdater() : CActive(EPriorityStandard) |
|
226 |
{ |
|
227 |
CActiveScheduler::Add(this); |
|
228 |
iBlockSize = KCMsgBlock; |
|
229 |
} |
|
230 |
||
231 |
// --------------------------------------------------------------------------- |
|
232 |
// CMailListModelUpdater::~CMailListModelUpdater |
|
233 |
// --------------------------------------------------------------------------- |
|
234 |
// |
|
235 |
CMailListModelUpdater::~CMailListModelUpdater() |
|
236 |
{ |
|
237 |
iObserver = NULL; |
|
238 |
Cancel(); |
|
239 |
iSorting.Close(); |
|
240 |
iTimer.Close(); |
|
241 |
} |
|
242 |
||
243 |
// --------------------------------------------------------------------------- |
|
244 |
// Returns arrays for sorting parameters. Updater owns the arrays because |
|
245 |
// it has to stay alive as long as the iterator is being used. |
|
246 |
// --------------------------------------------------------------------------- |
|
247 |
// |
|
248 |
RArray<TFSMailSortCriteria>& CMailListModelUpdater::Sorting() |
|
249 |
{ |
|
250 |
iSorting.Reset(); |
|
251 |
return iSorting; |
|
252 |
} |
|
253 |
||
254 |
// --------------------------------------------------------------------------- |
|
255 |
// Update the mail list model from given iterator. Update progress will be |
|
256 |
// informed to the observer. |
|
257 |
// --------------------------------------------------------------------------- |
|
258 |
// |
|
259 |
void CMailListModelUpdater::UpdateModelL(MObserver& aObserver, |
|
260 |
MFSMailIterator* aIterator, TInt aBlockSize) |
|
261 |
{ |
|
262 |
Cancel(); |
|
263 |
iObserver = &aObserver; |
|
264 |
iIterator = aIterator; |
|
265 |
Signal(EInitialize); |
|
266 |
iBlockSize = aBlockSize; |
|
267 |
} |
|
268 |
||
269 |
// --------------------------------------------------------------------------- |
|
270 |
// Internal method. Sets new state and signals itself. |
|
271 |
// --------------------------------------------------------------------------- |
|
272 |
// |
|
273 |
void CMailListModelUpdater::Signal(TState aState, TInt /*aError*/) |
|
274 |
{ |
|
275 |
const TInt KDelayInMicroSeconds = 5 * 1000; // 5 ms |
|
276 |
||
277 |
// timer used to get CAknWaitDialog animation working |
|
278 |
iState = aState; |
|
279 |
iTimer.After(iStatus, KDelayInMicroSeconds); |
|
280 |
SetActive(); |
|
281 |
||
282 |
||
283 |
//iState = aState; |
|
284 |
//iStatus = KRequestPending; |
|
285 |
//SetActive(); |
|
286 |
//TRequestStatus* status = &iStatus; |
|
287 |
//User::RequestComplete(status, aError); |
|
288 |
} |
|
289 |
||
290 |
// --------------------------------------------------------------------------- |
|
291 |
// Initialization state. Reset update and call UpdateBeginL() for the observer. |
|
292 |
// --------------------------------------------------------------------------- |
|
293 |
// |
|
294 |
void CMailListModelUpdater::InitializeL() |
|
295 |
{ |
|
296 |
iParentId = KFsTreeRootID; |
|
297 |
iId = TFSMailMsgId(); |
|
298 |
iItemsFetched = 0; |
|
299 |
iObserver->UpdateBeginL(); |
|
300 |
Signal(EFetch); |
|
301 |
} |
|
302 |
||
303 |
// --------------------------------------------------------------------------- |
|
304 |
// Fetch state. Fetch next messages and if there is more messages signal |
|
305 |
// fetch state again OR proceed to finalizing state. |
|
306 |
// --------------------------------------------------------------------------- |
|
307 |
// |
|
308 |
void CMailListModelUpdater::FetchL() |
|
309 |
{ |
|
310 |
TInt blockSize = iBlockSize; |
|
311 |
if ( iItemsFetched == 0 ) |
|
312 |
{ |
|
313 |
blockSize = KCMsgBlock; |
|
314 |
} |
|
315 |
||
316 |
RPointerArray<CFSMailMessage> messages(blockSize); |
|
317 |
CleanupClosePushL(messages); |
|
318 |
||
319 |
const TBool moreMessages(iIterator->NextL(iId, blockSize, messages)); |
|
320 |
||
321 |
if (messages.Count() > 0) |
|
322 |
{ |
|
323 |
iItemsFetched += messages.Count(); |
|
324 |
iId = messages[messages.Count() - 1]->GetMessageId(); |
|
325 |
iObserver->UpdateProgressL(iParentId, messages); |
|
326 |
} |
|
327 |
||
328 |
CleanupStack::PopAndDestroy(); // messages.Close() |
|
329 |
||
330 |
if (moreMessages && iItemsFetched < KMaxItemsFethed) |
|
331 |
{ |
|
332 |
Signal(EFetch); |
|
333 |
} |
|
334 |
else |
|
335 |
{ |
|
336 |
Signal(EFinalize); |
|
337 |
} |
|
338 |
} |
|
339 |
||
340 |
// --------------------------------------------------------------------------- |
|
341 |
// Finalizing state. Notify observer that model update has been done and |
|
342 |
// free the resources. |
|
343 |
// --------------------------------------------------------------------------- |
|
344 |
// |
|
345 |
void CMailListModelUpdater::FinalizeL() |
|
346 |
{ |
|
347 |
iObserver->UpdateCompleteL(); |
|
348 |
Reset(); |
|
349 |
} |
|
350 |
||
351 |
// --------------------------------------------------------------------------- |
|
352 |
// If the state is anything but EIdle, returns ETrue. |
|
353 |
// --------------------------------------------------------------------------- |
|
354 |
// |
|
355 |
TBool CMailListModelUpdater::IsUpdating() const |
|
356 |
{ |
|
357 |
return iState > EIdle; |
|
358 |
} |
|
359 |
||
360 |
// --------------------------------------------------------------------------- |
|
361 |
// Reset the state to EIdle and free resources. |
|
362 |
// --------------------------------------------------------------------------- |
|
363 |
// |
|
364 |
void CMailListModelUpdater::Reset() |
|
365 |
{ |
|
366 |
iSorting.Reset(); |
|
367 |
SafeDelete(iIterator); |
|
368 |
iState = EIdle; |
|
369 |
} |
|
370 |
||
371 |
// --------------------------------------------------------------------------- |
|
372 |
// Active objects RunL() |
|
373 |
// --------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
void CMailListModelUpdater::RunL() |
|
376 |
{ |
|
377 |
const TInt error(iStatus.Int()); |
|
378 |
if (!error) |
|
379 |
{ |
|
380 |
switch (iState) |
|
381 |
{ |
|
382 |
case EInitialize: |
|
383 |
InitializeL(); |
|
384 |
break; |
|
385 |
case EFetch: |
|
386 |
FetchL(); |
|
387 |
break; |
|
388 |
case EFinalize: |
|
389 |
default: |
|
390 |
FinalizeL(); |
|
391 |
break; |
|
392 |
} |
|
393 |
} |
|
394 |
else |
|
395 |
{ |
|
396 |
User::Leave(error); // causes RunError to be called |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
// --------------------------------------------------------------------------- |
|
401 |
// Update has been cancelled. Inform the observer and free resources. |
|
402 |
// --------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
void CMailListModelUpdater::DoCancel() |
|
405 |
{ |
|
406 |
if (iObserver) |
|
407 |
{ |
|
408 |
iObserver->UpdateCancelled(IsUpdating()); |
|
409 |
} |
|
410 |
Reset(); |
|
411 |
||
412 |
iTimer.Cancel(); |
|
413 |
} |
|
414 |
// --------------------------------------------------------------------------- |
|
415 |
// CMailListModelUpdater::RunError |
|
416 |
// --------------------------------------------------------------------------- |
|
417 |
// |
|
418 |
TInt CMailListModelUpdater::RunError(TInt aError) |
|
419 |
{ |
|
420 |
if ( aError != KErrNone ) |
|
421 |
{ |
|
422 |
TRAP_IGNORE( iObserver->UpdateErrorL( aError ) ); |
|
423 |
} |
|
424 |
||
425 |
return aError; |
|
426 |
} |
|
427 |
||
428 |
||
429 |
||
430 |
||
431 |
||
432 |
// --------------------------------------------------------------------------- |
|
433 |
// Static constructor. |
|
434 |
// --------------------------------------------------------------------------- |
|
435 |
// |
|
436 |
CFSEmailUiMailListVisualiser* CFSEmailUiMailListVisualiser::NewL(CAlfEnv& aEnv, |
|
437 |
CFreestyleEmailUiAppUi* aAppUi, |
|
438 |
CAlfControlGroup& aMailListControlGroup ) |
|
439 |
{ |
|
440 |
FUNC_LOG; |
|
441 |
CFSEmailUiMailListVisualiser* self = CFSEmailUiMailListVisualiser::NewLC(aEnv, aAppUi, aMailListControlGroup ); |
|
442 |
CleanupStack::Pop(self); |
|
443 |
return self; |
|
444 |
} |
|
445 |
||
446 |
// --------------------------------------------------------------------------- |
|
447 |
// Static constructor. |
|
448 |
// --------------------------------------------------------------------------- |
|
449 |
// |
|
450 |
CFSEmailUiMailListVisualiser* CFSEmailUiMailListVisualiser::NewLC(CAlfEnv& aEnv, |
|
451 |
CFreestyleEmailUiAppUi* aAppUi, |
|
452 |
CAlfControlGroup& aMailListControlGroup) |
|
453 |
{ |
|
454 |
FUNC_LOG; |
|
455 |
CFSEmailUiMailListVisualiser* self = |
|
456 |
new (ELeave) CFSEmailUiMailListVisualiser( aEnv, aAppUi, aMailListControlGroup ); |
|
457 |
CleanupStack::PushL( self ); |
|
458 |
self->ConstructL(); |
|
459 |
return self; |
|
460 |
} |
|
461 |
||
462 |
// --------------------------------------------------------------------------- |
|
463 |
// Second phase constructor. |
|
464 |
// --------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
void CFSEmailUiMailListVisualiser::ConstructL() |
|
467 |
{ |
|
468 |
FUNC_LOG; |
|
469 |
||
470 |
BaseConstructL( R_FSEMAILUI_MAIL_LIST_VIEW ); |
|
471 |
||
472 |
iMailListModelUpdater = CMailListModelUpdater::NewL(); |
|
473 |
||
474 |
// Don't construct this anywhere else than here. |
|
475 |
// Don't delete this until in the destructor to avoid NULL checks. |
|
476 |
iModel = CFSEmailUiMailListModel::NewL( &iAppUi ); |
|
477 |
||
478 |
// Set list as initial focused control |
|
479 |
iFocusedControl = EMailListComponent; |
|
480 |
iThisViewActive = EFalse; |
|
481 |
iSkinChanged = EFalse; |
|
482 |
||
483 |
iFirstStartCompleted = EFalse; |
|
484 |
||
485 |
iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard ); |
|
486 |
iAsyncRedrawer = new (ELeave) CAsyncCallBack( CActive::EPriorityLow ); |
|
487 |
iLastFocus = EFalse; |
|
488 |
iDeleteTask = new (ELeave) TDeleteTask<CFSEmailUiMailListVisualiser> (*this, HandleDeleteTaskL); |
|
489 |
||
490 |
iNewMailTimer = CFSEmailUiGenericTimer::NewL( this ); |
|
491 |
iSortTimer = CFSEmailUiGenericTimer::NewL( this ); |
|
492 |
iSortState = ESortNone; |
|
493 |
||
494 |
iTouchFeedBack = MTouchFeedback::Instance(); |
|
495 |
} |
|
496 |
||
497 |
// --------------------------------------------------------------------------- |
|
498 |
// Second phase constructor. |
|
499 |
// --------------------------------------------------------------------------- |
|
500 |
// |
|
501 |
// CFSEmailUiMailListVisualiser::DoFirstStartL() |
|
502 |
// Purpose of this function is to do first start things only when list is |
|
503 |
// really needed to be shown. Implemented to make app startuo faster. |
|
504 |
void CFSEmailUiMailListVisualiser::DoFirstStartL() |
|
505 |
{ |
|
506 |
FUNC_LOG; |
|
507 |
// Create mail list updater timer |
|
508 |
iMailListUpdater = CMailListUpdater::NewL( this ); |
|
509 |
||
510 |
// Set initial sort criteria |
|
511 |
iCurrentSortCriteria.iField = EFSMailSortByDate; |
|
512 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
513 |
||
514 |
// Create screen control and anchor layout |
|
515 |
iMailListControl = CFreestyleEmailUiMailListControl::NewL( iEnv, this ); |
|
516 |
iScreenAnchorLayout = CAlfAnchorLayout::AddNewL( *iMailListControl ); |
|
517 |
iScreenAnchorLayout->SetFlags(EAlfVisualFlagAutomaticLocaleMirroringEnabled); |
|
518 |
||
519 |
iTouchManager = CEUiEmailListTouchManager::NewL(*this); |
|
520 |
||
521 |
// Create control bar control and append to control group and anchor layout |
|
522 |
iControlBarControl = CFsControlBar::NewL( iEnv ); |
|
523 |
iControlBarControl->AddObserverL( *this ); |
|
524 |
iControlBarControl->AddObserverL( *iTouchManager ); |
|
525 |
||
526 |
CreateControlBarLayoutL(); |
|
527 |
SetMailListLayoutAnchors(); |
|
528 |
||
529 |
iControlBarControl->SetSelectorTransitionTimeL( KControlBarTransitionTime ); |
|
530 |
iControlBarControl->ClearBackgroundColor(); |
|
531 |
iControlBarLayout = CAlfDeckLayout::AddNewL( *iControlBarControl, iScreenAnchorLayout ); |
|
532 |
iControlBarVisual = iControlBarControl->Visual(); |
|
533 |
||
534 |
// Create list and append to control group and anchor layout |
|
535 |
||
536 |
iListLayout = CAlfDeckLayout::AddNewL( *iMailListControl, iScreenAnchorLayout ); |
|
537 |
iMailTreeListVisualizer = CFsTreeVisualizerBase::NewL(iMailListControl, *iListLayout); |
|
538 |
iMailTreeListVisualizer->SetFlipState( iKeyboardFlipOpen ); |
|
539 |
iMailTreeListVisualizer->SetFocusVisibility( iFocusVisible ); |
|
540 |
iMailList = CFsTreeList::NewL(*iMailTreeListVisualizer, iEnv ); |
|
541 |
||
542 |
// Set mark type and icon |
|
543 |
iMailList->SetMarkTypeL( CFsTreeList::EFsTreeListMultiMarkable ); |
|
544 |
iMailList->SetIndentationL(0); |
|
545 |
||
546 |
ControlGroup().AppendL( iMailListControl ); |
|
547 |
ControlGroup().AppendL( iControlBarControl ); |
|
548 |
ControlGroup().AppendL( iMailList->TreeControl() ); |
|
549 |
||
550 |
iTreeItemArray.Reset(); |
|
551 |
||
552 |
// Set empty text |
|
553 |
HBufC* emptyText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_EMPTY_MSG_LIST_TEXT ); |
|
554 |
iMailTreeListVisualizer->SetEmptyListTextL( *emptyText ); |
|
555 |
CleanupStack::PopAndDestroy( emptyText ); |
|
556 |
||
557 |
iFocusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
558 |
iNormalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
559 |
iNodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
|
560 |
iMailTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( iNormalTextColor ); |
|
561 |
||
562 |
// Set page up and page down keys |
|
563 |
iMailTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp ); |
|
564 |
iMailTreeListVisualizer->AddCustomPageDownKey( EStdKeyPageDown ); |
|
565 |
||
566 |
// Set selector brushes |
|
567 |
CAlfBrush* listSelectorBrush = iAppUi.FsTextureManager()->ListSelectorBrushL(); // not owned |
|
568 |
iMailTreeListVisualizer->SetSelectorPropertiesL( listSelectorBrush, 1.0, CFsTreeVisualizerBase::EFsSelectorMoveSmoothly ); |
|
569 |
||
570 |
CAlfBrush* cbSelectorBrush = iAppUi.FsTextureManager()->NewCtrlBarSelectorBrushLC(); |
|
571 |
iControlBarControl->SetSelectorImageL( cbSelectorBrush ); |
|
572 |
CleanupStack::Pop( cbSelectorBrush ); // ownership transferred to control bar |
|
573 |
||
574 |
iNewEmailText = StringLoader::LoadL( R_COMMAND_AREA_NEW_EMAIL ); |
|
575 |
||
576 |
// Set menu, mark and background icons |
|
577 |
iMailTreeListVisualizer->SetMarkIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMarkIcon ) ); |
|
578 |
iMailTreeListVisualizer->SetMenuIcon( iAppUi.FsTextureManager()->TextureByIndex( EListControlMenuIcon ) ); |
|
579 |
iMailList->AddObserverL( *this ); |
|
580 |
iMailList->AddObserverL( *iTouchManager ); |
|
581 |
// Initializing the default stylus long tap popup menu |
|
582 |
if( !iStylusPopUpMenu ) |
|
583 |
{ |
|
584 |
TPoint point( 0, 0 ); |
|
585 |
iStylusPopUpMenu = CAknStylusPopUpMenu::NewL( this , point ); |
|
586 |
TResourceReader reader; |
|
587 |
iCoeEnv->CreateResourceReaderLC( reader, |
|
588 |
R_STYLUS_POPUP_MENU_MESSAGE_LIST_VIEW ); |
|
589 |
iStylusPopUpMenu->ConstructFromResourceL( reader ); |
|
590 |
CleanupStack::PopAndDestroy(); // reader |
|
591 |
} |
|
592 |
||
593 |
iAppUi.LayoutHandler()->SetListMarqueeBehaviour( iMailList ); |
|
594 |
||
595 |
iDateChangeTimer = CDateChangeTimer::NewL( *this ); |
|
596 |
iDateChangeTimer->Start(); |
|
597 |
||
598 |
UpdateMailListSettingsL(); |
|
599 |
||
600 |
iMailList->SetIndentationL(0); |
|
601 |
iMailList->SetLoopingType( EFsTreeListLoopingDisabled ); |
|
602 |
iMailTreeListVisualizer->SetItemExpansionDelay( iAppUi.LayoutHandler()->ListItemExpansionDelay() ); |
|
603 |
iMailList->SetScrollTime( iAppUi.LayoutHandler()->ListScrollingTime(), 0.5 ); |
|
604 |
||
605 |
iFirstStartCompleted = ETrue; |
|
606 |
} |
|
607 |
||
608 |
||
609 |
// --------------------------------------------------------------------------- |
|
610 |
// Constructor. |
|
611 |
// --------------------------------------------------------------------------- |
|
612 |
// |
|
613 |
CFSEmailUiMailListVisualiser::CFSEmailUiMailListVisualiser( CAlfEnv& aEnv, |
|
614 |
CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aMailListControlGroup ) |
|
615 |
: CFsEmailUiViewBase( aMailListControlGroup, *aAppUi ), |
|
616 |
iEnv( aEnv ), |
|
617 |
iListMarkItemsState( ETrue ), //Initlly list has no markings |
|
618 |
iMoveToFolderOngoing( EFalse ), |
|
619 |
iConsumeStdKeyYes_KeyUp( EFalse ), // use to prevent Call application execution if call for contact processed |
|
620 |
iMailOpened( EFalse ), |
|
621 |
iMarkingMode( EFalse ), |
|
622 |
iMarkingModeWaitingToExit( EFalse ), |
|
623 |
iMarkingModeTextVisual( NULL ) |
|
624 |
{ |
|
625 |
FUNC_LOG; |
|
626 |
} |
|
627 |
||
628 |
// --------------------------------------------------------------------------- |
|
629 |
// Destructor. |
|
630 |
// --------------------------------------------------------------------------- |
|
631 |
// |
|
632 |
CFSEmailUiMailListVisualiser::~CFSEmailUiMailListVisualiser() |
|
633 |
{ |
|
634 |
FUNC_LOG; |
|
635 |
/* |
|
636 |
if (iExtension) |
|
637 |
{ |
|
638 |
iAppUi.GetMailClient()->ReleaseExtension(iExtension); |
|
639 |
} |
|
640 |
*/ |
|
641 |
SafeDelete(iMailListModelUpdater); |
|
642 |
SafeDelete(iMailFolder); |
|
643 |
delete iTouchManager; |
|
644 |
delete iStylusPopUpMenu; |
|
645 |
delete iMailList; |
|
646 |
delete iNewEmailText; |
|
647 |
||
648 |
// Don't construct this anywhere else than in constructor. |
|
649 |
// Don't delete anywhere else thatn here to avoid NULL checks. |
|
650 |
delete iModel; |
|
651 |
||
652 |
delete iDeleteTask; |
|
653 |
DeleteSortWaitNote(); |
|
654 |
delete iNewMailTimer; |
|
655 |
delete iSortTimer; |
|
656 |
iNewMailIds.Close(); |
|
657 |
} |
|
658 |
||
659 |
void CFSEmailUiMailListVisualiser::PrepareForExit() |
|
660 |
{ |
|
661 |
FUNC_LOG; |
|
662 |
iMailListModelUpdater->Cancel(); |
|
663 |
if ( iMsgNoteTimer ) |
|
664 |
{ |
|
665 |
// delete also cancels timer |
|
666 |
SafeDelete(iMsgNoteTimer); |
|
667 |
} |
|
668 |
if ( iDateChangeTimer ) |
|
669 |
{ |
|
670 |
// delete also cancels timer |
|
671 |
SafeDelete(iDateChangeTimer); |
|
672 |
} |
|
673 |
if ( iMailListUpdater ) |
|
674 |
{ |
|
675 |
// delete also cancels timer |
|
676 |
SafeDelete(iMailListUpdater); |
|
677 |
} |
|
678 |
if ( iAsyncRedrawer ) |
|
679 |
{ |
|
680 |
SafeDelete(iAsyncRedrawer); |
|
681 |
} |
|
682 |
if ( iAsyncCallback ) |
|
683 |
{ |
|
684 |
SafeDelete(iAsyncCallback); |
|
685 |
} |
|
686 |
if ( iMailList ) |
|
687 |
{ |
|
688 |
iMailList->RemoveObserver( *this ); |
|
689 |
} |
|
690 |
if ( iControlBarControl ) |
|
691 |
{ |
|
692 |
iControlBarControl->RemoveObserver( *this ); |
|
693 |
} |
|
694 |
||
695 |
if ( iNewMailTimer ) |
|
696 |
{ |
|
697 |
// delete also cancels timer |
|
698 |
SafeDelete( iNewMailTimer ); |
|
699 |
} |
|
700 |
||
701 |
if ( iSortTimer ) |
|
702 |
{ |
|
703 |
// delete also cancels timer |
|
704 |
SafeDelete( iSortTimer ); |
|
705 |
} |
|
706 |
||
707 |
SafeDelete(iMailFolder); |
|
708 |
iTreeItemArray.Reset(); |
|
709 |
// Reset, not delete to avoid NULL checks. |
|
710 |
iModel->Reset(); |
|
711 |
// Resources freed, new start required |
|
712 |
iFirstStartCompleted = EFalse; |
|
713 |
} |
|
714 |
||
715 |
// --------------------------------------------------------------------------- |
|
716 |
// Returns reference to mail list. |
|
717 |
// --------------------------------------------------------------------------- |
|
718 |
// |
|
719 |
CFsTreeList& CFSEmailUiMailListVisualiser::GetMailList() |
|
720 |
{ |
|
721 |
FUNC_LOG; |
|
722 |
return *iMailList; |
|
723 |
} |
|
724 |
||
725 |
// --------------------------------------------------------------------------- |
|
726 |
// @see CMailListModelUpdater::MObserver::UpdateErrorL |
|
727 |
// --------------------------------------------------------------------------- |
|
728 |
// |
|
729 |
void CFSEmailUiMailListVisualiser::UpdateErrorL(TInt aError) |
|
730 |
{ |
|
731 |
FUNC_LOG; |
|
732 |
||
733 |
DeleteSortWaitNote(); |
|
734 |
User::Leave(aError); |
|
735 |
} |
|
736 |
||
737 |
// --------------------------------------------------------------------------- |
|
738 |
// @see CMailListModelUpdater::MObserver::UpdateBeginL |
|
739 |
// --------------------------------------------------------------------------- |
|
740 |
// |
|
741 |
void CFSEmailUiMailListVisualiser::UpdateBeginL() |
|
742 |
{ |
|
743 |
FUNC_LOG; |
|
744 |
iMailList->BeginUpdate(); |
|
745 |
iMailList->RemoveAllL(); |
|
746 |
iTreeItemArray.Reset(); |
|
747 |
iModel->Reset(); |
|
748 |
iMailList->EndUpdateL(); |
|
749 |
||
750 |
SetListAndCtrlBarFocusL(); |
|
751 |
} |
|
752 |
||
753 |
// --------------------------------------------------------------------------- |
|
754 |
// @see CMailListModelUpdater::MObserver::UpdateProgressL |
|
755 |
// --------------------------------------------------------------------------- |
|
756 |
// |
|
757 |
void CFSEmailUiMailListVisualiser::UpdateProgressL(TFsTreeItemId& aParentId, RPointerArray<CFSMailMessage>& aMessages) |
|
758 |
{ |
|
759 |
FUNC_LOG; |
|
760 |
||
761 |
const TInt itemsInModel(iModel->Count()); |
|
762 |
CreateModelItemsL(aMessages); |
|
763 |
RefreshListItemsL(aParentId, itemsInModel, iModel->Count()); |
|
764 |
} |
|
765 |
||
766 |
// --------------------------------------------------------------------------- |
|
767 |
// @see CMailListModelUpdater::MObserver::UpdateCompleteL |
|
768 |
// --------------------------------------------------------------------------- |
|
769 |
// |
|
770 |
void CFSEmailUiMailListVisualiser::UpdateCompleteL() |
|
771 |
{ |
|
772 |
FUNC_LOG; |
|
773 |
TBool sorting = EFalse; |
|
774 |
if ( iSortWaitNote ) |
|
775 |
{ |
|
776 |
sorting = ETrue; |
|
777 |
} |
|
778 |
DeleteSortWaitNote(); |
|
779 |
||
780 |
if ( !iModel->Count() ) |
|
781 |
{ |
|
782 |
iFocusedControl = EControlBarComponent; |
|
783 |
} |
|
784 |
else |
|
785 |
{ |
|
786 |
iFocusedControl = EMailListComponent; |
|
787 |
if (iMailList->FocusedItem() == KFsTreeNoneID) |
|
788 |
{ |
|
789 |
iMailList->SetFocusedItemL( iTreeItemArray[0].iListItemId ); |
|
790 |
} |
|
791 |
} |
|
792 |
SetListAndCtrlBarFocusL(); |
|
793 |
||
794 |
if( !CheckAutoSyncSettingL() && !sorting ) |
|
795 |
{ |
|
796 |
iAppUi.StartMonitoringL(); |
|
797 |
} |
|
798 |
||
799 |
TIMESTAMP( "Locally stored messages fetched for message list" ); |
|
800 |
} |
|
801 |
||
802 |
// --------------------------------------------------------------------------- |
|
803 |
// @see CMailListModelUpdater::MObserver::UpdateCancelled |
|
804 |
// --------------------------------------------------------------------------- |
|
805 |
// |
|
806 |
void CFSEmailUiMailListVisualiser::UpdateCancelled(const TBool aForceRefresh) |
|
807 |
{ |
|
808 |
FUNC_LOG; |
|
809 |
||
810 |
iForceRefresh = aForceRefresh; |
|
811 |
DeleteSortWaitNote(); |
|
812 |
} |
|
813 |
||
814 |
// --------------------------------------------------------------------------- |
|
815 |
// CFSEmailUiMailListVisualiser::DeleteSortWaitNote |
|
816 |
// --------------------------------------------------------------------------- |
|
817 |
// |
|
818 |
void CFSEmailUiMailListVisualiser::DeleteSortWaitNote() |
|
819 |
{ |
|
820 |
if ( iSortWaitNote ) |
|
821 |
{ |
|
822 |
TRAP_IGNORE( iSortWaitNote->ProcessFinishedL() ); |
|
823 |
iSortWaitNote = NULL; |
|
824 |
} |
|
825 |
} |
|
826 |
||
827 |
||
828 |
// --------------------------------------------------------------------------- |
|
829 |
// Asynchronous mail list model sort. |
|
830 |
// --------------------------------------------------------------------------- |
|
831 |
// |
|
832 |
void CFSEmailUiMailListVisualiser::SortMailListModelAsyncL() |
|
833 |
{ |
|
834 |
FUNC_LOG; |
|
835 |
||
836 |
DeleteSortWaitNote(); |
|
837 |
||
838 |
TBool ret = UpdateMailListModelAsyncL( KCMsgBlockSort ); |
|
839 |
if ( ret ) |
|
840 |
{ |
|
841 |
TFsEmailUiUtility::ShowWaitNoteL( iSortWaitNote, R_FSE_WAIT_SORTING_TEXT, EFalse, ETrue ); |
|
842 |
} |
|
843 |
} |
|
844 |
||
845 |
// --------------------------------------------------------------------------- |
|
846 |
// Asynchronous mail list model update. |
|
847 |
// --------------------------------------------------------------------------- |
|
848 |
// |
|
849 |
TBool CFSEmailUiMailListVisualiser::UpdateMailListModelAsyncL(TInt aBlockSize) |
|
850 |
{ |
|
851 |
FUNC_LOG; |
|
852 |
TBool ret = EFalse; |
|
853 |
if ( iMailFolder ) |
|
854 |
{ |
|
855 |
TFSMailDetails details( EFSMsgDataEnvelope ); |
|
856 |
RArray<TFSMailSortCriteria>& sorting(iMailListModelUpdater->Sorting()); |
|
857 |
sorting.AppendL( iCurrentSortCriteria ); |
|
858 |
if ( iCurrentSortCriteria.iField != EFSMailSortByDate ) |
|
859 |
{ |
|
860 |
// Add date+descending as secondary sort criteria if primary field is something else than date |
|
861 |
TFSMailSortCriteria secondarySortCriteria; |
|
862 |
secondarySortCriteria.iField = EFSMailSortByDate; |
|
863 |
secondarySortCriteria.iOrder = EFSMailDescending; |
|
864 |
sorting.AppendL( secondarySortCriteria ); |
|
865 |
} |
|
866 |
// List all or maximum number of messages |
|
867 |
iMailListModelUpdater->UpdateModelL(*this, iMailFolder->ListMessagesL(details, sorting), aBlockSize); |
|
868 |
ret = ETrue; |
|
869 |
} |
|
870 |
else |
|
871 |
{ |
|
872 |
UpdateCompleteL(); |
|
873 |
} |
|
874 |
||
875 |
return ret; |
|
876 |
} |
|
877 |
||
878 |
// --------------------------------------------------------------------------- |
|
879 |
// |
|
880 |
// |
|
881 |
// --------------------------------------------------------------------------- |
|
882 |
// |
|
883 |
void CFSEmailUiMailListVisualiser::UpdateMailListModelL() |
|
884 |
{ |
|
885 |
FUNC_LOG; |
|
886 |
// Make sure asynchronous update is not going on |
|
887 |
iMailListModelUpdater->Cancel(); |
|
888 |
// Reset model with each update |
|
889 |
iModel->Reset(); |
|
890 |
if ( iMailFolder ) |
|
891 |
{ |
|
892 |
// Update folder if provided, otherwise use current folder |
|
893 |
RPointerArray<CFSMailMessage> folderMessages( KCMsgBlock ); |
|
894 |
CleanupClosePushL( folderMessages ); |
|
895 |
||
896 |
RPointerArray<CFSMailMessage> tempFolderMessages( KCMsgBlock ); |
|
897 |
CleanupClosePushL( tempFolderMessages ); |
|
898 |
||
899 |
TFSMailDetails details( EFSMsgDataEnvelope ); |
|
900 |
RArray<TFSMailSortCriteria> sorting; |
|
901 |
CleanupClosePushL( sorting ); |
|
902 |
sorting.Append( iCurrentSortCriteria ); |
|
903 |
if ( iCurrentSortCriteria.iField != EFSMailSortByDate ) |
|
904 |
{ |
|
905 |
// Add date+descending as secondary sort criteria if primary field is something else than date |
|
906 |
TFSMailSortCriteria secondarySortCriteria; |
|
907 |
secondarySortCriteria.iField = EFSMailSortByDate; |
|
908 |
secondarySortCriteria.iOrder = EFSMailDescending; |
|
909 |
sorting.Append( secondarySortCriteria ); |
|
910 |
} |
|
911 |
||
912 |
// List all or maximum number of messages |
|
913 |
MFSMailIterator* iterator = iMailFolder->ListMessagesL( details, sorting ); |
|
914 |
CleanupDeletePushL( iterator ); // standard CleanupStack::PushL does not work with non-C-class pointer |
|
915 |
||
916 |
// Use iterator to get messages in peaces of KCMsgBlock to avoid OOM in FSStore |
|
917 |
TFSMailMsgId dummy; |
|
918 |
TBool moreMessagesToFollow = iterator->NextL( dummy, KCMsgBlock, folderMessages ); |
|
919 |
for ( TInt i = KCMsgBlock; i < KMaxItemsFethed && moreMessagesToFollow ; i += KCMsgBlock ) |
|
920 |
{ |
|
921 |
tempFolderMessages.Reset(); |
|
922 |
moreMessagesToFollow = iterator->NextL( folderMessages[i-1]->GetMessageId(), KCMsgBlock, tempFolderMessages ); |
|
923 |
for ( TInt a=0 ; a<tempFolderMessages.Count() ; a++) |
|
924 |
{ |
|
925 |
folderMessages.Append(tempFolderMessages[a]); |
|
926 |
} |
|
927 |
} |
|
928 |
||
929 |
CleanupStack::PopAndDestroy( iterator ); |
|
930 |
CleanupStack::PopAndDestroy( &sorting ); |
|
931 |
||
932 |
// Update mail list model based on sorting criteria |
|
933 |
CreateModelItemsL( folderMessages ); |
|
934 |
||
935 |
CleanupStack::PopAndDestroy( &tempFolderMessages ); |
|
936 |
CleanupStack::PopAndDestroy( &folderMessages ); |
|
937 |
} |
|
938 |
} |
|
939 |
||
940 |
||
941 |
// --------------------------------------------------------------------------- |
|
942 |
// CreateModelItemsL |
|
943 |
// This function creates model items for the given messages and appends them |
|
944 |
// to the model. Also title divider items are created when necessary. |
|
945 |
// --------------------------------------------------------------------------- |
|
946 |
// |
|
947 |
void CFSEmailUiMailListVisualiser::CreateModelItemsL( RPointerArray<CFSMailMessage>& aMessages ) |
|
948 |
{ |
|
949 |
FUNC_LOG; |
|
950 |
// New Items |
|
951 |
CFSEmailUiMailListModelItem* newItem(NULL); |
|
952 |
||
953 |
// Draw first separator if there are messages. |
|
954 |
if ( aMessages.Count() && iNodesInUse == EListControlSeparatorEnabled ) |
|
955 |
{ |
|
956 |
if (iModel->Count()) |
|
957 |
{ |
|
958 |
CFSMailMessage* nextMessage = aMessages[0]; |
|
959 |
CFSEmailUiMailListModelItem* previousMessage(static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(iModel->Count() - 1))); |
|
960 |
if ( previousMessage ) // Safety |
|
961 |
{ |
|
962 |
TBool needANewDivider = |
|
963 |
!MessagesBelongUnderSameSeparatorL( previousMessage->MessagePtr(), *nextMessage ); |
|
964 |
if ( needANewDivider ) |
|
965 |
{ |
|
966 |
newItem = CreateSeparatorModelItemLC( *nextMessage ); |
|
967 |
iModel->AppendL( newItem ); |
|
968 |
CleanupStack::Pop( newItem ); |
|
969 |
} |
|
970 |
} |
|
971 |
} |
|
972 |
else |
|
973 |
{ |
|
974 |
newItem = CreateSeparatorModelItemLC( *aMessages[0] ); |
|
975 |
iModel->AppendL( newItem ); |
|
976 |
CleanupStack::Pop( newItem ); |
|
977 |
} |
|
978 |
} |
|
979 |
||
980 |
// Start appending items |
|
981 |
for (int i = 0; i < aMessages.Count(); i++) |
|
982 |
{ |
|
983 |
CFSMailMessage* curMessage = aMessages[i]; |
|
984 |
if ( curMessage ) |
|
985 |
{ |
|
986 |
newItem = CFSEmailUiMailListModelItem::NewL( curMessage, ETypeMailItem ); |
|
987 |
CleanupStack::PushL( newItem ); |
|
988 |
iModel->AppendL( newItem ); |
|
989 |
CleanupStack::Pop( newItem ); |
|
990 |
||
991 |
// Append new separator if needed |
|
992 |
if ( i != aMessages.Count()-1 && iNodesInUse == EListControlSeparatorEnabled ) |
|
993 |
{ |
|
994 |
CFSMailMessage* nextMessage = aMessages[i+1]; // This msg is next in the list |
|
995 |
||
996 |
if ( nextMessage ) |
|
997 |
{ |
|
998 |
TBool needANewDivider = |
|
999 |
!MessagesBelongUnderSameSeparatorL( *curMessage, *nextMessage ); |
|
1000 |
if ( needANewDivider ) |
|
1001 |
{ |
|
1002 |
newItem = CreateSeparatorModelItemLC( *nextMessage ); |
|
1003 |
iModel->AppendL( newItem ); |
|
1004 |
CleanupStack::Pop( newItem ); |
|
1005 |
} |
|
1006 |
} |
|
1007 |
} |
|
1008 |
} |
|
1009 |
} |
|
1010 |
} |
|
1011 |
||
1012 |
// --------------------------------------------------------------------------- |
|
1013 |
// CreateSeparatorModelItemLC |
|
1014 |
// Create separator model item for the given message. Separator text depends |
|
1015 |
// on active sorting mode. |
|
1016 |
// --------------------------------------------------------------------------- |
|
1017 |
// |
|
1018 |
CFSEmailUiMailListModelItem* CFSEmailUiMailListVisualiser::CreateSeparatorModelItemLC( CFSMailMessage& aMessage ) const |
|
1019 |
{ |
|
1020 |
FUNC_LOG; |
|
1021 |
CFSEmailUiMailListModelItem* separator = |
|
1022 |
CFSEmailUiMailListModelItem::NewL( &aMessage, ETypeSeparator ); |
|
1023 |
CleanupStack::PushL( separator ); |
|
1024 |
||
1025 |
HBufC* separatorText = NULL; |
|
1026 |
||
1027 |
switch ( iCurrentSortCriteria.iField ) |
|
1028 |
{ |
|
1029 |
case EFSMailSortByFlagStatus: |
|
1030 |
{ |
|
1031 |
if ( aMessage.IsFlagSet( EFSMsgFlag_FollowUp ) ) |
|
1032 |
{ |
|
1033 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_FOLLOW_UP ); |
|
1034 |
} |
|
1035 |
else if ( aMessage.IsFlagSet( EFSMsgFlag_FollowUpComplete ) ) |
|
1036 |
{ |
|
1037 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_FLAG_COMPLETE ); |
|
1038 |
} |
|
1039 |
else |
|
1040 |
{ |
|
1041 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_NO_FLAG ); |
|
1042 |
} |
|
1043 |
} |
|
1044 |
break; |
|
1045 |
case EFSMailSortByPriority: |
|
1046 |
{ |
|
1047 |
if ( aMessage.IsFlagSet( EFSMsgFlag_Important ) ) |
|
1048 |
{ |
|
1049 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_PRIO_HIGH ); |
|
1050 |
} |
|
1051 |
else if ( aMessage.IsFlagSet( EFSMsgFlag_Low ) ) |
|
1052 |
{ |
|
1053 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_PRIO_LOW ); |
|
1054 |
} |
|
1055 |
else |
|
1056 |
{ |
|
1057 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_PRIO_NORMAL ); |
|
1058 |
} |
|
1059 |
} |
|
1060 |
break; |
|
1061 |
case EFSMailSortByRecipient: |
|
1062 |
case EFSMailSortBySender: |
|
1063 |
{ |
|
1064 |
TInt folderType(EFSInbox); |
|
1065 |
if( iMailFolder ) |
|
1066 |
{ |
|
1067 |
folderType = iMailFolder->GetFolderType(); |
|
1068 |
} |
|
1069 |
TBool useRecipient = ( folderType == EFSSentFolder || |
|
1070 |
folderType == EFSDraftsFolder || |
|
1071 |
folderType == EFSOutbox ); |
|
1072 |
||
1073 |
CFSMailAddress* fromAddress(0); |
|
1074 |
// Check address based on whether we are using recipient or sender sort |
|
1075 |
if ( useRecipient ) |
|
1076 |
{ |
|
1077 |
RPointerArray<CFSMailAddress>& toArray = aMessage.GetToRecipients(); |
|
1078 |
if ( toArray.Count() ) |
|
1079 |
{ |
|
1080 |
fromAddress = toArray[0]; |
|
1081 |
} |
|
1082 |
} |
|
1083 |
else |
|
1084 |
{ |
|
1085 |
fromAddress = aMessage.GetSender(); |
|
1086 |
} |
|
1087 |
TDesC* diplayName(0); |
|
1088 |
if ( fromAddress ) |
|
1089 |
{ |
|
1090 |
diplayName = &fromAddress->GetDisplayName(); |
|
1091 |
} |
|
1092 |
||
1093 |
if ( fromAddress && diplayName && diplayName->Length() != 0 ) |
|
1094 |
{ |
|
1095 |
separatorText = diplayName->AllocLC(); |
|
1096 |
} |
|
1097 |
else if ( fromAddress && fromAddress->GetEmailAddress().Length() != 0 ) |
|
1098 |
{ |
|
1099 |
separatorText = fromAddress->GetEmailAddress().AllocLC(); |
|
1100 |
} |
|
1101 |
else |
|
1102 |
{ |
|
1103 |
if ( useRecipient ) |
|
1104 |
{ |
|
1105 |
separatorText = KNullDesC().AllocLC(); |
|
1106 |
} |
|
1107 |
else |
|
1108 |
{ |
|
1109 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE ); |
|
1110 |
} |
|
1111 |
} |
|
1112 |
// Get rid of possible unwanted characters in display name |
|
1113 |
if ( separatorText ) |
|
1114 |
{ |
|
1115 |
TFsEmailUiUtility::StripDisplayName( *separatorText ); |
|
1116 |
} |
|
1117 |
} |
|
1118 |
break; |
|
1119 |
case EFSMailSortByAttachment: |
|
1120 |
{ |
|
1121 |
if ( aMessage.IsFlagSet( EFSMsgFlag_Attachments ) ) |
|
1122 |
{ |
|
1123 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_ATTACHMENTS ); |
|
1124 |
} |
|
1125 |
else |
|
1126 |
{ |
|
1127 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_NO_ATTACHMENTS ); |
|
1128 |
} |
|
1129 |
} |
|
1130 |
break; |
|
1131 |
case EFSMailSortByUnread: |
|
1132 |
{ |
|
1133 |
if ( aMessage.IsFlagSet( EFSMsgFlag_Read ) ) |
|
1134 |
{ |
|
1135 |
separatorText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SEPARATOR_READ_MSGS ); |
|
1136 |
} |
|
1137 |
else |
|
1138 |
{ |
|
1139 |
separatorText = StringLoader::LoadLC(R_FREESTYLE_EMAIL_UI_SEPARATOR_UNREAD_MSGS); |
|
1140 |
} |
|
1141 |
} |
|
1142 |
break; |
|
1143 |
case EFSMailSortBySubject: |
|
1144 |
{ |
|
1145 |
separatorText = TFsEmailUiUtility::CreateSubjectWithoutLocalisedPrefixLC( &aMessage ); |
|
1146 |
} |
|
1147 |
break; |
|
1148 |
case EFSMailSortByDate: |
|
1149 |
{ |
|
1150 |
TBool eventToday = EFalse; |
|
1151 |
TBool eventYesterday = EFalse; |
|
1152 |
HBufC* weekDay = TFsEmailUiUtility::WeekDayTextFromMsgLC( &aMessage, ETrue, EFalse, eventToday, eventYesterday ); |
|
1153 |
if ( eventToday || eventYesterday ) |
|
1154 |
{ |
|
1155 |
separatorText = weekDay; |
|
1156 |
} |
|
1157 |
else |
|
1158 |
{ |
|
1159 |
HBufC* dateTextFromMsg = TFsEmailUiUtility::DateTextFromMsgLC( &aMessage ); |
|
1160 |
separatorText = HBufC::NewL( weekDay->Length() + |
|
1161 |
KSpace().Length() + |
|
1162 |
dateTextFromMsg->Length() ); |
|
1163 |
separatorText->Des().Append( *weekDay ); |
|
1164 |
separatorText->Des().Append( KSpace ); |
|
1165 |
separatorText->Des().Append( *dateTextFromMsg ); |
|
1166 |
CleanupStack::PopAndDestroy( dateTextFromMsg ); |
|
1167 |
CleanupStack::PopAndDestroy( weekDay ); |
|
1168 |
CleanupStack::PushL( separatorText ); |
|
1169 |
} |
|
1170 |
} |
|
1171 |
break; |
|
1172 |
default: |
|
1173 |
{ |
|
1174 |
separatorText = KNullDesC().AllocLC(); |
|
1175 |
} |
|
1176 |
break; |
|
1177 |
} |
|
1178 |
||
1179 |
separator->SetSeparatorTextL( *separatorText ); |
|
1180 |
CleanupStack::PopAndDestroy( separatorText ); |
|
1181 |
||
1182 |
return separator; |
|
1183 |
} |
|
1184 |
||
1185 |
// --------------------------------------------------------------------------- |
|
1186 |
// MessagesBelongUnderSameSeparatorL |
|
1187 |
// Checks if the given messages belong under the same title divider. This |
|
1188 |
// depends on the currect sorting mode. |
|
1189 |
// --------------------------------------------------------------------------- |
|
1190 |
// |
|
1191 |
TBool CFSEmailUiMailListVisualiser::MessagesBelongUnderSameSeparatorL( |
|
1192 |
const CFSMailMessage& aMessage1, |
|
1193 |
const CFSMailMessage& aMessage2 ) const |
|
1194 |
{ |
|
1195 |
FUNC_LOG; |
|
1196 |
return CFSEmailUiMailListModel::MessagesBelongUnderSameSeparatorL( aMessage1, |
|
1197 |
aMessage2, |
|
1198 |
iCurrentSortCriteria.iField ); |
|
1199 |
} |
|
1200 |
||
1201 |
// --------------------------------------------------------------------------- |
|
1202 |
// InsertNewMessagesL |
|
1203 |
// Gets new message items from the framework using the given IDs and inserts |
|
1204 |
// them in the correct place within the mail list. Both model and tree list |
|
1205 |
// are updated during this function. |
|
1206 |
// --------------------------------------------------------------------------- |
|
1207 |
// |
|
1208 |
void CFSEmailUiMailListVisualiser::InsertNewMessagesL( const RArray<TFSMailMsgId>& aMessages ) |
|
1209 |
{ |
|
1210 |
FUNC_LOG; |
|
1211 |
iModel->SetSortCriteria( iCurrentSortCriteria ); |
|
1212 |
||
1213 |
// Do complete refresh in case the list is not currently correctly ordered |
|
1214 |
// (alternatively, we could first reorder the existing items and then insert |
|
1215 |
// the new ones) |
|
1216 |
if ( iListOrderMayBeOutOfDate ) |
|
1217 |
{ |
|
1218 |
if ( iMailListUpdater ) |
|
1219 |
{ |
|
1220 |
if ( iMailListUpdater->IsActive() ) |
|
1221 |
{ |
|
1222 |
iMailListUpdater->Stop(); |
|
1223 |
} |
|
1224 |
iMailListUpdater->StartL(); |
|
1225 |
} |
|
1226 |
} |
|
1227 |
// Otherwise, just add the new items to correct places. |
|
1228 |
else |
|
1229 |
{ |
|
1230 |
// Set extended status before inserting messages |
|
1231 |
SetMailListItemsExtendedL(); |
|
1232 |
TInt count(0); |
|
1233 |
count = aMessages.Count(); |
|
1234 |
||
1235 |
for ( TInt i = 0 ; i < count ; ++i ) |
|
1236 |
{ |
|
1237 |
// Make sure we don't add duplicate items. |
|
1238 |
TInt existingIdx = ItemIndexFromMessageId( aMessages[i] ); |
|
1239 |
if ( existingIdx < 0 ) |
|
1240 |
{ |
|
1241 |
iNewMailIds.Append( aMessages[ i ] ); |
|
1242 |
} |
|
1243 |
} |
|
1244 |
||
1245 |
// start timer only when all conditions are met: |
|
1246 |
// timer isn`t already active |
|
1247 |
// there are new mails in the array |
|
1248 |
// timer event isn`t processing |
|
1249 |
// sorting timer isn't running |
|
1250 |
if ( !iNewMailTimer->IsActive() && iNewMailIds.Count() && |
|
1251 |
iNewMailTimer->iStatus != KErrInUse && iSortState == ESortNone ) |
|
1252 |
{ |
|
1253 |
iNewMailTimer->Start( KNewMailTimerDelay ); |
|
1254 |
} |
|
1255 |
} |
|
1256 |
} |
|
1257 |
||
1258 |
||
1259 |
// --------------------------------------------------------------------------- |
|
1260 |
// TimerEventL |
|
1261 |
// |
|
1262 |
// --------------------------------------------------------------------------- |
|
1263 |
// |
|
1264 |
void CFSEmailUiMailListVisualiser::TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer ) |
|
1265 |
{ |
|
1266 |
||
1267 |
if( aTriggeredTimer == iSortTimer ) |
|
1268 |
{ |
|
1269 |
switch ( iSortState ) |
|
1270 |
{ |
|
1271 |
case ESortNone: |
|
1272 |
{ |
|
1273 |
iSortTryCount = 0; |
|
1274 |
iSortState = ESortRequested; |
|
1275 |
break; |
|
1276 |
} |
|
1277 |
case ESortRequested: |
|
1278 |
{ |
|
1279 |
if( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse ) |
|
1280 |
{ |
|
1281 |
// Size sorting does not use nodes, so disable those, otherwise check from CR |
|
1282 |
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1283 |
SetSortButtonIconL(); |
25 | 1284 |
|
1285 |
iFocusedControl = EControlBarComponent; |
|
1286 |
iMailList->SetFocusedL( EFalse ); |
|
1287 |
iControlBarControl->SetFocusByIdL( iSortButtonId ); |
|
1288 |
||
1289 |
SortMailListModelAsyncL(); // sort can take long time |
|
1290 |
SetMskL(); |
|
1291 |
iSortState = ESortStarted; |
|
1292 |
} |
|
1293 |
else |
|
1294 |
{ |
|
1295 |
iSortTryCount = 0; |
|
1296 |
iSortState = ESortPostponed; |
|
1297 |
iNewMailTimer->Stop(); // stop mail timer |
|
1298 |
} |
|
1299 |
break; |
|
1300 |
} |
|
1301 |
case ESortPostponed: |
|
1302 |
{ |
|
1303 |
if ( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse ) |
|
1304 |
{ |
|
1305 |
iSortState = ESortRequested; // start request again |
|
1306 |
} |
|
1307 |
else |
|
1308 |
{ |
|
1309 |
iSortTryCount++; |
|
1310 |
} |
|
1311 |
if( iSortTryCount >= KSortCountdown )// repeat a few times |
|
1312 |
{ |
|
1313 |
iSortTryCount = 0; // reset |
|
1314 |
iSortState = ESortStartError; // can't start sorting some error |
|
1315 |
} |
|
1316 |
break; |
|
1317 |
} |
|
1318 |
case ESortStarted: |
|
1319 |
{ |
|
1320 |
if ( !iSortWaitNote )// it will restart the timer elsewhere (see below) |
|
1321 |
{ |
|
1322 |
iSortState = ESortCompleted; |
|
1323 |
} |
|
1324 |
break; |
|
1325 |
} |
|
1326 |
case ESortStartError: |
|
1327 |
case ESortCompleted: |
|
1328 |
{ |
|
1329 |
if( !iNewMailTimer->IsActive() ) |
|
1330 |
{ |
|
1331 |
// refresh the whole mail list if list was sorted |
|
1332 |
if(iSortState != ESortStartError ) |
|
1333 |
{ |
|
1334 |
RefreshL(); |
|
1335 |
} |
|
1336 |
// stop sorting process |
|
1337 |
iSortState = ESortNone; |
|
1338 |
iSortTimer->Stop(); |
|
1339 |
// restart if more messages available |
|
1340 |
if ( iNewMailIds.Count() ) |
|
1341 |
{ |
|
1342 |
iNewMailTimer->Start( KNewMailTimerDelay ); |
|
1343 |
} |
|
1344 |
return; |
|
1345 |
} |
|
1346 |
iNewMailTimer->Stop(); |
|
1347 |
break; |
|
1348 |
} |
|
1349 |
default : |
|
1350 |
{ |
|
1351 |
// do nothing |
|
1352 |
} |
|
1353 |
} |
|
1354 |
// start timer again |
|
1355 |
if ( !iSortTimer->IsActive() ) |
|
1356 |
{ |
|
1357 |
iSortTimer->Start( KSortTimerDelay ); |
|
1358 |
} |
|
1359 |
} |
|
1360 |
||
1361 |
if( aTriggeredTimer == iNewMailTimer ) |
|
1362 |
{ |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1363 |
if ( ! iThisViewActive ) // don't proceed if view is not active |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1364 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1365 |
iNewMailTimer->Stop(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1366 |
return; |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1367 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1368 |
|
25 | 1369 |
TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() ); |
1370 |
CFSMailClient* mailClient = iAppUi.GetMailClient(); |
|
1371 |
||
1372 |
// Enter critical section |
|
1373 |
// Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait |
|
1374 |
// to ensure that only one TimerEventL method is processed at time |
|
1375 |
// CFSEmailUiGenericTimer`s iStatus will be used as mutex |
|
1376 |
iNewMailTimer->iStatus = KErrInUse; |
|
1377 |
iModel->SetSortCriteria(iCurrentSortCriteria); |
|
1378 |
||
1379 |
for ( TInt i = 0; i < count; i++ ) |
|
1380 |
{ |
|
1381 |
// stop synchronization if mail list is being sorted |
|
1382 |
if( iSortState != ESortNone || iSortWaitNote ) |
|
1383 |
{ |
|
1384 |
iNewMailTimer->iStatus = KErrNone; |
|
1385 |
iNewMailTimer->Stop(); |
|
1386 |
return; // leave method |
|
1387 |
} |
|
1388 |
||
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1389 |
CFSMailMessage* msgPtr(NULL); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1390 |
TRAPD( err, msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
25 | 1391 |
iMailFolder->GetFolderId(), |
1392 |
iNewMailIds[ 0 ], |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1393 |
EFSMsgDataEnvelope ) ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1394 |
if ( KErrNone != err ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1395 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1396 |
iNewMailTimer->iStatus = KErrNone; |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1397 |
User::Leave(err); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1398 |
} |
25 | 1399 |
if ( msgPtr != NULL ) |
1400 |
{ |
|
1401 |
__ASSERT_DEBUG( FolderId() == msgPtr->GetFolderId(), User::Invariant() ); |
|
1402 |
CleanupStack::PushL( msgPtr ); |
|
1403 |
//first item - show scrollbar |
|
1404 |
//last item - update scrollbar |
|
1405 |
TBool allowRefresh = ( i == 0 || i == count - 1 ); |
|
1406 |
InsertNewMessageL( msgPtr, allowRefresh ); |
|
1407 |
CleanupStack::Pop( msgPtr ); // ownership transferred to model |
|
1408 |
} |
|
1409 |
// pop processed id from the queue, this is single thread operation |
|
1410 |
iNewMailIds.Remove( 0 ); |
|
1411 |
} |
|
1412 |
||
1413 |
// End critical section |
|
1414 |
iNewMailTimer->iStatus = KErrNone; |
|
1415 |
||
1416 |
// if timer stoped then restart if more messages available |
|
1417 |
if ( iNewMailIds.Count() && ! iNewMailTimer->IsActive() && iSortState == ESortNone ) |
|
1418 |
{ |
|
1419 |
iNewMailTimer->Start( KNewMailTimerDelay ); |
|
1420 |
} |
|
1421 |
}//iNewMailTimer |
|
1422 |
} |
|
1423 |
||
1424 |
// --------------------------------------------------------------------------- |
|
1425 |
// InsertNewMessageL |
|
1426 |
// Creates a single new message item to the model and tree list from the given |
|
1427 |
// message pointer. Ownership of the message is transferred. Also new |
|
1428 |
// separator item is created if necessary. |
|
1429 |
// --------------------------------------------------------------------------- |
|
1430 |
// |
|
1431 |
void CFSEmailUiMailListVisualiser::InsertNewMessageL( CFSMailMessage* aNewMessage, const TBool aAllowRefresh ) |
|
1432 |
{ |
|
1433 |
FUNC_LOG; |
|
1434 |
// Use simple heuristic rule: if the first item is highlighted before the new |
|
1435 |
// item is added, the highlight is forced to remain on the (possibly new) first |
|
1436 |
// item. Otherwise the highligh stays on the same item as before. |
|
1437 |
TBool firstItemWasFocused = |
|
1438 |
( iTreeItemArray.Count() && iTreeItemArray[0].iListItemId == iMailList->FocusedItem() ); |
|
1439 |
||
1440 |
CFSEmailUiMailListModelItem* newItem = |
|
1441 |
CFSEmailUiMailListModelItem::NewLC( aNewMessage, ETypeMailItem ); |
|
1442 |
TInt idx = KErrNotFound; |
|
1443 |
TFsTreeItemId parentId = KFsTreeRootID; |
|
1444 |
TInt childIdx = KErrNotFound; |
|
1445 |
TInt moveViewPortPosition = 0; |
|
1446 |
||
1447 |
if ( !iNodesInUse ) |
|
1448 |
{ |
|
1449 |
// Simple case: nodes are not in use. Just insert to correct place under root node. |
|
1450 |
idx = iModel->GetInsertionPointL( *newItem ); |
|
1451 |
childIdx = idx; |
|
1452 |
} |
|
1453 |
else |
|
1454 |
{ |
|
1455 |
// More complicated case: nodes are in use. |
|
1456 |
TInt parentIdx = KErrNotFound; |
|
1457 |
idx = iModel->GetInsertionPointL( *newItem, childIdx, parentIdx ); |
|
1458 |
||
1459 |
CFSEmailUiMailListModelItem* parentNode = NULL; |
|
1460 |
if ( parentIdx < 0 ) |
|
1461 |
{ |
|
1462 |
// Suitable parent node for the new item was not found and has to be created. |
|
1463 |
parentNode = CreateSeparatorModelItemLC( *aNewMessage ); |
|
1464 |
iModel->InsertL( parentNode, idx ); |
|
1465 |
CleanupStack::Pop( parentNode ); |
|
1466 |
idx++; // The originally found index was used for the new node and the new item will reside in the next index |
|
1467 |
||
1468 |
// To insert the node item to the tree list, we need to figure out the index of the |
|
1469 |
// new node under the root node. If the new item is not the last item in the list, |
|
1470 |
// then the insertion location currently contains the node in front of which the new |
|
1471 |
// node is inserted. |
|
1472 |
if ( idx == iModel->Count() ) |
|
1473 |
{ |
|
1474 |
InsertNodeItemL( idx-1, KErrNotFound, aAllowRefresh ); // append |
|
1475 |
} |
|
1476 |
else |
|
1477 |
{ |
|
1478 |
CFSEmailUiMailListModelItem* nextNode = |
|
1479 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(idx) ); |
|
1480 |
TFsTreeItemId nextNodeId = nextNode->CorrespondingListId(); |
|
1481 |
TInt nodeIdxUnderRoot = iMailList->ChildIndex( KFsTreeRootID, nextNodeId ); |
|
1482 |
InsertNodeItemL( idx-1, nodeIdxUnderRoot, aAllowRefresh ); |
|
1483 |
} |
|
1484 |
moveViewPortPosition += iAppUi.LayoutHandler()->OneLineListItemHeight(); |
|
1485 |
} |
|
1486 |
else |
|
1487 |
{ |
|
1488 |
// Suitable parent node exists and was found |
|
1489 |
parentNode = static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(parentIdx) ); |
|
1490 |
} |
|
1491 |
parentId = parentNode->CorrespondingListId(); |
|
1492 |
} |
|
1493 |
||
1494 |
// Insert the model item |
|
1495 |
iModel->InsertL( newItem, idx ); |
|
1496 |
CleanupStack::Pop( newItem ); |
|
1497 |
||
1498 |
// Insert the tree list item |
|
1499 |
TPoint viewPortCenterPos = iMailTreeListVisualizer->ViewPosition(); |
|
1500 |
TPoint viewPortTopPos = iMailTreeListVisualizer->ViewPortTopPosition(); |
|
1501 |
TInt itemPos = iMailTreeListVisualizer->GetItemWorldPosition( idx ); |
|
1502 |
TBool refresh = viewPortTopPos.iY != 0 && itemPos < viewPortCenterPos.iY; |
|
1503 |
||
1504 |
if( refresh ) |
|
1505 |
{ |
|
1506 |
InsertListItemL( idx, parentId, childIdx, EFalse ); |
|
1507 |
// viewPort update needed |
|
1508 |
moveViewPortPosition += iAppUi.LayoutHandler()->TwoLineListItemHeight(); // add mail item height |
|
1509 |
viewPortCenterPos.iY += moveViewPortPosition; |
|
1510 |
iMailTreeListVisualizer->ViewPositionChanged( viewPortCenterPos, EFalse, 1 ); |
|
1511 |
} |
|
1512 |
else |
|
1513 |
{ |
|
1514 |
InsertListItemL( idx, parentId, childIdx, aAllowRefresh ); |
|
1515 |
} |
|
1516 |
||
1517 |
// Move focus after insertion if necessary |
|
1518 |
if ( firstItemWasFocused ) |
|
1519 |
{ |
|
1520 |
TFsTreeItemId firstItemId = iMailList->Child( KFsTreeRootID, 0 ); |
|
1521 |
TFsTreeItemId focusedId = iMailList->FocusedItem(); |
|
1522 |
||
1523 |
if ( firstItemId != focusedId ) |
|
1524 |
{ |
|
1525 |
// Set the first item as focused and set |
|
1526 |
// list/ctrl bar focus according iFocusedControl |
|
1527 |
// <cmail> |
|
1528 |
//iMailList->SetFocusedItemL( firstItemId ); |
|
1529 |
iMailTreeListVisualizer->SetFocusedItemL( firstItemId, EFalse ); |
|
1530 |
// </cmail> |
|
1531 |
SetListAndCtrlBarFocusL(); |
|
1532 |
} |
|
1533 |
} |
|
1534 |
} |
|
1535 |
||
1536 |
// --------------------------------------------------------------------------- |
|
1537 |
// HighlightedIndex |
|
1538 |
// This function return highlighted inxed |
|
1539 |
// --------------------------------------------------------------------------- |
|
1540 |
// |
|
1541 |
TInt CFSEmailUiMailListVisualiser::HighlightedIndex() const |
|
1542 |
{ |
|
1543 |
FUNC_LOG; |
|
1544 |
TFsTreeItemId focusedId = static_cast<TFsTreeItemId>( iMailList->FocusedItem() ); |
|
1545 |
// Map id to the index in model |
|
1546 |
TInt ret( KErrNotFound ); |
|
1547 |
if ( focusedId != KFsTreeNoneID ) |
|
1548 |
{ |
|
1549 |
for ( TInt i=0; i<iTreeItemArray.Count();i++ ) |
|
1550 |
{ |
|
1551 |
if ( focusedId == iTreeItemArray[i].iListItemId ) |
|
1552 |
{ |
|
1553 |
ret = i; |
|
1554 |
break; |
|
1555 |
} |
|
1556 |
} |
|
1557 |
} |
|
1558 |
return ret; |
|
1559 |
} |
|
1560 |
||
1561 |
// --------------------------------------------------------------------------- |
|
1562 |
// HighlightedIndex |
|
1563 |
// Use this function to set highlighted inxed |
|
1564 |
// --------------------------------------------------------------------------- |
|
1565 |
// |
|
1566 |
void CFSEmailUiMailListVisualiser::SetHighlightedIndexL( TInt aWantedIndex ) |
|
1567 |
{ |
|
1568 |
FUNC_LOG; |
|
1569 |
if ( aWantedIndex >= 0 ) |
|
1570 |
{ |
|
1571 |
iMailTreeListVisualizer->SetFocusedItemL( iTreeItemArray[aWantedIndex].iListItemId ); |
|
1572 |
} |
|
1573 |
} |
|
1574 |
||
1575 |
// --------------------------------------------------------------------------- |
|
1576 |
// |
|
1577 |
// |
|
1578 |
// --------------------------------------------------------------------------- |
|
1579 |
// |
|
1580 |
TInt CFSEmailUiMailListVisualiser::NewEmailsInModelL() const |
|
1581 |
{ |
|
1582 |
FUNC_LOG; |
|
1583 |
// <cmail> |
|
1584 |
TInt newCount(0); |
|
1585 |
for ( TInt i=0; i<iModel->Count();i++) |
|
1586 |
{ |
|
1587 |
CFSEmailUiMailListModelItem* item = |
|
1588 |
static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1589 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
1590 |
{ |
|
1591 |
if ( !item->MessagePtr().IsFlagSet(EFSMsgFlag_Read) ) |
|
1592 |
{ |
|
1593 |
newCount++; |
|
1594 |
} |
|
1595 |
} |
|
1596 |
} |
|
1597 |
return newCount; |
|
1598 |
// </cmail> |
|
1599 |
} |
|
1600 |
||
1601 |
// --------------------------------------------------------------------------- |
|
1602 |
// |
|
1603 |
// |
|
1604 |
// --------------------------------------------------------------------------- |
|
1605 |
// |
|
1606 |
TInt CFSEmailUiMailListVisualiser::EmailsInModelL() const |
|
1607 |
{ |
|
1608 |
FUNC_LOG; |
|
1609 |
// <cmail> |
|
1610 |
TInt ret(0); |
|
1611 |
for ( TInt i=0; i<iModel->Count(); i++ ) |
|
1612 |
{ |
|
1613 |
CFSEmailUiMailListModelItem* item = |
|
1614 |
static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
1615 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
1616 |
{ |
|
1617 |
ret++; |
|
1618 |
} |
|
1619 |
} |
|
1620 |
return ret; |
|
1621 |
// </cmail> |
|
1622 |
} |
|
1623 |
||
1624 |
||
1625 |
// --------------------------------------------------------------------------- |
|
1626 |
// |
|
1627 |
// |
|
1628 |
// --------------------------------------------------------------------------- |
|
1629 |
// |
|
1630 |
TUid CFSEmailUiMailListVisualiser::Id() const |
|
1631 |
{ |
|
1632 |
FUNC_LOG; |
|
1633 |
return MailListId; |
|
1634 |
} |
|
1635 |
||
1636 |
// --------------------------------------------------------------------------- |
|
1637 |
// |
|
1638 |
// |
|
1639 |
// --------------------------------------------------------------------------- |
|
1640 |
// |
|
1641 |
void CFSEmailUiMailListVisualiser::ChildDoActivateL(const TVwsViewId& aPrevViewId, |
|
1642 |
TUid aCustomMessageId, |
|
1643 |
const TDesC8& aCustomMessage) |
|
1644 |
{ |
|
1645 |
FUNC_LOG; |
|
1646 |
TIMESTAMP( "Opening message list view" ); |
|
1647 |
||
1648 |
if (iMarkingModeWaitingToExit) |
|
1649 |
{ |
|
1650 |
if ( iAppUi.CurrentActiveView()->Id() == MailListId ) |
|
1651 |
{ |
|
1652 |
iMarkingModeWaitingToExit = EFalse; |
|
1653 |
TRAP_IGNORE( ExitMarkingModeL() ); |
|
1654 |
} |
|
1655 |
} |
|
1656 |
||
1657 |
iShowReplyAll = EFalse; |
|
1658 |
||
1659 |
if ( !iFirstStartCompleted ) |
|
1660 |
{ |
|
1661 |
DoFirstStartL(); |
|
1662 |
} |
|
1663 |
// set when editor was called so reset is needed i.e. here (Called by DoActivate) |
|
1664 |
iMailOpened = EFalse; |
|
1665 |
||
1666 |
// Make sure that pending popup is not displayd |
|
1667 |
if ( iAppUi.FolderList().IsPopupShown() ) |
|
1668 |
{ |
|
1669 |
iAppUi.FolderList().HidePopupL(); |
|
1670 |
} |
|
1671 |
DisableMailList( EFalse ); |
|
1672 |
||
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1673 |
UpdateFolderAndMarkingModeTextsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1674 |
|
25 | 1675 |
// inform baseView if view entered with forward navigation |
1676 |
TBool forwardNavigation = EFalse; |
|
1677 |
if ( aCustomMessageId != KStartListReturnToPreviousFolder && |
|
1678 |
aCustomMessageId != TUid::Uid(KMailSettingsReturnFromPluginSettings) ) |
|
1679 |
{ |
|
1680 |
ViewEntered( aPrevViewId ); |
|
1681 |
forwardNavigation = ETrue; |
|
1682 |
} |
|
1683 |
||
1684 |
if( iAppUi.CurrentFixedToolbar() ) |
|
1685 |
{ |
|
1686 |
iAppUi.CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
|
1687 |
} |
|
1688 |
||
1689 |
// Set control bar and list layout size always in activation |
|
1690 |
TRect clientRect = iAppUi.ClientRect(); |
|
1691 |
iScreenAnchorLayout->SetSize( clientRect.Size() ); |
|
1692 |
SetMailListLayoutAnchors(); |
|
1693 |
//if the view is already active don't update the icons so they won't "blink" |
|
1694 |
//when the view is activated. |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1695 |
if(!iThisViewActive && !iMarkingMode) |
25 | 1696 |
{ |
1697 |
ScaleControlBarL(); |
|
1698 |
||
1699 |
// Set icons on toolbar |
|
1700 |
iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon ); |
|
1701 |
iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) ); |
|
1702 |
iAppUi.FsTextureManager()->ClearTextureByIndex( EListTextureCreateNewMessageIcon ); |
|
1703 |
iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) ); |
|
1704 |
iAppUi.FsTextureManager()->ClearTextureByIndex( GetSortButtonTextureIndex() ); |
|
1705 |
iSortButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ) ); |
|
1706 |
||
1707 |
SetListAndCtrlBarFocusL(); |
|
1708 |
} |
|
1709 |
||
1710 |
FadeOut(EFalse); // we can show now CAlfVisuals from CurrentView (to show Folders before updating emails) |
|
1711 |
||
1712 |
// Update mail list settings and date formats, is done every time |
|
1713 |
// the user might have changed these in settings, so the list needs to refresh |
|
1714 |
// Store previous modes |
|
1715 |
TInt prevListMode = iListMode; |
|
1716 |
TInt prevNodesmode = iNodesInUse; |
|
1717 |
TAknUiZoom prevZoomLevel = iCurrentZoomLevel; |
|
1718 |
STimeDateFormats prevDateFormats = MailListTimeDateSettings(); |
|
1719 |
||
1720 |
// Get new settings and list drawing modes |
|
1721 |
CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel ); |
|
1722 |
UpdateMailListSettingsL(); |
|
1723 |
UpdateMailListTimeDateSettings(); |
|
1724 |
||
1725 |
// Check for changed settings, in that case a complete list refresh is needed |
|
1726 |
TRefreshState refreshState = ERefreshNone; |
|
1727 |
if (aCustomMessageId == KStartListWithFolderIdFromHomeScreen) |
|
1728 |
{ |
|
1729 |
refreshState = EFocusChangeNeeded; |
|
1730 |
} |
|
1731 |
||
1732 |
if ( iSkinChanged |
|
1733 |
|| iDateChanged |
|
1734 |
|| iListMode != prevListMode |
|
1735 |
|| iNodesInUse != prevNodesmode |
|
1736 |
|| iCurrentZoomLevel != prevZoomLevel |
|
1737 |
|| prevDateFormats.iDateFormat != iDateFormats.iDateFormat |
|
1738 |
|| prevDateFormats.iTimeFormat != iDateFormats.iTimeFormat |
|
1739 |
|| prevDateFormats.iAmPmPosition != iDateFormats.iAmPmPosition |
|
1740 |
|| prevDateFormats.iDateSeparator.GetNumericValue() != iDateFormats.iDateSeparator.GetNumericValue() |
|
1741 |
|| prevDateFormats.iTimeSeparator.GetNumericValue() != iDateFormats.iTimeSeparator.GetNumericValue() ) |
|
1742 |
{ |
|
1743 |
refreshState = EFullRefreshNeeded; |
|
1744 |
iSkinChanged = EFalse; |
|
1745 |
iDateChanged = EFalse; |
|
1746 |
} |
|
1747 |
||
1748 |
// Store previously used mailbox and folder IDs |
|
1749 |
TFSMailMsgId prevMailBoxId = iAppUi.GetActiveMailboxId(); |
|
1750 |
TFSMailMsgId prevFolderId = FolderId(); |
|
1751 |
||
1752 |
CFSMailClient* mailClient = iAppUi.GetMailClient(); |
|
1753 |
User::LeaveIfNull( mailClient ); // we can't go on if no mail client is available |
|
1754 |
||
1755 |
// FIGURE OUT WHICH FOLDER TO ACTIVATE |
|
1756 |
TMailListActivationData activationData; |
|
1757 |
||
1758 |
// Opening folder given in custom message |
|
1759 |
if ( aCustomMessage.Length() ) |
|
1760 |
{ |
|
1761 |
TPckgBuf<TMailListActivationData> viewData; |
|
1762 |
viewData.Copy( aCustomMessage ); |
|
1763 |
activationData = viewData(); |
|
1764 |
} |
|
1765 |
||
1766 |
// Returning to previous folder |
|
1767 |
if ( aCustomMessageId == KStartListReturnToPreviousFolder || |
|
1768 |
aCustomMessageId == TUid::Uid(KMailSettingsReturnFromPluginSettings) ) |
|
1769 |
{ |
|
1770 |
activationData.iMailBoxId = prevMailBoxId; |
|
1771 |
activationData.iFolderId = prevFolderId; |
|
1772 |
} |
|
1773 |
||
1774 |
// Proper mailbox ID is not given in custom message. Try using MSV session. |
|
1775 |
if ( activationData.iMailBoxId.IsNullId() ) |
|
1776 |
{ |
|
1777 |
CMsvSession* msvSession = iAppUi.GetMsvSession(); |
|
1778 |
CFSMailBox* mailBox = NULL; |
|
1779 |
||
1780 |
if ( msvSession ) |
|
1781 |
{ |
|
1782 |
// MSV id is passed to us in aCustomMessageId when activation happens by email key |
|
1783 |
if ( aCustomMessageId != TUid::Null() ) |
|
1784 |
{ |
|
1785 |
// <cmail> |
|
1786 |
TInt error = KErrNone; |
|
1787 |
TRAP( error, mailBox = TFsEmailUiUtility::GetMailboxForMtmIdL( *mailClient, *msvSession, aCustomMessageId.iUid ) ); |
|
1788 |
// </cmail> |
|
1789 |
if ( mailBox ) |
|
1790 |
{ |
|
1791 |
activationData.iMailBoxId = mailBox->GetId(); |
|
1792 |
delete mailBox; |
|
1793 |
mailBox = NULL; |
|
1794 |
} |
|
1795 |
} |
|
1796 |
||
1797 |
// Try to get MCE default mailbox if we still haven't got any other box |
|
1798 |
if ( activationData.iMailBoxId.IsNullId() ) |
|
1799 |
{ |
|
1800 |
// <cmail> |
|
1801 |
TInt error = KErrNone; |
|
1802 |
TRAP( error, mailBox = TFsEmailUiUtility::GetMceDefaultMailboxL( *mailClient, *msvSession ) ); |
|
1803 |
// </cmail> |
|
1804 |
if ( mailBox ) |
|
1805 |
{ |
|
1806 |
activationData.iMailBoxId = mailBox->GetId(); |
|
1807 |
delete mailBox; |
|
1808 |
mailBox = NULL; |
|
1809 |
} |
|
1810 |
} |
|
1811 |
} |
|
1812 |
||
1813 |
} |
|
1814 |
||
1815 |
// If still no mailbox then use first from the list of the framework |
|
1816 |
if ( activationData.iMailBoxId.IsNullId() ) |
|
1817 |
{ |
|
1818 |
TFSMailMsgId id; |
|
1819 |
RPointerArray<CFSMailBox> mailboxes; |
|
1820 |
CleanupResetAndDestroyClosePushL( mailboxes ); |
|
1821 |
mailClient->ListMailBoxes( id, mailboxes ); |
|
1822 |
if ( mailboxes.Count() > 0 ) |
|
1823 |
{ |
|
1824 |
activationData.iMailBoxId = mailboxes[0]->GetId(); |
|
1825 |
} |
|
1826 |
CleanupStack::PopAndDestroy( &mailboxes ); |
|
1827 |
} |
|
1828 |
||
1829 |
||
1830 |
// Check if we got any mailbox |
|
1831 |
if ( activationData.iMailBoxId.IsNullId() ) |
|
1832 |
{ |
|
1833 |
// could not get mailbox so leave |
|
1834 |
User::Leave( KErrGeneral ); |
|
1835 |
} |
|
1836 |
else |
|
1837 |
{ |
|
1838 |
// Set the active mailbox of AppUi. Do this also when mailbox hasn't actually |
|
1839 |
// changed to do the autoconnect when necessary and to verify that the previously |
|
1840 |
// active mailbox is still valid. |
|
1841 |
// Leave is caused if mailbox is no longer available, and BaseView will take care |
|
1842 |
// of the error handling. |
|
1843 |
iAppUi.SetActiveMailboxL( activationData.iMailBoxId, forwardNavigation ); |
|
1844 |
||
1845 |
// we got mailbox but no folder has been given => use Inbox |
|
1846 |
if ( activationData.iFolderId.IsNullId() || |
|
1847 |
activationData.iFolderId.Id() == 0 ) |
|
1848 |
{ |
|
1849 |
activationData.iFolderId = iAppUi.GetActiveBoxInboxId(); |
|
1850 |
} |
|
1851 |
} |
|
1852 |
||
1853 |
// NOW WE HAVE A VALID MAILBOX AND FOLDER ID. |
|
1854 |
// Tries to create an extension for the Ozone plugin |
|
1855 |
CreateExtensionL(); |
|
1856 |
||
1857 |
// if mailbox changed stop timer driven insertion of new mails into list |
|
1858 |
if ( activationData.iMailBoxId != prevMailBoxId ) |
|
1859 |
{ |
|
1860 |
iNewMailTimer->Cancel(); |
|
1861 |
iSortTimer->Cancel(); // stop sorting timer |
|
1862 |
iNewMailIds.Reset(); |
|
1863 |
} |
|
1864 |
||
1865 |
// CHECK IF MODEL NEEDS TO BE UPDATED |
|
1866 |
if ( activationData.iMailBoxId != prevMailBoxId || |
|
1867 |
activationData.iFolderId != prevFolderId || |
|
1868 |
activationData.iRequestRefresh || |
|
1869 |
iForceRefresh ) |
|
1870 |
{ |
|
1871 |
iForceRefresh = EFalse; |
|
1872 |
// Set initial sort criteria when folder is changed |
|
1873 |
iCurrentSortCriteria.iField = EFSMailSortByDate; |
|
1874 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1875 |
SetSortButtonIconL(); |
25 | 1876 |
|
1877 |
SafeDelete(iMailFolder); |
|
1878 |
TRAP_IGNORE( iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( |
|
1879 |
activationData.iMailBoxId, activationData.iFolderId ) ); |
|
1880 |
if ( !iMailFolder ) |
|
1881 |
{ |
|
1882 |
if ( forwardNavigation ) |
|
1883 |
{ |
|
1884 |
iAppUi.StartMonitoringL(); |
|
1885 |
} |
|
1886 |
// Safety, try to revert back to standard folder inbox |
|
1887 |
TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox ); |
|
1888 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( activationData.iMailBoxId, inboxId ); |
|
1889 |
} |
|
1890 |
iMailList->SetFocusedItemL( KFsTreeNoneID ); |
|
1891 |
refreshState = EFullRefreshNeeded; |
|
1892 |
} |
|
1893 |
||
1894 |
// Set mailbox name to status pane |
|
1895 |
SetMailboxNameToStatusPaneL(); |
|
1896 |
||
1897 |
// Set branded watermark and mailbox icon |
|
1898 |
SetBrandedListWatermarkL(); |
|
1899 |
SetBrandedMailBoxIconL(); |
|
1900 |
||
1901 |
// Check sync icon timer and sync status |
|
1902 |
ConnectionIconHandling(); |
|
1903 |
||
1904 |
// REBUILD TREE LIST IF NECESSARY |
|
1905 |
if ( refreshState == EFullRefreshNeeded ) |
|
1906 |
{ |
|
1907 |
// Try to maintain previously active item if possible. |
|
1908 |
// This is of course not possible if folder has changed. |
|
1909 |
TFSMailMsgId focused = MsgIdFromListId( iMailList->FocusedItem() ); |
|
1910 |
||
1911 |
// Clear any previous items from the screen and then make the view visible |
|
1912 |
iMailList->BeginUpdate(); |
|
1913 |
iMailList->RemoveAllL(); |
|
1914 |
iTreeItemArray.Reset(); |
|
1915 |
iModel->Reset(); |
|
1916 |
iMailList->EndUpdateL(); |
|
1917 |
iMailList->ShowListL(); |
|
1918 |
||
1919 |
// If coming from wizard use synchronous list updating |
|
1920 |
if (activationData.iReturnAfterWizard) |
|
1921 |
{ |
|
1922 |
UpdateMailListModelL(); |
|
1923 |
} |
|
1924 |
else |
|
1925 |
{ |
|
1926 |
UpdateMailListModelAsyncL( KCMsgBlockSort ); |
|
1927 |
} |
|
1928 |
} |
|
1929 |
else if(refreshState == EFocusChangeNeeded) |
|
1930 |
{//Move focus to the beginning of the list |
|
1931 |
TInt firstIndex(0); |
|
1932 |
TFsTreeItemId firstItemId(KFsTreeNoneID); |
|
1933 |
if ( iMailList->CountChildren( KFsTreeRootID ) ) |
|
1934 |
{ |
|
1935 |
firstItemId = iMailList->Child( KFsTreeRootID, firstIndex ); |
|
1936 |
} |
|
1937 |
iMailTreeListVisualizer->SetFocusedItemL( firstItemId, EFalse ); |
|
1938 |
//if the view is already active don't update the list so it won't "blink" |
|
1939 |
//when the view is activated. |
|
1940 |
if(!iThisViewActive) |
|
1941 |
{ |
|
1942 |
iMailList->ShowListL(); |
|
1943 |
} |
|
1944 |
} |
|
1945 |
// THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED. |
|
1946 |
else |
|
1947 |
{ |
|
1948 |
iMailList->ShowListL(); |
|
1949 |
TBool manualSync = CheckAutoSyncSettingL(); |
|
1950 |
if (forwardNavigation && !manualSync) |
|
1951 |
{ |
|
1952 |
iAppUi.StartMonitoringL(); |
|
1953 |
} |
|
1954 |
SetListAndCtrlBarFocusL(); // ShowListL() makes list focused and this may need to be reverted |
|
1955 |
if ( aCustomMessageId == TUid::Uid(KMailSettingsReturnFromPluginSettings) ) |
|
1956 |
{ |
|
1957 |
// Better to refresh launcher grid view because mailbox branding might be changed. |
|
1958 |
iAppUi.LauncherGrid().SetRefreshNeeded(); |
|
1959 |
} |
|
1960 |
// Check the validity of focused message, it may be deleted or |
|
1961 |
// reply/forward, read/unread status might have changed in editor or viewer |
|
1962 |
UpdateItemAtIndexL( HighlightedIndex() ); |
|
1963 |
SetMskL(); |
|
1964 |
} |
|
1965 |
||
1966 |
iCurrentClientRect = clientRect; |
|
1967 |
iThisViewActive = ETrue; |
|
1968 |
||
1969 |
//emailindicator handling, is removed from 9.2 |
|
1970 |
//TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( activationData.iMailBoxId.Id())); |
|
1971 |
||
1972 |
//Update mailbox widget index status in homescreen |
|
1973 |
TFsEmailUiUtility::ToggleEmailIconL(EFalse, activationData.iMailBoxId ); |
|
1974 |
||
1975 |
iShiftDepressed = EFalse; // clear state just in case |
|
1976 |
||
1977 |
// Inform MR observer if needed, special MR case, returning from attachment list |
|
1978 |
iAppUi.MailViewer().CompletePendingMrCommand(); |
|
1979 |
||
1980 |
// Make sure that correct component is set to focused. |
|
1981 |
if ( iFocusedControl == EMailListComponent ) |
|
1982 |
{ |
|
1983 |
SetTreeListFocusedL(); |
|
1984 |
} |
|
1985 |
else |
|
1986 |
{ |
|
1987 |
SetControlBarFocusedL(); |
|
1988 |
iControlBarControl->MakeSelectorVisible( iAppUi.IsFocusShown() ); |
|
1989 |
} |
|
1990 |
FocusVisibilityChange( iAppUi.IsFocusShown() ); |
|
1991 |
iAppUi.ShowTitlePaneConnectionStatus(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1992 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1993 |
// if timer stoped when quitting view then restart if more messages available |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1994 |
if ( iNewMailIds.Count() && ( ! iNewMailTimer->IsActive() ) && iSortState == ESortNone ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1995 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1996 |
iNewMailTimer->Start( KNewMailTimerDelay ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1997 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
1998 |
|
25 | 1999 |
TIMESTAMP( "Message list view opened" ); |
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2000 |
} // CFSEmailUiMailListVisualiser::ChildDoActivateL |
25 | 2001 |
|
2002 |
// --------------------------------------------------------------------------- |
|
2003 |
// Sets status bar layout |
|
2004 |
// --------------------------------------------------------------------------- |
|
2005 |
// |
|
2006 |
void CFSEmailUiMailListVisualiser::SetStatusBarLayout() |
|
2007 |
{ |
|
2008 |
TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT; |
|
2009 |
if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
2010 |
{ |
|
2011 |
// landscape must use different layout |
|
2012 |
res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT; |
|
2013 |
} |
|
2014 |
||
2015 |
if ( StatusPane()->CurrentLayoutResId() != res ) |
|
2016 |
{ |
|
2017 |
TRAP_IGNORE( |
|
2018 |
StatusPane()->SwitchLayoutL( res )); |
|
2019 |
} |
|
2020 |
} |
|
2021 |
||
2022 |
||
2023 |
// --------------------------------------------------------------------------- |
|
2024 |
// |
|
2025 |
// |
|
2026 |
// --------------------------------------------------------------------------- |
|
2027 |
// |
|
2028 |
void CFSEmailUiMailListVisualiser::ChildDoDeactivate() |
|
2029 |
{ |
|
2030 |
FUNC_LOG; |
|
2031 |
if (iMailListModelUpdater) |
|
2032 |
{ |
|
2033 |
iMailListModelUpdater->Cancel(); |
|
2034 |
} |
|
2035 |
if ( !iAppUi.AppUiExitOngoing() ) |
|
2036 |
{ |
|
2037 |
TRAP_IGNORE( { |
|
2038 |
iMailList->HideListL(); |
|
2039 |
iMailList->SetFocusedL( EFalse ); |
|
2040 |
} ); |
|
2041 |
iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse ); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2042 |
TRAP_IGNORE( UpdateFolderAndMarkingModeTextsL() ); |
25 | 2043 |
} |
2044 |
iThisViewActive = EFalse; |
|
2045 |
} |
|
2046 |
||
2047 |
// --------------------------------------------------------------------------- |
|
2048 |
// |
|
2049 |
// |
|
2050 |
// --------------------------------------------------------------------------- |
|
2051 |
// |
|
2052 |
CFSEmailUiMailListModel* CFSEmailUiMailListVisualiser::Model() |
|
2053 |
{ |
|
2054 |
FUNC_LOG; |
|
2055 |
return iModel; |
|
2056 |
} |
|
2057 |
||
2058 |
// --------------------------------------------------------------------------- |
|
2059 |
// |
|
2060 |
// |
|
2061 |
// --------------------------------------------------------------------------- |
|
2062 |
// |
|
2063 |
TFSMailMsgId CFSEmailUiMailListVisualiser::FolderId() |
|
2064 |
{ |
|
2065 |
FUNC_LOG; |
|
2066 |
TFSMailMsgId folderId; // constructs null ID |
|
2067 |
if ( iMailFolder ) |
|
2068 |
{ |
|
2069 |
folderId = iMailFolder->GetFolderId(); |
|
2070 |
} |
|
2071 |
return folderId; |
|
2072 |
} |
|
2073 |
||
2074 |
// --------------------------------------------------------------------------- |
|
2075 |
// |
|
2076 |
// |
|
2077 |
// --------------------------------------------------------------------------- |
|
2078 |
// |
|
2079 |
void CFSEmailUiMailListVisualiser::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
2080 |
{ |
|
2081 |
FUNC_LOG; |
|
2082 |
CompletePendingRefresh(); |
|
2083 |
||
2084 |
// Get the list of items which will be targetted by the actions menu commands |
|
2085 |
RFsTreeItemIdList targetEntries; |
|
2086 |
CleanupClosePushL( targetEntries ); |
|
2087 |
GetActionsTargetEntriesL( targetEntries ); |
|
2088 |
||
2089 |
TBool supportsMoving = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ); |
|
2090 |
TBool supportsFlag = TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ); |
|
2091 |
||
2092 |
TInt currentFolderType = KErrNotFound; |
|
2093 |
if ( iMailFolder ) |
|
2094 |
{ |
|
2095 |
currentFolderType = iMailFolder->GetFolderType(); |
|
2096 |
} |
|
2097 |
||
2098 |
if ( aResourceId == R_FSEMAILUI_MAILLIST_MARKING_MODE_MENUPANE ) |
|
2099 |
{ |
|
2100 |
if (!CountMarkedItemsL()) |
|
2101 |
{ |
|
2102 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeDelete, ETrue ); |
|
2103 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnread, ETrue ); |
|
2104 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeRead, ETrue ); |
|
2105 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMove, ETrue ); |
|
2106 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeFollowUp, ETrue ); |
|
2107 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMarkAll, EFalse ); |
|
2108 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnmarkAll, ETrue ); |
|
2109 |
} |
|
2110 |
else |
|
2111 |
{ |
|
2112 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeDelete, EFalse ); |
|
2113 |
if ( AreAllMarkedItemsUnreadL() ) |
|
2114 |
{ |
|
2115 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnread, ETrue ); |
|
2116 |
} |
|
2117 |
else |
|
2118 |
{ |
|
2119 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnread, EFalse ); |
|
2120 |
} |
|
2121 |
if ( AreAllMarkedItemsReadL() ) |
|
2122 |
{ |
|
2123 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeRead, ETrue ); |
|
2124 |
} |
|
2125 |
else |
|
2126 |
{ |
|
2127 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeRead, EFalse ); |
|
2128 |
} |
|
2129 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMove, !supportsMoving ); |
|
2130 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeFollowUp, !supportsFlag ); |
|
2131 |
if ( AreAllItemsMarked() ) |
|
2132 |
{ |
|
2133 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMarkAll, ETrue ); |
|
2134 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnmarkAll, EFalse ); |
|
2135 |
} |
|
2136 |
else if ( AreAllItemsUnmarked() ) |
|
2137 |
{ |
|
2138 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMarkAll, EFalse ); |
|
2139 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnmarkAll, ETrue ); |
|
2140 |
} |
|
2141 |
else |
|
2142 |
{ |
|
2143 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeMarkAll, EFalse ); |
|
2144 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingModeUnmarkAll, EFalse ); |
|
2145 |
} |
|
2146 |
} |
|
2147 |
} |
|
2148 |
||
2149 |
// MAIN MENU *************************************************************************** |
|
2150 |
if ( aResourceId == R_FSEMAILUI_MAILLIST_MENUPANE ) |
|
2151 |
{ |
|
2152 |
// Saves a focus visibility. |
|
2153 |
iLastFocus = EFalse; |
|
2154 |
if( iFocusedControl == EMailListComponent && IsFocusShown() ) |
|
2155 |
{ |
|
2156 |
iLastFocus = ETrue; |
|
2157 |
} |
|
2158 |
if (FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration )) |
|
2159 |
{ |
|
2160 |
// remove help support in pf5250 |
|
2161 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue); |
|
2162 |
} |
|
2163 |
||
2164 |
// Checks if a device has a keyboard or not. |
|
2165 |
if( !iLastFocus ) |
|
2166 |
{ |
|
2167 |
// Hide all the normal email message specific actions |
|
2168 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
2169 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
2170 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
|
2171 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue); |
|
2172 |
} |
|
2173 |
else |
|
2174 |
{ |
|
2175 |
CFSMailMessage* targetMessage = NULL; |
|
2176 |
if ( targetEntries.Count() == 1 ) |
|
2177 |
{ |
|
2178 |
targetMessage = &MsgPtrFromListIdL( targetEntries[0] ); |
|
2179 |
} |
|
2180 |
||
2181 |
// Hide the irrelevant reply / reply all / forward commands |
|
2182 |
TInt numRecipients(0); |
|
2183 |
if ( targetMessage ) |
|
2184 |
{ |
|
2185 |
//Get # of recipients |
|
2186 |
numRecipients = TFsEmailUiUtility::CountRecipientsSmart( iAppUi, targetMessage ); |
|
2187 |
} |
|
2188 |
// All reply/forward options are hidden when multiple marked messages or folder is outbox or drafts |
|
2189 |
if ( targetEntries.Count() != 1 || |
|
2190 |
currentFolderType == EFSOutbox || |
|
2191 |
currentFolderType == EFSDraftsFolder ) |
|
2192 |
{ |
|
2193 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, ETrue ); |
|
2194 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
2195 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, ETrue ); |
|
2196 |
} |
|
2197 |
||
2198 |
// Reply all is hidden also when the single target message has multiple recipients |
|
2199 |
else if ( !targetMessage || numRecipients <= 1 ) |
|
2200 |
{ |
|
2201 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue ); |
|
2202 |
} |
|
2203 |
} |
|
2204 |
||
2205 |
// EMPTY LIST, MOST OPTIONS ARE HIDDEN |
|
2206 |
if ( !iModel->Count() || !iMailFolder ) |
|
2207 |
{ |
|
2208 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMailActions, ETrue ); |
|
2209 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSearch, ETrue ); |
|
2210 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkingMode, ETrue ); |
|
2211 |
} |
|
2212 |
||
2213 |
// FOLDER SPECIFIC COMMAND HIDING |
|
2214 |
// "Clear deleted folder" command is available only in Deleted folder |
|
2215 |
if ( currentFolderType != EFSDeleted || !iModel->Count() ) |
|
2216 |
{ |
|
2217 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsEmptyDeleted, ETrue ); |
|
2218 |
} |
|
2219 |
||
2220 |
CConnectionStatusQueryExtension::TConnectionStatus connetionStatus; |
|
2221 |
iAppUi.GetConnectionStatusL( connetionStatus ); |
|
2222 |
if ( connetionStatus == CConnectionStatusQueryExtension::ESynchronizing ) |
|
2223 |
{ |
|
2224 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue ); |
|
2225 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, EFalse ); |
|
2226 |
} |
|
2227 |
else |
|
2228 |
{ |
|
2229 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, EFalse ); |
|
2230 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue ); |
|
2231 |
} |
|
2232 |
} |
|
2233 |
||
2234 |
// MAIN MENU *************************************************************************** |
|
2235 |
||
2236 |
||
2237 |
// ACTIONS SUBMENU ********************************************************************* |
|
2238 |
if ( aResourceId == R_FSEMAILUI_MAILLIST_SUBMENU_MAIL_ACTIONS ) |
|
2239 |
{ |
|
2240 |
// COMMON PART OF ACTIONS SUBMENU |
|
2241 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() ); |
|
2242 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() ); |
|
2243 |
||
2244 |
if ( !supportsMoving || !iMailFolder ) // Hide move from actions if not supported |
|
2245 |
{ |
|
2246 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
|
2247 |
} |
|
2248 |
else |
|
2249 |
{ |
|
2250 |
// Moving supported, show/hide moving options depending on the current folder |
|
2251 |
// Check for outbox case |
|
2252 |
if ( currentFolderType == EFSOutbox ) |
|
2253 |
{ |
|
2254 |
// moving from outbox is not allowed otherwise |
|
2255 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, ETrue ); |
|
2256 |
} |
|
2257 |
// Handle rest of the folders |
|
2258 |
else |
|
2259 |
{ |
|
2260 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMove, EFalse ); |
|
2261 |
} |
|
2262 |
} |
|
2263 |
||
2264 |
TInt markedCount = CountMarkedItemsL(); |
|
2265 |
||
2266 |
// Hide expand/collapse all when not applicable |
|
2267 |
if ( iNodesInUse == EListControlSeparatorDisabled || !iModel->Count() ) |
|
2268 |
{ |
|
2269 |
aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsCollapseAll, ETrue); |
|
2270 |
aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsExpandAll, ETrue); |
|
2271 |
} |
|
2272 |
else |
|
2273 |
{ |
|
2274 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() ); |
|
2275 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() ); |
|
2276 |
} |
|
2277 |
||
2278 |
// Hide followup flagging if not applicable |
|
2279 |
if ( !supportsFlag || !targetEntries.Count() ) |
|
2280 |
{ |
|
2281 |
aMenuPane->SetItemDimmed(EFsEmailUiCmdActionsFlag, ETrue); |
|
2282 |
} |
|
2283 |
||
2284 |
// Some commands are hidden in the outbox and drafts folders |
|
2285 |
if ( currentFolderType == EFSOutbox || |
|
2286 |
currentFolderType == EFSDraftsFolder ) |
|
2287 |
{ |
|
2288 |
aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue ); |
|
2289 |
} |
|
2290 |
} |
|
2291 |
// ACTIONS SUBMENU ********************************************************************* |
|
2292 |
||
2293 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
2294 |
||
2295 |
// Add shortcut hints |
|
2296 |
iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, |
|
2297 |
CFSEmailUiShortcutBinding::EContextMailList ); |
|
2298 |
} |
|
2299 |
||
2300 |
// --------------------------------------------------------------------------- |
|
2301 |
// |
|
2302 |
// |
|
2303 |
// --------------------------------------------------------------------------- |
|
2304 |
// |
|
2305 |
void CFSEmailUiMailListVisualiser::MarkAllItemsL() |
|
2306 |
{ |
|
2307 |
FUNC_LOG; |
|
2308 |
if ( iTreeItemArray.Count() ) |
|
2309 |
{ |
|
2310 |
for ( TInt i=0;i<iTreeItemArray.Count(); i++ ) |
|
2311 |
{ |
|
2312 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId ) ) |
|
2313 |
{ |
|
2314 |
iMailList->MarkItemL( iTreeItemArray[i].iListItemId, ETrue ); |
|
2315 |
} |
|
2316 |
} |
|
2317 |
} |
|
2318 |
} |
|
2319 |
||
2320 |
// --------------------------------------------------------------------------- |
|
2321 |
// |
|
2322 |
// |
|
2323 |
// --------------------------------------------------------------------------- |
|
2324 |
// |
|
2325 |
void CFSEmailUiMailListVisualiser::UnmarkAllItemsL() |
|
2326 |
{ |
|
2327 |
FUNC_LOG; |
|
2328 |
for ( TInt i=0 ; i<iTreeItemArray.Count() ; i++ ) |
|
2329 |
{ |
|
2330 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId) ) |
|
2331 |
{ |
|
2332 |
iMailList->MarkItemL( iTreeItemArray[i].iListItemId, EFalse ); |
|
2333 |
} |
|
2334 |
} |
|
2335 |
} |
|
2336 |
||
2337 |
// --------------------------------------------------------------------------- |
|
2338 |
// |
|
2339 |
// |
|
2340 |
// --------------------------------------------------------------------------- |
|
2341 |
// |
|
2342 |
TInt CFSEmailUiMailListVisualiser::CountMarkedItemsL() |
|
2343 |
{ |
|
2344 |
FUNC_LOG; |
|
2345 |
RFsTreeItemIdList markedEntries; |
|
2346 |
CleanupClosePushL( markedEntries ); |
|
2347 |
iMailList->GetMarkedItemsL( markedEntries ); |
|
2348 |
TInt count = markedEntries.Count(); |
|
2349 |
CleanupStack::PopAndDestroy( &markedEntries ); |
|
2350 |
return count; |
|
2351 |
} |
|
2352 |
||
2353 |
// --------------------------------------------------------------------------- |
|
2354 |
// |
|
2355 |
// |
|
2356 |
// --------------------------------------------------------------------------- |
|
2357 |
// |
|
2358 |
TBool CFSEmailUiMailListVisualiser::AreAllItemsMarked() |
|
2359 |
{ |
|
2360 |
FUNC_LOG; |
|
2361 |
||
2362 |
TBool ret(ETrue); |
|
2363 |
||
2364 |
if ( iTreeItemArray.Count() ) |
|
2365 |
{ |
|
2366 |
for ( TInt i=0;i<iTreeItemArray.Count(); i++ ) |
|
2367 |
{ |
|
2368 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId ) && |
|
2369 |
!iMailList->IsMarked( iTreeItemArray[i].iListItemId )) |
|
2370 |
{ |
|
2371 |
ret = EFalse; |
|
2372 |
break; |
|
2373 |
} |
|
2374 |
} |
|
2375 |
} |
|
2376 |
return ret; |
|
2377 |
} |
|
2378 |
||
2379 |
// --------------------------------------------------------------------------- |
|
2380 |
// |
|
2381 |
// |
|
2382 |
// --------------------------------------------------------------------------- |
|
2383 |
// |
|
2384 |
TBool CFSEmailUiMailListVisualiser::AreAllItemsUnmarked() |
|
2385 |
{ |
|
2386 |
FUNC_LOG; |
|
2387 |
||
2388 |
TBool ret(ETrue); |
|
2389 |
||
2390 |
if ( iTreeItemArray.Count() ) |
|
2391 |
{ |
|
2392 |
for ( TInt i=0;i<iTreeItemArray.Count(); i++ ) |
|
2393 |
{ |
|
2394 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId ) && |
|
2395 |
iMailList->IsMarked( iTreeItemArray[i].iListItemId )) |
|
2396 |
{ |
|
2397 |
ret = EFalse; |
|
2398 |
break; |
|
2399 |
} |
|
2400 |
} |
|
2401 |
} |
|
2402 |
return ret; |
|
2403 |
} |
|
2404 |
||
2405 |
// --------------------------------------------------------------------------- |
|
2406 |
// |
|
2407 |
// |
|
2408 |
// --------------------------------------------------------------------------- |
|
2409 |
// |
|
2410 |
TBool CFSEmailUiMailListVisualiser::AreAllMarkedItemsReadL() |
|
2411 |
{ |
|
2412 |
FUNC_LOG; |
|
2413 |
||
2414 |
TBool ret(ETrue); |
|
2415 |
||
2416 |
if ( iTreeItemArray.Count() ) |
|
2417 |
{ |
|
2418 |
for ( TInt i=0;i<iTreeItemArray.Count(); i++ ) |
|
2419 |
{ |
|
2420 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId ) && |
|
2421 |
iMailList->IsMarked( iTreeItemArray[i].iListItemId )) |
|
2422 |
{ |
|
2423 |
CFSEmailUiMailListModelItem* item = |
|
2424 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) ); |
|
2425 |
if ( item ) // Safety |
|
2426 |
{ |
|
2427 |
CFSMailMessage* confirmedMsgPtr(0); |
|
2428 |
confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(), |
|
2429 |
iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope ); |
|
2430 |
TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read ); |
|
2431 |
delete confirmedMsgPtr; |
|
2432 |
if ( !isReadMessage ) |
|
2433 |
{ |
|
2434 |
ret = EFalse; |
|
2435 |
break; |
|
2436 |
} |
|
2437 |
} |
|
2438 |
} |
|
2439 |
} |
|
2440 |
} |
|
2441 |
return ret; |
|
2442 |
} |
|
2443 |
||
2444 |
// --------------------------------------------------------------------------- |
|
2445 |
// |
|
2446 |
// |
|
2447 |
// --------------------------------------------------------------------------- |
|
2448 |
// |
|
2449 |
TBool CFSEmailUiMailListVisualiser::AreAllMarkedItemsUnreadL() |
|
2450 |
{ |
|
2451 |
FUNC_LOG; |
|
2452 |
||
2453 |
TBool ret(ETrue); |
|
2454 |
||
2455 |
if ( iTreeItemArray.Count() ) |
|
2456 |
{ |
|
2457 |
for ( TInt i=0;i<iTreeItemArray.Count(); i++ ) |
|
2458 |
{ |
|
2459 |
if ( !iMailList->IsNode(iTreeItemArray[i].iListItemId ) && |
|
2460 |
iMailList->IsMarked( iTreeItemArray[i].iListItemId )) |
|
2461 |
{ |
|
2462 |
CFSEmailUiMailListModelItem* item = |
|
2463 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) ); |
|
2464 |
if ( item ) // Safety |
|
2465 |
{ |
|
2466 |
CFSMailMessage* confirmedMsgPtr(0); |
|
2467 |
confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(), |
|
2468 |
iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope ); |
|
2469 |
TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read ); |
|
2470 |
delete confirmedMsgPtr; |
|
2471 |
if ( isReadMessage ) |
|
2472 |
{ |
|
2473 |
ret = EFalse; |
|
2474 |
break; |
|
2475 |
} |
|
2476 |
} |
|
2477 |
} |
|
2478 |
} |
|
2479 |
} |
|
2480 |
return ret; |
|
2481 |
} |
|
2482 |
||
2483 |
// --------------------------------------------------------------------------- |
|
2484 |
// |
|
2485 |
// |
|
2486 |
// --------------------------------------------------------------------------- |
|
2487 |
// |
|
2488 |
void CFSEmailUiMailListVisualiser::GetMarkedMessagesL( RArray<TFSMailMsgId>& aMessageIDs ) const |
|
2489 |
{ |
|
2490 |
FUNC_LOG; |
|
2491 |
aMessageIDs.Reset(); |
|
2492 |
||
2493 |
RFsTreeItemIdList markedEntries; |
|
2494 |
CleanupClosePushL( markedEntries ); |
|
2495 |
iMailList->GetMarkedItemsL( markedEntries ); |
|
2496 |
||
2497 |
for ( TInt i=0 ; i<markedEntries.Count() ; ++i ) |
|
2498 |
{ |
|
2499 |
// This could be optimized if we could be certain that the order of the |
|
2500 |
// marked entries is the same as the order in the message list. This is |
|
2501 |
// probably true, but the interface does not guarantee that. Now the |
|
2502 |
// time counsumption is Theta(n*m) while Theta(n+m) could be possible |
|
2503 |
TFSMailMsgId messageId = MsgIdFromListId( markedEntries[i] ); |
|
2504 |
if ( !messageId.IsNullId() ) |
|
2505 |
{ |
|
2506 |
aMessageIDs.Append( messageId ); |
|
2507 |
} |
|
2508 |
} |
|
2509 |
||
2510 |
CleanupStack::PopAndDestroy( &markedEntries ); |
|
2511 |
} |
|
2512 |
||
2513 |
// --------------------------------------------------------------------------- |
|
2514 |
// |
|
2515 |
// |
|
2516 |
// --------------------------------------------------------------------------- |
|
2517 |
// |
|
2518 |
void CFSEmailUiMailListVisualiser::MarkMessagesIfFoundL( const RArray<TFSMailMsgId>& aMessageIDs ) |
|
2519 |
{ |
|
2520 |
FUNC_LOG; |
|
2521 |
for ( TInt i=0 ; i<aMessageIDs.Count() ; ++i ) |
|
2522 |
{ |
|
2523 |
// Same performance tweaking possibility is here that is commented in GetMarkedMessagesL(). |
|
2524 |
TInt index = ItemIndexFromMessageId( aMessageIDs[i] ); |
|
2525 |
if ( index >= 0 ) |
|
2526 |
{ |
|
2527 |
iMailList->MarkItemL( iTreeItemArray[index].iListItemId, ETrue ); |
|
2528 |
} |
|
2529 |
} |
|
2530 |
} |
|
2531 |
||
2532 |
// --------------------------------------------------------------------------- |
|
2533 |
// |
|
2534 |
// |
|
2535 |
// --------------------------------------------------------------------------- |
|
2536 |
// |
|
2537 |
void CFSEmailUiMailListVisualiser::ExitMarkingModeL() |
|
2538 |
{ |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2539 |
FUNC_LOG; |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2540 |
iMarkingMode = EFalse; |
25 | 2541 |
// Hide marking mode text on the place of drop down menus |
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2542 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 2543 |
UnmarkAllItemsL(); |
2544 |
// Change softkeys back to normal |
|
2545 |
SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK ); |
|
2546 |
// Change options menu back to normal |
|
2547 |
CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar(); |
|
2548 |
menu->StopDisplayingMenuBar(); |
|
2549 |
menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR); |
|
2550 |
// Change background back to normal |
|
2551 |
DisplayMarkingModeBgL( EFalse ); |
|
2552 |
// Display drop down menu buttons |
|
2553 |
iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() ); |
|
2554 |
iNewEmailButton->SetDimmed( EFalse ); |
|
2555 |
iFolderListButton->SetDimmed( EFalse ); |
|
2556 |
iSortButton->SetDimmed( EFalse ); |
|
2557 |
ScaleControlBarL(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2558 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2559 |
iMailTreeListVisualizer->HideList(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2560 |
SetMailListLayoutAnchors(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2561 |
iMailTreeListVisualizer->ShowListL(); |
25 | 2562 |
} |
2563 |
||
2564 |
// --------------------------------------------------------------------------- |
|
2565 |
// |
|
2566 |
// |
|
2567 |
// --------------------------------------------------------------------------- |
|
2568 |
// |
|
2569 |
void CFSEmailUiMailListVisualiser::EnterMarkingModeL() |
|
2570 |
{ |
|
2571 |
FUNC_LOG; |
|
2572 |
iMarkingMode = ETrue; |
|
2573 |
iListMarkItemsState = ETrue; // shift-scrolling does marking after one item is marked |
|
2574 |
HandleCommandL( EFsEmailUiCmdActionsExpandAll ); |
|
2575 |
// Change softkeys for marking mode |
|
2576 |
SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_CANCEL ); |
|
2577 |
// Change options menu for marking mode |
|
2578 |
CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar(); |
|
2579 |
menu->StopDisplayingMenuBar(); |
|
2580 |
menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE); |
|
2581 |
// Hide drop down menu buttons |
|
2582 |
iNewEmailButton->SetDimmed(); |
|
2583 |
iFolderListButton->SetDimmed(); |
|
2584 |
iSortButton->SetDimmed(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2585 |
TRect rect(0,0,0,0); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2586 |
iControlBarControl->SetRectL( rect ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2587 |
UpdateFolderAndMarkingModeTextsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2588 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2589 |
iMailTreeListVisualizer->HideList(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2590 |
SetMailListLayoutAnchors(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2591 |
iMailTreeListVisualizer->ShowListL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2592 |
// Change background to marking mode |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2593 |
DisplayMarkingModeBgL( ETrue ); |
25 | 2594 |
} |
2595 |
||
2596 |
// --------------------------------------------------------------------------- |
|
2597 |
// |
|
2598 |
// |
|
2599 |
// --------------------------------------------------------------------------- |
|
2600 |
// |
|
2601 |
void CFSEmailUiMailListVisualiser::RefreshMarkingModeL() |
|
2602 |
{ |
|
2603 |
FUNC_LOG; |
|
2604 |
if ( iMarkingMode ) |
|
2605 |
{ |
|
2606 |
// Hide drop down menu buttons |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2607 |
TRect rect(0,0,0,0); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2608 |
iControlBarControl->SetRectL( rect ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2609 |
iNewEmailButton->SetDimmed(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2610 |
iFolderListButton->SetDimmed(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2611 |
iSortButton->SetDimmed(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2612 |
UpdateFolderAndMarkingModeTextsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2613 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2614 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2615 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2616 |
// --------------------------------------------------------------------------- |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2617 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2618 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2619 |
// --------------------------------------------------------------------------- |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2620 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2621 |
void CFSEmailUiMailListVisualiser::DisplayMarkingModeTextOnButtonsL() |
25 | 2622 |
{ |
2623 |
FUNC_LOG; |
|
2624 |
if (!iMarkingModeTextVisual) |
|
2625 |
{ |
|
2626 |
const TRect sortButtonRect( iAppUi.LayoutHandler()->GetControlBarSortButtonRect() ); |
|
2627 |
const TRect newMailButtonRect( iAppUi.LayoutHandler()->GetControlBarNewEmailButtonRect() ); |
|
2628 |
||
2629 |
iMarkingModeTextRect = TRect( newMailButtonRect.iTl, sortButtonRect.iBr ); |
|
2630 |
iMarkingModeTextParentLayout = CAlfDeckLayout::AddNewL( *iMailListControl ); |
|
2631 |
iMarkingModeTextParentLayout->SetFlags( EAlfVisualFlagManualLayout ); |
|
2632 |
iMarkingModeTextParentLayout->SetRect( iMarkingModeTextRect ); |
|
2633 |
||
2634 |
iMarkingModeTextContentLayout = CAlfAnchorLayout::AddNewL( *iMailListControl, iMarkingModeTextParentLayout ); |
|
2635 |
||
2636 |
iMarkingModeTextVisual = CAlfTextVisual::AddNewL( *iMailListControl, iMarkingModeTextContentLayout ); |
|
2637 |
iMarkingModeTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
2638 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
2639 |
{ |
|
2640 |
iMarkingModeTextVisual->SetAlign( EAlfAlignHRight, EAlfAlignVCenter ); |
|
2641 |
} |
|
2642 |
else |
|
2643 |
{ |
|
2644 |
iMarkingModeTextVisual->SetAlign( EAlfAlignHLeft, EAlfAlignVCenter ); |
|
2645 |
} |
|
2646 |
iMarkingModeTextVisual->SetStyle( EAlfTextStyleTitle ); |
|
2647 |
TRgb color = iAppUi.LayoutHandler()->ListNodeTextColor(); |
|
2648 |
iMarkingModeTextVisual->SetColor ( color ); |
|
2649 |
if( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
2650 |
{ |
|
2651 |
HBufC* msg = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MARKINGMODE ); |
|
2652 |
iMarkingModeTextVisual->SetTextL( *msg ); |
|
2653 |
CleanupStack::PopAndDestroy( msg ); |
|
2654 |
} |
|
2655 |
else |
|
2656 |
{ |
|
2657 |
iMarkingModeTextVisual->SetTextL( KNullDesC ); |
|
2658 |
} |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2659 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2660 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2661 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2662 |
// --------------------------------------------------------------------------- |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2663 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2664 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2665 |
// --------------------------------------------------------------------------- |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2666 |
// |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
2667 |
void CFSEmailUiMailListVisualiser::RemoveMarkingModeTextOnButtonsL() |
25 | 2668 |
{ |
2669 |
FUNC_LOG; |
|
2670 |
if (iMarkingModeTextVisual) |
|
2671 |
{ |
|
2672 |
iMarkingModeTextVisual->SetTextL( KNullDesC ); |
|
2673 |
iMarkingModeTextVisual->RemoveAndDestroyAllD(); |
|
2674 |
iMarkingModeTextVisual = NULL; |
|
2675 |
iMarkingModeTextContentLayout->RemoveAndDestroyAllD(); |
|
2676 |
iMarkingModeTextContentLayout = NULL; |
|
2677 |
iMarkingModeTextParentLayout->RemoveAndDestroyAllD(); |
|
2678 |
iMarkingModeTextParentLayout = NULL; |
|
2679 |
} |
|
2680 |
} |
|
2681 |
||
2682 |
// --------------------------------------------------------------------------- |
|
2683 |
// |
|
2684 |
// |
|
2685 |
// --------------------------------------------------------------------------- |
|
2686 |
// |
|
2687 |
void CFSEmailUiMailListVisualiser::DisplayMarkingModeBgL( TBool aDisplay ) |
|
2688 |
{ |
|
2689 |
FUNC_LOG; |
|
2690 |
if (aDisplay) |
|
2691 |
{ |
|
2692 |
CAlfBrush* brush = iAppUi.FsTextureManager()->NewMailListMarkingModeBgBrushLC(); |
|
2693 |
iMailTreeListVisualizer->SetBackgroundBrushL( brush ); |
|
2694 |
CleanupStack::Pop( brush ); |
|
2695 |
} |
|
2696 |
else |
|
2697 |
{ |
|
2698 |
iMailTreeListVisualizer->ClearBackground(); |
|
2699 |
} |
|
2700 |
} |
|
2701 |
||
2702 |
// --------------------------------------------------------------------------- |
|
2703 |
// |
|
2704 |
// |
|
2705 |
// --------------------------------------------------------------------------- |
|
2706 |
// |
|
2707 |
void CFSEmailUiMailListVisualiser::RefreshL( TFSMailMsgId* aFocusToMessage ) |
|
2708 |
{ |
|
2709 |
FUNC_LOG; |
|
2710 |
iMailList->RemoveAllL(); |
|
2711 |
iTreeItemArray.Reset(); |
|
2712 |
||
2713 |
// when we get refresh mail list updates should be fully enabled |
|
2714 |
iMailOpened = EFalse; |
|
2715 |
||
2716 |
RefreshListItemsL(); |
|
2717 |
||
2718 |
if ( !iModel->Count() ) |
|
2719 |
{ |
|
2720 |
iFocusedControl = EControlBarComponent; |
|
2721 |
// If focus is not visible, hide selector |
|
2722 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
2723 |
} |
|
2724 |
else |
|
2725 |
{ |
|
2726 |
// Try to keep the previous list item if focused message ptr is given, |
|
2727 |
// and it's not NULL id |
|
2728 |
if ( aFocusToMessage && !aFocusToMessage->IsNullId() ) |
|
2729 |
{ |
|
2730 |
TInt idx = ItemIndexFromMessageId( *aFocusToMessage ); |
|
2731 |
if ( idx >= 0 ) |
|
2732 |
{ |
|
2733 |
TFsTreeItemId itemId = iTreeItemArray[idx].iListItemId; |
|
2734 |
iMailList->SetFocusedItemL( itemId ); |
|
2735 |
// If contorl bar is focused, we need to hide |
|
2736 |
// focus then. |
|
2737 |
if( iFocusedControl == EControlBarComponent ) |
|
2738 |
{ |
|
2739 |
iMailTreeListVisualizer->UpdateItemL( itemId ); |
|
2740 |
} |
|
2741 |
} |
|
2742 |
} |
|
2743 |
} |
|
2744 |
||
2745 |
SetListAndCtrlBarFocusL(); |
|
2746 |
SetMskL(); |
|
2747 |
||
2748 |
iListOrderMayBeOutOfDate = EFalse; |
|
2749 |
} |
|
2750 |
||
2751 |
void CFSEmailUiMailListVisualiser::RefreshOrderL() |
|
2752 |
{ |
|
2753 |
FUNC_LOG; |
|
2754 |
if ( iTreeItemArray.Count() ) |
|
2755 |
{ |
|
2756 |
TInt itemIdxUnderNode = -1; |
|
2757 |
TInt nodeIdx = -1; |
|
2758 |
TFsTreeItemId parentNodeId = KFsTreeRootID; |
|
2759 |
||
2760 |
//iMailList->HideListL( EFalse, EFalse ); |
|
2761 |
TFsTreeItemId prevFocus = iMailList->FocusedItem(); |
|
2762 |
iMailList->SetFocusedItemL( iTreeItemArray[0].iListItemId ); // Try to prevent over indexing in generic list |
|
2763 |
||
2764 |
// iTreeItemArray is recreated on reordering. |
|
2765 |
iTreeItemArray.Reset(); |
|
2766 |
SMailListItem mailListItem; |
|
2767 |
||
2768 |
for ( TInt i = 0 ; i < iModel->Count() ; ++i ) |
|
2769 |
{ |
|
2770 |
CFSEmailUiMailListModelItem* item = static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(i) ); |
|
2771 |
TFsTreeItemId itemId = item->CorrespondingListId(); |
|
2772 |
||
2773 |
if ( item->ModelItemType() == ETypeSeparator ) |
|
2774 |
{ |
|
2775 |
nodeIdx++; |
|
2776 |
itemIdxUnderNode = -1; |
|
2777 |
parentNodeId = itemId; |
|
2778 |
if ( iMailList->ChildIndex( itemId, KFsTreeRootID ) != nodeIdx ) |
|
2779 |
{ |
|
2780 |
iMailList->MoveItemL( itemId, KFsTreeRootID, nodeIdx ); |
|
2781 |
} |
|
2782 |
} |
|
2783 |
else |
|
2784 |
{ |
|
2785 |
itemIdxUnderNode++; |
|
2786 |
if ( iMailList->Parent(itemId) != parentNodeId || |
|
2787 |
iMailList->ChildIndex( parentNodeId, itemId ) != itemIdxUnderNode ) |
|
2788 |
{ |
|
2789 |
iMailList->MoveItemL( itemId, parentNodeId, itemIdxUnderNode ); |
|
2790 |
} |
|
2791 |
} |
|
2792 |
||
2793 |
mailListItem.iListItemId = itemId; |
|
2794 |
mailListItem.iTreeItemData = &iMailList->ItemData(itemId); |
|
2795 |
mailListItem.iTreeItemVisualiser = &iMailList->ItemVisualizer(itemId); |
|
2796 |
iTreeItemArray.AppendL( mailListItem ); |
|
2797 |
} |
|
2798 |
||
2799 |
iMailList->SetFocusedItemL( prevFocus ); |
|
2800 |
//iMailList->ShowListL( EFalse, EFalse ); |
|
2801 |
} |
|
2802 |
iListOrderMayBeOutOfDate = EFalse; |
|
2803 |
} |
|
2804 |
||
2805 |
// --------------------------------------------------------------------------- |
|
2806 |
// Start refresh list items asynchronously |
|
2807 |
// |
|
2808 |
// --------------------------------------------------------------------------- |
|
2809 |
// |
|
2810 |
// |
|
2811 |
void CFSEmailUiMailListVisualiser::RefreshDeferred( TFSMailMsgId* aFocusToMessage /*= NULL*/ ) |
|
2812 |
{ |
|
2813 |
FUNC_LOG; |
|
2814 |
if ( aFocusToMessage ) |
|
2815 |
{ |
|
2816 |
iMsgToFocusAfterRedraw = *aFocusToMessage; |
|
2817 |
} |
|
2818 |
else |
|
2819 |
{ |
|
2820 |
// SetNullId sets just the null id flag, |
|
2821 |
// so we need to null the actual id manually |
|
2822 |
iMsgToFocusAfterRedraw.SetId( 0 ); |
|
2823 |
iMsgToFocusAfterRedraw.SetNullId(); |
|
2824 |
} |
|
2825 |
||
2826 |
if ( iAsyncRedrawer ) |
|
2827 |
{ |
|
2828 |
TCallBack asyncRefresh( DoRefresh, this ); |
|
2829 |
iAsyncRedrawer->Cancel(); |
|
2830 |
iAsyncRedrawer->Set( asyncRefresh ); |
|
2831 |
iAsyncRedrawer->CallBack(); |
|
2832 |
} |
|
2833 |
} |
|
2834 |
||
2835 |
// --------------------------------------------------------------------------- |
|
2836 |
// Static wrapper function for RefreshL() to enable asynchronous calling |
|
2837 |
// |
|
2838 |
// --------------------------------------------------------------------------- |
|
2839 |
// |
|
2840 |
// |
|
2841 |
TInt CFSEmailUiMailListVisualiser::DoRefresh( TAny* aSelfPtr ) |
|
2842 |
{ |
|
2843 |
FUNC_LOG; |
|
2844 |
CFSEmailUiMailListVisualiser* self = |
|
2845 |
static_cast< CFSEmailUiMailListVisualiser* >( aSelfPtr ); |
|
2846 |
TRAPD( err, self->RefreshL( &self->iMsgToFocusAfterRedraw ) ); |
|
2847 |
return err; |
|
2848 |
} |
|
2849 |
||
2850 |
// --------------------------------------------------------------------------- |
|
2851 |
// Force any pending refresh event to be completed immediately |
|
2852 |
// |
|
2853 |
// --------------------------------------------------------------------------- |
|
2854 |
// |
|
2855 |
// |
|
2856 |
void CFSEmailUiMailListVisualiser::CompletePendingRefresh() |
|
2857 |
{ |
|
2858 |
FUNC_LOG; |
|
2859 |
||
2860 |
if ( iAsyncRedrawer && iAsyncRedrawer->IsActive() ) |
|
2861 |
{ |
|
2862 |
iAsyncRedrawer->Cancel(); |
|
2863 |
DoRefresh( this ); |
|
2864 |
} |
|
2865 |
} |
|
2866 |
||
2867 |
// --------------------------------------------------------------------------- |
|
2868 |
// |
|
2869 |
// |
|
2870 |
// --------------------------------------------------------------------------- |
|
2871 |
// |
|
2872 |
void CFSEmailUiMailListVisualiser::RefreshListItemsL() |
|
2873 |
{ |
|
2874 |
FUNC_LOG; |
|
2875 |
// IMPLEMENTATION OF FILLING UP THE LIST |
|
2876 |
TFsTreeItemId latestNodeId = KFsTreeRootID; // items will go under root node if no other nodes found in the model |
|
2877 |
CFSEmailUiMailListModelItem* item( NULL ); |
|
2878 |
SetMailListItemsExtendedL(); |
|
2879 |
||
2880 |
TInt count(0); |
|
2881 |
count = iModel->Count(); |
|
2882 |
for ( TInt i=0; i < count; i++ ) |
|
2883 |
{ |
|
2884 |
item = static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
2885 |
||
2886 |
const TBool allowRefresh(i == 0 || (i == count - 1)); |
|
2887 |
||
2888 |
// Append separator item text into the list |
|
2889 |
if ( item && item->ModelItemType() == ETypeSeparator ) |
|
2890 |
{ |
|
2891 |
latestNodeId = InsertNodeItemL( i, KErrNotFound, allowRefresh ); |
|
2892 |
} |
|
2893 |
// Append mail item into the list |
|
2894 |
else if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2895 |
{ |
|
2896 |
InsertListItemL( i, latestNodeId, KErrNotFound, allowRefresh ); |
|
2897 |
} |
|
2898 |
} |
|
2899 |
} |
|
2900 |
||
2901 |
// --------------------------------------------------------------------------- |
|
2902 |
// |
|
2903 |
// |
|
2904 |
// --------------------------------------------------------------------------- |
|
2905 |
// |
|
2906 |
void CFSEmailUiMailListVisualiser::RefreshListItemsL(TFsTreeItemId& aLatestNodeId, const TInt aStartIndex, const TInt aEndIndex) |
|
2907 |
{ |
|
2908 |
FUNC_LOG; |
|
2909 |
// IMPLEMENTATION OF FILLING UP THE LIST |
|
2910 |
iMailList->BeginUpdate(); |
|
2911 |
CFSEmailUiMailListModelItem* item( NULL ); |
|
2912 |
if (aLatestNodeId == KFsTreeRootID && !aStartIndex) |
|
2913 |
{ |
|
2914 |
iMailList->RemoveAllL(); |
|
2915 |
iTreeItemArray.Reset(); |
|
2916 |
SetMailListItemsExtendedL(); |
|
2917 |
} |
|
2918 |
for ( TInt i = aStartIndex; i < aEndIndex; i++ ) |
|
2919 |
{ |
|
2920 |
item = static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
2921 |
// Append separator item text into the list |
|
2922 |
if ( item && item->ModelItemType() == ETypeSeparator ) |
|
2923 |
{ |
|
2924 |
aLatestNodeId = InsertNodeItemL( i, KErrNotFound, EFalse ); |
|
2925 |
} |
|
2926 |
// Append mail item into the list |
|
2927 |
else if ( item && item->ModelItemType() == ETypeMailItem ) |
|
2928 |
{ |
|
2929 |
InsertListItemL( i, aLatestNodeId, KErrNotFound, EFalse ); |
|
2930 |
} |
|
2931 |
} |
|
2932 |
iMailList->EndUpdateL(); |
|
2933 |
} |
|
2934 |
||
2935 |
void CFSEmailUiMailListVisualiser::SetMailListItemsExtendedL() |
|
2936 |
{ |
|
2937 |
FUNC_LOG; |
|
2938 |
// Set items always extended in double line preview on mode. |
|
2939 |
if ( iListMode == EListControlTypeDoubleLinePreviewOn || |
|
2940 |
iListMode == EListControlTypeDoubleLinePreviewOff ) |
|
2941 |
{ |
|
2942 |
if ( iMailTreeListVisualizer ) |
|
2943 |
{ |
|
2944 |
iMailTreeListVisualizer->SetItemsAlwaysExtendedL( ETrue ); |
|
2945 |
} |
|
2946 |
} |
|
2947 |
else |
|
2948 |
{ |
|
2949 |
// Set the extendedability and extended size |
|
2950 |
if ( iMailTreeListVisualizer ) |
|
2951 |
{ |
|
2952 |
iMailTreeListVisualizer->SetItemsAlwaysExtendedL( EFalse ); |
|
2953 |
} |
|
2954 |
} |
|
2955 |
} |
|
2956 |
||
2957 |
||
2958 |
// --------------------------------------------------------------------------- |
|
2959 |
// Create and insert one list node item according to given model item. |
|
2960 |
// Omitting the argument aChildIdx causes the new node to be appended as last |
|
2961 |
// child of the root node. |
|
2962 |
// --------------------------------------------------------------------------- |
|
2963 |
// |
|
2964 |
TFsTreeItemId CFSEmailUiMailListVisualiser::InsertNodeItemL( TInt aModelIndex, |
|
2965 |
TInt aChildIndex, |
|
2966 |
const TBool aAllowRefresh ) |
|
2967 |
{ |
|
2968 |
FUNC_LOG; |
|
2969 |
TFsTreeItemId nodeId; |
|
2970 |
CFsTreePlainOneLineNodeData* plainNodeData(0); |
|
2971 |
CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer(0); |
|
2972 |
||
2973 |
CFSEmailUiMailListModelItem* item = |
|
2974 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(aModelIndex) ); |
|
2975 |
||
2976 |
CreatePlainNodeL( item->SeparatorText(), plainNodeData, plainNodeVisualizer ); |
|
2977 |
CleanupStack::PushL( plainNodeData ); |
|
2978 |
CleanupStack::PushL( plainNodeVisualizer ); |
|
2979 |
// Set text aling for western or A&H layout |
|
2980 |
plainNodeVisualizer->SetTextAlign( EAlfAlignHLocale ); |
|
2981 |
//new node is expanded |
|
2982 |
plainNodeVisualizer->SetExpanded( ETrue ); |
|
2983 |
||
2984 |
// In mail list, scrollbar does not need to be updated after node, since node is always followed by item |
|
2985 |
if ( aChildIndex >= 0 ) |
|
2986 |
{ |
|
2987 |
nodeId = iMailList->InsertNodeL( *plainNodeData, *plainNodeVisualizer, KFsTreeRootID, aChildIndex, aAllowRefresh ); |
|
2988 |
} |
|
2989 |
else |
|
2990 |
{ |
|
2991 |
nodeId = iMailList->InsertNodeL( *plainNodeData, *plainNodeVisualizer, KFsTreeRootID, KErrNotFound, aAllowRefresh ); |
|
2992 |
} |
|
2993 |
||
2994 |
CleanupStack::Pop( 2, plainNodeData ); |
|
2995 |
||
2996 |
SMailListItem mailListItem; |
|
2997 |
mailListItem.iListItemId = nodeId; |
|
2998 |
mailListItem.iTreeItemData = plainNodeData; |
|
2999 |
mailListItem.iTreeItemVisualiser = plainNodeVisualizer; |
|
3000 |
iTreeItemArray.InsertL( mailListItem, aModelIndex ); |
|
3001 |
item->AddCorrespondingListId( nodeId ); |
|
3002 |
||
3003 |
return nodeId; |
|
3004 |
} |
|
3005 |
||
3006 |
// --------------------------------------------------------------------------- |
|
3007 |
// Create and insert one list item according the given model item. The item is |
|
3008 |
// added under the given node. Omitting the argument aChildIdx causes the new |
|
3009 |
// item to be appended as last child of the node. |
|
3010 |
// --------------------------------------------------------------------------- |
|
3011 |
// |
|
3012 |
TFsTreeItemId CFSEmailUiMailListVisualiser::InsertListItemL( TInt aModelIndex, |
|
3013 |
TFsTreeItemId aParentNodeId, |
|
3014 |
TInt aChildIdx, /*= KErrNotFound*/ |
|
3015 |
TBool aAllowRefresh /*= ETrue*/ ) |
|
3016 |
{ |
|
3017 |
FUNC_LOG; |
|
3018 |
CFsTreePlainTwoLineItemData* itemData = NULL; |
|
3019 |
CFsTreePlainTwoLineItemVisualizer* itemVisualizer = NULL; |
|
3020 |
CFSEmailUiMailListModelItem* item = |
|
3021 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(aModelIndex) ); |
|
3022 |
||
3023 |
// Create data |
|
3024 |
itemData = CFsTreePlainTwoLineItemData::NewL(); |
|
3025 |
CleanupStack::PushL(itemData); |
|
3026 |
||
3027 |
// Read the data from the message |
|
3028 |
UpdateItemDataL( itemData, &item->MessagePtr() ); |
|
3029 |
||
3030 |
// Set placeholder for body preview |
|
3031 |
itemData->SetPreviewPaneDataL( KMissingPreviewDataMarker ); |
|
3032 |
||
3033 |
// Create item visualiser |
|
3034 |
itemVisualizer = CFsTreePlainTwoLineItemVisualizer::NewL( |
|
3035 |
*iMailList->TreeControl() ); |
|
3036 |
CleanupStack::PushL( itemVisualizer ); |
|
3037 |
||
3038 |
itemVisualizer->SetTextAlign( EAlfAlignHLocale ); |
|
3039 |
||
3040 |
TBool previewOn = ( iListMode == EListControlTypeDoubleLinePreviewOn || |
|
3041 |
iListMode == EListControlTypeSingleLinePreviewOn ); |
|
3042 |
itemVisualizer->SetPreviewPaneOn( previewOn ); |
|
3043 |
itemVisualizer->SetExtendable( ETrue ); |
|
3044 |
||
3045 |
// Set correct skin text colors for the list items |
|
3046 |
itemVisualizer->SetFocusedStateTextColor( iFocusedTextColor ); |
|
3047 |
itemVisualizer->SetNormalStateTextColor( iNormalTextColor ); |
|
3048 |
||
3049 |
// Set font height |
|
3050 |
itemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
3051 |
||
3052 |
//Update icons and text bolding |
|
3053 |
//DOES NOT update the item - will be drawn automatically (if needed) during InsertItemL |
|
3054 |
UpdateMsgIconAndBoldingL( itemData, itemVisualizer, &item->MessagePtr() ); |
|
3055 |
||
3056 |
// Insert or append under the given node |
|
3057 |
TFsTreeItemId itemId(0); |
|
3058 |
itemId = iMailList->InsertItemL( *itemData, *itemVisualizer, aParentNodeId, aChildIdx, aAllowRefresh ); |
|
3059 |
||
3060 |
// The visualizer and data are now owned by the iMailList and should be removed from |
|
3061 |
// the cleanup stack |
|
3062 |
CleanupStack::Pop( itemVisualizer ); |
|
3063 |
CleanupStack::Pop( itemData ); |
|
3064 |
||
3065 |
// Insert corresponding item to iTreeItemArray |
|
3066 |
SMailListItem mailListItem; |
|
3067 |
mailListItem.iListItemId = itemId; |
|
3068 |
mailListItem.iTreeItemData = itemData; |
|
3069 |
mailListItem.iTreeItemVisualiser = itemVisualizer; |
|
3070 |
iTreeItemArray.InsertL( mailListItem, aModelIndex ); |
|
3071 |
item->AddCorrespondingListId( itemId ); |
|
3072 |
||
3073 |
// Updating the preview pane must be handled separately in this case; |
|
3074 |
// generic logic in TreeListEvent handler doesn't work while we are |
|
3075 |
// still in the middle of adding the item. |
|
3076 |
if ( iMailList->FocusedItem() == itemId ) |
|
3077 |
{ |
|
3078 |
UpdatePreviewPaneTextIfNecessaryL( itemId, ETrue ); |
|
3079 |
} |
|
3080 |
||
3081 |
return itemId; |
|
3082 |
} |
|
3083 |
||
3084 |
// --------------------------------------------------------------------------- |
|
3085 |
// |
|
3086 |
// |
|
3087 |
// --------------------------------------------------------------------------- |
|
3088 |
// |
|
3089 |
HBufC* CFSEmailUiMailListVisualiser::GetListFirstTextLineL( const CFSMailMessage* aMsgPtr ) |
|
3090 |
{ |
|
3091 |
FUNC_LOG; |
|
3092 |
HBufC* ret( NULL ); |
|
3093 |
||
3094 |
TDesC* displayName( NULL ); |
|
3095 |
TDesC* emailAddress( NULL ); |
|
3096 |
||
3097 |
TInt folderType( EFSInbox ); |
|
3098 |
if( iMailFolder ) |
|
3099 |
{ |
|
3100 |
folderType = iMailFolder->GetFolderType(); |
|
3101 |
} |
|
3102 |
||
3103 |
// Use sender in all other folders than outbox, sent, and drafts |
|
3104 |
if ( folderType != EFSOutbox && |
|
3105 |
folderType != EFSSentFolder && |
|
3106 |
folderType != EFSDraftsFolder ) |
|
3107 |
{ |
|
3108 |
CFSMailAddress* fromAddress = aMsgPtr->GetSender(); |
|
3109 |
if ( fromAddress ) |
|
3110 |
{ |
|
3111 |
displayName = &fromAddress->GetDisplayName(); |
|
3112 |
emailAddress = &fromAddress->GetEmailAddress(); |
|
3113 |
||
3114 |
if ( displayName && displayName->Length() != 0 ) |
|
3115 |
{ |
|
3116 |
ret = displayName->AllocL(); |
|
3117 |
} |
|
3118 |
else if ( emailAddress && emailAddress->Length() != 0 ) |
|
3119 |
{ |
|
3120 |
ret = emailAddress->AllocL(); |
|
3121 |
} |
|
3122 |
} |
|
3123 |
else // no fromAddress in that case we show "(No sender info available)", |
|
3124 |
// in case sender sends MR to himself/herself |
|
3125 |
{ |
|
3126 |
ret = StringLoader::LoadL( R_FREESTYLE_EMAIL_UI_MSG_DETAILS_NO_SENDER_INFO_AVAILABLE); |
|
3127 |
} |
|
3128 |
} |
|
3129 |
// Use first recipient in case of outgoing folders |
|
3130 |
else // folderType == EFSOutbox || folderType == EFSSentFolder || folderType == EFSDraftsFolder |
|
3131 |
{ |
|
3132 |
CFSMailMessage* msgPtr = const_cast<CFSMailMessage*>( aMsgPtr ); // there's no const function in FW to get recipient data |
|
3133 |
RPointerArray<CFSMailAddress>& toArray = msgPtr->GetToRecipients(); |
|
3134 |
if ( toArray.Count() ) |
|
3135 |
{ |
|
3136 |
CFSMailAddress* toAddress = toArray[0]; // Use first |
|
3137 |
if ( toAddress ) |
|
3138 |
{ |
|
3139 |
displayName = &toAddress->GetDisplayName(); |
|
3140 |
emailAddress = &toAddress->GetEmailAddress(); |
|
3141 |
||
3142 |
if ( displayName && displayName->Length() ) |
|
3143 |
{ |
|
3144 |
ret = displayName->AllocL(); |
|
3145 |
} |
|
3146 |
else if ( emailAddress && emailAddress->Length() ) |
|
3147 |
{ |
|
3148 |
ret = emailAddress->AllocL(); |
|
3149 |
} |
|
3150 |
} |
|
3151 |
} |
|
3152 |
} |
|
3153 |
||
3154 |
// Allocate empty string if everything else fails |
|
3155 |
if ( !ret ) |
|
3156 |
{ |
|
3157 |
ret = KNullDesC().AllocL(); |
|
3158 |
} |
|
3159 |
||
3160 |
// Drop out unwanted characters from display name such as <> and "" |
|
3161 |
TFsEmailUiUtility::StripDisplayName( *ret ); |
|
3162 |
||
3163 |
return ret; |
|
3164 |
} |
|
3165 |
||
3166 |
// --------------------------------------------------------------------------- |
|
3167 |
// |
|
3168 |
// |
|
3169 |
// --------------------------------------------------------------------------- |
|
3170 |
// |
|
3171 |
void CFSEmailUiMailListVisualiser::UpdateItemDataL( CFsTreePlainTwoLineItemData* aData, const CFSMailMessage* aMsgPtr ) |
|
3172 |
{ |
|
3173 |
FUNC_LOG; |
|
3174 |
// Set first line of data |
|
3175 |
HBufC* firstLineText = GetListFirstTextLineL( aMsgPtr ); |
|
3176 |
if ( firstLineText ) |
|
3177 |
{ |
|
3178 |
CleanupStack::PushL( firstLineText ); |
|
3179 |
aData->SetDataL( *firstLineText ); |
|
3180 |
CleanupStack::PopAndDestroy( firstLineText ); |
|
3181 |
} |
|
3182 |
else |
|
3183 |
{ |
|
3184 |
aData->SetDataL( KNullDesC ); |
|
3185 |
} |
|
3186 |
||
3187 |
// Set second line of data |
|
3188 |
HBufC* subjectText = TFsEmailUiUtility::CreateSubjectTextLC( aMsgPtr ); |
|
3189 |
aData->SetSecondaryDataL( *subjectText ); |
|
3190 |
CleanupStack::PopAndDestroy( subjectText ); |
|
3191 |
||
3192 |
// Set time item in mail |
|
3193 |
HBufC* timeText = NULL; |
|
3194 |
if ( iCurrentSortCriteria.iField == EFSMailSortByDate ) |
|
3195 |
{ |
|
3196 |
timeText = TFsEmailUiUtility::ListMsgTimeTextFromMsgLC( aMsgPtr, iNodesInUse ); |
|
3197 |
} |
|
3198 |
else |
|
3199 |
{ |
|
3200 |
// Use dates also in other sort criterias that sort by date. |
|
3201 |
timeText = TFsEmailUiUtility::ListMsgTimeTextFromMsgLC( aMsgPtr, EFalse ); |
|
3202 |
} |
|
3203 |
aData->SetDateTimeDataL( *timeText ); |
|
3204 |
CleanupStack::PopAndDestroy( timeText ); |
|
3205 |
} |
|
3206 |
||
3207 |
// --------------------------------------------------------------------------- |
|
3208 |
// |
|
3209 |
// |
|
3210 |
// --------------------------------------------------------------------------- |
|
3211 |
// |
|
3212 |
void CFSEmailUiMailListVisualiser::UpdatePreviewPaneTextForItemL( TInt aListItemId, CFSMailMessage* aMsgPtr ) |
|
3213 |
{ |
|
3214 |
FUNC_LOG; |
|
3215 |
if ( aMsgPtr && ( iListMode == EListControlTypeSingleLinePreviewOn || |
|
3216 |
iListMode == EListControlTypeDoubleLinePreviewOn ) ) |
|
3217 |
{ |
|
3218 |
CFsTreePlainTwoLineItemData* twoLineItemData = static_cast<CFsTreePlainTwoLineItemData*>( ItemDataFromItemId( aListItemId ) ); |
|
3219 |
UpdatePreviewPaneTextForItemL( twoLineItemData, aMsgPtr ); |
|
3220 |
} |
|
3221 |
} |
|
3222 |
||
3223 |
// --------------------------------------------------------------------------- |
|
3224 |
// |
|
3225 |
// |
|
3226 |
// --------------------------------------------------------------------------- |
|
3227 |
// |
|
3228 |
void CFSEmailUiMailListVisualiser::UpdatePreviewPaneTextForItemL( |
|
3229 |
CFsTreePlainTwoLineItemData* aTwoLineItemData, CFSMailMessage* aMsgPtr ) |
|
3230 |
{ |
|
3231 |
FUNC_LOG; |
|
3232 |
// Preview pane data update |
|
3233 |
if ( aTwoLineItemData && aMsgPtr && ( iListMode == EListControlTypeSingleLinePreviewOn || |
|
3234 |
iListMode == EListControlTypeDoubleLinePreviewOn ) ) |
|
3235 |
{ |
|
3236 |
TBool previewSet = EFalse; |
|
3237 |
CFSMailMessagePart* textPart = aMsgPtr->PlainTextBodyPartL(); |
|
3238 |
CleanupStack::PushL( textPart ); |
|
3239 |
if ( textPart && ( textPart->FetchLoadState() == EFSPartial || |
|
3240 |
textPart->FetchLoadState() == EFSFull ) ) |
|
3241 |
{ |
|
3242 |
TInt previewSize = Min( KMaxPreviewPaneLength, textPart->FetchedContentSize() ); |
|
3243 |
HBufC* plainTextData16 = HBufC::NewLC( previewSize ); |
|
3244 |
TPtr textPtr = plainTextData16->Des(); |
|
3245 |
||
3246 |
// Getting the content needs to be trapped as it seems to leave in some error cases |
|
3247 |
// at least with IMAP |
|
3248 |
TRAP_IGNORE( textPart->GetContentToBufferL( textPtr, 0 ) ); // Zero is start offset |
|
3249 |
// Crop out line feed, paragraph break, and tabulator |
|
3250 |
TFsEmailUiUtility::FilterListItemTextL( textPtr ); |
|
3251 |
||
3252 |
if ( textPtr.Length() ) |
|
3253 |
{ |
|
3254 |
aTwoLineItemData->SetPreviewPaneDataL( *plainTextData16 ); |
|
3255 |
previewSet = ETrue; |
|
3256 |
} |
|
3257 |
||
3258 |
CleanupStack::PopAndDestroy( plainTextData16 ); |
|
3259 |
} |
|
3260 |
||
3261 |
// Display message size in preview pane if we got no body content |
|
3262 |
if ( !previewSet ) |
|
3263 |
{ |
|
3264 |
TUint contentSize = aMsgPtr->ContentSize(); |
|
3265 |
HBufC* sizeDesc = TFsEmailUiUtility::CreateSizeDescLC( contentSize ); |
|
3266 |
HBufC* msgSizeText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_PREV_PANE_MSG_SIZE, *sizeDesc ); |
|
3267 |
aTwoLineItemData->SetPreviewPaneDataL( *msgSizeText ); |
|
3268 |
CleanupStack::PopAndDestroy( msgSizeText ); |
|
3269 |
CleanupStack::PopAndDestroy( sizeDesc ); |
|
3270 |
} |
|
3271 |
CleanupStack::PopAndDestroy( textPart ); |
|
3272 |
} |
|
3273 |
} |
|
3274 |
||
3275 |
// --------------------------------------------------------------------------- |
|
3276 |
// |
|
3277 |
// |
|
3278 |
// --------------------------------------------------------------------------- |
|
3279 |
// |
|
3280 |
void CFSEmailUiMailListVisualiser::UpdatePreviewPaneTextIfNecessaryL( TFsTreeItemId aListItemId, TBool aUpdateItem ) |
|
3281 |
{ |
|
3282 |
FUNC_LOG; |
|
3283 |
if ( iFirstStartCompleted && aListItemId != KFsTreeNoneID ) |
|
3284 |
{ |
|
3285 |
if ( iListMode == EListControlTypeSingleLinePreviewOn || |
|
3286 |
iListMode == EListControlTypeDoubleLinePreviewOn ) |
|
3287 |
{ |
|
3288 |
if ( !iMailList->IsNode( aListItemId ) ) |
|
3289 |
{ |
|
3290 |
TInt idx = ModelIndexFromListId( aListItemId ); |
|
3291 |
if ( idx != KErrNotFound ) |
|
3292 |
{ |
|
3293 |
CFsTreePlainTwoLineItemData* data = |
|
3294 |
static_cast<CFsTreePlainTwoLineItemData*>( iTreeItemArray[idx].iTreeItemData ); |
|
3295 |
if ( data->PreviewPaneData() == KMissingPreviewDataMarker ) |
|
3296 |
{ |
|
3297 |
CFSEmailUiMailListModelItem* modelItem = |
|
3298 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(idx) ); |
|
3299 |
if ( modelItem ) // For safety |
|
3300 |
{ |
|
3301 |
CFSMailMessage& msgRef = modelItem->MessagePtr(); |
|
3302 |
UpdatePreviewPaneTextForItemL( aListItemId, &msgRef ); |
|
3303 |
if ( aUpdateItem ) |
|
3304 |
{ |
|
3305 |
iMailTreeListVisualizer->UpdateItemL( aListItemId ); |
|
3306 |
} |
|
3307 |
} |
|
3308 |
} |
|
3309 |
} |
|
3310 |
} |
|
3311 |
} |
|
3312 |
} |
|
3313 |
} |
|
3314 |
||
3315 |
// --------------------------------------------------------------------------- |
|
3316 |
// |
|
3317 |
// |
|
3318 |
// --------------------------------------------------------------------------- |
|
3319 |
// |
|
3320 |
void CFSEmailUiMailListVisualiser::CreatePlainNodeL( const TDesC* aItemDataBuff, |
|
3321 |
CFsTreePlainOneLineNodeData* &aItemData, |
|
3322 |
CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const |
|
3323 |
{ |
|
3324 |
FUNC_LOG; |
|
3325 |
aItemData = CFsTreePlainOneLineNodeData::NewL(); |
|
3326 |
CleanupStack::PushL( aItemData ); |
|
3327 |
||
3328 |
aItemData->SetDataL( *aItemDataBuff ); |
|
3329 |
aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded )); |
|
3330 |
aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed )); |
|
3331 |
aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL(*iMailList->TreeControl()); |
|
3332 |
CleanupStack::PushL( aNodeVisualizer ); |
|
3333 |
TInt nodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight(); |
|
3334 |
// use cached client rect instead of iAppUi.ClientRect() to save time |
|
3335 |
// ASSERT in debug to be sure that rects are these same |
|
3336 |
__ASSERT_DEBUG( iAppUi.ClientRect() == iCurrentClientRect, User::Invariant() ); |
|
3337 |
aNodeVisualizer->SetSize( TSize(iCurrentClientRect.Width(), nodeHeight) ); |
|
3338 |
aNodeVisualizer->SetExtendable(EFalse); |
|
3339 |
// Set correct skin text colors for the list items |
|
3340 |
aNodeVisualizer->SetFocusedStateTextColor( iFocusedTextColor ); |
|
3341 |
aNodeVisualizer->SetNormalStateTextColor( iNodeTextColor ); |
|
3342 |
// Set font height |
|
3343 |
aNodeVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() ); |
|
3344 |
// Set font always bolded in nodes |
|
3345 |
aNodeVisualizer->SetTextBold( ETrue ); |
|
3346 |
||
3347 |
//<cmail> |
|
3348 |
CAlfBrush* titleDividerBgBrush = |
|
3349 |
iAppUi.FsTextureManager()->TitleDividerBgBrushL(); |
|
3350 |
// ownership is not transfered |
|
3351 |
aNodeVisualizer->SetBackgroundBrush( titleDividerBgBrush ); |
|
3352 |
//</cmail> |
|
3353 |
||
3354 |
CleanupStack::Pop( aNodeVisualizer ); |
|
3355 |
CleanupStack::Pop( aItemData ); |
|
3356 |
} |
|
3357 |
||
3358 |
// --------------------------------------------------------------------------- |
|
3359 |
// |
|
3360 |
// |
|
3361 |
// --------------------------------------------------------------------------- |
|
3362 |
// |
|
3363 |
void CFSEmailUiMailListVisualiser::HandleDynamicVariantSwitchL( |
|
3364 |
CFsEmailUiViewBase::TDynamicSwitchType aType ) |
|
3365 |
{ |
|
3366 |
FUNC_LOG; |
|
3367 |
CFsEmailUiViewBase::HandleDynamicVariantSwitchL( aType ); |
|
3368 |
||
3369 |
if ( iFirstStartCompleted ) // Safety |
|
3370 |
{ |
|
3371 |
if ( aType == EScreenLayoutChanged ) |
|
3372 |
{ |
|
3373 |
SetStatusBarLayout(); |
|
3374 |
} |
|
3375 |
||
3376 |
if ( aType == ESkinChanged ) |
|
3377 |
{ |
|
3378 |
UpdateThemeL(); |
|
3379 |
} |
|
3380 |
else |
|
3381 |
{ |
|
3382 |
iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon ); |
|
3383 |
iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) ); |
|
3384 |
iAppUi.FsTextureManager()->ClearTextureByIndex( EListTextureCreateNewMessageIcon ); |
|
3385 |
iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) ); |
|
3386 |
iAppUi.FsTextureManager()->ClearTextureByIndex( GetSortButtonTextureIndex() ); |
|
3387 |
iSortButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ) ); |
|
3388 |
||
3389 |
iMailTreeListVisualizer->HideList(); |
|
3390 |
// screen layout changed |
|
3391 |
iCurrentClientRect = iAppUi.ClientRect(); |
|
3392 |
iScreenAnchorLayout->SetSize( iCurrentClientRect.Size() ); |
|
3393 |
SetMailListLayoutAnchors(); |
|
3394 |
// Set branded watermark |
|
3395 |
SetBrandedListWatermarkL(); |
|
3396 |
iMailTreeListVisualizer->ShowListL(); |
|
3397 |
||
3398 |
ScaleControlBarL(); |
|
3399 |
SetBrandedMailBoxIconL(); |
|
3400 |
} |
|
3401 |
// Update the folder/sort popup layout in case it happened to be open |
|
3402 |
if ( iAppUi.FolderList().IsPopupShown() ) |
|
3403 |
{ |
|
3404 |
iAppUi.FolderList().HandleDynamicVariantSwitchL( aType ); |
|
3405 |
} |
|
3406 |
} |
|
3407 |
if (iMarkingMode) |
|
3408 |
{ |
|
3409 |
RefreshMarkingModeL(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
3410 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
3411 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 3412 |
} |
3413 |
||
3414 |
// --------------------------------------------------------------------------- |
|
3415 |
// |
|
3416 |
// |
|
3417 |
// --------------------------------------------------------------------------- |
|
3418 |
// |
|
3419 |
void CFSEmailUiMailListVisualiser::HandleDynamicVariantSwitchOnBackgroundL( |
|
3420 |
CFsEmailUiViewBase::TDynamicSwitchType aType ) |
|
3421 |
{ |
|
3422 |
FUNC_LOG; |
|
3423 |
CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType ); |
|
3424 |
if ( aType == ESkinChanged ) |
|
3425 |
{ |
|
3426 |
UpdateThemeL(); |
|
3427 |
} |
|
3428 |
} |
|
3429 |
||
3430 |
// --------------------------------------------------------------------------- |
|
3431 |
// |
|
3432 |
// --------------------------------------------------------------------------- |
|
3433 |
// |
|
3434 |
TBool CFSEmailUiMailListVisualiser::HitTest( |
|
3435 |
const CAlfControl& aControl, const TPoint& aPoint ) const |
|
3436 |
{ |
|
3437 |
FUNC_LOG; |
|
3438 |
TBool contains( EFalse ); |
|
3439 |
const TInt visualCount( aControl.VisualCount() ); |
|
3440 |
for( TInt index( 0 ); index < visualCount && !contains; ++index ) |
|
3441 |
{ |
|
3442 |
TRect rect( aControl.Visual( index ).DisplayRectTarget() ); |
|
3443 |
if( rect.Contains( aPoint ) ) |
|
3444 |
{ |
|
3445 |
contains = ETrue; |
|
3446 |
} |
|
3447 |
} |
|
3448 |
return contains; |
|
3449 |
} |
|
3450 |
||
3451 |
// --------------------------------------------------------------------------- |
|
3452 |
// |
|
3453 |
// --------------------------------------------------------------------------- |
|
3454 |
// |
|
3455 |
TBool CFSEmailUiMailListVisualiser::HandleArrowEventInPortraitL( |
|
3456 |
const TInt aScancode, |
|
3457 |
const TAlfEvent& aEvent, |
|
3458 |
const TBool aShiftState ) |
|
3459 |
{ |
|
3460 |
FUNC_LOG; |
|
3461 |
TBool result( EFalse ); |
|
3462 |
||
3463 |
if( aScancode == EStdKeyLeftArrow ) |
|
3464 |
{ |
|
3465 |
if( ( iControlBarControl ) && |
|
3466 |
( iFocusedControl == EMailListComponent ) ) |
|
3467 |
{ |
|
3468 |
// Move focus to control bar (focused button is |
|
3469 |
// sort button). |
|
3470 |
HandleCommandL( EFsEmailUiCmdGoToSwitchSorting ); |
|
3471 |
result = ETrue; |
|
3472 |
} |
|
3473 |
else if( ( iControlBarControl ) && |
|
3474 |
( iFocusedControl == EControlBarComponent ) ) |
|
3475 |
{ |
|
3476 |
TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
3477 |
if ( focusedButtonId == iNewEmailButtonId ) |
|
3478 |
{ |
|
3479 |
// Change focus to mail list if there are any |
|
3480 |
// emails in it. |
|
3481 |
if( iModel->Count() ) |
|
3482 |
{ |
|
3483 |
iFocusedControl = EMailListComponent; |
|
3484 |
result = EFalse; |
|
3485 |
} |
|
3486 |
// Leave focus to control bar because there are no |
|
3487 |
// mails in mail list. |
|
3488 |
else |
|
3489 |
{ |
|
3490 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3491 |
iFocusedControl = EControlBarComponent; |
|
3492 |
result = ETrue; // Do not set focus to empty list |
|
3493 |
} |
|
3494 |
} |
|
3495 |
else |
|
3496 |
{ |
|
3497 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3498 |
iFocusedControl = EControlBarComponent; |
|
3499 |
result = EFalse; |
|
3500 |
} |
|
3501 |
} |
|
3502 |
else |
|
3503 |
{ |
|
3504 |
iFocusedControl = EMailListComponent; |
|
3505 |
result = EFalse; |
|
3506 |
} |
|
3507 |
SetMskL(); |
|
3508 |
} |
|
3509 |
else if( aScancode == EStdKeyRightArrow ) |
|
3510 |
{ |
|
3511 |
// Show toolbar if there is data on the list |
|
3512 |
const TInt modelCount( iModel->Count() ); |
|
3513 |
TBool focusShown( IsFocusShown() ); |
|
3514 |
||
3515 |
// If control bar is focused. |
|
3516 |
if( ( iControlBarControl ) && |
|
3517 |
( iFocusedControl == EControlBarComponent ) ) |
|
3518 |
{ |
|
3519 |
TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
3520 |
||
3521 |
// If sort button is focused and there are mails in mail |
|
3522 |
// list then focus is moved to mail list, otherwise |
|
3523 |
// leave focus to control bar |
|
3524 |
if( focusedButtonId == iSortButtonId ) |
|
3525 |
{ |
|
3526 |
if ( modelCount > 0 ) // Check for empty folder |
|
3527 |
{ |
|
3528 |
iFocusedControl = EMailListComponent; |
|
3529 |
result = EFalse; |
|
3530 |
} |
|
3531 |
else |
|
3532 |
{ |
|
3533 |
iFocusedControl = EControlBarComponent; |
|
3534 |
iControlBarControl->MakeSelectorVisible( focusShown ); |
|
3535 |
result = ETrue; // Do not set focus to empty list |
|
3536 |
} |
|
3537 |
} |
|
3538 |
else |
|
3539 |
{ |
|
3540 |
iFocusedControl = EControlBarComponent; |
|
3541 |
iControlBarControl->MakeSelectorVisible( focusShown ); |
|
3542 |
result = EFalse; |
|
3543 |
} |
|
3544 |
} |
|
3545 |
else if( ( iControlBarControl ) && |
|
3546 |
( iFocusedControl == EMailListComponent ) ) |
|
3547 |
{ |
|
3548 |
HandleCommandL( EFsEmailUiCmdGoToSwitchNewEmail ); |
|
3549 |
result = ETrue; |
|
3550 |
} |
|
3551 |
else |
|
3552 |
{ |
|
3553 |
iFocusedControl = EMailListComponent; |
|
3554 |
result = EFalse; |
|
3555 |
} |
|
3556 |
SetMskL(); |
|
3557 |
} |
|
3558 |
else if( aScancode == EStdKeyDownArrow ) |
|
3559 |
{ |
|
3560 |
const TInt itemCount( iModel->Count() ); |
|
3561 |
if ( iFocusedControl == EMailListComponent ) |
|
3562 |
{ |
|
3563 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3564 |
if ( aShiftState ) |
|
3565 |
{ |
|
3566 |
DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
3567 |
} |
|
3568 |
} |
|
3569 |
else if( ( iFocusedControl == EControlBarComponent ) && |
|
3570 |
( itemCount == 0 ) ) |
|
3571 |
{ |
|
3572 |
result = ETrue; // Do not set focus to empty list |
|
3573 |
} |
|
3574 |
else if( ( iFocusedControl == EControlBarComponent ) && |
|
3575 |
( itemCount > 0 ) ) |
|
3576 |
{ |
|
3577 |
iFocusedControl = EMailListComponent; |
|
3578 |
||
3579 |
result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
3580 |
if ( aShiftState ) |
|
3581 |
{ |
|
3582 |
DoScrollMarkUnmarkL(); // marking is done after moving the cursor |
|
3583 |
} |
|
3584 |
} |
|
3585 |
else |
|
3586 |
{ |
|
3587 |
result = EFalse; |
|
3588 |
} |
|
3589 |
SetMskL(); |
|
3590 |
} |
|
3591 |
else if( aScancode == EStdKeyUpArrow ) |
|
3592 |
{ |
|
3593 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3594 |
if ( iFocusedControl == EMailListComponent ) |
|
3595 |
{ |
|
3596 |
if ( HighlightedIndex() == 0 ) |
|
3597 |
{ |
|
3598 |
HandleCommandL( EFsEmailUiCmdGoToSwitchFolder ); |
|
3599 |
result = ETrue; |
|
3600 |
} |
|
3601 |
else |
|
3602 |
{ |
|
3603 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3604 |
if ( aShiftState ) |
|
3605 |
{ |
|
3606 |
// marking is done after moving the cursor |
|
3607 |
DoScrollMarkUnmarkL(); |
|
3608 |
} |
|
3609 |
SetMskL(); |
|
3610 |
} |
|
3611 |
} |
|
3612 |
else if( iFocusedControl == EControlBarComponent ) |
|
3613 |
{ |
|
3614 |
result = ETrue; |
|
3615 |
} |
|
3616 |
else |
|
3617 |
{ |
|
3618 |
result = EFalse; |
|
3619 |
} |
|
3620 |
} |
|
3621 |
||
3622 |
return result; |
|
3623 |
} |
|
3624 |
||
3625 |
// --------------------------------------------------------------------------- |
|
3626 |
// |
|
3627 |
// --------------------------------------------------------------------------- |
|
3628 |
// |
|
3629 |
TBool CFSEmailUiMailListVisualiser::HandleArrowEventInLandscapeL( |
|
3630 |
const TInt aScancode, |
|
3631 |
const TAlfEvent& aEvent, |
|
3632 |
const TBool aShiftState ) |
|
3633 |
{ |
|
3634 |
FUNC_LOG; |
|
3635 |
TBool result( EFalse ); |
|
3636 |
if( aScancode == EStdKeyRightArrow ) |
|
3637 |
{ |
|
3638 |
if ( iFocusedControl == EMailListComponent ) |
|
3639 |
{ |
|
3640 |
HandleCommandL( EFsEmailUiCmdGoToSwitchFolder ); |
|
3641 |
result = ETrue; |
|
3642 |
} |
|
3643 |
else if( iFocusedControl == EControlBarComponent ) |
|
3644 |
{ |
|
3645 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3646 |
result = ETrue; |
|
3647 |
} |
|
3648 |
} |
|
3649 |
else if( aScancode == EStdKeyLeftArrow ) |
|
3650 |
{ |
|
3651 |
if ( iFocusedControl == EControlBarComponent ) |
|
3652 |
{ |
|
3653 |
const TInt modelCount( iModel->Count() ); |
|
3654 |
if( modelCount > 0 ) |
|
3655 |
{ |
|
3656 |
iFocusedControl = EMailListComponent; |
|
3657 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3658 |
if( aShiftState ) |
|
3659 |
{ |
|
3660 |
// marking is done after moving the cursor |
|
3661 |
DoScrollMarkUnmarkL(); |
|
3662 |
} |
|
3663 |
} |
|
3664 |
else |
|
3665 |
{ |
|
3666 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3667 |
// Do not set focus to empty list |
|
3668 |
result = ETrue; |
|
3669 |
} |
|
3670 |
} |
|
3671 |
else if( iFocusedControl == EMailListComponent ) |
|
3672 |
{ |
|
3673 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3674 |
if ( aShiftState ) |
|
3675 |
{ |
|
3676 |
// marking is done after moving the cursor |
|
3677 |
DoScrollMarkUnmarkL(); |
|
3678 |
} |
|
3679 |
} |
|
3680 |
SetMskL(); |
|
3681 |
} |
|
3682 |
if( aScancode == EStdKeyUpArrow ) |
|
3683 |
{ |
|
3684 |
if( iFocusedControl == EMailListComponent ) |
|
3685 |
{ |
|
3686 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3687 |
if ( aShiftState ) |
|
3688 |
{ |
|
3689 |
// marking is done after moving the cursor |
|
3690 |
DoScrollMarkUnmarkL(); |
|
3691 |
} |
|
3692 |
} |
|
3693 |
else if( iFocusedControl == EControlBarComponent ) |
|
3694 |
{ |
|
3695 |
TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
3696 |
if ( focusedButtonId == iNewEmailButtonId ) |
|
3697 |
{ |
|
3698 |
// Change focus to mail list if there are any |
|
3699 |
// mails in it. |
|
3700 |
if( iModel->Count() > 0 ) |
|
3701 |
{ |
|
3702 |
iFocusedControl = EMailListComponent; |
|
3703 |
result = EFalse; |
|
3704 |
} |
|
3705 |
// Leave focus to control bar because there are no |
|
3706 |
// mails in mail list. |
|
3707 |
else |
|
3708 |
{ |
|
3709 |
// Do not set focus to empty list |
|
3710 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3711 |
result = ETrue; |
|
3712 |
} |
|
3713 |
} |
|
3714 |
else |
|
3715 |
{ |
|
3716 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3717 |
result = static_cast<CAlfControl*>( iControlBarControl )->OfferEventL( aEvent ); |
|
3718 |
} |
|
3719 |
} |
|
3720 |
SetMskL(); |
|
3721 |
} |
|
3722 |
else if( aScancode == EStdKeyDownArrow ) |
|
3723 |
{ |
|
3724 |
if( iFocusedControl == EMailListComponent ) |
|
3725 |
{ |
|
3726 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
3727 |
if( aShiftState ) |
|
3728 |
{ |
|
3729 |
// marking is done after moving the cursor |
|
3730 |
DoScrollMarkUnmarkL(); |
|
3731 |
} |
|
3732 |
} |
|
3733 |
else if( iFocusedControl == EControlBarComponent ) |
|
3734 |
{ |
|
3735 |
const TInt modelCount( iModel->Count() ); |
|
3736 |
TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
3737 |
// If sort button is focused and there are mails in mail |
|
3738 |
// list then focus is moved to mail list, otherwise |
|
3739 |
// leave focus to control bar |
|
3740 |
if( focusedButtonId == iSortButtonId ) |
|
3741 |
{ |
|
3742 |
if ( modelCount > 0 ) // Check for empty folder |
|
3743 |
{ |
|
3744 |
iFocusedControl = EMailListComponent; |
|
3745 |
result = EFalse; |
|
3746 |
} |
|
3747 |
else |
|
3748 |
{ |
|
3749 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3750 |
result = ETrue; // Do not set focus to empty list |
|
3751 |
} |
|
3752 |
} |
|
3753 |
else |
|
3754 |
{ |
|
3755 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
3756 |
result = static_cast<CAlfControl*>( iControlBarControl )->OfferEventL( aEvent ); |
|
3757 |
} |
|
3758 |
} |
|
3759 |
SetMskL(); |
|
3760 |
} |
|
3761 |
||
3762 |
return result; |
|
3763 |
} |
|
3764 |
||
3765 |
// --------------------------------------------------------------------------- |
|
3766 |
// |
|
3767 |
// --------------------------------------------------------------------------- |
|
3768 |
// |
|
3769 |
void CFSEmailUiMailListVisualiser::UpdateThemeL(const TBool aSystemUpdate) |
|
3770 |
{ |
|
3771 |
iSkinChanged = iSkinChanged || aSystemUpdate; |
|
3772 |
||
3773 |
iFocusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor(); |
|
3774 |
iNormalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor(); |
|
3775 |
iNodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor(); |
|
3776 |
||
3777 |
iNewEmailButton->SetNormalTextColor( iNormalTextColor ); |
|
3778 |
iNewEmailButton->SetFocusedTextColor( iFocusedTextColor ); |
|
3779 |
||
3780 |
iFolderListButton->SetNormalTextColor( iNormalTextColor ); |
|
3781 |
iFolderListButton->SetFocusedTextColor( iFocusedTextColor ); |
|
3782 |
||
3783 |
iSortButton->SetNormalTextColor( iNormalTextColor ); |
|
3784 |
iSortButton->SetFocusedTextColor( iFocusedTextColor ); |
|
3785 |
||
3786 |
//sometimes theme wasn't properly refreshed on buttons, this helps |
|
3787 |
iNewEmailButton->HideButton(); |
|
3788 |
iNewEmailButton->ShowButtonL(); |
|
3789 |
||
3790 |
iFolderListButton->HideButton(); |
|
3791 |
iFolderListButton->ShowButtonL(); |
|
3792 |
||
3793 |
iSortButton->HideButton(); |
|
3794 |
iSortButton->ShowButtonL(); |
|
3795 |
} |
|
3796 |
||
3797 |
// --------------------------------------------------------------------------- |
|
3798 |
// HandleForegroundEventL |
|
3799 |
// Function checks in foregroundevent that whether settings have changed and |
|
3800 |
// If there is a need to refresh the list. |
|
3801 |
// --------------------------------------------------------------------------- |
|
3802 |
// |
|
3803 |
void CFSEmailUiMailListVisualiser::HandleForegroundEventL( TBool aForeground ) |
|
3804 |
{ |
|
3805 |
FUNC_LOG; |
|
3806 |
if( iMailFolder ) |
|
3807 |
{ |
|
3808 |
//emailindicator handling, is removed from 9.2 |
|
3809 |
//TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( iMailFolder->GetMailBoxId().Id())); |
|
3810 |
//Update mailbox widget index status in homescreen |
|
3811 |
TFsEmailUiUtility::ToggleEmailIconL(EFalse, iMailFolder->GetMailBoxId() ); |
|
3812 |
} |
|
3813 |
||
3814 |
if ( aForeground && iFirstStartCompleted ) // Safety |
|
3815 |
{ |
|
3816 |
// Update mail list settings and date formats, is done every time |
|
3817 |
// the user might have changed these in settings, so the list needs to refresh |
|
3818 |
// Store previous modes |
|
3819 |
TInt prevListMode = iListMode; |
|
3820 |
TInt prevNodesmode = iNodesInUse; |
|
3821 |
TAknUiZoom prevZoomLevel = iCurrentZoomLevel; |
|
3822 |
STimeDateFormats prevDateFormats = MailListTimeDateSettings(); |
|
3823 |
||
3824 |
// Get new settings and list drawing modes |
|
3825 |
CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel ); |
|
3826 |
UpdateMailListSettingsL(); |
|
3827 |
UpdateMailListTimeDateSettings(); |
|
3828 |
||
3829 |
// Check sync icon timer and sync status |
|
3830 |
ConnectionIconHandling(); |
|
3831 |
||
3832 |
// Updates the folder list's size after the screensaver |
|
3833 |
iAppUi.FolderList().HandleForegroundEventL(); |
|
3834 |
||
3835 |
// Check for changed settings, in that case a complete list refresh is needed |
|
3836 |
if ( iSkinChanged |
|
3837 |
|| iDateChanged |
|
3838 |
|| iListMode != prevListMode |
|
3839 |
|| iNodesInUse != prevNodesmode |
|
3840 |
|| iCurrentZoomLevel != prevZoomLevel |
|
3841 |
|| prevDateFormats.iDateFormat != iDateFormats.iDateFormat |
|
3842 |
|| prevDateFormats.iTimeFormat != iDateFormats.iTimeFormat |
|
3843 |
|| prevDateFormats.iAmPmPosition != iDateFormats.iAmPmPosition |
|
3844 |
|| prevDateFormats.iDateSeparator != iDateFormats.iDateSeparator |
|
3845 |
|| prevDateFormats.iTimeSeparator != iDateFormats.iTimeSeparator ) |
|
3846 |
{ |
|
3847 |
// Store the list of marked items. The markings are erased when the list |
|
3848 |
// is repopulated and, hence, the markings need to be reset after the |
|
3849 |
// refreshing is done. The marked items must be identified by the message |
|
3850 |
// ID rather than with the list ID because refreshing may change the list IDs. |
|
3851 |
RArray<TFSMailMsgId> markedMessages; |
|
3852 |
CleanupClosePushL( markedMessages ); |
|
3853 |
GetMarkedMessagesL( markedMessages ); |
|
3854 |
// Store the message ID of the focused item |
|
3855 |
TFSMailMsgId msgIdBeforeRefresh = MsgIdFromListId( iMailList->FocusedItem() ); |
|
3856 |
TFsTreeItemId firstVisibleListId = iMailTreeListVisualizer->FirstVisibleItem(); |
|
3857 |
TInt modelFirstIndexBeforeUpdate = ModelIndexFromListId( firstVisibleListId ); |
|
3858 |
TInt highlightedIndexBeforeUpdate = HighlightedIndex(); |
|
3859 |
TInt modelCountBeforeUpdate = iModel->Count(); |
|
3860 |
||
3861 |
UpdateMailListModelL(); |
|
3862 |
if ( markedMessages.Count() ) |
|
3863 |
{ |
|
3864 |
RefreshL( &msgIdBeforeRefresh ); |
|
3865 |
// Restore the marking status |
|
3866 |
MarkMessagesIfFoundL( markedMessages ); |
|
3867 |
} |
|
3868 |
else |
|
3869 |
{ |
|
3870 |
RefreshDeferred( &msgIdBeforeRefresh ); |
|
3871 |
} |
|
3872 |
CleanupStack::PopAndDestroy( &markedMessages ); |
|
3873 |
iSkinChanged = EFalse; // Toggle handled |
|
3874 |
iDateChanged = EFalse; // Toggle handled |
|
3875 |
} |
|
3876 |
if (iMarkingMode) |
|
3877 |
{ |
|
3878 |
RefreshMarkingModeL(); |
|
3879 |
} |
|
3880 |
} |
|
3881 |
} |
|
3882 |
||
3883 |
||
3884 |
// --------------------------------------------------------------------------- |
|
3885 |
// |
|
3886 |
// |
|
3887 |
// --------------------------------------------------------------------------- |
|
3888 |
// |
|
3889 |
void CFSEmailUiMailListVisualiser::HandleCommandL( TInt aCommand ) |
|
3890 |
{ |
|
3891 |
FUNC_LOG; |
|
3892 |
TIMESTAMP( "Message list command for handling" ); |
|
3893 |
CompletePendingRefresh(); |
|
3894 |
||
3895 |
// custom command handling for launching plugin settings |
|
3896 |
if ( EFsEmailUiCmdSettingsBaseCommandId <= aCommand |
|
3897 |
&& EFsEmailUiCmdSettingsBaseCommandIdMax > aCommand ) |
|
3898 |
{ |
|
3899 |
CESMailSettingsPlugin::TSubViewActivationData activationData; |
|
3900 |
activationData.iAccount = iAppUi.GetActiveMailbox()->GetId(); |
|
3901 |
// which settings plugin subview will be activated |
|
3902 |
TInt selectedCommand = aCommand - EFsEmailUiCmdSettingsBaseCommandId; |
|
3903 |
activationData.iSubviewId = selectedCommand; |
|
3904 |
||
3905 |
TUid pluginUid = iAppUi.GetActiveMailbox()->GetSettingsUid(); |
|
3906 |
||
3907 |
// If plugin view does not exist, create and register it to app ui. |
|
3908 |
if ( !iAppUi.View( pluginUid ) ) |
|
3909 |
{ |
|
3910 |
CESMailSettingsPlugin* plugin = CESMailSettingsPlugin::NewL( pluginUid ); |
|
3911 |
CleanupStack::PushL( plugin ); |
|
3912 |
iAppUi.AddViewL( plugin ); // Ownership is transferred. |
|
3913 |
CleanupStack::Pop( plugin ); |
|
3914 |
} |
|
3915 |
TUid messageId = TUid::Uid( CESMailSettingsPlugin::EActivateMailSettingsSubview ); |
|
3916 |
const TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> pluginMessagePkg( activationData ); |
|
3917 |
||
3918 |
StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
3919 |
iAppUi.EnterPluginSettingsViewL( pluginUid, messageId, pluginMessagePkg ); |
|
3920 |
} |
|
3921 |
||
3922 |
// Many commands may be targetted either to the focused item or to the marked item(s). |
|
3923 |
// Get list of marked or focused items. |
|
3924 |
RFsTreeItemIdList actionTargetItems; |
|
3925 |
CleanupClosePushL( actionTargetItems ); |
|
3926 |
GetActionsTargetEntriesL( actionTargetItems ); |
|
3927 |
||
3928 |
// Check if the focus needs to be removed. |
|
3929 |
if ( ( iStylusPopUpMenuVisible ) && |
|
3930 |
( aCommand == KErrCancel || |
|
3931 |
aCommand == EFsEmailUiCmdActionsDelete || |
|
3932 |
aCommand == EFsEmailUiCmdMarkAsRead || |
|
3933 |
aCommand == EFsEmailUiCmdMarkAsUnread || |
|
3934 |
aCommand == EFsEmailUiCmdActionsMove || |
|
3935 |
aCommand == EFsEmailUiCmdActionsMoveMessage || |
|
3936 |
aCommand == EFsEmailUiCmdMarkingModeFromPopUp || |
|
3937 |
aCommand == EFsEmailUiCmdActionsCollapseAll || |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
3938 |
aCommand == EFsEmailUiCmdActionsExpandAll || |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
3939 |
aCommand == EFsEmailUiCmdActionsFlag ) ) |
25 | 3940 |
{ |
3941 |
// We end up here if the user selects an option from the pop up menu |
|
3942 |
// or exits the menu by tapping outside of it's area. |
|
3943 |
// Remove the focus from a list item if an item is focused. |
|
3944 |
iStylusPopUpMenuVisible = EFalse; |
|
3945 |
iAppUi.SetFocusVisibility( EFalse ); |
|
3946 |
} |
|
3947 |
||
3948 |
switch( aCommand ) |
|
3949 |
{ |
|
3950 |
case EAknSoftkeyOpen: |
|
3951 |
{ |
|
3952 |
TIMESTAMP( "Open email selected from message list" ); |
|
3953 |
if( !iAppUi.IsFocusShown() ) |
|
3954 |
{ |
|
3955 |
iAppUi.SetFocusVisibility( ETrue ); |
|
3956 |
break; |
|
3957 |
} |
|
3958 |
} |
|
3959 |
case EAknSoftkeySelect: |
|
3960 |
{ |
|
3961 |
TIMESTAMP( "Open email selected from message list" ); |
|
3962 |
if ( iFocusedControl == EMailListComponent ) |
|
3963 |
{ |
|
3964 |
CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
3965 |
// MAIL ITEM; OPEN MAIL |
|
3966 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
3967 |
{ |
|
3968 |
CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
3969 |
if ( messagePtr ) |
|
3970 |
{ |
|
3971 |
OpenHighlightedMailL(); |
|
3972 |
} |
|
3973 |
} |
|
3974 |
} |
|
3975 |
} |
|
3976 |
break; |
|
3977 |
case EAknSoftkeyChange: |
|
3978 |
{ |
|
3979 |
if( !iAppUi.IsFocusShown() ) |
|
3980 |
{ |
|
3981 |
iAppUi.SetFocusVisibility( ETrue ); |
|
3982 |
break; |
|
3983 |
} |
|
3984 |
if( iFocusedControl == EControlBarComponent ) |
|
3985 |
{ |
|
3986 |
TInt focusedButtonId = iControlBarControl->GetFocusedButton()->Id(); |
|
3987 |
if ( focusedButtonId == iFolderListButtonId ) |
|
3988 |
{ |
|
3989 |
//<cmail> |
|
3990 |
//Set touchmanager not active for preventing getting events. |
|
3991 |
DisableMailList(ETrue); |
|
3992 |
//</cmail> |
|
3993 |
iAppUi.ShowFolderListInPopupL( FolderId(), this, iFolderListButton ); |
|
3994 |
} |
|
3995 |
else if( focusedButtonId == iSortButtonId ) |
|
3996 |
{ |
|
3997 |
TFSFolderType folderType; |
|
3998 |
if( iMailFolder ) |
|
3999 |
{ |
|
4000 |
folderType = iMailFolder->GetFolderType(); |
|
4001 |
} |
|
4002 |
else |
|
4003 |
{ |
|
4004 |
folderType = EFSInbox; |
|
4005 |
} |
|
4006 |
// <cmail> Sorting set possible even for empty mailbox |
|
4007 |
// Show sort if model has data. |
|
4008 |
//if ( iModel->Count() ) |
|
4009 |
// { |
|
4010 |
// </cmail> |
|
4011 |
//<cmail> |
|
4012 |
//Set touchmanager not active for preventing getting events. |
|
4013 |
DisableMailList(ETrue); |
|
4014 |
//</cmail> |
|
4015 |
iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
|
4016 |
// <cmail> |
|
4017 |
// } |
|
4018 |
// </cmail> |
|
4019 |
} |
|
4020 |
} |
|
4021 |
} |
|
4022 |
break; |
|
4023 |
case EAknSoftkeyBack: |
|
4024 |
if ( !iAppUi.ViewSwitchingOngoing() ) |
|
4025 |
{ |
|
4026 |
NavigateBackL(); |
|
4027 |
} |
|
4028 |
break; |
|
4029 |
case EAknSoftkeyCancel: |
|
4030 |
if (iMarkingMode) |
|
4031 |
{ |
|
4032 |
ExitMarkingModeL(); |
|
4033 |
} |
|
4034 |
break; |
|
4035 |
case EEikCmdExit: |
|
4036 |
case EAknSoftkeyExit: |
|
4037 |
case EFsEmailUiCmdExit: |
|
4038 |
TIMESTAMP( "Exit selected from message list" ); |
|
4039 |
iAppUi.Exit(); |
|
4040 |
break; |
|
4041 |
case EFsEmailUiCmdCalActionsReplyAsMail: |
|
4042 |
case EFsEmailUiCmdActionsReply: |
|
4043 |
{ |
|
4044 |
TIMESTAMP( "Reply to selected from message list" ); |
|
4045 |
ReplyL( NULL ); // Function will check marked/highlighted msg |
|
4046 |
} |
|
4047 |
break; |
|
4048 |
case EFsEmailUiCmdActionsReplyAll: |
|
4049 |
{ |
|
4050 |
TIMESTAMP( "Reply to all selected from message list" ); |
|
4051 |
ReplyAllL( NULL ); // Function will check marked/highlighted msg |
|
4052 |
} |
|
4053 |
break; |
|
4054 |
case EFsEmailUiCmdCalActionsForwardAsMail: |
|
4055 |
case EFsEmailUiCmdActionsForward: |
|
4056 |
{ |
|
4057 |
TIMESTAMP( "Forward selected from message list" ); |
|
4058 |
ForwardL( NULL ); // Function will check marked/highlighted msg |
|
4059 |
} |
|
4060 |
break; |
|
4061 |
case EFsEmailUiCmdActionsCallSender: |
|
4062 |
{ |
|
4063 |
if ( !iAppUi.ViewSwitchingOngoing() ) |
|
4064 |
{ |
|
4065 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
|
4066 |
iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
4067 |
{ |
|
4068 |
// Calling can happen only when there's exactly one message marked or in focus |
|
4069 |
if ( actionTargetItems.Count() == 1 ) |
|
4070 |
{ |
|
4071 |
CFSMailMessage& message = MsgPtrFromListIdL( actionTargetItems[0] ); |
|
4072 |
CFSMailAddress* fromAddress = message.GetSender(); |
|
4073 |
TDesC* mailAddress(0); |
|
4074 |
if ( fromAddress ) |
|
4075 |
{ |
|
4076 |
mailAddress = &fromAddress->GetEmailAddress(); |
|
4077 |
} |
|
4078 |
if ( mailAddress && mailAddress->Length() ) |
|
4079 |
{ |
|
4080 |
if ( iMailFolder->GetFolderType() == EFSSentFolder ) |
|
4081 |
{ |
|
4082 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( |
|
4083 |
*mailAddress, iAppUi.GetActiveMailbox(), this, EFalse ); |
|
4084 |
} |
|
4085 |
else |
|
4086 |
{ |
|
4087 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( |
|
4088 |
*mailAddress, iAppUi.GetActiveMailbox(), this, ETrue ); |
|
4089 |
} |
|
4090 |
} |
|
4091 |
} |
|
4092 |
} |
|
4093 |
} |
|
4094 |
} |
|
4095 |
break; |
|
4096 |
case EFsEmailUiCmdMarkAsRead: |
|
4097 |
{ |
|
4098 |
// Change status of marked or highlighted |
|
4099 |
if ( CountMarkedItemsL() ) |
|
4100 |
{ |
|
4101 |
ChangeReadStatusOfMarkedL( ETrue ); |
|
4102 |
} |
|
4103 |
else |
|
4104 |
{ |
|
4105 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
4106 |
} |
|
4107 |
} |
|
4108 |
break; |
|
4109 |
case EFsEmailUiCmdMarkAsUnread: |
|
4110 |
{ |
|
4111 |
// Change status of marked or highlighted |
|
4112 |
if ( CountMarkedItemsL() ) |
|
4113 |
{ |
|
4114 |
ChangeReadStatusOfMarkedL( EFalse ); |
|
4115 |
} |
|
4116 |
else |
|
4117 |
{ |
|
4118 |
ChangeReadStatusOfHighlightedL( EFalse ); |
|
4119 |
} |
|
4120 |
} |
|
4121 |
break; |
|
4122 |
case EFsEmailUiCmdGoToTop: |
|
4123 |
{ |
|
4124 |
// Safety check, ignore command if the list is empty |
|
4125 |
if( iTreeItemArray.Count() ) |
|
4126 |
{ |
|
4127 |
if ( iFocusedControl != EMailListComponent ) |
|
4128 |
{ |
|
4129 |
iFocusedControl = EMailListComponent; |
|
4130 |
iMailList->SetFocusedL( ETrue ); |
|
4131 |
iControlBarControl->SetFocusL( EFalse ); |
|
4132 |
} |
|
4133 |
// No need to check for nodes as in move to bottom. |
|
4134 |
iMailTreeListVisualizer->SetFocusedItemL( iTreeItemArray[0].iListItemId ); |
|
4135 |
} |
|
4136 |
} |
|
4137 |
break; |
|
4138 |
case EFsEmailUiCmdGoToBottom: |
|
4139 |
{ |
|
4140 |
// Safety check, ignore command if the list is empty |
|
4141 |
if( iTreeItemArray.Count() ) |
|
4142 |
{ |
|
4143 |
if ( iFocusedControl != EMailListComponent ) |
|
4144 |
{ |
|
4145 |
iFocusedControl = EMailListComponent; |
|
4146 |
iMailList->SetFocusedL( ETrue ); |
|
4147 |
iControlBarControl->SetFocusL( EFalse ); |
|
4148 |
} |
|
4149 |
||
4150 |
TFsTreeItemId bottomItem = iTreeItemArray[iTreeItemArray.Count()-1].iListItemId; |
|
4151 |
TFsTreeItemId parentItem = ParentNode( bottomItem ); // parent node of the bottom item |
|
4152 |
||
4153 |
// Check whether the parent is node and is collapsed |
|
4154 |
if ( parentItem>0 && !iMailList->IsExpanded( parentItem ) ) |
|
4155 |
{ |
|
4156 |
bottomItem = parentItem; |
|
4157 |
} |
|
4158 |
iMailTreeListVisualizer->SetFocusedItemL( bottomItem ); |
|
4159 |
} |
|
4160 |
} |
|
4161 |
break; |
|
4162 |
case EFsEmailUiCmdPageUp: |
|
4163 |
{ |
|
4164 |
TKeyEvent simEvent = { EKeyPageUp, EStdKeyPageUp, 0, 0 }; |
|
4165 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
4166 |
} |
|
4167 |
break; |
|
4168 |
case EFsEmailUiCmdPageDown: |
|
4169 |
{ |
|
4170 |
TKeyEvent simEvent = { EKeyPageDown, EStdKeyPageDown, 0, 0 }; |
|
4171 |
iCoeEnv->SimulateKeyEventL( simEvent, EEventKey ); |
|
4172 |
} |
|
4173 |
break; |
|
4174 |
case EFsEmailUiCmdActionsDeleteCalEvent: |
|
4175 |
case EFsEmailUiCmdActionsDelete: |
|
4176 |
{ |
|
4177 |
TIMESTAMP( "Delete to selected from message list" ); |
|
4178 |
TInt index = HighlightedIndex(); |
|
4179 |
CFSEmailUiMailListModelItem* item = |
|
4180 |
dynamic_cast<CFSEmailUiMailListModelItem*>( |
|
4181 |
iModel->Item( index ) ); |
|
4182 |
||
4183 |
// If selected item is separator (divider) mark/unmark all messages |
|
4184 |
// under it. |
|
4185 |
||
4186 |
// Delete message only if mail list component is focused |
|
4187 |
// or if there are some marked items |
|
4188 |
TInt markedItems( CountMarkedItemsL() ); |
|
4189 |
const TBool isNode(iMailList->IsNode(iMailList->FocusedItem())); |
|
4190 |
if (iFocusedControl == EMailListComponent || markedItems |
|
4191 |
|| isNode) |
|
4192 |
{ |
|
4193 |
DeleteMessagesL(); |
|
4194 |
} |
|
4195 |
} |
|
4196 |
break; |
|
4197 |
case EFsEmailUiCmdCompose: |
|
4198 |
{ |
|
4199 |
// Switching to another view can take some time and this view |
|
4200 |
// can still receive some commands - so ignore them. |
|
4201 |
if ( iAppUi.CurrentActiveView() == this ) |
|
4202 |
{ |
|
4203 |
TIMESTAMP( "Create new message selected from message list" ); |
|
4204 |
CreateNewMsgL(); |
|
4205 |
} |
|
4206 |
} |
|
4207 |
break; |
|
4208 |
case EFsEmailUiCmdMessageDetails: |
|
4209 |
{ |
|
4210 |
// Message details can be viewed only when there's exactly one message marked or in focus |
|
4211 |
if ( actionTargetItems.Count() == 1 ) |
|
4212 |
{ |
|
4213 |
CFSMailMessage& message = MsgPtrFromListIdL( actionTargetItems[0] ); |
|
4214 |
TMsgDetailsActivationData msgDetailsData; |
|
4215 |
msgDetailsData.iMailBoxId = iAppUi.GetActiveMailboxId(); |
|
4216 |
msgDetailsData.iFolderId = FolderId(); |
|
4217 |
msgDetailsData.iMessageId = message.GetMessageId(); |
|
4218 |
const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData ); |
|
4219 |
iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning, pkgOut ); |
|
4220 |
} |
|
4221 |
} |
|
4222 |
break; |
|
4223 |
case EFsEmailUiCmdSettingsGlobal: |
|
4224 |
{ |
|
4225 |
iAppUi.EnterFsEmailViewL( GlobalSettingsViewId ); |
|
4226 |
} |
|
4227 |
break; |
|
4228 |
case EFsEmailUiCmdSettingsService: |
|
4229 |
case EFsEmailUiCmdSettingsMailbox: |
|
4230 |
{ |
|
4231 |
CESMailSettingsPlugin::TSubViewActivationData activationData; |
|
4232 |
activationData.iAccount = iAppUi.GetActiveMailbox()->GetId(); |
|
4233 |
activationData.iSubviewId = 0; |
|
4234 |
if ( EFsEmailUiCmdSettingsService == aCommand ) |
|
4235 |
{ |
|
4236 |
activationData.iSubviewId = 1; |
|
4237 |
} |
|
4238 |
||
4239 |
TUid pluginUid = iAppUi.GetActiveMailbox()->GetSettingsUid(); |
|
4240 |
// register plugin view if not exists so that activation can be made |
|
4241 |
if ( !iAppUi.View( pluginUid ) ) |
|
4242 |
{ |
|
4243 |
CESMailSettingsPlugin* plugin = CESMailSettingsPlugin::NewL( pluginUid ); |
|
4244 |
CleanupStack::PushL( plugin ); |
|
4245 |
iAppUi.AddViewL( plugin ); |
|
4246 |
CleanupStack::Pop( plugin ); |
|
4247 |
} |
|
4248 |
TUid messageId = TUid::Uid( CESMailSettingsPlugin::EActivateMailSettingsSubview ); |
|
4249 |
const TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> pluginMessagePkg( activationData ); |
|
4250 |
iAppUi.EnterPluginSettingsViewL( pluginUid, messageId, pluginMessagePkg ); |
|
4251 |
} |
|
4252 |
break; |
|
4253 |
case EFsEmailUiCmdOpen: |
|
4254 |
case EFsEmailUiCmdActionsOpen: |
|
4255 |
{ |
|
4256 |
TIMESTAMP( "Open email selected from message list" ); |
|
4257 |
if ( iFocusedControl == EMailListComponent ) |
|
4258 |
{ |
|
4259 |
// Opening can happen only when there's exactly one message marked or in focus |
|
4260 |
if ( actionTargetItems.Count() == 1 ) |
|
4261 |
{ |
|
4262 |
OpenMailItemL( actionTargetItems[0] ); |
|
4263 |
} |
|
4264 |
} |
|
4265 |
} |
|
4266 |
break; |
|
4267 |
case EFsEmailUiCmdActionsFlag: |
|
4268 |
{ |
|
4269 |
SetMessageFollowupFlagL(); |
|
4270 |
} |
|
4271 |
break; |
|
4272 |
case EFsEmailUiCmdActionsCollapseAll: |
|
4273 |
// Safety check, ignore command if the list is empty |
|
4274 |
if( iMailList->Count() ) |
|
4275 |
{ |
|
4276 |
CollapseAllNodesL(); |
|
4277 |
} |
|
4278 |
break; |
|
4279 |
case EFsEmailUiCmdActionsExpandAll: |
|
4280 |
// Safety check, ignore command if the list is empty |
|
4281 |
if( iMailList->Count() ) |
|
4282 |
{ |
|
4283 |
ExpandAllNodesL(); |
|
4284 |
} |
|
4285 |
break; |
|
4286 |
case EFsEmailUiCmdCollapse: |
|
4287 |
if( !iAppUi.IsFocusShown() ) |
|
4288 |
{ |
|
4289 |
iAppUi.SetFocusVisibility( ETrue ); |
|
4290 |
break; |
|
4291 |
} |
|
4292 |
// Safety check, ignore command if the list is empty |
|
4293 |
if( iMailList->Count() ) |
|
4294 |
{ |
|
4295 |
ExpandOrCollapseL(); |
|
4296 |
} |
|
4297 |
break; |
|
4298 |
case EFsEmailUiCmdExpand: |
|
4299 |
if( !iAppUi.IsFocusShown() ) |
|
4300 |
{ |
|
4301 |
iAppUi.SetFocusVisibility( ETrue ); |
|
4302 |
break; |
|
4303 |
} |
|
4304 |
// Safety check, ignore command if the list is empty |
|
4305 |
if( iMailList->Count() ) |
|
4306 |
{ |
|
4307 |
ExpandOrCollapseL(); |
|
4308 |
} |
|
4309 |
break; |
|
4310 |
case EFsEmailUiCmdSearch: |
|
4311 |
{ |
|
4312 |
TSearchListActivationData tmp; |
|
4313 |
tmp.iMailBoxId = iAppUi.GetActiveMailbox()->GetId(); |
|
4314 |
const TPckgBuf<TSearchListActivationData> pkgOut( tmp ); |
|
4315 |
iAppUi.EnterFsEmailViewL( SearchListViewId, KStartNewSearch, pkgOut ); |
|
4316 |
} |
|
4317 |
break; |
|
4318 |
// <cmail> Prevent Download Manager opening with attachments |
|
4319 |
// case EFsEmailUiCmdDownloadManager: |
|
4320 |
// iAppUi.EnterFsEmailViewL( DownloadManagerViewId ); |
|
4321 |
// break; |
|
4322 |
// </cmail> |
|
4323 |
case EFsEmailUiCmdMarkingModeFromPopUp: |
|
4324 |
{ |
|
4325 |
EnterMarkingModeL(); |
|
4326 |
// Mark current item first |
|
4327 |
TInt focusedItem = iMailList->FocusedItem(); |
|
4328 |
if ( focusedItem > 0 && iFocusedControl == EMailListComponent ) |
|
4329 |
{ |
|
4330 |
CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex())); |
|
4331 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
4332 |
{ |
|
4333 |
iMailList->MarkItemL( iMailList->FocusedItem(), ETrue ); |
|
4334 |
} |
|
4335 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
4336 |
{ |
|
4337 |
TInt index = HighlightedIndex(); |
|
4338 |
MarkItemsUnderSeparatorL( ETrue, index ); |
|
4339 |
} |
|
4340 |
} |
|
4341 |
} |
|
4342 |
break; |
|
4343 |
case EFsEmailUiCmdMarkingMode: |
|
4344 |
{ |
|
4345 |
EnterMarkingModeL(); |
|
4346 |
} |
|
4347 |
break; |
|
4348 |
case EFsEmailUiCmdMarkingModeDelete: |
|
4349 |
{ |
|
4350 |
DeleteMessagesL(); |
|
4351 |
} |
|
4352 |
break; |
|
4353 |
case EFsEmailUiCmdMarkingModeUnread: |
|
4354 |
{ |
|
4355 |
ChangeReadStatusOfMarkedL( EFalse ); |
|
4356 |
ExitMarkingModeL(); |
|
4357 |
} |
|
4358 |
break; |
|
4359 |
case EFsEmailUiCmdMarkingModeRead: |
|
4360 |
{ |
|
4361 |
ChangeReadStatusOfMarkedL( ETrue ); |
|
4362 |
ExitMarkingModeL(); |
|
4363 |
} |
|
4364 |
break; |
|
4365 |
case EFsEmailUiCmdMarkingModeFollowUp: |
|
4366 |
{ |
|
4367 |
SetMessageFollowupFlagL(); |
|
4368 |
} |
|
4369 |
break; |
|
4370 |
case EFsEmailUiCmdMarkingModeMarkAll: |
|
4371 |
{ |
|
4372 |
MarkAllItemsL(); |
|
4373 |
} |
|
4374 |
break; |
|
4375 |
case EFsEmailUiCmdMarkingModeUnmarkAll: |
|
4376 |
{ |
|
4377 |
UnmarkAllItemsL(); |
|
4378 |
} |
|
4379 |
break; |
|
4380 |
case EFsEmailUiCmdReadEmail: |
|
4381 |
{ |
|
4382 |
iAppUi.StartReadingEmailsL(); |
|
4383 |
} |
|
4384 |
break; |
|
4385 |
case EFsEmailUiCmdSync: |
|
4386 |
{ |
|
4387 |
TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync ); |
|
4388 |
if ( supportsSync ) |
|
4389 |
{ |
|
4390 |
// If synchronizing is ongoing and a new sync is started we ignore it |
|
4391 |
if( !GetLatestSyncState() ) |
|
4392 |
{ |
|
4393 |
iAppUi.SyncActiveMailBoxL(); |
|
4394 |
// Sync was started by the user |
|
4395 |
ManualMailBoxSync( ETrue ); |
|
4396 |
} |
|
4397 |
} |
|
4398 |
else |
|
4399 |
{ |
|
4400 |
//POP3 synchronise |
|
4401 |
iAppUi.DoAutoConnectL(); |
|
4402 |
} |
|
4403 |
} |
|
4404 |
break; |
|
4405 |
case EFsEmailUiCmdCancelSync: |
|
4406 |
{ |
|
4407 |
if ( GetLatestSyncState() ) |
|
4408 |
{ |
|
4409 |
iAppUi.StopActiveMailBoxSyncL(); |
|
4410 |
} |
|
4411 |
} |
|
4412 |
break; |
|
4413 |
case EFsEmailUiCmdGoOffline: |
|
4414 |
{ |
|
4415 |
iAppUi.GetActiveMailbox()->GoOfflineL(); |
|
4416 |
} |
|
4417 |
break; |
|
4418 |
case EFsEmailUiCmdGoOnline: |
|
4419 |
{ |
|
4420 |
CFSMailBox* mb = iAppUi.GetActiveMailbox(); |
|
4421 |
mb->GoOnlineL(); |
|
4422 |
} |
|
4423 |
break; |
|
4424 |
case EFsEmailUiCmdHelp: |
|
4425 |
{ |
|
4426 |
||
4427 |
TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID ); |
|
4428 |
} |
|
4429 |
break; |
|
4430 |
||
4431 |
||
4432 |
case EFsEmailUiCmdActionsAddContact: |
|
4433 |
{ |
|
4434 |
// contact can be got from message only when there's exactly one target message |
|
4435 |
if ( actionTargetItems.Count() == 1 && iMailFolder ) |
|
4436 |
{ |
|
4437 |
CFSMailMessage& message = MsgPtrFromListIdL( actionTargetItems[0] ); |
|
4438 |
||
4439 |
CFSMailAddress* addressToBeStored(0); |
|
4440 |
TInt folderType = iMailFolder->GetFolderType(); |
|
4441 |
// Use first to recepient in outbox, drafts and sent if found. |
|
4442 |
if ( folderType == EFSOutbox || folderType == EFSDraftsFolder || folderType == EFSSentFolder ) |
|
4443 |
{ |
|
4444 |
RPointerArray<CFSMailAddress>& toArray = message.GetToRecipients(); |
|
4445 |
if ( toArray.Count() ) |
|
4446 |
{ |
|
4447 |
addressToBeStored = toArray[0]; |
|
4448 |
} |
|
4449 |
} |
|
4450 |
// Use sender in all other "normal" folders |
|
4451 |
else |
|
4452 |
{ |
|
4453 |
addressToBeStored = message.GetSender(); |
|
4454 |
} |
|
4455 |
TDesC* emailAddressText(0); |
|
4456 |
if ( addressToBeStored ) |
|
4457 |
{ |
|
4458 |
emailAddressText = &addressToBeStored->GetEmailAddress(); |
|
4459 |
} |
|
4460 |
if ( emailAddressText && emailAddressText->Length() ) |
|
4461 |
{ |
|
4462 |
TAddToContactsType type; |
|
4463 |
//Query to "update existing" or "Create new" --> EFALSE = user choosed "cancel" |
|
4464 |
if ( CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddtoContactsQueryL( type ) ) |
|
4465 |
{ |
|
4466 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->AddToContactL( |
|
4467 |
*emailAddressText, EContactUpdateEmail, type, this ); |
|
4468 |
} |
|
4469 |
} |
|
4470 |
} |
|
4471 |
} |
|
4472 |
break; |
|
4473 |
case EFsEmailUiCmdMarkingModeMove: |
|
4474 |
{ |
|
4475 |
iMarkingModeWaitingToExit = ETrue; |
|
4476 |
} |
|
4477 |
// Flow through |
|
4478 |
case EFsEmailUiCmdActionsMove: |
|
4479 |
case EFsEmailUiCmdActionsMoveMessage: |
|
4480 |
{ |
|
4481 |
TFSMailMsgId folderID; |
|
4482 |
folderID.SetNullId(); // Selection is popped up with NULL |
|
4483 |
MoveMsgsToFolderL( folderID ); |
|
4484 |
} |
|
4485 |
break; |
|
4486 |
case EFsEmailUiCmdActionsMoveToDrafts: |
|
4487 |
{ |
|
4488 |
MoveMessagesToDraftsL(); |
|
4489 |
} |
|
4490 |
break; |
|
4491 |
case EFsEmailUiCmdActionsCopyMessage: |
|
4492 |
{ |
|
4493 |
} |
|
4494 |
break; |
|
4495 |
case EFsEmailUiCmdActionsCollapseExpandAllToggle: |
|
4496 |
{ |
|
4497 |
ShortcutCollapseExpandAllToggleL(); |
|
4498 |
} |
|
4499 |
break; |
|
4500 |
case EFsEmailUiCmdMarkAsReadUnreadToggle: |
|
4501 |
{ |
|
4502 |
ShortcutReadUnreadToggleL(); |
|
4503 |
} |
|
4504 |
break; |
|
4505 |
case EFsEmailUiCmdGoToSwitchFolder: |
|
4506 |
{ |
|
4507 |
iControlBarControl->SetFocusByIdL( iFolderListButtonId ); |
|
4508 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
4509 |
iFocusedControl = EControlBarComponent; |
|
4510 |
iMailList->SetFocusedL( EFalse ); |
|
4511 |
} |
|
4512 |
break; |
|
4513 |
case EFsEmailUiCmdGoToSwitchSorting: |
|
4514 |
{ |
|
4515 |
iControlBarControl->SetFocusByIdL( iSortButtonId ); |
|
4516 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
4517 |
iFocusedControl = EControlBarComponent; |
|
4518 |
iMailList->SetFocusedL( EFalse ); |
|
4519 |
} |
|
4520 |
break; |
|
4521 |
case EFsEmailUiCmdGoToSwitchNewEmail: |
|
4522 |
{ |
|
4523 |
iControlBarControl->SetFocusByIdL( iNewEmailButtonId ); |
|
4524 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
4525 |
iFocusedControl = EControlBarComponent; |
|
4526 |
iMailList->SetFocusedL( EFalse ); |
|
4527 |
break; |
|
4528 |
} |
|
4529 |
case EFsEmailUiCmdCalActionsAccept: |
|
4530 |
case EFsEmailUiCmdCalActionsTentative: |
|
4531 |
case EFsEmailUiCmdCalActionsDecline: |
|
4532 |
case EFsEmailUiCmdCalRemoveFromCalendar: |
|
4533 |
{ |
|
4534 |
if ( actionTargetItems.Count() == 1 ) |
|
4535 |
{ |
|
4536 |
TInt mrItemIdx = ModelIndexFromListId( actionTargetItems[0] ); |
|
4537 |
CFSEmailUiMailListModelItem* item = |
|
4538 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item(mrItemIdx) ); |
|
4539 |
if ( item && item->MessagePtr().IsFlagSet( EFSMsgFlag_CalendarMsg ) ) |
|
4540 |
{ |
|
4541 |
// Respond to meeting request |
|
4542 |
if ( iAppUi.MrViewerInstanceL() && iAppUi.MrViewerInstanceL()->CanViewMessage( item->MessagePtr() ) ) |
|
4543 |
{ |
|
4544 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
4545 |
iAppUi.MailViewer().HandleMrCommandL( aCommand, |
|
4546 |
iAppUi.GetActiveMailbox()->GetId(), |
|
4547 |
FolderId(), |
|
4548 |
item->MessagePtr().GetMessageId() ); |
|
4549 |
} |
|
4550 |
} |
|
4551 |
} |
|
4552 |
} |
|
4553 |
break; |
|
4554 |
case EFsEmailUiCmdActionsEmptyDeleted: |
|
4555 |
{ |
|
4556 |
// <cmail> |
|
4557 |
if ( iMailFolder && iMailFolder->GetFolderType() == EFSDeleted && |
|
4558 |
iModel->Count() != 0 ) |
|
4559 |
// </cmail> |
|
4560 |
{ |
|
4561 |
TBool okToDelete( EFalse ); |
|
4562 |
HBufC* msg = StringLoader::LoadLC( R_FREESTYLE_EMAIL_QUERY_NOTE_PERMANENTLY_DELETE ); |
|
4563 |
CAknQueryDialog *queryNote = new ( ELeave ) CAknQueryDialog(); |
|
4564 |
CleanupStack::PushL( queryNote ); |
|
4565 |
queryNote->SetPromptL( *msg ); |
|
4566 |
CleanupStack::Pop( queryNote ); |
|
4567 |
CleanupStack::PopAndDestroy( msg ); |
|
4568 |
okToDelete = queryNote->ExecuteLD( R_FSEMAIL_QUERY_DIALOG ); |
|
4569 |
if ( okToDelete ) |
|
4570 |
{ |
|
4571 |
// Empty deleted items folder |
|
4572 |
RArray<TFSMailMsgId> msgIds; |
|
4573 |
CleanupClosePushL( msgIds ); |
|
4574 |
for ( TInt i=0 ; i<iModel->Count();i++ ) |
|
4575 |
{ |
|
4576 |
CFSEmailUiMailListModelItem* item = |
|
4577 |
static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i)); |
|
4578 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
4579 |
{ |
|
4580 |
msgIds.Append( item->MessagePtr().GetMessageId() ); |
|
4581 |
} |
|
4582 |
} |
|
4583 |
TFSMailMsgId folderId = FolderId(); |
|
4584 |
TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId(); |
|
4585 |
iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
|
4586 |
RemoveMsgItemsFromListIfFoundL( msgIds ); |
|
4587 |
CleanupStack::PopAndDestroy( &msgIds ); |
|
4588 |
} |
|
4589 |
} |
|
4590 |
} |
|
4591 |
break; |
|
4592 |
case EFsEmailUiCmdSettings: |
|
4593 |
{ |
|
4594 |
TInt tmp = 0; |
|
4595 |
const TPckgBuf<TInt> pkgBuf( tmp ); |
|
4596 |
iAppUi.EnterFsEmailViewL( SettingsViewId, |
|
4597 |
TUid::Uid(KMailSettingsOpenMainList), pkgBuf ); |
|
4598 |
} |
|
4599 |
break; |
|
4600 |
||
4601 |
||
4602 |
default: |
|
4603 |
break; |
|
4604 |
} // switch ( aCommand ) |
|
4605 |
CleanupStack::PopAndDestroy( &actionTargetItems ); |
|
4606 |
TIMESTAMP( "Message list selected operation done" ); |
|
4607 |
} |
|
4608 |
||
4609 |
// --------------------------------------------------------------------------- |
|
4610 |
// |
|
4611 |
// |
|
4612 |
// --------------------------------------------------------------------------- |
|
4613 |
// |
|
4614 |
TInt CFSEmailUiMailListVisualiser::MoveMsgsToFolderL( const TFSMailMsgId& aDestinationFolderId ) |
|
4615 |
{ |
|
4616 |
FUNC_LOG; |
|
4617 |
TInt ret(KErrGeneral); |
|
4618 |
RFsTreeItemIdList targetEntries; |
|
4619 |
CleanupClosePushL( targetEntries ); |
|
4620 |
GetActionsTargetEntriesL( targetEntries ); |
|
4621 |
TBool supportsMove = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ); |
|
4622 |
// Moving is not possible, if there are no items or the focus is on separator and |
|
4623 |
// there are no marked items. In outbox, moving is allowed only to the drafts folder; |
|
4624 |
// folder selection popup is not allowed. |
|
4625 |
// These have to be checked before launching the folder view. |
|
4626 |
if ( targetEntries.Count() && supportsMove ) |
|
4627 |
{ |
|
4628 |
TBool outbox = (iMailFolder && iMailFolder->GetFolderType() == EFSOutbox); |
|
4629 |
||
4630 |
if ( !(outbox && aDestinationFolderId.IsNullId()) ) |
|
4631 |
{ |
|
4632 |
// If destination folder is not set, it needs to be asked messages are moved after callbak |
|
4633 |
if ( aDestinationFolderId.IsNullId() ) |
|
4634 |
{ |
|
4635 |
// Activate folder selection view and handle moving after callback gets destination |
|
4636 |
iMoveToFolderOngoing = ETrue; |
|
4637 |
TFolderListActivationData folderListData; |
|
4638 |
folderListData.iCallback = this; |
|
4639 |
if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. |
|
4640 |
{ |
|
4641 |
folderListData.iSourceFolderType = iMailFolder->GetFolderType(); |
|
4642 |
} |
|
4643 |
else |
|
4644 |
{ |
|
4645 |
folderListData.iSourceFolderType = EFSInbox; |
|
4646 |
} |
|
4647 |
const TPckgBuf<TFolderListActivationData> pkgOut( folderListData ); |
|
4648 |
if ( targetEntries.Count() == 1 ) |
|
4649 |
{ |
|
4650 |
iAppUi.EnterFsEmailViewL( FolderListId, KFolderListMoveMessage, pkgOut ); |
|
4651 |
} |
|
4652 |
else |
|
4653 |
{ |
|
4654 |
iAppUi.EnterFsEmailViewL( FolderListId, KFolderListMoveMessages, pkgOut ); |
|
4655 |
} |
|
4656 |
ret = KErrNotReady; |
|
4657 |
} |
|
4658 |
// Destination folder is set, move message(s) immediately |
|
4659 |
else |
|
4660 |
{ |
|
4661 |
iMoveToFolderOngoing = EFalse; |
|
4662 |
// Get message IDs from target list IDs |
|
4663 |
RArray<TFSMailMsgId> msgIds; |
|
4664 |
CleanupClosePushL( msgIds ); |
|
4665 |
for ( TInt i = 0 ; i < targetEntries.Count() ; i++) |
|
4666 |
{ |
|
4667 |
msgIds.Append( MsgIdFromListId( targetEntries[i] ) ); |
|
4668 |
} |
|
4669 |
||
4670 |
if ( iMailFolder && msgIds.Count() ) // Something to move |
|
4671 |
{ |
|
4672 |
// check that source and destination are different |
|
4673 |
if( iMailFolder->GetFolderId() != aDestinationFolderId ) |
|
4674 |
{ |
|
4675 |
// Trap is needed because protocol might return KErrNotSupported |
|
4676 |
// If move away from current folder is not supprted |
|
4677 |
TRAPD( errMove, iAppUi.GetActiveMailbox()->MoveMessagesL( msgIds, iMailFolder->GetFolderId(), aDestinationFolderId ) ); |
|
4678 |
if ( errMove != KErrNotSupported ) |
|
4679 |
{ |
|
4680 |
if ( errMove == KErrNone ) |
|
4681 |
{ |
|
4682 |
RemoveMsgItemsFromListIfFoundL( msgIds ); |
|
4683 |
if ( !iMsgNoteTimer ) |
|
4684 |
{ |
|
4685 |
iMsgNoteTimer = CMsgMovedNoteTimer::NewL( &iAppUi, this ); |
|
4686 |
} |
|
4687 |
iMsgNoteTimer->Cancel(); |
|
4688 |
iMsgNoteTimer->Start( msgIds.Count(), aDestinationFolderId ); |
|
4689 |
ret = KErrNone; |
|
4690 |
} |
|
4691 |
else |
|
4692 |
{ |
|
4693 |
User::Leave(errMove); |
|
4694 |
} |
|
4695 |
} |
|
4696 |
} |
|
4697 |
} |
|
4698 |
CleanupStack::PopAndDestroy( &msgIds ); |
|
4699 |
} |
|
4700 |
} |
|
4701 |
} |
|
4702 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
4703 |
return ret; |
|
4704 |
} |
|
4705 |
||
4706 |
// --------------------------------------------------------------------------- |
|
4707 |
// |
|
4708 |
// |
|
4709 |
// --------------------------------------------------------------------------- |
|
4710 |
// |
|
4711 |
void CFSEmailUiMailListVisualiser::MoveMessagesToDraftsL() |
|
4712 |
{ |
|
4713 |
FUNC_LOG; |
|
4714 |
if ( iMailFolder && iMailFolder->GetFolderType() == EFSOutbox ) // Move to drafts should only be available from outbox, safety |
|
4715 |
{ |
|
4716 |
MoveMsgsToFolderL( iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSDraftsFolder ) ); |
|
4717 |
} |
|
4718 |
} |
|
4719 |
||
4720 |
// --------------------------------------------------------------------------- |
|
4721 |
// |
|
4722 |
// |
|
4723 |
// --------------------------------------------------------------------------- |
|
4724 |
// |
|
4725 |
void CFSEmailUiMailListVisualiser::CollapseAllNodesL() |
|
4726 |
{ |
|
4727 |
FUNC_LOG; |
|
4728 |
// Safety check, ignore command if the list is empty |
|
4729 |
if ( iMailList->Count() > 0 ) |
|
4730 |
{ |
|
4731 |
iMailTreeListVisualizer->CollapseAllL(); |
|
4732 |
} |
|
4733 |
} |
|
4734 |
||
4735 |
// --------------------------------------------------------------------------- |
|
4736 |
// |
|
4737 |
// --------------------------------------------------------------------------- |
|
4738 |
// |
|
4739 |
void CFSEmailUiMailListVisualiser::ExpandAllNodesL() |
|
4740 |
{ |
|
4741 |
FUNC_LOG; |
|
4742 |
// Safety check, ignore command if the list is empty |
|
4743 |
if ( iMailList->Count() > 0 ) |
|
4744 |
{ |
|
4745 |
TFsTreeItemId prevId = iMailList->FocusedItem(); |
|
4746 |
iMailTreeListVisualizer->ExpandAllL(); |
|
4747 |
iMailTreeListVisualizer->SetFocusedItemL( prevId ); |
|
4748 |
} |
|
4749 |
} |
|
4750 |
||
4751 |
// --------------------------------------------------------------------------- |
|
4752 |
// |
|
4753 |
// --------------------------------------------------------------------------- |
|
4754 |
// |
|
4755 |
void CFSEmailUiMailListVisualiser::ExpandOrCollapseL() |
|
4756 |
{ |
|
4757 |
FUNC_LOG; |
|
4758 |
CFSEmailUiMailListModelItem* item = |
|
4759 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
4760 |
if ( item && item->ModelItemType() == ETypeSeparator ) |
|
4761 |
{ |
|
4762 |
if ( iMailList->IsExpanded( iMailList->FocusedItem() ) ) |
|
4763 |
{ |
|
4764 |
//ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); |
|
4765 |
iMailList->CollapseNodeL( iMailList->FocusedItem() ); |
|
4766 |
} |
|
4767 |
else |
|
4768 |
{ |
|
4769 |
//ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); |
|
4770 |
iMailList->ExpandNodeL( iMailList->FocusedItem() ); |
|
4771 |
} |
|
4772 |
} |
|
4773 |
} |
|
4774 |
||
4775 |
// --------------------------------------------------------------------------- |
|
4776 |
// |
|
4777 |
// |
|
4778 |
// --------------------------------------------------------------------------- |
|
4779 |
// |
|
4780 |
void CFSEmailUiMailListVisualiser::SetMessageFollowupFlagL() |
|
4781 |
{ |
|
4782 |
FUNC_LOG; |
|
4783 |
if ( TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ) ) |
|
4784 |
{ |
|
4785 |
RFsTreeItemIdList targetItems; |
|
4786 |
CleanupClosePushL( targetItems ); |
|
4787 |
GetActionsTargetEntriesL( targetItems ); |
|
4788 |
||
4789 |
// If there are marked or focused item(s) |
|
4790 |
if ( targetItems.Count() ) |
|
4791 |
{ |
|
4792 |
// Convert list IDs to message IDs because it's possible that list refresh |
|
4793 |
// causes list IDs to change while the flag dialog is open |
|
4794 |
RArray< TFSMailMsgId > targetMsgIds; |
|
4795 |
CleanupClosePushL( targetMsgIds ); |
|
4796 |
for ( TInt i = 0 ; i < targetItems.Count() ; ++i ) |
|
4797 |
{ |
|
4798 |
TFSMailMsgId msgId = MsgIdFromIndex( ModelIndexFromListId( targetItems[i] ) ); |
|
4799 |
targetMsgIds.AppendL( msgId ); |
|
4800 |
} |
|
4801 |
||
4802 |
TFollowUpNewState newFollowUpState = EFollowUpNoChanges; |
|
4803 |
if ( TFsEmailUiUtility::RunFollowUpListDialogL( newFollowUpState ) ) |
|
4804 |
{ |
|
4805 |
// Update the target messages |
|
4806 |
for ( TInt i = 0 ; i < targetMsgIds.Count() ; ++i ) |
|
4807 |
{ |
|
4808 |
// Confirm that message is still in the list after selection has closed |
|
4809 |
TInt itemIndex = ItemIndexFromMessageId( targetMsgIds[i] ); |
|
4810 |
CFSEmailUiMailListModelItem* modelItem = |
|
4811 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( itemIndex ) ); |
|
4812 |
CFSMailMessage* confirmedPtr = NULL; // owned by the model |
|
4813 |
if ( modelItem ) |
|
4814 |
{ |
|
4815 |
confirmedPtr = &modelItem->MessagePtr(); |
|
4816 |
} |
|
4817 |
if ( confirmedPtr ) |
|
4818 |
{ |
|
4819 |
// Store flags to confirmed pointer for saving |
|
4820 |
TInt currentFlags = confirmedPtr->GetFlags(); |
|
4821 |
switch ( newFollowUpState ) |
|
4822 |
{ |
|
4823 |
case EFollowUp: |
|
4824 |
{ |
|
4825 |
confirmedPtr->SetFlag( EFSMsgFlag_FollowUp ); |
|
4826 |
confirmedPtr->ResetFlag( EFSMsgFlag_FollowUpComplete ); |
|
4827 |
} |
|
4828 |
break; |
|
4829 |
case EFollowUpComplete: |
|
4830 |
{ |
|
4831 |
confirmedPtr->SetFlag( EFSMsgFlag_FollowUpComplete ); |
|
4832 |
confirmedPtr->ResetFlag( EFSMsgFlag_FollowUp ); |
|
4833 |
} |
|
4834 |
break; |
|
4835 |
case EFollowUpClear: |
|
4836 |
{ |
|
4837 |
confirmedPtr->ResetFlag( EFSMsgFlag_FollowUp | EFSMsgFlag_FollowUpComplete ); |
|
4838 |
} |
|
4839 |
break; |
|
4840 |
} |
|
4841 |
||
4842 |
TInt newFlags = confirmedPtr->GetFlags(); |
|
4843 |
if ( newFlags != currentFlags ) |
|
4844 |
{ |
|
4845 |
// Save confirmed message |
|
4846 |
confirmedPtr->SaveMessageL(); |
|
4847 |
||
4848 |
// Update flag icon |
|
4849 |
UpdateMsgIconAndBoldingL( itemIndex ); |
|
4850 |
||
4851 |
// In case we are in flag sort mode, resetting the flag may cause the list order to be out of date. |
|
4852 |
if ( iCurrentSortCriteria.iField == EFSMailSortByFlagStatus ) |
|
4853 |
{ |
|
4854 |
iListOrderMayBeOutOfDate = ETrue; |
|
4855 |
} |
|
4856 |
} |
|
4857 |
} |
|
4858 |
} |
|
4859 |
if ( iMarkingMode ) |
|
4860 |
{ |
|
4861 |
ExitMarkingModeL(); |
|
4862 |
} |
|
4863 |
} |
|
4864 |
CleanupStack::PopAndDestroy( &targetMsgIds ); |
|
4865 |
} |
|
4866 |
CleanupStack::PopAndDestroy( &targetItems ); |
|
4867 |
} |
|
4868 |
} |
|
4869 |
||
4870 |
// --------------------------------------------------------------------------- |
|
4871 |
// |
|
4872 |
// |
|
4873 |
// --------------------------------------------------------------------------- |
|
4874 |
// |
|
4875 |
void CFSEmailUiMailListVisualiser::SetViewSoftkeysL( TInt aResourceId ) |
|
4876 |
{ |
|
4877 |
FUNC_LOG; |
|
4878 |
Cba()->SetCommandSetL( aResourceId ); |
|
4879 |
Cba()->DrawDeferred(); |
|
4880 |
} |
|
4881 |
||
4882 |
// --------------------------------------------------------------------------- |
|
4883 |
// Method to set Middle SoftKey |
|
4884 |
// --------------------------------------------------------------------------- |
|
4885 |
// |
|
4886 |
void CFSEmailUiMailListVisualiser::SetMskL() |
|
4887 |
{ |
|
4888 |
FUNC_LOG; |
|
4889 |
// If there is no keyboard present, than Msk buttom must not be shown |
|
4890 |
if ( iAppUi.ShortcutBinding().KeyBoardType() == |
|
4891 |
CFSEmailUiShortcutBinding::ENoKeyboard ) |
|
4892 |
{ |
|
4893 |
return; |
|
4894 |
} |
|
4895 |
// Get the mail list count |
|
4896 |
TInt listCount(0); |
|
4897 |
if ( iMailList ) |
|
4898 |
{ |
|
4899 |
listCount = iMailList->Count(); |
|
4900 |
} |
|
4901 |
||
4902 |
if ( iFocusedControl == EControlBarComponent ) |
|
4903 |
{ |
|
4904 |
ChangeMskCommandL( R_FSE_QTN_MSK_CHANGE ); // change - switch focus on |
|
4905 |
} |
|
4906 |
else if ( iFocusedControl == EMailListComponent ) |
|
4907 |
{ |
|
4908 |
if ( listCount ) // Safety check |
|
4909 |
{ |
|
4910 |
CFSEmailUiMailListModelItem* item = |
|
4911 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item(HighlightedIndex()) ); |
|
4912 |
// SHIFT DEPRESSED. SELECTION KEY DOES MARK/UNMARK |
|
4913 |
if ( iShiftDepressed ) |
|
4914 |
{ |
|
4915 |
// Nodes may not be marked |
|
4916 |
if ( iMailList->IsNode( iMailList->FocusedItem() ) ) |
|
4917 |
{ |
|
4918 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); // nothing |
|
4919 |
} |
|
4920 |
else |
|
4921 |
{ |
|
4922 |
if ( iMailList->IsMarked( iMailList->FocusedItem() ) ) |
|
4923 |
{ |
|
4924 |
ChangeMskCommandL( R_FSE_QTN_MSK_UNMARK ); // unmark item |
|
4925 |
} |
|
4926 |
else |
|
4927 |
{ |
|
4928 |
ChangeMskCommandL( R_FSE_QTN_MSK_MARK ); // mark item |
|
4929 |
} |
|
4930 |
} |
|
4931 |
} |
|
4932 |
else |
|
4933 |
{ |
|
4934 |
// MAIL ITEM; OPEN MAIL |
|
4935 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
4936 |
{ |
|
4937 |
CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
4938 |
if ( messagePtr ) |
|
4939 |
{ |
|
4940 |
if ( iMailFolder && iMailFolder->GetFolderType() == EFSOutbox ) |
|
4941 |
{ |
|
4942 |
ChangeMskCommandL( R_FSE_QTN_MSK_OPEN_BLOCKED ); // blocked email opening |
|
4943 |
} |
|
4944 |
else |
|
4945 |
{ |
|
4946 |
ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); // open email |
|
4947 |
} |
|
4948 |
} |
|
4949 |
} |
|
4950 |
||
4951 |
// SEPARAOR ITEM; COLLAPSE / EXPAND NODE |
|
4952 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
4953 |
{ |
|
4954 |
if( iMailList->IsNode( iMailList->FocusedItem() ) ) |
|
4955 |
{ |
|
4956 |
if ( iMailList->IsExpanded( iMailList->FocusedItem() ) ) |
|
4957 |
{ |
|
4958 |
ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); // collapse folder |
|
4959 |
} |
|
4960 |
else |
|
4961 |
{ |
|
4962 |
ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); // expand folder |
|
4963 |
} |
|
4964 |
} |
|
4965 |
} |
|
4966 |
} |
|
4967 |
} |
|
4968 |
} |
|
4969 |
} |
|
4970 |
||
4971 |
// --------------------------------------------------------------------------- |
|
4972 |
// |
|
4973 |
// |
|
4974 |
// --------------------------------------------------------------------------- |
|
4975 |
// |
|
4976 |
TBool CFSEmailUiMailListVisualiser::OfferEventL( const TAlfEvent& aEvent ) |
|
4977 |
{ |
|
4978 |
FUNC_LOG; |
|
4979 |
TBool result( EFalse ); |
|
4980 |
||
4981 |
if ( !aEvent.IsKeyEvent() ) |
|
4982 |
{ |
|
4983 |
// Only handle key events |
|
4984 |
if ( aEvent.IsPointerEvent() ) |
|
4985 |
{ |
|
4986 |
if( aEvent.PointerDown() ) |
|
4987 |
{ |
|
4988 |
// If pointer down event was made on control bar area |
|
4989 |
// focus needs to be changed to control bar control, if it |
|
4990 |
// didn't already have focus. |
|
4991 |
if( HitTest( *iControlBarControl, aEvent.PointerEvent().iPosition ) ) |
|
4992 |
{ |
|
4993 |
if( iFocusedControl != EControlBarComponent ) |
|
4994 |
{ |
|
4995 |
SetControlBarFocusedL(); |
|
4996 |
} |
|
4997 |
} |
|
4998 |
else |
|
4999 |
{ |
|
5000 |
// If pointer down event was not made on control bar area |
|
5001 |
// then focus need to be set to mail list component, if it |
|
5002 |
// didn't already have focus. If mail list is empty, then |
|
5003 |
// focus is hidden and control bar stays as a focused item. |
|
5004 |
if( ( iFocusedControl != EMailListComponent ) && |
|
5005 |
( iMailList->Count() > 0 ) ) |
|
5006 |
{ |
|
5007 |
SetTreeListFocusedL(); |
|
5008 |
} |
|
5009 |
else |
|
5010 |
{ |
|
5011 |
iAppUi.SetFocusVisibility( EFalse ); |
|
5012 |
} |
|
5013 |
} |
|
5014 |
} |
|
5015 |
||
5016 |
// Offer event to focused control. |
|
5017 |
if( iFocusedControl == EMailListComponent ) |
|
5018 |
{ |
|
5019 |
result = iMailList->TreeControl()->OfferEventL( aEvent ); |
|
5020 |
} |
|
5021 |
else // iFocusedControl == EControlBarComponent |
|
5022 |
{ |
|
5023 |
result = static_cast<CAlfControl*>( |
|
5024 |
iControlBarControl )->OfferEventL( aEvent ); |
|
5025 |
} |
|
5026 |
} |
|
5027 |
return result; |
|
5028 |
} |
|
5029 |
||
5030 |
TInt scanCode = aEvent.KeyEvent().iScanCode; |
|
5031 |
// Swap right and left controls in mirrored layout |
|
5032 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
5033 |
{ |
|
5034 |
if ( scanCode == EStdKeyRightArrow ) |
|
5035 |
{ |
|
5036 |
scanCode = EStdKeyLeftArrow; |
|
5037 |
} |
|
5038 |
else if ( scanCode == EStdKeyLeftArrow ) |
|
5039 |
{ |
|
5040 |
scanCode = EStdKeyRightArrow; |
|
5041 |
} |
|
5042 |
} |
|
5043 |
||
5044 |
// Toggle mark items state when shift key is pressed or released |
|
5045 |
if ( iFocusedControl == EMailListComponent && |
|
5046 |
( scanCode == EStdKeyLeftShift || |
|
5047 |
scanCode == EStdKeyRightShift || |
|
5048 |
scanCode == EStdKeyHash ) ) |
|
5049 |
{ |
|
5050 |
if ( aEvent.Code() == EEventKeyDown ) |
|
5051 |
{ |
|
5052 |
iShiftDepressed = ETrue; |
|
5053 |
iOtherKeyPressedWhileShiftDepressed = EFalse; |
|
5054 |
if ( iModel->Count() && iMailList->IsMarked( iMailList->FocusedItem() ) ) |
|
5055 |
{ |
|
5056 |
iListMarkItemsState = EFalse; // Unmark state |
|
5057 |
} |
|
5058 |
else |
|
5059 |
{ |
|
5060 |
iListMarkItemsState = ETrue; // Mark items state |
|
5061 |
} |
|
5062 |
} |
|
5063 |
else if ( aEvent.Code() == EEventKeyUp ) |
|
5064 |
{ |
|
5065 |
iShiftDepressed = EFalse; |
|
5066 |
} |
|
5067 |
} |
|
5068 |
||
5069 |
// If any other key event is gained while hash is depressed, the hash key is used only |
|
5070 |
// as shift and not as individual key. |
|
5071 |
if ( iShiftDepressed && scanCode && |
|
5072 |
scanCode != EStdKeyHash && scanCode != EStdKeyLeftShift && scanCode != EStdKeyRightShift ) |
|
5073 |
{ |
|
5074 |
iOtherKeyPressedWhileShiftDepressed = ETrue; |
|
5075 |
} |
|
5076 |
||
5077 |
// MSK label can now be updated when shift key has been handled |
|
5078 |
SetMskL(); |
|
5079 |
// On KeyUp of EStdKeyYes usually Call application is called - prevent it |
|
5080 |
if ( iConsumeStdKeyYes_KeyUp && (aEvent.Code() == EEventKeyUp )) |
|
5081 |
{ |
|
5082 |
iConsumeStdKeyYes_KeyUp = EFalse; // in case call button was consumed elsewhere first key up enables calling Call application |
|
5083 |
if ( EStdKeyYes == scanCode) |
|
5084 |
{ |
|
5085 |
result = ETrue; // consume not to switch to Call application when call to contact was processed |
|
5086 |
return result; |
|
5087 |
} |
|
5088 |
} |
|
5089 |
||
5090 |
if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKey ) |
|
5091 |
{ |
|
5092 |
TBool shiftState = ( aEvent.KeyEvent().iModifiers & EModifierShift ); |
|
5093 |
||
5094 |
// Do the (un)marking if in shift state and suitable key is received |
|
5095 |
if ( shiftState ) |
|
5096 |
{ |
|
5097 |
switch ( aEvent.KeyEvent().iScanCode ) |
|
5098 |
{ |
|
5099 |
case EStdKeyDownArrow: |
|
5100 |
case EStdKeyUpArrow: |
|
5101 |
{ |
|
5102 |
DoScrollMarkUnmarkL(); |
|
5103 |
result = EFalse; // event is not consumed yet, because it must also move the cursor |
|
5104 |
} |
|
5105 |
break; |
|
5106 |
case EStdKeyEnter: |
|
5107 |
case EStdKeyDevice3: |
|
5108 |
{ |
|
5109 |
if ( !aEvent.KeyEvent().iRepeats ) // no repeated (un)marking by holding selection key depressed |
|
5110 |
{ |
|
5111 |
// The selection key always toggles the marking state of the current item. |
|
5112 |
// It also toggles the scroll marking/unmarking state. |
|
5113 |
if ( iModel->Count() ) |
|
5114 |
{ |
|
5115 |
CFSEmailUiMailListModelItem* item = |
|
5116 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
5117 |
||
5118 |
if ( item && item->ModelItemType() == ETypeMailItem ) // Separators are not markable |
|
5119 |
{ |
|
5120 |
if ( iMailList->IsMarked( iMailList->FocusedItem() ) ) |
|
5121 |
{ |
|
5122 |
iMailList->MarkItemL( iMailList->FocusedItem(), EFalse ); |
|
5123 |
iListMarkItemsState = EFalse; |
|
5124 |
} |
|
5125 |
else |
|
5126 |
{ |
|
5127 |
iMailList->MarkItemL( iMailList->FocusedItem(), ETrue ); |
|
5128 |
iListMarkItemsState = ETrue; |
|
5129 |
} |
|
5130 |
} |
|
5131 |
} |
|
5132 |
} |
|
5133 |
result = ETrue; // shift + selection is always consumed |
|
5134 |
} |
|
5135 |
break; |
|
5136 |
default: |
|
5137 |
break; |
|
5138 |
} |
|
5139 |
||
5140 |
} |
|
5141 |
||
5142 |
// If event not handled by now |
|
5143 |
if ( !result ) |
|
5144 |
{ |
|
5145 |
// Handle possible focus visibility change |
|
5146 |
if ( ( scanCode == EStdKeyRightArrow ) || |
|
5147 |
( scanCode == EStdKeyLeftArrow ) || |
|
5148 |
( scanCode == EStdKeyUpArrow ) || |
|
5149 |
( scanCode == EStdKeyDownArrow ) || |
|
5150 |
( scanCode == EStdKeyEnter ) || |
|
5151 |
( scanCode == EStdKeyDeviceA ) || |
|
5152 |
( scanCode ==EStdKeyDevice3 ) ) |
|
5153 |
{ |
|
5154 |
// If the focus was not active already, ignore the key press |
|
5155 |
if( !iAppUi.SetFocusVisibility( ETrue ) ) |
|
5156 |
{ |
|
5157 |
return ETrue; |
|
5158 |
} |
|
5159 |
} |
|
5160 |
||
5161 |
switch ( scanCode ) |
|
5162 |
{ |
|
5163 |
case EStdKeyDevice3: // CENTER CLICK |
|
5164 |
case EStdKeyEnter: // ENTER EITHER SELECTS ITEM IN TOOLBAR OR OPENS MAIL |
|
5165 |
case EStdKeyNkpEnter: |
|
5166 |
case EAknSoftkeySelect: |
|
5167 |
{ |
|
5168 |
SetMskL(); |
|
5169 |
if ( iFocusedControl == EMailListComponent ) |
|
5170 |
{ |
|
5171 |
TInt modelCount( modelCount = iModel->Count() ); |
|
5172 |
if ( modelCount ) // Safety check |
|
5173 |
{ |
|
5174 |
if (iMarkingMode) |
|
5175 |
{ |
|
5176 |
//Do not open mail or expand/collapse separator in marking mode |
|
5177 |
DoHandleListItemOpenL(); |
|
5178 |
} |
|
5179 |
else |
|
5180 |
{ |
|
5181 |
CFSEmailUiMailListModelItem* item = |
|
5182 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
5183 |
// MAIL ITEM; OPEN MAIL |
|
5184 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
5185 |
{ |
|
5186 |
CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
5187 |
if ( messagePtr ) |
|
5188 |
{ |
|
5189 |
TIMESTAMP( "Open email selected from message list" ); |
|
5190 |
OpenHighlightedMailL(); |
|
5191 |
return EKeyWasConsumed; |
|
5192 |
} |
|
5193 |
} |
|
5194 |
// SEPARAOR ITEM; COLLAPSE / EXPAND NODE |
|
5195 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
5196 |
{ |
|
5197 |
ExpandOrCollapseL(); |
|
5198 |
return EKeyWasConsumed; |
|
5199 |
} |
|
5200 |
} |
|
5201 |
} |
|
5202 |
} |
|
5203 |
else |
|
5204 |
{ |
|
5205 |
TInt focusedButtonId( iControlBarControl->GetFocusedButton()->Id() ); |
|
5206 |
if ( focusedButtonId == iNewEmailButtonId ) |
|
5207 |
{ |
|
5208 |
HandleCommandL(EFsEmailUiCmdCompose); |
|
5209 |
} |
|
5210 |
else if ( focusedButtonId == iFolderListButtonId ) |
|
5211 |
{ |
|
5212 |
// Set touchmanager not active for preventing getting events. |
|
5213 |
DisableMailList( ETrue ); |
|
5214 |
iAppUi.ShowFolderListInPopupL( FolderId(), this, iFolderListButton ); |
|
5215 |
} |
|
5216 |
else if ( focusedButtonId == iSortButtonId ) |
|
5217 |
{ |
|
5218 |
TFSFolderType folderType; |
|
5219 |
if( iMailFolder ) |
|
5220 |
{ |
|
5221 |
folderType = iMailFolder->GetFolderType(); |
|
5222 |
} |
|
5223 |
else |
|
5224 |
{ |
|
5225 |
folderType = EFSInbox; |
|
5226 |
} |
|
5227 |
// Show sort if model has data. |
|
5228 |
if ( iModel->Count() ) |
|
5229 |
{ |
|
5230 |
// Set touchmanager not active for preventing getting events. |
|
5231 |
DisableMailList(ETrue); |
|
5232 |
iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
|
5233 |
} |
|
5234 |
else |
|
5235 |
{ |
|
5236 |
// hide selector focus if popup is not opened |
|
5237 |
// and selection was not made via HW-keys |
|
5238 |
iControlBarControl->MakeSelectorVisible( |
|
5239 |
IsFocusShown() ); |
|
5240 |
} |
|
5241 |
} |
|
5242 |
return ETrue; // iControlBar->OfferEventL( aEvent ); |
|
5243 |
} |
|
5244 |
} |
|
5245 |
break; |
|
5246 |
case EStdKeyLeftArrow: |
|
5247 |
case EStdKeyRightArrow: |
|
5248 |
case EStdKeyDownArrow: |
|
5249 |
case EStdKeyUpArrow: |
|
5250 |
{ |
|
5251 |
if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
5252 |
{ |
|
5253 |
result = HandleArrowEventInLandscapeL( scanCode, |
|
5254 |
aEvent, shiftState ); |
|
5255 |
} |
|
5256 |
else |
|
5257 |
{ |
|
5258 |
result = HandleArrowEventInPortraitL( scanCode, |
|
5259 |
aEvent, shiftState ); |
|
5260 |
} |
|
5261 |
break; |
|
5262 |
} |
|
5263 |
case EStdKeyYes: |
|
5264 |
{ |
|
5265 |
if ( !iAppUi.ViewSwitchingOngoing() ) |
|
5266 |
{ |
|
5267 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox && |
|
5268 |
iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
5269 |
{ |
|
5270 |
TInt modelCount = iModel->Count(); |
|
5271 |
if ( modelCount ) // Safety check |
|
5272 |
{ |
|
5273 |
CFSEmailUiMailListModelItem* item = |
|
5274 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
5275 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
5276 |
{ |
|
5277 |
CFSMailAddress* fromAddress = item->MessagePtr().GetSender(); |
|
5278 |
TDesC* mailAddress(0); |
|
5279 |
if ( fromAddress ) |
|
5280 |
{ |
|
5281 |
mailAddress = &fromAddress->GetEmailAddress(); |
|
5282 |
} |
|
5283 |
if ( mailAddress && mailAddress->Length() ) |
|
5284 |
{ |
|
5285 |
if ( iMailFolder->GetFolderType() == EFSSentFolder ) |
|
5286 |
{ |
|
5287 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( |
|
5288 |
*mailAddress, iAppUi.GetActiveMailbox(), this, EFalse ); |
|
5289 |
} |
|
5290 |
else |
|
5291 |
{ |
|
5292 |
CFsDelayedLoader::InstanceL()->GetContactHandlerL()->FindAndCallToContactByEmailL( |
|
5293 |
*mailAddress, iAppUi.GetActiveMailbox(), this, ETrue ); |
|
5294 |
} |
|
5295 |
// consume following KyUp event to prevent execution of Call application when call to contact processing |
|
5296 |
iConsumeStdKeyYes_KeyUp = result = ETrue; |
|
5297 |
} |
|
5298 |
} |
|
5299 |
} |
|
5300 |
} |
|
5301 |
} |
|
5302 |
} |
|
5303 |
break; |
|
5304 |
case EStdKeyHash: |
|
5305 |
{ |
|
5306 |
// Consume hash key events before they go to our shortcut framework. We do not want |
|
5307 |
// to react to those until the in the key up event. There hash key works as mark/unmark shortcut only |
|
5308 |
// if it hasn't been used as shift modifier. |
|
5309 |
result = ETrue; |
|
5310 |
} |
|
5311 |
break; |
|
5312 |
// Backspace (C key) must be handled on Key-Down instead of Key-Up |
|
5313 |
// ( this was the reason that deleted two emails from opened mail in viewer ) |
|
5314 |
case EStdKeyBackspace: |
|
5315 |
{ |
|
5316 |
TInt shortcutCommand = iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
5317 |
CFSEmailUiShortcutBinding::EContextMailList ); |
|
5318 |
||
5319 |
if ( shortcutCommand != KErrNotFound ) |
|
5320 |
{ |
|
5321 |
HandleCommandL( shortcutCommand ); |
|
5322 |
result = ETrue; |
|
5323 |
} |
|
5324 |
else result = EFalse; |
|
5325 |
} |
|
5326 |
break; |
|
5327 |
default: |
|
5328 |
{ |
|
5329 |
if ( iFocusedControl == EMailListComponent ) |
|
5330 |
{ |
|
5331 |
result = iMailList->TreeControl()->OfferEventL(aEvent); |
|
5332 |
} |
|
5333 |
else |
|
5334 |
{ |
|
5335 |
result = EFalse; |
|
5336 |
} |
|
5337 |
} |
|
5338 |
break; |
|
5339 |
} |
|
5340 |
} |
|
5341 |
} |
|
5342 |
else if ( aEvent.IsKeyEvent() && aEvent.Code() == EEventKeyUp ) |
|
5343 |
{ |
|
5344 |
// Check keyboard shortcuts on key up events. These can't be checked on key event |
|
5345 |
// because half-QWERTY keyboad has shortcuts also on shift and chr keys which do |
|
5346 |
// no send any key events, only key down and key up. |
|
5347 |
TInt shortcutCommand = |
|
5348 |
iAppUi.ShortcutBinding().CommandForShortcutKey( aEvent.KeyEvent(), |
|
5349 |
CFSEmailUiShortcutBinding::EContextMailList ); |
|
5350 |
||
5351 |
// Hash/shift key of ITU-T and half-QWERTY keyboards is an exception case to other |
|
5352 |
// shortcuts: it is handled only if it hasn't been used as shift modifier |
|
5353 |
if ( (scanCode == EStdKeyHash || scanCode == EStdKeyLeftShift || scanCode == EStdKeyRightShift) && |
|
5354 |
iOtherKeyPressedWhileShiftDepressed ) |
|
5355 |
{ |
|
5356 |
shortcutCommand = KErrNotFound; |
|
5357 |
} |
|
5358 |
||
5359 |
// block Backspace (C key) handle on Key-Up |
|
5360 |
if ( scanCode == EStdKeyBackspace ) |
|
5361 |
{ |
|
5362 |
shortcutCommand = KErrNotFound; // handled on Key-Down, see above |
|
5363 |
} |
|
5364 |
||
5365 |
if ( shortcutCommand != KErrNotFound ) |
|
5366 |
{ |
|
5367 |
HandleCommandL( shortcutCommand ); |
|
5368 |
result = ETrue; |
|
5369 |
} |
|
5370 |
else |
|
5371 |
{ |
|
5372 |
result = EFalse; |
|
5373 |
} |
|
5374 |
} |
|
5375 |
||
5376 |
return result; |
|
5377 |
} |
|
5378 |
||
5379 |
// --------------------------------------------------------------------------- |
|
5380 |
// CFSEmailUiMailListVisualiser::DoHandleListItemOpenL |
|
5381 |
// --------------------------------------------------------------------------- |
|
5382 |
// |
|
5383 |
void CFSEmailUiMailListVisualiser::DoHandleListItemOpenL() |
|
5384 |
{ |
|
5385 |
FUNC_LOG; |
|
5386 |
if ( 0 < iModel->Count() ) // Safety check |
|
5387 |
{ |
|
5388 |
CFSEmailUiMailListModelItem* item = |
|
5389 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
5390 |
if ( iMarkingMode ) |
|
5391 |
{ |
|
5392 |
// In marking mode. Mark/unmark it instead of opening it. |
|
5393 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
5394 |
{ |
|
5395 |
if (iMailList->IsMarked( iMailList->FocusedItem() )) |
|
5396 |
{ |
|
5397 |
iMailList->MarkItemL( iMailList->FocusedItem(), EFalse ); |
|
5398 |
} |
|
5399 |
else |
|
5400 |
{ |
|
5401 |
iMailList->MarkItemL( iMailList->FocusedItem(), ETrue ); |
|
5402 |
} |
|
5403 |
} |
|
5404 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
5405 |
{ |
|
5406 |
TInt index = HighlightedIndex(); |
|
5407 |
if ( AreAllItemsMarkedUnderSeparatorL( index ) ) |
|
5408 |
{ |
|
5409 |
MarkItemsUnderSeparatorL( EFalse, index ); |
|
5410 |
} |
|
5411 |
else |
|
5412 |
{ |
|
5413 |
MarkItemsUnderSeparatorL( ETrue, index ); |
|
5414 |
} |
|
5415 |
} |
|
5416 |
} |
|
5417 |
else if ( iAppUi.CurrentActiveView() == this ) |
|
5418 |
{ |
|
5419 |
||
5420 |
// MAIL ITEM; OPEN MAIL |
|
5421 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
5422 |
{ |
|
5423 |
CFSMailMessage* messagePtr = &item->MessagePtr(); |
|
5424 |
if ( messagePtr ) |
|
5425 |
{ |
|
5426 |
TIMESTAMP( "Open email selected from message list" ); |
|
5427 |
OpenHighlightedMailL(); |
|
5428 |
} |
|
5429 |
||
5430 |
// Give feedback to user (vibration) |
|
5431 |
iTouchFeedBack->InstantFeedback(ETouchFeedbackBasic); |
|
5432 |
} |
|
5433 |
// SEPARATOR ITEM; COLLAPSE / EXPAND NODE |
|
5434 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
5435 |
{ |
|
5436 |
ExpandOrCollapseL(); |
|
5437 |
SetMskL(); |
|
5438 |
} |
|
5439 |
} |
|
5440 |
} |
|
5441 |
} |
|
5442 |
||
5443 |
// --------------------------------------------------------------------------- |
|
5444 |
// CFSEmailUiMailListVisualiser::DoHandleControlBarOpenL |
|
5445 |
// --------------------------------------------------------------------------- |
|
5446 |
// |
|
5447 |
void CFSEmailUiMailListVisualiser::DoHandleControlBarOpenL( TInt aControlBarButtonId ) |
|
5448 |
{ |
|
5449 |
FUNC_LOG; |
|
5450 |
||
5451 |
if ( aControlBarButtonId == iNewEmailButtonId ) |
|
5452 |
{ |
|
5453 |
HandleCommandL(EFsEmailUiCmdCompose); |
|
5454 |
} |
|
5455 |
else if ( aControlBarButtonId == iFolderListButtonId ) |
|
5456 |
{ |
|
5457 |
//FOLDERLIST |
|
5458 |
//Set touchmanager not active for preventing getting events. |
|
5459 |
DisableMailList(ETrue); |
|
5460 |
iAppUi.ShowFolderListInPopupL( FolderId(), this, iFolderListButton ); |
|
5461 |
} |
|
5462 |
else if ( aControlBarButtonId == iSortButtonId ) |
|
5463 |
{ |
|
5464 |
//SORTLIST |
|
5465 |
TFSFolderType folderType; |
|
5466 |
if ( iMailFolder ) |
|
5467 |
{ |
|
5468 |
folderType = iMailFolder->GetFolderType(); |
|
5469 |
} |
|
5470 |
else |
|
5471 |
{ |
|
5472 |
folderType = EFSInbox; |
|
5473 |
} |
|
5474 |
// we can't show sort list when sorting is active |
|
5475 |
if ( iModel->Count() && iSortState == ESortNone ) |
|
5476 |
{ |
|
5477 |
//Set touchmanager not active for preventing getting events. |
|
5478 |
DisableMailList(ETrue); |
|
5479 |
iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
|
5480 |
} |
|
5481 |
else |
|
5482 |
{ |
|
5483 |
// hide selector focus if popup is not opened and selection was not |
|
5484 |
// made via HW-keys |
|
5485 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
5486 |
} |
|
5487 |
} |
|
5488 |
} |
|
5489 |
||
5490 |
// --------------------------------------------------------------------------- |
|
5491 |
// CFSEmailUiMailListVisualiser::DoHandleListItemLongTapL |
|
5492 |
// --------------------------------------------------------------------------- |
|
5493 |
// |
|
5494 |
void CFSEmailUiMailListVisualiser::DoHandleListItemLongTapL( const TPoint& aPoint ) |
|
5495 |
{ |
|
5496 |
FUNC_LOG; |
|
5497 |
||
5498 |
if ( 0 < iModel->Count() ) // Safety check |
|
5499 |
{ |
|
5500 |
if ( iMarkingMode ) |
|
5501 |
{ |
|
5502 |
iMailTreeListVisualizer->SetFocusVisibility( EFalse ); |
|
5503 |
TInt currentFocusState = iMailList->IsFocused(); |
|
5504 |
iMailList->SetFocusedL( EFalse ); |
|
5505 |
iMailList->SetFocusedL( currentFocusState ); |
|
5506 |
CFSEmailUiMailListModelItem* item = |
|
5507 |
dynamic_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
5508 |
// In marking mode. Mark/unmark it instead of open popup. |
|
5509 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
5510 |
{ |
|
5511 |
if (iMailList->IsMarked( iMailList->FocusedItem() )) |
|
5512 |
{ |
|
5513 |
iMailList->MarkItemL( iMailList->FocusedItem(), EFalse ); |
|
5514 |
} |
|
5515 |
else |
|
5516 |
{ |
|
5517 |
iMailList->MarkItemL( iMailList->FocusedItem(), ETrue ); |
|
5518 |
} |
|
5519 |
} |
|
5520 |
else if ( item && item->ModelItemType() == ETypeSeparator ) |
|
5521 |
{ |
|
5522 |
TInt index = HighlightedIndex(); |
|
5523 |
if ( AreAllItemsMarkedUnderSeparatorL( index ) ) |
|
5524 |
{ |
|
5525 |
MarkItemsUnderSeparatorL( EFalse, index ); |
|
5526 |
} |
|
5527 |
else |
|
5528 |
{ |
|
5529 |
MarkItemsUnderSeparatorL( ETrue, index ); |
|
5530 |
} |
|
5531 |
} |
|
5532 |
} |
|
5533 |
else |
|
5534 |
{ |
|
5535 |
LaunchStylusPopupMenuL( aPoint ); |
|
5536 |
} |
|
5537 |
} |
|
5538 |
} |
|
5539 |
||
5540 |
// --------------------------------------------------------------------------- |
|
5541 |
// CFSEmailUiMailListVisualiser::GetFocusedControl |
|
5542 |
// --------------------------------------------------------------------------- |
|
5543 |
// |
|
5544 |
TInt CFSEmailUiMailListVisualiser::GetFocusedControl() const |
|
5545 |
{ |
|
5546 |
FUNC_LOG; |
|
5547 |
return iFocusedControl; |
|
5548 |
} |
|
5549 |
||
5550 |
// --------------------------------------------------------------------------- |
|
5551 |
// CFSEmailUiMailListVisualiser::SetControlBarFocusedL |
|
5552 |
// --------------------------------------------------------------------------- |
|
5553 |
// |
|
5554 |
void CFSEmailUiMailListVisualiser::SetControlBarFocusedL() |
|
5555 |
{ |
|
5556 |
FUNC_LOG; |
|
5557 |
iFocusedControl = EControlBarComponent; |
|
5558 |
iMailList->SetFocusedL( EFalse ); |
|
5559 |
SetMskL(); |
|
5560 |
} |
|
5561 |
||
5562 |
// --------------------------------------------------------------------------- |
|
5563 |
// CFSEmailUiMailListVisualiser::SetTreeListFocusedL |
|
5564 |
// --------------------------------------------------------------------------- |
|
5565 |
// |
|
5566 |
void CFSEmailUiMailListVisualiser::SetTreeListFocusedL() |
|
5567 |
{ |
|
5568 |
FUNC_LOG; |
|
5569 |
iFocusedControl = EMailListComponent; |
|
5570 |
iMailList->SetFocusedL( ETrue ); |
|
5571 |
iControlBarControl->SetFocusL( EFalse ); |
|
5572 |
SetMskL(); |
|
5573 |
} |
|
5574 |
||
5575 |
// ----------------------------------------------------------------------------- |
|
5576 |
// CFSEmailUiMailListVisualiser::FlipStateChangedL |
|
5577 |
// ----------------------------------------------------------------------------- |
|
5578 |
// |
|
5579 |
void CFSEmailUiMailListVisualiser::FlipStateChangedL( TBool aKeyboardFlipOpen ) |
|
5580 |
{ |
|
5581 |
FUNC_LOG; |
|
5582 |
CFsEmailUiViewBase::FlipStateChangedL( aKeyboardFlipOpen ); |
|
5583 |
iMailTreeListVisualizer->SetFlipState( iKeyboardFlipOpen ); |
|
5584 |
} |
|
5585 |
||
5586 |
// ----------------------------------------------------------------------------- |
|
5587 |
// CFSEmailUiMailListVisualiser::HandleTimerFocusStateChange |
|
5588 |
// ----------------------------------------------------------------------------- |
|
5589 |
// |
|
5590 |
void CFSEmailUiMailListVisualiser::FocusVisibilityChange( TBool aVisible ) |
|
5591 |
{ |
|
5592 |
FUNC_LOG; |
|
5593 |
||
5594 |
CFsEmailUiViewBase::FocusVisibilityChange( aVisible ); |
|
5595 |
||
5596 |
if( iFocusedControl == EControlBarComponent ) |
|
5597 |
{ |
|
5598 |
iControlBarControl->MakeSelectorVisible( aVisible ); |
|
5599 |
} |
|
5600 |
||
5601 |
if ( iStylusPopUpMenuVisible && !aVisible ) |
|
5602 |
{ |
|
5603 |
// Do not allow to remove the focus from a list element if the pop up |
|
5604 |
// menu was just launched. |
|
5605 |
return; |
|
5606 |
} |
|
5607 |
||
5608 |
iMailTreeListVisualizer->SetFocusVisibility( aVisible ); |
|
5609 |
} |
|
5610 |
||
5611 |
// --------------------------------------------------------------------------- |
|
5612 |
// CFSEmailUiMailListVisualiser::DisableMailList |
|
5613 |
// --------------------------------------------------------------------------- |
|
5614 |
// |
|
5615 |
void CFSEmailUiMailListVisualiser::DisableMailList( TBool aValue ) |
|
5616 |
{ |
|
5617 |
FUNC_LOG; |
|
5618 |
iTouchManager->SetDisabled( aValue ); |
|
5619 |
iControlBarControl->EnableTouch( (aValue) ? EFalse : ETrue ); |
|
5620 |
} |
|
5621 |
//</cmail> |
|
5622 |
||
5623 |
// --------------------------------------------------------------------------- |
|
5624 |
// |
|
5625 |
// |
|
5626 |
// --------------------------------------------------------------------------- |
|
5627 |
// |
|
5628 |
void CFSEmailUiMailListVisualiser::ShortcutCollapseExpandAllToggleL() |
|
5629 |
{ |
|
5630 |
FUNC_LOG; |
|
5631 |
if ( !AllNodesCollapsed() ) |
|
5632 |
{ |
|
5633 |
CollapseAllNodesL(); |
|
5634 |
} |
|
5635 |
else |
|
5636 |
{ |
|
5637 |
ExpandAllNodesL(); |
|
5638 |
} |
|
5639 |
} |
|
5640 |
||
5641 |
// --------------------------------------------------------------------------- |
|
5642 |
// |
|
5643 |
// |
|
5644 |
// --------------------------------------------------------------------------- |
|
5645 |
// |
|
5646 |
TBool CFSEmailUiMailListVisualiser::AllNodesCollapsed() const |
|
5647 |
{ |
|
5648 |
FUNC_LOG; |
|
5649 |
for ( TInt i=0;i<iTreeItemArray.Count();i++) |
|
5650 |
{ |
|
5651 |
if ( iMailList->IsNode( iTreeItemArray[i].iListItemId ) ) |
|
5652 |
{ |
|
5653 |
if ( iMailList->IsExpanded( iTreeItemArray[i].iListItemId ) ) |
|
5654 |
{ |
|
5655 |
return EFalse; |
|
5656 |
} |
|
5657 |
} |
|
5658 |
} |
|
5659 |
||
5660 |
return ETrue; |
|
5661 |
} |
|
5662 |
||
5663 |
// --------------------------------------------------------------------------- |
|
5664 |
// |
|
5665 |
// |
|
5666 |
// --------------------------------------------------------------------------- |
|
5667 |
// |
|
5668 |
TBool CFSEmailUiMailListVisualiser::AllNodesExpanded() const |
|
5669 |
{ |
|
5670 |
FUNC_LOG; |
|
5671 |
for ( TInt i=0;i<iTreeItemArray.Count();i++) |
|
5672 |
{ |
|
5673 |
if ( iMailList->IsNode( iTreeItemArray[i].iListItemId ) ) |
|
5674 |
{ |
|
5675 |
if ( !iMailList->IsExpanded( iTreeItemArray[i].iListItemId ) ) |
|
5676 |
{ |
|
5677 |
return EFalse; |
|
5678 |
} |
|
5679 |
} |
|
5680 |
} |
|
5681 |
||
5682 |
return ETrue; |
|
5683 |
} |
|
5684 |
||
5685 |
// --------------------------------------------------------------------------- |
|
5686 |
// CFSEmailUiMailListVisualiser::IsMarkAsReadAvailableL() |
|
5687 |
// Function checks if mark as read option should be available for user |
|
5688 |
// --------------------------------------------------------------------------- |
|
5689 |
// |
|
5690 |
TBool CFSEmailUiMailListVisualiser::IsMarkAsReadAvailableL() const |
|
5691 |
{ |
|
5692 |
FUNC_LOG; |
|
5693 |
TBool available = EFalse; |
|
5694 |
||
5695 |
// In outbox the mark as read is always inavailable |
|
5696 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox ) |
|
5697 |
{ |
|
5698 |
RFsTreeItemIdList targetEntries; |
|
5699 |
CleanupClosePushL( targetEntries ); |
|
5700 |
GetActionsTargetEntriesL( targetEntries ); |
|
5701 |
||
5702 |
// Mark as read is available if at least one of the target entries is unread |
|
5703 |
for ( TInt i = 0 ; i < targetEntries.Count() ; ++i ) |
|
5704 |
{ |
|
5705 |
const CFSMailMessage& message = MsgPtrFromListIdL( targetEntries[i] ); |
|
5706 |
if ( !message.IsFlagSet(EFSMsgFlag_Read) ) |
|
5707 |
{ |
|
5708 |
available = ETrue; |
|
5709 |
break; |
|
5710 |
} |
|
5711 |
} |
|
5712 |
||
5713 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
5714 |
} |
|
5715 |
||
5716 |
return available; |
|
5717 |
} |
|
5718 |
||
5719 |
// --------------------------------------------------------------------------- |
|
5720 |
// CFSEmailUiMailListVisualiser::IsMarkAsUnreadAvailableL() |
|
5721 |
// Function checks if mark as unread option should be available for user |
|
5722 |
// --------------------------------------------------------------------------- |
|
5723 |
// |
|
5724 |
TBool CFSEmailUiMailListVisualiser::IsMarkAsUnreadAvailableL() const |
|
5725 |
{ |
|
5726 |
FUNC_LOG; |
|
5727 |
TBool available = EFalse; |
|
5728 |
||
5729 |
// In outbox the mark as unread is always inavailable |
|
5730 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSOutbox ) |
|
5731 |
{ |
|
5732 |
RFsTreeItemIdList targetEntries; |
|
5733 |
CleanupClosePushL( targetEntries ); |
|
5734 |
GetActionsTargetEntriesL( targetEntries ); |
|
5735 |
||
5736 |
// Mark as unread is available if at least one of the target entries is read |
|
5737 |
for ( TInt i = 0 ; i < targetEntries.Count() ; ++i ) |
|
5738 |
{ |
|
5739 |
const CFSMailMessage& message = MsgPtrFromListIdL( targetEntries[i] ); |
|
5740 |
if ( message.IsFlagSet(EFSMsgFlag_Read) ) |
|
5741 |
{ |
|
5742 |
available = ETrue; |
|
5743 |
break; |
|
5744 |
} |
|
5745 |
} |
|
5746 |
||
5747 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
5748 |
} |
|
5749 |
||
5750 |
return available; |
|
5751 |
} |
|
5752 |
||
5753 |
// --------------------------------------------------------------------------- |
|
5754 |
// Utility function to get list of entries which will be targeted by the |
|
5755 |
// Actions menu commands. The list contains either marked entries or the |
|
5756 |
// focused message entry or is empty. |
|
5757 |
// --------------------------------------------------------------------------- |
|
5758 |
void CFSEmailUiMailListVisualiser::GetActionsTargetEntriesL( RFsTreeItemIdList& aListItems ) const |
|
5759 |
{ |
|
5760 |
FUNC_LOG; |
|
5761 |
if ( iMailList ) |
|
5762 |
{ |
|
5763 |
iMailList->GetMarkedItemsL( aListItems ); |
|
5764 |
||
5765 |
// If there are no marked entries the command target is the focused item. |
|
5766 |
if ( !aListItems.Count() ) |
|
5767 |
{ |
|
5768 |
TFsTreeItemId focusedId = iMailList->FocusedItem(); |
|
5769 |
if ( iFocusedControl == EMailListComponent && |
|
5770 |
focusedId != KFsTreeNoneID && |
|
5771 |
!iMailList->IsNode( focusedId ) ) |
|
5772 |
{ |
|
5773 |
aListItems.AppendL( focusedId ); |
|
5774 |
} |
|
5775 |
} |
|
5776 |
} |
|
5777 |
} |
|
5778 |
||
5779 |
// --------------------------------------------------------------------------- |
|
5780 |
// |
|
5781 |
// |
|
5782 |
// --------------------------------------------------------------------------- |
|
5783 |
// |
|
5784 |
void CFSEmailUiMailListVisualiser::ShortcutReadUnreadToggleL() |
|
5785 |
{ |
|
5786 |
FUNC_LOG; |
|
5787 |
// Setting the read status is not possible in outbox |
|
5788 |
// <cmail> |
|
5789 |
if ( iModel->Count() && iMailFolder && iMailFolder->GetFolderType() != EFSOutbox ) |
|
5790 |
// </cmail> |
|
5791 |
{ |
|
5792 |
RFsTreeItemIdList targetEntries; |
|
5793 |
CleanupClosePushL( targetEntries ); |
|
5794 |
GetActionsTargetEntriesL( targetEntries ); |
|
5795 |
TInt targetCount = targetEntries.Count(); |
|
5796 |
||
5797 |
// figure out are we marking items as read or unread |
|
5798 |
TBool toggleAsRead(ETrue); |
|
5799 |
for ( TInt i=0 ; i<targetCount ; i++ ) |
|
5800 |
{ |
|
5801 |
CFSMailMessage& msgPtr = MsgPtrFromListIdL( targetEntries[i] ); |
|
5802 |
if ( msgPtr.IsFlagSet(EFSMsgFlag_Read) ) |
|
5803 |
{ |
|
5804 |
toggleAsRead = EFalse; |
|
5805 |
break; |
|
5806 |
} |
|
5807 |
} |
|
5808 |
||
5809 |
// change the status of the target items |
|
5810 |
for ( TInt i=0 ; i<targetCount ; i++ ) |
|
5811 |
{ |
|
5812 |
TInt msgIndex = ModelIndexFromListId( targetEntries[i] ); |
|
5813 |
ChangeReadStatusOfIndexL( toggleAsRead, msgIndex ); |
|
5814 |
} |
|
5815 |
||
5816 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
5817 |
} |
|
5818 |
} |
|
5819 |
||
5820 |
// --------------------------------------------------------------------------- |
|
5821 |
// |
|
5822 |
// |
|
5823 |
// --------------------------------------------------------------------------- |
|
5824 |
// |
|
5825 |
void CFSEmailUiMailListVisualiser::HandleControlBarEvent( TFsControlBarEvent aEvent, TInt aData ) |
|
5826 |
{ |
|
5827 |
FUNC_LOG; |
|
5828 |
||
5829 |
switch( aEvent ) |
|
5830 |
{ |
|
5831 |
case EEventFocusLostAtBottom: |
|
5832 |
case EEventFocusLostAtSide: |
|
5833 |
{ |
|
5834 |
iFocusedControl = EMailListComponent; |
|
5835 |
TRAP_IGNORE( iMailList->SetFocusedL( ETrue ) ); |
|
5836 |
break; |
|
5837 |
} |
|
5838 |
case EEventFocusGained: |
|
5839 |
{ |
|
5840 |
break; |
|
5841 |
} |
|
5842 |
case EEventButtonPressed: |
|
5843 |
{ |
|
5844 |
// Handle 2 control buttons |
|
5845 |
if ( aData == iFolderListButtonId ) |
|
5846 |
{ |
|
5847 |
} |
|
5848 |
else if ( aData == iSortButtonId ) |
|
5849 |
{ |
|
5850 |
} |
|
5851 |
break; |
|
5852 |
} |
|
5853 |
case EEventFocusVisibilityChanged: |
|
5854 |
{ |
|
5855 |
// Hide focus after button release |
|
5856 |
iAppUi.SetFocusVisibility( EFalse ); |
|
5857 |
break; |
|
5858 |
} |
|
5859 |
default: |
|
5860 |
{ |
|
5861 |
// No need to handle other events |
|
5862 |
break; |
|
5863 |
} |
|
5864 |
} |
|
5865 |
} |
|
5866 |
||
5867 |
// --------------------------------------------------------------------------- |
|
5868 |
// |
|
5869 |
// |
|
5870 |
// --------------------------------------------------------------------------- |
|
5871 |
// |
|
5872 |
void CFSEmailUiMailListVisualiser::CreateControlBarLayoutL() |
|
5873 |
{ |
|
5874 |
FUNC_LOG; |
|
5875 |
iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() ); |
|
5876 |
||
5877 |
// New email button |
|
5878 |
iNewEmailButtonId = iControlBarControl->AddButtonL( ECBTypeOneLineLabelIconA ); |
|
5879 |
iNewEmailButton = iControlBarControl->ButtonById( iNewEmailButtonId ); |
|
5880 |
const TRect mailButtonRect( iAppUi.LayoutHandler()->GetControlBarNewEmailButtonRect() ); |
|
5881 |
iNewEmailButton->SetPos( mailButtonRect.iTl ); |
|
5882 |
iNewEmailButton->SetSize( mailButtonRect.Size() ); |
|
5883 |
ControlGroup().AppendL(iNewEmailButton->AsAlfControl()); |
|
5884 |
||
5885 |
// Folder list button |
|
5886 |
iFolderListButtonId = iControlBarControl->AddButtonL( ECBTypeOneLineLabelIconA ); |
|
5887 |
iFolderListButton = iControlBarControl->ButtonById( iFolderListButtonId ); |
|
5888 |
const TRect folderButtonRect( iAppUi.LayoutHandler()->GetControlBarFolderListButtonRect() ); |
|
5889 |
iFolderListButton->SetPos( folderButtonRect.iTl ); |
|
5890 |
iFolderListButton->SetSize( folderButtonRect.Size() ); |
|
5891 |
ControlGroup().AppendL(iFolderListButton->AsAlfControl()); |
|
5892 |
||
5893 |
// Sort order button |
|
5894 |
iSortButtonId = iControlBarControl->AddButtonL( ECBTypeOneLineLabelIconA ); |
|
5895 |
iSortButton = iControlBarControl->ButtonById( iSortButtonId ); |
|
5896 |
const TRect sortButtonRect( iAppUi.LayoutHandler()->GetControlBarSortButtonRect() ); |
|
5897 |
iSortButton->SetPos( sortButtonRect.iTl ); |
|
5898 |
iSortButton->SetSize( sortButtonRect.Size() ); |
|
5899 |
ControlGroup().AppendL(iSortButton->AsAlfControl()); |
|
5900 |
// </cmail> |
|
5901 |
||
5902 |
// Set the text alignment according the layout |
|
5903 |
TAlfAlignHorizontal horizontalAlign = EAlfAlignHLeft; |
|
5904 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
5905 |
{ |
|
5906 |
horizontalAlign = EAlfAlignHRight; |
|
5907 |
} |
|
5908 |
// Icons and sort button text |
|
5909 |
iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) ); |
|
5910 |
iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) ); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
5911 |
SetSortButtonIconL(); |
25 | 5912 |
|
5913 |
iNewEmailButton->SetElemAlignL( |
|
5914 |
ECBElemIconA, |
|
5915 |
EAlfAlignHCenter, |
|
5916 |
EAlfAlignVCenter ); |
|
5917 |
||
5918 |
iFolderListButton->SetElemAlignL( |
|
5919 |
ECBElemLabelFirstLine, |
|
5920 |
horizontalAlign, |
|
5921 |
EAlfAlignVCenter ); |
|
5922 |
iSortButton->SetElemAlignL( |
|
5923 |
ECBElemLabelFirstLine, |
|
5924 |
horizontalAlign, |
|
5925 |
EAlfAlignVCenter ); |
|
5926 |
iSortButton->SetElemAlignL( |
|
5927 |
ECBElemIconA, |
|
5928 |
EAlfAlignHCenter, |
|
5929 |
EAlfAlignVCenter ); |
|
5930 |
||
5931 |
// Show the buttons |
|
5932 |
iNewEmailButton->ShowButtonL(); |
|
5933 |
iFolderListButton->ShowButtonL(); |
|
5934 |
iSortButton->ShowButtonL(); |
|
5935 |
} |
|
5936 |
||
5937 |
// --------------------------------------------------------------------------- |
|
5938 |
// |
|
5939 |
// |
|
5940 |
// --------------------------------------------------------------------------- |
|
5941 |
// |
|
5942 |
void CFSEmailUiMailListVisualiser::ScaleControlBarL() |
|
5943 |
{ |
|
5944 |
FUNC_LOG; |
|
5945 |
||
5946 |
if( !Layout_Meta_Data::IsLandscapeOrientation() && iMarkingMode) |
|
5947 |
{ |
|
5948 |
// No control bar buttons in portrait marking mode |
|
5949 |
return; |
|
5950 |
} |
|
5951 |
||
5952 |
TRect screenRect = iAppUi.ClientRect(); |
|
5953 |
||
5954 |
// First set pos, widht and height |
|
5955 |
iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() ); |
|
5956 |
||
5957 |
const TRect newEmailButtonRect( iAppUi.LayoutHandler()->GetControlBarNewEmailButtonRect() ); |
|
5958 |
//Add comments by luo gen(e0645320) |
|
5959 |
//The position of button should be set according to the size of button, so set size first |
|
5960 |
iNewEmailButton->SetSize( newEmailButtonRect.Size() ); |
|
5961 |
iNewEmailButton->SetPos( newEmailButtonRect.iTl ); |
|
5962 |
||
5963 |
const TRect folderButtonRect( iAppUi.LayoutHandler()->GetControlBarFolderListButtonRect() ); |
|
5964 |
iFolderListButton->SetSize( folderButtonRect.Size() ); |
|
5965 |
iFolderListButton->SetPos( folderButtonRect.iTl ); |
|
5966 |
||
5967 |
const TRect sortButtonRect( iAppUi.LayoutHandler()->GetControlBarSortButtonRect() ); |
|
5968 |
iSortButton->SetSize( sortButtonRect.Size() ); |
|
5969 |
iSortButton->SetPos( sortButtonRect.iTl ); |
|
5970 |
||
5971 |
TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
|
5972 |
TAknLayoutText textLayout; |
|
5973 |
if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
5974 |
{ |
|
5975 |
textLayout.LayoutText(TRect(0,0,0,0), AknLayoutScalable_Apps::cmail_ddmenu_btn02_pane_t2(0)); |
|
5976 |
} |
|
5977 |
else |
|
5978 |
{ |
|
5979 |
textLayout.LayoutText(TRect(0,0,0,0), AknLayoutScalable_Apps::main_sp_fs_ctrlbar_ddmenu_pane_t1(var)); |
|
5980 |
} |
|
5981 |
iNewEmailButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() ); |
|
5982 |
iFolderListButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() ); |
|
5983 |
iSortButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() ); |
|
5984 |
||
5985 |
UpdateThemeL(EFalse); |
|
5986 |
||
5987 |
iNewEmailButton->ShowButtonL(); |
|
5988 |
iFolderListButton->ShowButtonL(); |
|
5989 |
iSortButton->ShowButtonL(); |
|
5990 |
} |
|
5991 |
||
5992 |
// --------------------------------------------------------------------------- |
|
5993 |
// |
|
5994 |
// |
|
5995 |
// --------------------------------------------------------------------------- |
|
5996 |
// |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
5997 |
void CFSEmailUiMailListVisualiser::SetSortButtonIconL() |
25 | 5998 |
{ |
5999 |
FUNC_LOG; |
|
6000 |
iSortButton->SetIconL( |
|
6001 |
iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ), |
|
6002 |
ECBElemIconA ); |
|
6003 |
||
6004 |
} |
|
6005 |
||
6006 |
// --------------------------------------------------------------------------- |
|
6007 |
// |
|
6008 |
// |
|
6009 |
// --------------------------------------------------------------------------- |
|
6010 |
// |
|
6011 |
TFSEmailUiTextures CFSEmailUiMailListVisualiser::GetSortButtonTextureIndex() |
|
6012 |
{ |
|
6013 |
FUNC_LOG; |
|
6014 |
||
6015 |
TFSEmailUiTextures textureIndex( ETextureFirst ); |
|
6016 |
switch ( iCurrentSortCriteria.iField ) |
|
6017 |
{ |
|
6018 |
case EFSMailSortBySubject: |
|
6019 |
{ |
|
6020 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6021 |
ESortListSubjectDescTexture : |
|
6022 |
ESortListSubjectAscTexture; |
|
6023 |
} |
|
6024 |
break; |
|
6025 |
case EFSMailSortByAttachment: |
|
6026 |
{ |
|
6027 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6028 |
ESortListAttachmentDescTexture : |
|
6029 |
ESortListAttachmentAscTexture; |
|
6030 |
} |
|
6031 |
break; |
|
6032 |
case EFSMailSortByFlagStatus: |
|
6033 |
{ |
|
6034 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6035 |
ESortListFollowDescTexture : |
|
6036 |
ESortListFollowAscTexture; |
|
6037 |
} |
|
6038 |
break; |
|
6039 |
case EFSMailSortByRecipient: |
|
6040 |
case EFSMailSortBySender: |
|
6041 |
{ |
|
6042 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6043 |
ESortListSenderDescTexture : |
|
6044 |
ESortListSenderAscTexture; |
|
6045 |
} |
|
6046 |
break; |
|
6047 |
case EFSMailSortByPriority: |
|
6048 |
{ |
|
6049 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6050 |
ESortListPriorityDescTexture : |
|
6051 |
ESortListPriorityAscTexture; |
|
6052 |
} |
|
6053 |
break; |
|
6054 |
case EFSMailSortByUnread: |
|
6055 |
{ |
|
6056 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6057 |
ESortListUnreadDescTexture : |
|
6058 |
ESortListUnreadAscTexture; |
|
6059 |
} |
|
6060 |
break; |
|
6061 |
case EFSMailSortByDate: |
|
6062 |
default: |
|
6063 |
{ |
|
6064 |
textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ? |
|
6065 |
ESortListDateDescTexture : |
|
6066 |
ESortListDateAscTexture; |
|
6067 |
} |
|
6068 |
break; |
|
6069 |
} |
|
6070 |
return textureIndex; |
|
6071 |
} |
|
6072 |
||
6073 |
// --------------------------------------------------------------------------- |
|
6074 |
// |
|
6075 |
// |
|
6076 |
// --------------------------------------------------------------------------- |
|
6077 |
// |
|
6078 |
HBufC* CFSEmailUiMailListVisualiser::GetSortButtonTextLC() |
|
6079 |
{ |
|
6080 |
FUNC_LOG; |
|
6081 |
HBufC* buttonText( 0 ); |
|
6082 |
||
6083 |
switch ( iCurrentSortCriteria.iField ) |
|
6084 |
{ |
|
6085 |
case EFSMailSortBySubject: |
|
6086 |
{ |
|
6087 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_SUBJECT ); |
|
6088 |
} |
|
6089 |
break; |
|
6090 |
case EFSMailSortByAttachment: |
|
6091 |
{ |
|
6092 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_ATTACHMENT ); |
|
6093 |
} |
|
6094 |
break; |
|
6095 |
case EFSMailSortByFlagStatus: |
|
6096 |
{ |
|
6097 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_FLAG ); |
|
6098 |
} |
|
6099 |
break; |
|
6100 |
case EFSMailSortByRecipient: |
|
6101 |
case EFSMailSortBySender: |
|
6102 |
{ |
|
6103 |
TFSFolderType folderType( EFSInbox ); |
|
6104 |
if( iMailFolder ) |
|
6105 |
{ |
|
6106 |
folderType = iMailFolder->GetFolderType(); |
|
6107 |
} |
|
6108 |
switch( folderType ) |
|
6109 |
{ |
|
6110 |
case EFSSentFolder: |
|
6111 |
case EFSDraftsFolder: |
|
6112 |
case EFSOutbox: |
|
6113 |
{ |
|
6114 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_RECIPIENT ); |
|
6115 |
} |
|
6116 |
break; |
|
6117 |
default: |
|
6118 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_SENDER ); |
|
6119 |
break; |
|
6120 |
} |
|
6121 |
} |
|
6122 |
break; |
|
6123 |
case EFSMailSortByPriority: |
|
6124 |
{ |
|
6125 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_PRIORITY ); |
|
6126 |
} |
|
6127 |
break; |
|
6128 |
case EFSMailSortByUnread: |
|
6129 |
{ |
|
6130 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_UNREAD ); |
|
6131 |
} |
|
6132 |
break; |
|
6133 |
case EFSMailSortByDate: |
|
6134 |
default: |
|
6135 |
{ |
|
6136 |
buttonText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_SORT_BY_DATE ); |
|
6137 |
} |
|
6138 |
break; |
|
6139 |
} |
|
6140 |
return buttonText; |
|
6141 |
} |
|
6142 |
||
6143 |
// --------------------------------------------------------------------------- |
|
6144 |
// |
|
6145 |
// |
|
6146 |
// --------------------------------------------------------------------------- |
|
6147 |
// |
|
6148 |
void CFSEmailUiMailListVisualiser::SetMailListLayoutAnchors() |
|
6149 |
{ |
|
6150 |
FUNC_LOG; |
|
6151 |
// Set anchors so that list leaves space for control bar |
|
6152 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 0, |
|
6153 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
6154 |
EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
6155 |
TAlfTimedPoint(0, 0 )); |
|
6156 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0, |
|
6157 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
6158 |
EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute, |
|
6159 |
TAlfTimedPoint(1, iAppUi.LayoutHandler()->ControlBarHeight() )); |
|
6160 |
||
6161 |
TRect listRect = iAppUi.LayoutHandler()->GetListRect(); |
|
6162 |
// Set anchors so that list leaves space for control bar |
|
6163 |
if( Layout_Meta_Data::IsMirrored() ) |
|
6164 |
{ |
|
6165 |
TInt tlX = listRect.iTl.iX; |
|
6166 |
TInt brX = listRect.iBr.iX; |
|
6167 |
||
6168 |
listRect.iTl.iX = AknLayoutScalable_Avkon::Screen().LayoutLine().iW - brX; |
|
6169 |
listRect.iBr.iX = AknLayoutScalable_Avkon::Screen().LayoutLine().iW - tlX; |
|
6170 |
} |
|
6171 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1, |
|
6172 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
6173 |
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
6174 |
TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY)); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6175 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6176 |
if (iMarkingMode && Layout_Meta_Data::IsLandscapeOrientation()) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6177 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6178 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6179 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6180 |
EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6181 |
TAlfTimedPoint(1, listRect.iBr.iY)); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6182 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6183 |
else |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6184 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6185 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6186 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6187 |
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6188 |
TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY)); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
6189 |
} |
25 | 6190 |
|
6191 |
// Set anchors for connection icon |
|
6192 |
TRect connectionIconRect( iAppUi.LayoutHandler()->GetControlBarConnectionIconRect() ); |
|
6193 |
const TPoint& tl( connectionIconRect.iTl ); |
|
6194 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2, |
|
6195 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
6196 |
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
6197 |
TAlfTimedPoint( tl.iX, tl.iY )); |
|
6198 |
const TPoint& br( connectionIconRect.iBr ); |
|
6199 |
iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2, |
|
6200 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
6201 |
EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
6202 |
TAlfTimedPoint( br.iX, br.iY )); |
|
6203 |
||
6204 |
iScreenAnchorLayout->UpdateChildrenLayout(); |
|
6205 |
} |
|
6206 |
||
6207 |
// --------------------------------------------------------------------------- |
|
6208 |
// |
|
6209 |
// |
|
6210 |
// --------------------------------------------------------------------------- |
|
6211 |
// |
|
6212 |
void CFSEmailUiMailListVisualiser::ChangeReadStatusOfHighlightedL( TBool aRead ) |
|
6213 |
{ |
|
6214 |
FUNC_LOG; |
|
6215 |
ChangeReadStatusOfIndexL( aRead, HighlightedIndex() ); |
|
6216 |
} |
|
6217 |
||
6218 |
// --------------------------------------------------------------------------- |
|
6219 |
// ChangeReadStatusOfMarkedL |
|
6220 |
// |
|
6221 |
// --------------------------------------------------------------------------- |
|
6222 |
// |
|
6223 |
void CFSEmailUiMailListVisualiser::ChangeReadStatusOfMarkedL( TBool aRead ) |
|
6224 |
{ |
|
6225 |
FUNC_LOG; |
|
6226 |
RFsTreeItemIdList markedEntries; |
|
6227 |
CleanupClosePushL( markedEntries ); |
|
6228 |
iMailList->GetMarkedItemsL( markedEntries ); |
|
6229 |
for ( TInt i=0; i<markedEntries.Count();i++ ) |
|
6230 |
{ |
|
6231 |
TInt msgIndex = ModelIndexFromListId( markedEntries[i] ); |
|
6232 |
ChangeReadStatusOfIndexL( aRead, msgIndex ); |
|
6233 |
} |
|
6234 |
UnmarkAllItemsL(); |
|
6235 |
CleanupStack::PopAndDestroy( &markedEntries ); |
|
6236 |
} |
|
6237 |
||
6238 |
void CFSEmailUiMailListVisualiser::ChangeReadStatusOfIndexL( TBool aRead, TInt aIndex ) |
|
6239 |
{ |
|
6240 |
FUNC_LOG; |
|
6241 |
// <cmail> |
|
6242 |
if ( iModel->Count() ) |
|
6243 |
// </cmail> |
|
6244 |
{ |
|
6245 |
CFSEmailUiMailListModelItem* selectedItem = |
|
6246 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( aIndex )); |
|
6247 |
if ( selectedItem ) // Safety |
|
6248 |
{ |
|
6249 |
CFSMailMessage& msgPtr = selectedItem->MessagePtr(); |
|
6250 |
TBool msgWasReadBefore = msgPtr.IsFlagSet( EFSMsgFlag_Read ); |
|
6251 |
if ( aRead != msgWasReadBefore ) |
|
6252 |
{ |
|
6253 |
if ( aRead ) |
|
6254 |
{ |
|
6255 |
// Send flags, local and server |
|
6256 |
msgPtr.SetFlag( EFSMsgFlag_Read ); |
|
6257 |
} |
|
6258 |
else |
|
6259 |
{ |
|
6260 |
// Send flags, local and server |
|
6261 |
msgPtr.ResetFlag( EFSMsgFlag_Read ); |
|
6262 |
} |
|
6263 |
msgPtr.SaveMessageL(); // Save flag |
|
6264 |
||
6265 |
// Switch icon to correct one if mail list is visible |
|
6266 |
TBool needRefresh = ( iAppUi.CurrentActiveView()->Id() == MailListId ); |
|
6267 |
UpdateMsgIconAndBoldingL( aIndex, needRefresh); |
|
6268 |
||
6269 |
if ( iCurrentSortCriteria.iField == EFSMailSortByUnread ) |
|
6270 |
{ |
|
6271 |
// Attribute affecting the current sorting order has been changed. |
|
6272 |
// Thus, the list order may now be incorrect. |
|
6273 |
iListOrderMayBeOutOfDate = ETrue; |
|
6274 |
} |
|
6275 |
} |
|
6276 |
} |
|
6277 |
} |
|
6278 |
} |
|
6279 |
||
6280 |
// --------------------------------------------------------------------------- |
|
6281 |
// DeleteMessagesL |
|
6282 |
// |
|
6283 |
// --------------------------------------------------------------------------- |
|
6284 |
// |
|
6285 |
void CFSEmailUiMailListVisualiser::DeleteMessagesL() |
|
6286 |
{ |
|
6287 |
FUNC_LOG; |
|
6288 |
const TInt markedCount(CountMarkedItemsL()); |
|
6289 |
const TFsTreeItemId focusedId(iMailList->FocusedItem()); |
|
6290 |
||
6291 |
// Delete either marked items or the focused one |
|
6292 |
if (markedCount) |
|
6293 |
{ |
|
6294 |
DeleteMarkedMessagesL(); |
|
6295 |
} |
|
6296 |
else if (iMailList->IsNode(focusedId)) |
|
6297 |
{ |
|
6298 |
DeleteMessagesUnderNodeL(focusedId); |
|
6299 |
} |
|
6300 |
else |
|
6301 |
{ |
|
6302 |
DeleteFocusedMessageL(); |
|
6303 |
} |
|
6304 |
||
6305 |
// Set highlight to control bar if no items after delete |
|
6306 |
// <cmail> |
|
6307 |
if ( iModel->Count() == 0 ) |
|
6308 |
// </cmail> |
|
6309 |
{ |
|
6310 |
iFocusedControl = EControlBarComponent; |
|
6311 |
iMailList->SetFocusedL( EFalse ); |
|
6312 |
iControlBarControl->SetFocusL(); |
|
6313 |
} |
|
6314 |
} |
|
6315 |
||
6316 |
// --------------------------------------------------------------------------- |
|
6317 |
// UpdateItemAtIndexL |
|
6318 |
// Reload message pointer from mail client and update list item contents to |
|
6319 |
// match it. Item is removed if it isn't valid anymore. |
|
6320 |
// --------------------------------------------------------------------------- |
|
6321 |
// |
|
6322 |
void CFSEmailUiMailListVisualiser::UpdateItemAtIndexL( TInt aIndex ) |
|
6323 |
{ |
|
6324 |
FUNC_LOG; |
|
6325 |
// <cmail> |
|
6326 |
||
6327 |
if ( aIndex >= 0 && aIndex < iModel->Count() ) |
|
6328 |
// </cmail> |
|
6329 |
{ |
|
6330 |
CFSEmailUiMailListModelItem* modelItem = |
|
6331 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( aIndex ) ); |
|
6332 |
if ( modelItem && modelItem->ModelItemType() == ETypeMailItem ) |
|
6333 |
{ |
|
6334 |
// This is beacause message deleted event migh have occured. |
|
6335 |
CFSMailMessage* confirmedMsgPtr = NULL; |
|
6336 |
TRAP_IGNORE( confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
|
6337 |
iMailFolder->GetFolderId(), |
|
6338 |
modelItem->MessagePtr().GetMessageId() , |
|
6339 |
EFSMsgDataEnvelope ) ); |
|
6340 |
if( aIndex < iTreeItemArray.Count() ) |
|
6341 |
{ |
|
6342 |
if ( confirmedMsgPtr ) |
|
6343 |
{ |
|
6344 |
const SMailListItem& item = iTreeItemArray[aIndex]; |
|
6345 |
// Replace message pointer in model with newly fetched one |
|
6346 |
Model()->ReplaceMessagePtr( aIndex, confirmedMsgPtr ); |
|
6347 |
||
6348 |
// Update the list item contents and formating to match the message pointer |
|
6349 |
CFsTreePlainTwoLineItemData* itemData = |
|
6350 |
static_cast<CFsTreePlainTwoLineItemData*>( item.iTreeItemData ); |
|
6351 |
CFsTreePlainTwoLineItemVisualizer* itemVis = |
|
6352 |
static_cast<CFsTreePlainTwoLineItemVisualizer*>( item.iTreeItemVisualiser ); |
|
6353 |
||
6354 |
UpdateItemDataL( itemData, confirmedMsgPtr ); |
|
6355 |
UpdatePreviewPaneTextForItemL( itemData, confirmedMsgPtr ); |
|
6356 |
UpdateMsgIconAndBoldingL( itemData, itemVis, confirmedMsgPtr ); |
|
6357 |
iMailTreeListVisualizer->UpdateItemL( item.iListItemId ); |
|
6358 |
} |
|
6359 |
else |
|
6360 |
{ |
|
6361 |
// No confirmed message for highlighted, remove from list also |
|
6362 |
iMailList->RemoveL( iTreeItemArray[aIndex].iListItemId ); // remove from list |
|
6363 |
iTreeItemArray.Remove( aIndex ); // remove from internal array. |
|
6364 |
iModel->RemoveAndDestroy( aIndex ); // Remove from model |
|
6365 |
if ( iNodesInUse ) |
|
6366 |
{ |
|
6367 |
RemoveUnnecessaryNodesL(); |
|
6368 |
} |
|
6369 |
} |
|
6370 |
} |
|
6371 |
} |
|
6372 |
} |
|
6373 |
} |
|
6374 |
||
6375 |
// --------------------------------------------------------------------------- |
|
6376 |
// CheckValidityOfHighlightedMsgL |
|
6377 |
// Check validity of highlighted msg, and remove from list if needed |
|
6378 |
// Typically called after view is returned from editot or viewer. |
|
6379 |
// --------------------------------------------------------------------------- |
|
6380 |
// |
|
6381 |
TBool CFSEmailUiMailListVisualiser::CheckValidityOfHighlightedMsgL() |
|
6382 |
{ |
|
6383 |
FUNC_LOG; |
|
6384 |
TBool ret(EFalse); |
|
6385 |
// <cmail> |
|
6386 |
if ( iModel->Count() ) |
|
6387 |
// </cmail> |
|
6388 |
{ |
|
6389 |
CFSEmailUiMailListModelItem* item = |
|
6390 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( HighlightedIndex() ) ); |
|
6391 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
6392 |
{ |
|
6393 |
// This is beacause message deleted event migh have occured. |
|
6394 |
CFSMailMessage* confirmedMsgPtr = NULL; |
|
6395 |
TRAP_IGNORE( confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(), |
|
6396 |
iMailFolder->GetFolderId(), |
|
6397 |
item->MessagePtr().GetMessageId() , |
|
6398 |
EFSMsgDataEnvelope ) ); |
|
6399 |
if ( confirmedMsgPtr ) |
|
6400 |
{ |
|
6401 |
ret = ETrue; |
|
6402 |
delete confirmedMsgPtr; |
|
6403 |
confirmedMsgPtr = NULL; |
|
6404 |
} |
|
6405 |
else |
|
6406 |
{ |
|
6407 |
// No confirmed message for highlighted, remove from list also |
|
6408 |
ret = EFalse; |
|
6409 |
SMailListItem item; |
|
6410 |
item.iListItemId = iMailList->FocusedItem(); |
|
6411 |
TInt IndexToBeDestroyed = iTreeItemArray.Find( item ); |
|
6412 |
iTreeItemArray.Remove( IndexToBeDestroyed ); // remove from internal array. |
|
6413 |
iModel->RemoveAndDestroy( IndexToBeDestroyed ); // Remove from model |
|
6414 |
iMailList->RemoveL( iMailList->FocusedItem() ); // remove from list |
|
6415 |
if ( iNodesInUse ) |
|
6416 |
{ |
|
6417 |
RemoveUnnecessaryNodesL(); |
|
6418 |
} |
|
6419 |
} |
|
6420 |
} |
|
6421 |
} |
|
6422 |
return ret; |
|
6423 |
} |
|
6424 |
||
6425 |
// --------------------------------------------------------------------------- |
|
6426 |
// UpdateMsgIconAndBoldingL |
|
6427 |
// Updates our own message object with the data from a given message object. |
|
6428 |
// The messages are matched with the message ID. |
|
6429 |
// --------------------------------------------------------------------------- |
|
6430 |
void CFSEmailUiMailListVisualiser::UpdateMsgIconAndBoldingL( CFSMailMessage* aMsgPtr ) |
|
6431 |
{ |
|
6432 |
FUNC_LOG; |
|
6433 |
// <cmail> |
|
6434 |
if ( aMsgPtr && iModel->Count() ) |
|
6435 |
// </cmail> |
|
6436 |
{ |
|
6437 |
TInt mailItemIdx = ItemIndexFromMessageId( aMsgPtr->GetMessageId() ); |
|
6438 |
if ( mailItemIdx >= 0 ) |
|
6439 |
{ |
|
6440 |
CFSEmailUiMailListModelItem* item = |
|
6441 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( mailItemIdx ) ); |
|
6442 |
||
6443 |
if ( item ) // For safety |
|
6444 |
{ |
|
6445 |
// Update all flags |
|
6446 |
TUint32 prevFlags = item->MessagePtr().GetFlags(); |
|
6447 |
TUint32 newFlags = aMsgPtr->GetFlags(); |
|
6448 |
if ( prevFlags != newFlags ) |
|
6449 |
{ |
|
6450 |
item->MessagePtr().ResetFlag( prevFlags ); |
|
6451 |
item->MessagePtr().SetFlag( newFlags ); |
|
6452 |
||
6453 |
// Save changed flags in internal model array |
|
6454 |
item->MessagePtr().SaveMessageL(); |
|
6455 |
} |
|
6456 |
||
6457 |
// Update the list item graphics |
|
6458 |
UpdateMsgIconAndBoldingL( mailItemIdx ); |
|
6459 |
} |
|
6460 |
} |
|
6461 |
} |
|
6462 |
} |
|
6463 |
||
6464 |
// --------------------------------------------------------------------------- |
|
6465 |
// UpdateMsgIconAndBoldingL |
|
6466 |
// Updates list item at given index to match the state of the message object |
|
6467 |
// --------------------------------------------------------------------------- |
|
6468 |
// |
|
6469 |
void CFSEmailUiMailListVisualiser::UpdateMsgIconAndBoldingL( TInt aListIndex, TBool aRefreshItem ) |
|
6470 |
{ |
|
6471 |
FUNC_LOG; |
|
6472 |
CFSEmailUiMailListModelItem* item = |
|
6473 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(aListIndex) ); |
|
6474 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
6475 |
{ |
|
6476 |
CFSMailMessage* msgPtr = &item->MessagePtr(); |
|
6477 |
CFsTreePlainTwoLineItemData* itemData = |
|
6478 |
static_cast<CFsTreePlainTwoLineItemData*>( iTreeItemArray[aListIndex].iTreeItemData ); |
|
6479 |
CFsTreePlainTwoLineItemVisualizer* itemVis = |
|
6480 |
static_cast<CFsTreePlainTwoLineItemVisualizer*>( iTreeItemArray[aListIndex].iTreeItemVisualiser ); |
|
6481 |
||
6482 |
UpdateMsgIconAndBoldingL( itemData, itemVis, msgPtr ); |
|
6483 |
||
6484 |
//refresh item if requested |
|
6485 |
if ( aRefreshItem ) |
|
6486 |
{ |
|
6487 |
iMailTreeListVisualizer->UpdateItemL( iTreeItemArray[aListIndex].iListItemId ); |
|
6488 |
} |
|
6489 |
} |
|
6490 |
} |
|
6491 |
||
6492 |
// --------------------------------------------------------------------------- |
|
6493 |
// UpdateMsgIconAndBoldingL |
|
6494 |
// Updates list item at given index to match the state of the message object |
|
6495 |
// --------------------------------------------------------------------------- |
|
6496 |
// |
|
6497 |
void CFSEmailUiMailListVisualiser::UpdateMsgIconAndBoldingL( CFsTreePlainTwoLineItemData* aItemData, |
|
6498 |
CFsTreePlainTwoLineItemVisualizer* aItemVis, |
|
6499 |
CFSMailMessage* aMsgPtr ) |
|
6500 |
{ |
|
6501 |
FUNC_LOG; |
|
6502 |
||
6503 |
if ( aItemData && aItemVis && aMsgPtr ) |
|
6504 |
{ |
|
6505 |
CAlfTexture* itemTexture = &TFsEmailUiUtility::GetMsgIcon( aMsgPtr, *iAppUi.FsTextureManager() ); |
|
6506 |
aItemData->SetIcon( *itemTexture ); |
|
6507 |
TInt variety( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 ); |
|
6508 |
CAlfTextStyle& textStyle = |
|
6509 |
iAppUi.LayoutHandler()->FSTextStyleFromLayoutL( |
|
6510 |
AknLayoutScalable_Apps::list_single_dyc_row_text_pane_t1( variety ) ); |
|
6511 |
const TBool isNotRead( !aMsgPtr->IsFlagSet( EFSMsgFlag_Read ) ); |
|
6512 |
textStyle.SetBold( isNotRead ); |
|
6513 |
aItemVis->SetTextBold( isNotRead ); |
|
6514 |
aItemVis->SetTextStyleId ( textStyle.Id() ); |
|
6515 |
// Set follow up flag icon |
|
6516 |
if ( aMsgPtr->IsFlagSet( EFSMsgFlag_FollowUp ) ) |
|
6517 |
{ |
|
6518 |
aItemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagList ) ); |
|
6519 |
aItemVis->SetFlagIconVisible( ETrue ); |
|
6520 |
} |
|
6521 |
else if ( aMsgPtr->IsFlagSet( EFSMsgFlag_FollowUpComplete ) ) |
|
6522 |
{ |
|
6523 |
aItemData->SetFlagIcon( iAppUi.FsTextureManager()->TextureByIndex( EFollowUpFlagCompleteList ) ); |
|
6524 |
aItemVis->SetFlagIconVisible( ETrue ); |
|
6525 |
} |
|
6526 |
else |
|
6527 |
{ |
|
6528 |
aItemVis->SetFlagIconVisible( EFalse ); |
|
6529 |
} |
|
6530 |
} |
|
6531 |
} |
|
6532 |
||
6533 |
// --------------------------------------------------------------------------- |
|
6534 |
// RemoveMsgItemsFromListIfFoundL |
|
6535 |
// Message removing from list if found. Does not panic or return found status. |
|
6536 |
// --------------------------------------------------------------------------- |
|
6537 |
// |
|
6538 |
void CFSEmailUiMailListVisualiser::RemoveMsgItemsFromListIfFoundL( const RArray<TFSMailMsgId>& aEntryIds ) |
|
6539 |
{ |
|
6540 |
FUNC_LOG; |
|
6541 |
||
6542 |
TBool itemFound = EFalse; |
|
6543 |
for ( TInt i=0 ; i<aEntryIds.Count() ; ++i ) |
|
6544 |
{ |
|
6545 |
const TFSMailMsgId& entryId = aEntryIds[i]; |
|
6546 |
if ( !entryId.IsNullId() ) |
|
6547 |
{ |
|
6548 |
TInt idx = ItemIndexFromMessageId( entryId ); |
|
6549 |
if ( idx >= 0 ) |
|
6550 |
{ |
|
6551 |
iMailList->RemoveL( iTreeItemArray[idx].iListItemId ); // remove from list |
|
6552 |
iTreeItemArray.Remove( idx ); // remove from internal array. |
|
6553 |
iModel->RemoveAndDestroy( idx ); // Remove from model |
|
6554 |
itemFound = ETrue; |
|
6555 |
} |
|
6556 |
} |
|
6557 |
} |
|
6558 |
||
6559 |
if ( !itemFound ) |
|
6560 |
{ |
|
6561 |
return; // no items to be removed |
|
6562 |
} |
|
6563 |
||
6564 |
if ( iNodesInUse ) |
|
6565 |
{ |
|
6566 |
RemoveUnnecessaryNodesL(); |
|
6567 |
} |
|
6568 |
||
6569 |
// Set highligh to control bar if no items left after |
|
6570 |
// deleted items have been revoved from the list |
|
6571 |
// Otherwise mail list takes care of highlight |
|
6572 |
// <cmail> |
|
6573 |
if ( iModel->Count() == 0 ) |
|
6574 |
// </cmail> |
|
6575 |
{ |
|
6576 |
iFocusedControl = EControlBarComponent; |
|
6577 |
iMailList->SetFocusedL( EFalse ); |
|
6578 |
iControlBarControl->SetFocusL(); |
|
6579 |
} |
|
6580 |
} |
|
6581 |
||
6582 |
// --------------------------------------------------------------------------- |
|
6583 |
// DeleteFocusedMessageL |
|
6584 |
// |
|
6585 |
// --------------------------------------------------------------------------- |
|
6586 |
// |
|
6587 |
void CFSEmailUiMailListVisualiser::DeleteFocusedMessageL() |
|
6588 |
{ |
|
6589 |
FUNC_LOG; |
|
6590 |
TInt currentItemIndex = HighlightedIndex(); |
|
6591 |
if ( Model()->Count() ) |
|
6592 |
{ |
|
6593 |
CFSEmailUiMailListModelItem* item = |
|
6594 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(currentItemIndex) ); |
|
6595 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
6596 |
{ |
|
6597 |
CFSMailMessage& messagePtr = item->MessagePtr(); |
|
6598 |
// Delete message from framework, and perform internal housekeeping |
|
6599 |
TFSMailMsgId msgId = messagePtr.GetMessageId(); |
|
6600 |
RArray<TFSMailMsgId> msgIds; |
|
6601 |
CleanupClosePushL( msgIds ); |
|
6602 |
msgIds.Append( msgId ); |
|
6603 |
TFSMailMsgId folderId = FolderId(); |
|
6604 |
TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId(); |
|
6605 |
iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
|
6606 |
RemoveMsgItemsFromListIfFoundL( msgIds ); |
|
6607 |
CleanupStack::PopAndDestroy( &msgIds ); |
|
6608 |
} |
|
6609 |
} |
|
6610 |
} |
|
6611 |
||
6612 |
// --------------------------------------------------------------------------- |
|
6613 |
// DeleteMessagesUnderNodeL |
|
6614 |
// |
|
6615 |
// --------------------------------------------------------------------------- |
|
6616 |
// |
|
6617 |
void CFSEmailUiMailListVisualiser::DeleteMessagesUnderNodeL( |
|
6618 |
const TFsTreeItemId aNodeId) |
|
6619 |
{ |
|
6620 |
FUNC_LOG; |
|
6621 |
iModel->GetItemIdsUnderNodeL(aNodeId, iDeleteTask->Entries()); |
|
6622 |
ConfirmAndStartDeleteTaskL(iDeleteTask); |
|
6623 |
} |
|
6624 |
||
6625 |
// --------------------------------------------------------------------------- |
|
6626 |
// DeleteMarkedMessagesL |
|
6627 |
// |
|
6628 |
// --------------------------------------------------------------------------- |
|
6629 |
// |
|
6630 |
void CFSEmailUiMailListVisualiser::DeleteMarkedMessagesL() |
|
6631 |
{ |
|
6632 |
FUNC_LOG; |
|
6633 |
iMailList->GetMarkedItemsL(iDeleteTask->Entries()); |
|
6634 |
ConfirmAndStartDeleteTaskL(iDeleteTask); |
|
6635 |
} |
|
6636 |
||
6637 |
// --------------------------------------------------------------------------- |
|
6638 |
// ConfirmAndStartDeleteTaskL |
|
6639 |
// |
|
6640 |
// --------------------------------------------------------------------------- |
|
6641 |
// |
|
6642 |
void CFSEmailUiMailListVisualiser::ConfirmAndStartDeleteTaskL( |
|
6643 |
TDeleteTask<CFSEmailUiMailListVisualiser>* aTask ) |
|
6644 |
{ |
|
6645 |
FUNC_LOG; |
|
6646 |
const RFsTreeItemIdList& entries(aTask->Entries()); |
|
6647 |
if (entries.Count()) |
|
6648 |
{ |
|
6649 |
if (ConfirmDeleteL(entries.Count(), entries[0])) |
|
6650 |
{ |
|
6651 |
ExitMarkingModeL(); |
|
6652 |
if (entries.Count() > KMsgDeletionWaitNoteAmount) |
|
6653 |
{ |
|
6654 |
TFsEmailUiUtility::ShowWaitNoteL(iDeletingWaitNote, |
|
6655 |
R_FSE_WAIT_DELETING_TEXT, EFalse, ETrue); |
|
6656 |
} |
|
6657 |
if (iAsyncCallback) |
|
6658 |
{ |
|
6659 |
// Call actual deletion asynchronously because we must give wait |
|
6660 |
// note time to show up before deletion begins. |
|
6661 |
iAsyncCallback->Cancel(); |
|
6662 |
iAsyncCallback->Set(TCallBack(DoExecuteDeleteTask, aTask)); |
|
6663 |
iAsyncCallback->CallBack(); |
|
6664 |
} |
|
6665 |
} |
|
6666 |
else |
|
6667 |
{ |
|
6668 |
aTask->Reset(); |
|
6669 |
} |
|
6670 |
} |
|
6671 |
} |
|
6672 |
||
6673 |
// --------------------------------------------------------------------------- |
|
6674 |
// DoExecuteDeleteTask |
|
6675 |
// |
|
6676 |
// --------------------------------------------------------------------------- |
|
6677 |
// |
|
6678 |
TInt CFSEmailUiMailListVisualiser::DoExecuteDeleteTask( TAny* aSelfPtr ) |
|
6679 |
{ |
|
6680 |
FUNC_LOG; |
|
6681 |
TRAPD( error, |
|
6682 |
reinterpret_cast<TDeleteTask<CFSEmailUiMailListVisualiser>*>(aSelfPtr)->ExecuteL() ); |
|
6683 |
return error; |
|
6684 |
} |
|
6685 |
||
6686 |
// --------------------------------------------------------------------------- |
|
6687 |
// HandleDeleteTaskL |
|
6688 |
// This is called asynchronously by ConfirmAndStartDeleteTaskL |
|
6689 |
// --------------------------------------------------------------------------- |
|
6690 |
// |
|
6691 |
void CFSEmailUiMailListVisualiser::HandleDeleteTaskL( const RFsTreeItemIdList& aEntries ) |
|
6692 |
{ |
|
6693 |
FUNC_LOG; |
|
6694 |
// Close wait note if it was used |
|
6695 |
if ( iDeletingWaitNote ) |
|
6696 |
{ |
|
6697 |
TRAPD( result, HandleDeleteTaskLeavingCodeL(aEntries) ); |
|
6698 |
// closing the "Deleting" dialog message should not be skipped by leaving |
|
6699 |
TRAP_IGNORE( iDeletingWaitNote->ProcessFinishedL() ); |
|
6700 |
if ( KErrNone != result ) |
|
6701 |
{ |
|
6702 |
// Handle error. |
|
6703 |
User::Leave( result ); |
|
6704 |
} |
|
6705 |
} |
|
6706 |
else |
|
6707 |
{ |
|
6708 |
HandleDeleteTaskLeavingCodeL( aEntries ); |
|
6709 |
} |
|
6710 |
} |
|
6711 |
||
6712 |
// --------------------------------------------------------------------------- |
|
6713 |
// original code HandleDeleteTaskL which may leave - help function to enable |
|
6714 |
// calling iDeletingWaitNote->ProcessFinishedL() |
|
6715 |
// --------------------------------------------------------------------------- |
|
6716 |
// |
|
6717 |
void CFSEmailUiMailListVisualiser::HandleDeleteTaskLeavingCodeL( const RFsTreeItemIdList& aEntries ) |
|
6718 |
{ |
|
6719 |
FUNC_LOG; |
|
6720 |
TFSMailMsgId folderId = FolderId(); |
|
6721 |
TFSMailMsgId mailBox = iAppUi.GetActiveMailboxId(); |
|
6722 |
RArray<TFSMailMsgId> msgIds; |
|
6723 |
CleanupClosePushL( msgIds ); |
|
6724 |
for ( TInt i = aEntries.Count() - 1; i >= 0; i-- ) |
|
6725 |
{ |
|
6726 |
msgIds.AppendL( MsgIdFromListId( aEntries[i] ) ); |
|
6727 |
} |
|
6728 |
||
6729 |
// Clear the focused item to avoid repeated selection of a new focused |
|
6730 |
// item, unnecessary scrolling of the viewport, etc. |
|
6731 |
iMailTreeListVisualizer->SetFocusedItemL( KFsTreeNoneID ); |
|
6732 |
||
6733 |
iMailList->BeginUpdate(); |
|
6734 |
iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds ); |
|
6735 |
// Remove from mail list if not already removed by mailbox events |
|
6736 |
RemoveMsgItemsFromListIfFoundL( msgIds ); |
|
6737 |
iMailList->EndUpdateL(); |
|
6738 |
||
6739 |
CleanupStack::PopAndDestroy(); // msgIds.Close() |
|
6740 |
} |
|
6741 |
||
6742 |
// --------------------------------------------------------------------------- |
|
6743 |
// ConfirmDeleteL |
|
6744 |
// |
|
6745 |
// --------------------------------------------------------------------------- |
|
6746 |
// |
|
6747 |
TBool CFSEmailUiMailListVisualiser::ConfirmDeleteL(const TInt aItemCount, |
|
6748 |
const TFsTreeItemId aItemId) const |
|
6749 |
{ |
|
6750 |
FUNC_LOG; |
|
6751 |
TBool result(ETrue); |
|
6752 |
if (iAppUi.GetCRHandler()->WarnBeforeDelete()) |
|
6753 |
{ |
|
6754 |
HBufC* noteText(NULL); |
|
6755 |
// The note depends on the amount and type of message(s) |
|
6756 |
if (aItemCount == 1) |
|
6757 |
{ |
|
6758 |
const CFSMailMessage& msgPtr(MsgPtrFromListIdL(aItemId)); |
|
6759 |
HBufC* msgSubject = TFsEmailUiUtility::CreateSubjectTextLC( |
|
6760 |
&msgPtr); |
|
6761 |
if (msgPtr.IsFlagSet(EFSMsgFlag_CalendarMsg)) |
|
6762 |
{ |
|
6763 |
noteText = StringLoader::LoadL( |
|
6764 |
R_FREESTYLE_EMAIL_DELETE_CALEVENT_NOTE, *msgSubject); |
|
6765 |
} |
|
6766 |
else |
|
6767 |
{ |
|
6768 |
noteText = StringLoader::LoadL( |
|
6769 |
R_FREESTYLE_EMAIL_DELETE_MAIL_NOTE, *msgSubject); |
|
6770 |
} |
|
6771 |
CleanupStack::PopAndDestroy(msgSubject); |
|
6772 |
CleanupStack::PushL(noteText); |
|
6773 |
} |
|
6774 |
else // markedEntries.Count() > 1 |
|
6775 |
{ |
|
6776 |
noteText = StringLoader::LoadLC( |
|
6777 |
R_FREESTYLE_EMAIL_DELETE_N_MAILS_NOTE, aItemCount); |
|
6778 |
} |
|
6779 |
||
6780 |
// Show the note |
|
6781 |
result = TFsEmailUiUtility::ShowConfirmationQueryL(*noteText); |
|
6782 |
CleanupStack::PopAndDestroy(noteText); |
|
6783 |
} |
|
6784 |
return result; |
|
6785 |
} |
|
6786 |
||
6787 |
// --------------------------------------------------------------------------- |
|
6788 |
// RemoveUnnecessaryNodesL |
|
6789 |
// |
|
6790 |
// --------------------------------------------------------------------------- |
|
6791 |
// |
|
6792 |
void CFSEmailUiMailListVisualiser::RemoveUnnecessaryNodesL() |
|
6793 |
{ |
|
6794 |
FUNC_LOG; |
|
6795 |
RArray<TInt> nodesToBeRemoved; |
|
6796 |
CleanupClosePushL( nodesToBeRemoved ); |
|
6797 |
for ( TInt i=0;i<iTreeItemArray.Count();i++) |
|
6798 |
{ |
|
6799 |
if ( iMailList->IsNode( iTreeItemArray[i].iListItemId ) ) |
|
6800 |
{ |
|
6801 |
if ( iMailList->CountChildren( iTreeItemArray[i].iListItemId ) == 0) |
|
6802 |
{ |
|
6803 |
nodesToBeRemoved.Append( iTreeItemArray[i].iListItemId ); |
|
6804 |
} |
|
6805 |
} |
|
6806 |
} |
|
6807 |
// Remove from the list itself and from iTreeItemArray |
|
6808 |
for ( TInt a = 0; a < nodesToBeRemoved.Count(); a++ ) |
|
6809 |
{ |
|
6810 |
iMailList->RemoveL( nodesToBeRemoved[a] ); |
|
6811 |
SMailListItem item; |
|
6812 |
item.iListItemId = nodesToBeRemoved[a]; |
|
6813 |
TInt IndexToBeDestroyed = iTreeItemArray.Find( item ); |
|
6814 |
iTreeItemArray.Remove( IndexToBeDestroyed ); // remove from internal array. |
|
6815 |
// Remove from model |
|
6816 |
iModel->RemoveAndDestroy( IndexToBeDestroyed ); |
|
6817 |
} |
|
6818 |
CleanupStack::PopAndDestroy( &nodesToBeRemoved ); |
|
6819 |
} |
|
6820 |
||
6821 |
// --------------------------------------------------------------------------- |
|
6822 |
// MsgIdFromIndex |
|
6823 |
// Helper function to get message id from list index |
|
6824 |
// --------------------------------------------------------------------------- |
|
6825 |
// |
|
6826 |
TFSMailMsgId CFSEmailUiMailListVisualiser::MsgIdFromIndex( TInt aItemIdx ) const |
|
6827 |
{ |
|
6828 |
FUNC_LOG; |
|
6829 |
TFSMailMsgId msgId; // constructs null ID |
|
6830 |
// <cmail> |
|
6831 |
if ( 0 <= aItemIdx && aItemIdx < iModel->Count() ) |
|
6832 |
// </cmail> |
|
6833 |
{ |
|
6834 |
CFSEmailUiMailListModelItem* item = |
|
6835 |
static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(aItemIdx)); |
|
6836 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
6837 |
{ |
|
6838 |
msgId = item->MessagePtr().GetMessageId(); |
|
6839 |
} |
|
6840 |
} |
|
6841 |
||
6842 |
return msgId; |
|
6843 |
} |
|
6844 |
||
6845 |
// --------------------------------------------------------------------------- |
|
6846 |
// MsgIdFromListId |
|
6847 |
// Get message ID corresponding given list ID. If the list ID is for a node, |
|
6848 |
// the message ID of its first child is returned |
|
6849 |
// --------------------------------------------------------------------------- |
|
6850 |
// |
|
6851 |
TFSMailMsgId CFSEmailUiMailListVisualiser::MsgIdFromListId( TFsTreeItemId aListId ) const |
|
6852 |
{ |
|
6853 |
FUNC_LOG; |
|
6854 |
TFSMailMsgId msgId; // constructs null ID |
|
6855 |
||
6856 |
if ( aListId != KFsTreeNoneID ) |
|
6857 |
{ |
|
6858 |
// Find corresponding message from the model |
|
6859 |
const TInt modelCount( iModel->Count() ); |
|
6860 |
for( TInt i( 0 ) ; i < modelCount ; ++i ) |
|
6861 |
{ |
|
6862 |
CFSEmailUiMailListModelItem* item = |
|
6863 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) ); |
|
6864 |
if ( item && aListId == item->CorrespondingListId() ) |
|
6865 |
{ |
|
6866 |
msgId = item->MessagePtr().GetMessageId(); |
|
6867 |
// if list id points to separator |
|
6868 |
// set flag on. This is made for improving focus handling. |
|
6869 |
if( item->ModelItemType() == ETypeSeparator ) |
|
6870 |
{ |
|
6871 |
msgId.SetSeparator( ETrue ); |
|
6872 |
} |
|
6873 |
break; |
|
6874 |
} |
|
6875 |
} |
|
6876 |
} |
|
6877 |
||
6878 |
return msgId; |
|
6879 |
} |
|
6880 |
||
6881 |
// --------------------------------------------------------------------------- |
|
6882 |
// MsgPtrFromListIdL |
|
6883 |
// |
|
6884 |
// --------------------------------------------------------------------------- |
|
6885 |
// |
|
6886 |
CFSMailMessage& CFSEmailUiMailListVisualiser::MsgPtrFromListIdL( TFsTreeItemId aListId ) |
|
6887 |
{ |
|
6888 |
FUNC_LOG; |
|
6889 |
TInt index = ModelIndexFromListId( aListId ); |
|
6890 |
if ( index >= 0 ) |
|
6891 |
{ |
|
6892 |
CFSEmailUiMailListModelItem* item = |
|
6893 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(index) ); |
|
6894 |
return item->MessagePtr(); |
|
6895 |
} |
|
6896 |
else |
|
6897 |
{ |
|
6898 |
// Leave if no message found. As the function returns a reference, it is not |
|
6899 |
// possible to return any meaningful null value. |
|
6900 |
User::Leave( KErrNotFound ); |
|
6901 |
} |
|
6902 |
||
6903 |
CFSMailMessage* dummy = NULL; |
|
6904 |
return *dummy; // to surpress warning about missing return value; this is not really ever run |
|
6905 |
} |
|
6906 |
||
6907 |
// --------------------------------------------------------------------------- |
|
6908 |
// MsgPtrFromListIdL |
|
6909 |
// |
|
6910 |
// --------------------------------------------------------------------------- |
|
6911 |
// |
|
6912 |
const CFSMailMessage& CFSEmailUiMailListVisualiser::MsgPtrFromListIdL( TFsTreeItemId aListId ) const |
|
6913 |
{ |
|
6914 |
FUNC_LOG; |
|
6915 |
TInt index = ModelIndexFromListId( aListId ); |
|
6916 |
if ( index >= 0 ) |
|
6917 |
{ |
|
6918 |
CFSEmailUiMailListModelItem* item = |
|
6919 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(index) ); |
|
6920 |
return item->MessagePtr(); |
|
6921 |
} |
|
6922 |
else |
|
6923 |
{ |
|
6924 |
// Leave if no message found. As the function returns a reference, it is not |
|
6925 |
// possible to return any meaningful null value. |
|
6926 |
User::Leave( KErrNotFound ); |
|
6927 |
} |
|
6928 |
||
6929 |
const CFSMailMessage* dummy = NULL; |
|
6930 |
return *dummy; // to surpress warning about missing return value; this is not really ever run |
|
6931 |
} |
|
6932 |
||
6933 |
// --------------------------------------------------------------------------- |
|
6934 |
// ItemDataFromItemId |
|
6935 |
// Function returns a valid pointer to list item data based on item id |
|
6936 |
// --------------------------------------------------------------------------- |
|
6937 |
// |
|
6938 |
MFsTreeItemData* CFSEmailUiMailListVisualiser::ItemDataFromItemId( TFsTreeItemId aItemId ) |
|
6939 |
{ |
|
6940 |
FUNC_LOG; |
|
6941 |
MFsTreeItemData* itemData = NULL; |
|
6942 |
if ( aItemId != KFsTreeNoneID ) |
|
6943 |
{ |
|
6944 |
itemData = &iMailList->ItemData( aItemId ); |
|
6945 |
} |
|
6946 |
return itemData; |
|
6947 |
} |
|
6948 |
||
6949 |
// --------------------------------------------------------------------------- |
|
6950 |
// ItemVisualiserFromItemId |
|
6951 |
// Function returns a valid pointer to list item visualiser based on item id |
|
6952 |
// --------------------------------------------------------------------------- |
|
6953 |
// |
|
6954 |
MFsTreeItemVisualizer* CFSEmailUiMailListVisualiser::ItemVisualiserFromItemId( TFsTreeItemId aItemId ) |
|
6955 |
{ |
|
6956 |
FUNC_LOG; |
|
6957 |
MFsTreeItemVisualizer* itemVis = NULL; |
|
6958 |
if ( aItemId != KFsTreeNoneID ) |
|
6959 |
{ |
|
6960 |
itemVis = &iMailList->ItemVisualizer( aItemId ); |
|
6961 |
} |
|
6962 |
return itemVis; |
|
6963 |
} |
|
6964 |
||
6965 |
// --------------------------------------------------------------------------- |
|
6966 |
// ItemIndexFromMessageId |
|
6967 |
// Function returns list index based on message pointer. KErrNotFound if |
|
6968 |
// ID is not included in the list |
|
6969 |
// --------------------------------------------------------------------------- |
|
6970 |
// |
|
6971 |
TInt CFSEmailUiMailListVisualiser::ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const |
|
6972 |
{ |
|
6973 |
FUNC_LOG; |
|
6974 |
TInt idx = KErrNotFound; |
|
6975 |
||
6976 |
// Check first the special case; if searched id is null id, there's no |
|
6977 |
// point to loop the whole list. There shouldn't be any null id's in |
|
6978 |
// the model anyway. There is currently also an error in FW's equality |
|
6979 |
// operator implementation; it doesn't check the iNullId flag at all. |
|
6980 |
if( !aMessageId.IsNullId() ) |
|
6981 |
{ |
|
6982 |
const TInt modelCount( iModel->Count() ); |
|
6983 |
for ( TInt i( 0 ); i < modelCount ; ++i ) |
|
6984 |
{ |
|
6985 |
CFSEmailUiMailListModelItem* item = |
|
6986 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) ); |
|
6987 |
// when the item is a separator check whether its MessagePtr is valid (actually it's a reference) |
|
6988 |
if( item && &(item->MessagePtr()) != NULL) |
|
6989 |
{ |
|
6990 |
if ( aMessageId == item->MessagePtr().GetMessageId() ) |
|
6991 |
{ |
|
6992 |
TModelItemType itemType = item->ModelItemType(); |
|
6993 |
TBool separator( aMessageId.IsSeparator() ); |
|
6994 |
||
6995 |
// Because separator and the first message after separator |
|
6996 |
// have same message id, we need to separate these cases |
|
6997 |
// and that is made with separator flag which is stored to |
|
6998 |
// TFSMailMsgId object. If separator flag is on item need to be |
|
6999 |
// separator if it is not on item needs to be mail item. |
|
7000 |
if( ( separator && itemType == ETypeSeparator ) || |
|
7001 |
( !separator && itemType == ETypeMailItem ) ) |
|
7002 |
{ |
|
7003 |
idx = i; |
|
7004 |
break; |
|
7005 |
} |
|
7006 |
} |
|
7007 |
} |
|
7008 |
} |
|
7009 |
} |
|
7010 |
return idx; |
|
7011 |
} |
|
7012 |
||
7013 |
// --------------------------------------------------------------------------- |
|
7014 |
// NextMessageIndex |
|
7015 |
// Function returns next message index from highlighted index |
|
7016 |
// KErrNotFound if there is no next message |
|
7017 |
// --------------------------------------------------------------------------- |
|
7018 |
// |
|
7019 |
TInt CFSEmailUiMailListVisualiser::NextMessageIndex( TInt aCurMsgIdx ) const |
|
7020 |
{ |
|
7021 |
FUNC_LOG; |
|
7022 |
TInt idx = KErrNotFound; |
|
7023 |
for ( TInt i=aCurMsgIdx+1 ; i<iModel->Count() ; i++ ) |
|
7024 |
{ |
|
7025 |
CFSEmailUiMailListModelItem* item = |
|
7026 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(i) ); |
|
7027 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
7028 |
{ |
|
7029 |
idx = i; |
|
7030 |
break; |
|
7031 |
} |
|
7032 |
} |
|
7033 |
||
7034 |
return idx; |
|
7035 |
} |
|
7036 |
||
7037 |
// --------------------------------------------------------------------------- |
|
7038 |
// PreviousMessageIndex |
|
7039 |
// Function returns previous message index from highlighted index |
|
7040 |
// KErrNotFound if there is no previous message |
|
7041 |
// --------------------------------------------------------------------------- |
|
7042 |
// |
|
7043 |
TInt CFSEmailUiMailListVisualiser::PreviousMessageIndex( TInt aCurMsgIdx ) const |
|
7044 |
{ |
|
7045 |
FUNC_LOG; |
|
7046 |
TInt idx( KErrNotFound ); |
|
7047 |
if ( aCurMsgIdx < iModel->Count() ) |
|
7048 |
{ |
|
7049 |
for ( TInt i=aCurMsgIdx-1 ; i>=0 ; i-- ) |
|
7050 |
{ |
|
7051 |
CFSEmailUiMailListModelItem* item = |
|
7052 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(i) ); |
|
7053 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
7054 |
{ |
|
7055 |
idx = i; |
|
7056 |
break; |
|
7057 |
} |
|
7058 |
} |
|
7059 |
} |
|
7060 |
return idx; |
|
7061 |
} |
|
7062 |
||
7063 |
// --------------------------------------------------------------------------- |
|
7064 |
// ModelIndexFromListId |
|
7065 |
// Function returns a model index corresponding the given tree list item ID |
|
7066 |
// --------------------------------------------------------------------------- |
|
7067 |
// |
|
7068 |
TInt CFSEmailUiMailListVisualiser::ModelIndexFromListId( TFsTreeItemId aItemId ) const |
|
7069 |
{ |
|
7070 |
FUNC_LOG; |
|
7071 |
TInt ret = KErrNotFound; |
|
7072 |
const TInt count = iModel->Count(); |
|
7073 |
for ( TInt i=0; i < count; i++ ) |
|
7074 |
{ |
|
7075 |
const CFSEmailUiMailListModelItem* item = |
|
7076 |
static_cast<const CFSEmailUiMailListModelItem*>( iModel->Item(i) ); |
|
7077 |
if ( item && aItemId == item->CorrespondingListId() ) |
|
7078 |
{ |
|
7079 |
ret = i; |
|
7080 |
break; |
|
7081 |
} |
|
7082 |
} |
|
7083 |
return ret; |
|
7084 |
} |
|
7085 |
||
7086 |
// --------------------------------------------------------------------------- |
|
7087 |
// FolderSelectedL |
|
7088 |
// Folder list selection callback. Function updates list when folder is changed |
|
7089 |
// --------------------------------------------------------------------------- |
|
7090 |
// |
|
7091 |
void CFSEmailUiMailListVisualiser::FolderSelectedL( |
|
7092 |
TFSMailMsgId aSelectedFolderId, |
|
7093 |
TFSEmailUiCtrlBarResponse aResponse ) |
|
7094 |
{ |
|
7095 |
FUNC_LOG; |
|
7096 |
// hide selector if keys are not pressed |
|
7097 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7098 |
if ( iMoveToFolderOngoing ) |
|
7099 |
{ |
|
7100 |
iMoveToFolderOngoing = EFalse; |
|
7101 |
switch ( aResponse ) |
|
7102 |
{ |
|
7103 |
case EFSEmailUiCtrlBarResponseCancel: |
|
7104 |
iMarkingModeWaitingToExit = EFalse; |
|
7105 |
SetMskL(); |
|
7106 |
return; |
|
7107 |
case EFSEmailUiCtrlBarResponseSelect: |
|
7108 |
{ |
|
7109 |
MoveMsgsToFolderL( aSelectedFolderId ); |
|
7110 |
SetMskL(); |
|
7111 |
} |
|
7112 |
break; |
|
7113 |
default: |
|
7114 |
break; |
|
7115 |
} |
|
7116 |
} |
|
7117 |
else |
|
7118 |
{ |
|
7119 |
// Ignore if cancel selected |
|
7120 |
switch ( aResponse ) |
|
7121 |
{ |
|
7122 |
case EFSEmailUiCtrlBarResponseSwitchList: |
|
7123 |
{ |
|
7124 |
TFSFolderType folderType; |
|
7125 |
if ( iMailFolder ) |
|
7126 |
{ |
|
7127 |
folderType = iMailFolder->GetFolderType(); |
|
7128 |
} |
|
7129 |
else |
|
7130 |
{ |
|
7131 |
folderType = EFSInbox; |
|
7132 |
} |
|
7133 |
iControlBarControl->SetFocusByIdL( iSortButtonId ); |
|
7134 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7135 |
||
7136 |
// Sorting empty mail list disabled |
|
7137 |
// Show sort list only if mail list is not empty |
|
7138 |
if ( iModel->Count() ) |
|
7139 |
{ |
|
7140 |
iAppUi.ShowSortListInPopupL( iCurrentSortCriteria, folderType, this, iSortButton ); |
|
7141 |
} |
|
7142 |
} |
|
7143 |
return; |
|
7144 |
case EFSEmailUiCtrlBarResponseCancel: |
|
7145 |
iMarkingModeWaitingToExit = EFalse; |
|
7146 |
SetMskL(); |
|
7147 |
//Set touchmanager back to active |
|
7148 |
DisableMailList(EFalse); |
|
7149 |
return; |
|
7150 |
case EFSEmailUiCtrlBarResponseSelect: |
|
7151 |
SetMskL(); |
|
7152 |
//Set touchmanager back to active |
|
7153 |
DisableMailList(EFalse); |
|
7154 |
default: |
|
7155 |
break; |
|
7156 |
} |
|
7157 |
||
7158 |
if ( !iMailFolder || ( iMailFolder && iMailFolder->GetFolderId() != aSelectedFolderId ) ) |
|
7159 |
{ |
|
7160 |
iMailListModelUpdater->Cancel(); |
|
7161 |
iNewMailTimer->Cancel(); |
|
7162 |
iNewMailIds.Reset(); |
|
7163 |
SafeDelete(iMailFolder); |
|
7164 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), aSelectedFolderId ); |
|
7165 |
||
7166 |
if ( !iMailFolder ) |
|
7167 |
{ |
|
7168 |
// Do nothing if can't get the folder object |
|
7169 |
return; |
|
7170 |
} |
|
7171 |
||
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7172 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 7173 |
|
7174 |
// Set initial sort criteria when folder has changed |
|
7175 |
iCurrentSortCriteria.iField = EFSMailSortByDate; |
|
7176 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
7177 |
// reload node state because in file sort mode this is disabled even when globally enabled |
|
7178 |
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7179 |
SetSortButtonIconL(); |
25 | 7180 |
|
7181 |
// Update the mail list contents |
|
7182 |
UpdateMailListModelL(); |
|
7183 |
RefreshL(); |
|
7184 |
} |
|
7185 |
iFocusedControl = EControlBarComponent; |
|
7186 |
SetListAndCtrlBarFocusL(); |
|
7187 |
iMoveToFolderOngoing = EFalse; |
|
7188 |
} |
|
7189 |
SetMskL(); |
|
7190 |
} |
|
7191 |
||
7192 |
// --------------------------------------------------------------------------- |
|
7193 |
// MailboxSelectedL |
|
7194 |
// Mailbox selection callback. Function updates list when mailbox is changed |
|
7195 |
// --------------------------------------------------------------------------- |
|
7196 |
// |
|
7197 |
void CFSEmailUiMailListVisualiser::MailboxSelectedL( TFSMailMsgId aSelectedMailboxId ) |
|
7198 |
{ |
|
7199 |
FUNC_LOG; |
|
7200 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7201 |
//Set touchmanager back to active |
|
7202 |
DisableMailList(EFalse); |
|
7203 |
iAppUi.SetActiveMailboxL( aSelectedMailboxId ); |
|
7204 |
iMailListModelUpdater->Cancel(); |
|
7205 |
SafeDelete(iMailFolder); |
|
7206 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), iAppUi.GetActiveBoxInboxId() ); |
|
7207 |
||
7208 |
// Set initial sort criteria when folder has changed |
|
7209 |
iCurrentSortCriteria.iField = EFSMailSortByDate; |
|
7210 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
7211 |
// reload node state because in file sort mode this is disabled even when globally enabled |
|
7212 |
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7213 |
SetSortButtonIconL(); |
25 | 7214 |
|
7215 |
// Set folder name to the control bar button |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7216 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 7217 |
|
7218 |
// Set mailbox name and icons |
|
7219 |
SetMailboxNameToStatusPaneL(); |
|
7220 |
SetBrandedListWatermarkL(); |
|
7221 |
SetBrandedMailBoxIconL(); |
|
7222 |
||
7223 |
// Update model |
|
7224 |
UpdateMailListModelL(); |
|
7225 |
iMailList->RemoveAllL(); |
|
7226 |
RefreshDeferred(); |
|
7227 |
||
7228 |
// Check sync icon timer and sync status |
|
7229 |
ConnectionIconHandling(); |
|
7230 |
iFocusedControl = EControlBarComponent; |
|
7231 |
} |
|
7232 |
||
7233 |
// --------------------------------------------------------------------------- |
|
7234 |
// FolderButtonRect |
|
7235 |
// Getter for folder button rectangle. Folder popup needs to get this |
|
7236 |
// information when screen layout changes. |
|
7237 |
// --------------------------------------------------------------------------- |
|
7238 |
// |
|
7239 |
TRect CFSEmailUiMailListVisualiser::FolderButtonRect() |
|
7240 |
{ |
|
7241 |
FUNC_LOG; |
|
7242 |
const TPoint& buttonPos = iFolderListButton->Pos().Target(); |
|
7243 |
const TPoint& buttonSize = iFolderListButton->Size().Target(); |
|
7244 |
TRect buttonRect( buttonPos, buttonSize.AsSize() ); |
|
7245 |
return buttonRect; |
|
7246 |
} |
|
7247 |
||
7248 |
// --------------------------------------------------------------------------- |
|
7249 |
// SortOrderChangedL |
|
7250 |
// Sort order selection callback. Function updates list when sorting is changed |
|
7251 |
// --------------------------------------------------------------------------- |
|
7252 |
// |
|
7253 |
void CFSEmailUiMailListVisualiser::SortOrderChangedL( |
|
7254 |
TFSMailSortField aSortField, TFSEmailUiCtrlBarResponse aResponse ) |
|
7255 |
{ |
|
7256 |
FUNC_LOG; |
|
7257 |
// Ignore if cancel selected |
|
7258 |
switch( aResponse ) |
|
7259 |
{ |
|
7260 |
case EFSEmailUiCtrlBarResponseSwitchList: |
|
7261 |
{ |
|
7262 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7263 |
iControlBarControl->SetFocusByIdL( iFolderListButtonId ); |
|
7264 |
iAppUi.ShowFolderListInPopupL( FolderId(), this, iFolderListButton ); |
|
7265 |
} |
|
7266 |
return; |
|
7267 |
case EFSEmailUiCtrlBarResponseCancel: |
|
7268 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7269 |
SetMskL(); |
|
7270 |
// <cmail> Touch |
|
7271 |
//Set touchmanager back to active |
|
7272 |
DisableMailList(EFalse); |
|
7273 |
return; |
|
7274 |
||
7275 |
case EFSEmailUiCtrlBarResponseSelect: |
|
7276 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
7277 |
//Set touchmanager back to active |
|
7278 |
DisableMailList(EFalse); |
|
7279 |
// </cmail> |
|
7280 |
default: |
|
7281 |
break; |
|
7282 |
} |
|
7283 |
||
7284 |
// Check is the selected sort field same as the previous one |
|
7285 |
if( iCurrentSortCriteria.iField == aSortField ) |
|
7286 |
{ |
|
7287 |
// If same sort field selected, switch the sorting order |
|
7288 |
if( iCurrentSortCriteria.iOrder == EFSMailAscending ) |
|
7289 |
{ |
|
7290 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
7291 |
} |
|
7292 |
else |
|
7293 |
{ |
|
7294 |
iCurrentSortCriteria.iOrder = EFSMailAscending; |
|
7295 |
} |
|
7296 |
} |
|
7297 |
else if ( aSortField == EFSMailSortBySubject || |
|
7298 |
aSortField == EFSMailSortBySender || |
|
7299 |
aSortField == EFSMailSortByUnread || // <cmail> |
|
7300 |
aSortField == EFSMailSortByRecipient ) |
|
7301 |
{ |
|
7302 |
iCurrentSortCriteria.iOrder = EFSMailAscending; |
|
7303 |
} |
|
7304 |
else |
|
7305 |
{ |
|
7306 |
iCurrentSortCriteria.iOrder = EFSMailDescending; |
|
7307 |
} |
|
7308 |
||
7309 |
iCurrentSortCriteria.iField = aSortField; |
|
7310 |
iModel->SetSortCriteria(iCurrentSortCriteria); |
|
7311 |
||
7312 |
// rest of the code moved to TimerEventL ( iSortTimer part ) |
|
7313 |
// used also in DoHandleControlBarOpenL to prevent SortList reopening |
|
7314 |
iSortState = ESortRequested; |
|
7315 |
iSortTimer->Start( KSortTimerDelay ); |
|
7316 |
} |
|
7317 |
||
7318 |
// --------------------------------------------------------------------------- |
|
7319 |
// SortButtonRect |
|
7320 |
// Getter for sort button rectangle. Sort popup needs to get this |
|
7321 |
// information when screen layout changes. |
|
7322 |
// --------------------------------------------------------------------------- |
|
7323 |
// |
|
7324 |
TRect CFSEmailUiMailListVisualiser::SortButtonRect() |
|
7325 |
{ |
|
7326 |
FUNC_LOG; |
|
7327 |
const TPoint& buttonPos = iSortButton->Pos().Target(); |
|
7328 |
const TPoint& buttonSize = iSortButton->Size().Target(); |
|
7329 |
TRect buttonRect( buttonPos, buttonSize.AsSize() ); |
|
7330 |
return buttonRect; |
|
7331 |
} |
|
7332 |
||
7333 |
// --------------------------------------------------------------------------- |
|
7334 |
// OpenHighlightedMailL |
|
7335 |
// Function opens highlighted mail either to internal viewer or to mrui if |
|
7336 |
// message type is meeting |
|
7337 |
// --------------------------------------------------------------------------- |
|
7338 |
// |
|
7339 |
void CFSEmailUiMailListVisualiser::OpenHighlightedMailL() |
|
7340 |
{ |
|
7341 |
FUNC_LOG; |
|
7342 |
OpenMailItemL( iMailList->FocusedItem() ); |
|
7343 |
} |
|
7344 |
||
7345 |
// --------------------------------------------------------------------------- |
|
7346 |
// OpenHighlightedMailL |
|
7347 |
// Function opens given mail item either to internal viewer or to mrui if |
|
7348 |
// message type is meeting |
|
7349 |
// --------------------------------------------------------------------------- |
|
7350 |
// |
|
7351 |
void CFSEmailUiMailListVisualiser::OpenMailItemL( TFsTreeItemId aMailItem ) |
|
7352 |
{ |
|
7353 |
FUNC_LOG; |
|
7354 |
TInt idx = ModelIndexFromListId( aMailItem ); |
|
7355 |
if ( idx >= 0 ) |
|
7356 |
{ |
|
7357 |
CFSEmailUiMailListModelItem* item = |
|
7358 |
static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(idx) ); |
|
7359 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
7360 |
{ |
|
7361 |
// First make sure that the highlighted message really exists in the store |
|
7362 |
// Get confirmed msg ptr |
|
7363 |
CFSMailMessage* confirmedMsgPtr(0); |
|
7364 |
confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(), |
|
7365 |
iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope ); |
|
7366 |
if ( confirmedMsgPtr ) |
|
7367 |
{ |
|
7368 |
iMailOpened = ETrue; |
|
7369 |
||
7370 |
ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); |
|
7371 |
// Pointer confirmed, store Id and delete not needed anymore |
|
7372 |
TFSMailMsgId confirmedId = confirmedMsgPtr->GetMessageId(); |
|
7373 |
TBool isCalMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_CalendarMsg ); |
|
7374 |
TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read ); |
|
7375 |
delete confirmedMsgPtr; |
|
7376 |
// Open to editor from drafts |
|
7377 |
if ( iMailFolder->GetFolderType() == EFSDraftsFolder ) |
|
7378 |
{ |
|
7379 |
if ( !isCalMessage ) // Open only normal messages for now |
|
7380 |
{ |
|
7381 |
TEditorLaunchParams params; |
|
7382 |
params.iMailboxId = iAppUi.GetActiveMailboxId(); |
|
7383 |
params.iActivatedExternally = EFalse; |
|
7384 |
params.iMsgId = confirmedId; |
|
7385 |
params.iFolderId = iMailFolder->GetFolderId(); |
|
7386 |
iAppUi.LaunchEditorL( KEditorCmdOpen, params ); |
|
7387 |
} |
|
7388 |
else |
|
7389 |
{ |
|
7390 |
//Try to open to editor if support for that is needed |
|
7391 |
} |
|
7392 |
} |
|
7393 |
else if ( iMailFolder->GetFolderType() == EFSOutbox ) |
|
7394 |
{ |
|
7395 |
TFsEmailUiUtility::ShowErrorNoteL( R_FREESTYLE_EMAIL_UI_OPEN_FROM_OUTBOX_NOTE, ETrue ); |
|
7396 |
} |
|
7397 |
else |
|
7398 |
{ |
|
7399 |
THtmlViewerActivationData htmlData; |
|
7400 |
htmlData.iActivationDataType = THtmlViewerActivationData::EMailMessage; |
|
7401 |
htmlData.iMailBoxId = iAppUi.GetActiveMailbox()->GetId(); |
|
7402 |
htmlData.iFolderId = FolderId(); |
|
7403 |
htmlData.iMessageId = confirmedId; |
|
7404 |
TPckgBuf<THtmlViewerActivationData> pckgData( htmlData ); |
|
7405 |
||
7406 |
// Change read status only if needed |
|
7407 |
if ( !isReadMessage ) |
|
7408 |
{ |
|
7409 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
7410 |
} |
|
7411 |
||
7412 |
// Opening viewer seems to take more time than other views, |
|
7413 |
// so we do longer fade out in this case |
|
7414 |
SetNextTransitionOutLong( ETrue ); |
|
7415 |
||
7416 |
iAppUi.EnterFsEmailViewL( HtmlViewerId, KHtmlViewerOpenNew, pckgData ); |
|
7417 |
} |
|
7418 |
} |
|
7419 |
} |
|
7420 |
} |
|
7421 |
} |
|
7422 |
||
7423 |
// --------------------------------------------------------------------------- |
|
7424 |
// From MFSEmailUiContactHandlerObserver |
|
7425 |
// The ownership of the CLS items in the contacts array is transferred to the |
|
7426 |
// observer, and they must be deleted by the observer. |
|
7427 |
// --------------------------------------------------------------------------- |
|
7428 |
// |
|
7429 |
void CFSEmailUiMailListVisualiser::OperationCompleteL( |
|
7430 |
TContactHandlerCmd /*aCmd*/, const RPointerArray<CFSEmailUiClsItem>& /*aContacts*/ ) |
|
7431 |
{ |
|
7432 |
FUNC_LOG; |
|
7433 |
} |
|
7434 |
||
7435 |
// --------------------------------------------------------------------------- |
|
7436 |
// From MFSEmailUiContactHandlerObserver |
|
7437 |
// Handles error in contact handler operation. |
|
7438 |
// --------------------------------------------------------------------------- |
|
7439 |
// |
|
7440 |
void CFSEmailUiMailListVisualiser::OperationErrorL( TContactHandlerCmd /*aCmd*/, |
|
7441 |
TInt /*aError*/ ) |
|
7442 |
{ |
|
7443 |
FUNC_LOG; |
|
7444 |
} |
|
7445 |
||
7446 |
// --------------------------------------------------------------------------- |
|
7447 |
// NotifyDateChangedL |
|
7448 |
// Called when CDateChangeTimer completes. This happens when either when date |
|
7449 |
// changes or when user alters the system time. Redraws the list to ensure |
|
7450 |
// that time stamp texts in emails and nodes are up-to-date. |
|
7451 |
// --------------------------------------------------------------------------- |
|
7452 |
// |
|
7453 |
void CFSEmailUiMailListVisualiser::NotifyDateChangedL() |
|
7454 |
{ |
|
7455 |
FUNC_LOG; |
|
7456 |
iDateChanged = ETrue; |
|
7457 |
if ( iAppUi.IsForeground() ) |
|
7458 |
{ |
|
7459 |
HandleForegroundEventL(ETrue); |
|
7460 |
} |
|
7461 |
} |
|
7462 |
||
7463 |
// --------------------------------------------------------------------------- |
|
7464 |
// CreateFolderNameLC |
|
7465 |
// Creates folder name from folder ptr. Localised if standard folder. |
|
7466 |
// --------------------------------------------------------------------------- |
|
7467 |
// |
|
7468 |
HBufC* CFSEmailUiMailListVisualiser::CreateFolderNameLC( const CFSMailFolder* aFolder ) const |
|
7469 |
{ |
|
7470 |
FUNC_LOG; |
|
7471 |
TInt resourceId(0); |
|
7472 |
HBufC* ret(0); |
|
7473 |
if ( !aFolder || aFolder->GetFolderId().IsNullId() ) |
|
7474 |
{ |
|
7475 |
// INBOX FOR NULL ID |
|
7476 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_INBOX; |
|
7477 |
} |
|
7478 |
else |
|
7479 |
{ |
|
7480 |
TInt folderType = aFolder->GetFolderType(); |
|
7481 |
switch ( folderType ) |
|
7482 |
{ |
|
7483 |
case EFSInbox: |
|
7484 |
{ |
|
7485 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_INBOX; |
|
7486 |
} |
|
7487 |
break; |
|
7488 |
case EFSOutbox: |
|
7489 |
{ |
|
7490 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_OUTBOX; |
|
7491 |
} |
|
7492 |
break; |
|
7493 |
case EFSDraftsFolder: |
|
7494 |
{ |
|
7495 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_DRAFTS; |
|
7496 |
} |
|
7497 |
break; |
|
7498 |
case EFSSentFolder: |
|
7499 |
{ |
|
7500 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_SENT; |
|
7501 |
} |
|
7502 |
break; |
|
7503 |
case EFSDeleted: |
|
7504 |
{ |
|
7505 |
resourceId = R_FREESTYLE_EMAIL_UI_DROPDOWN_LIST_DELETED; |
|
7506 |
} |
|
7507 |
break; |
|
7508 |
default: |
|
7509 |
// Not a standard folder |
|
7510 |
break; |
|
7511 |
} |
|
7512 |
} |
|
7513 |
if ( resourceId ) |
|
7514 |
{ |
|
7515 |
ret = StringLoader::LoadLC( resourceId ); |
|
7516 |
} |
|
7517 |
else |
|
7518 |
{ |
|
7519 |
ret = aFolder->GetFolderName().AllocLC(); |
|
7520 |
} |
|
7521 |
return ret; |
|
7522 |
} |
|
7523 |
||
7524 |
// --------------------------------------------------------------------------- |
|
7525 |
// LaunchStylusPopupMenuL |
|
7526 |
// Function launches avkon stylus popup menu based on the selected message item/items |
|
7527 |
// --------------------------------------------------------------------------- |
|
7528 |
// |
|
7529 |
void CFSEmailUiMailListVisualiser::LaunchStylusPopupMenuL( const TPoint& aPoint ) |
|
7530 |
{ |
|
7531 |
// Irrelevant items for focused mail list item get dimmed at runtime |
|
7532 |
||
7533 |
// Check mail list item's type |
|
7534 |
CFSEmailUiMailListModelItem* item = |
|
7535 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
7536 |
if ( item ) |
|
7537 |
{ |
|
7538 |
if ( item->ModelItemType() == ETypeMailItem ) |
|
7539 |
{ |
|
7540 |
// Add mark as read / unread options |
|
7541 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() ); |
|
7542 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() ); |
|
7543 |
||
7544 |
// Check support for object mail iten moving |
|
7545 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, |
|
7546 |
!(iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ) |
|
7547 |
&& iMailFolder->SupportsMoveFromL( iMailFolder->GetFolderType() ) ) ); |
|
7548 |
||
7549 |
// Hide / show follow up |
|
7550 |
TBool supportsFlag = TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() ); |
|
7551 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsFlag, !supportsFlag ); |
|
7552 |
||
7553 |
// Hide collapse / expand all |
|
7554 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, ETrue ); |
|
7555 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, ETrue ); |
|
7556 |
} |
|
7557 |
else if ( item->ModelItemType() == ETypeSeparator ) |
|
7558 |
{ |
|
7559 |
// Hide mark as read / unread options |
|
7560 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, ETrue ); |
|
7561 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsRead, ETrue ); |
|
7562 |
||
7563 |
// Hide move & follow up |
|
7564 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, ETrue ); |
|
7565 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue ); |
|
7566 |
||
7567 |
// Hide collapse / expand all when applicable |
|
7568 |
if ( iNodesInUse == EListControlSeparatorDisabled || !iModel->Count() ) |
|
7569 |
{ |
|
7570 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, ETrue ); |
|
7571 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, ETrue ); |
|
7572 |
} |
|
7573 |
else |
|
7574 |
{ |
|
7575 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsCollapseAll, AllNodesCollapsed() ); |
|
7576 |
iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsExpandAll, AllNodesExpanded() ); |
|
7577 |
} |
|
7578 |
} |
|
7579 |
} |
|
7580 |
||
7581 |
// Set the position for the popup |
|
7582 |
TPoint point(aPoint.iX, aPoint.iY + 45); |
|
7583 |
iStylusPopUpMenu->SetPosition( point, CAknStylusPopUpMenu::EPositionTypeRightBottom ); |
|
7584 |
||
7585 |
// Display the popup and set the flag to indicate that the menu was |
|
7586 |
// launched. |
|
7587 |
iStylusPopUpMenu->ShowMenu(); |
|
7588 |
iStylusPopUpMenuVisible = ETrue; |
|
7589 |
} |
|
7590 |
||
7591 |
// --------------------------------------------------------------------------- |
|
7592 |
// CreateNewMsgL |
|
7593 |
// Launches editor. |
|
7594 |
// --------------------------------------------------------------------------- |
|
7595 |
// |
|
7596 |
void CFSEmailUiMailListVisualiser::CreateNewMsgL() |
|
7597 |
{ |
|
7598 |
FUNC_LOG; |
|
7599 |
TEditorLaunchParams params; |
|
7600 |
params.iMailboxId = iAppUi.GetActiveMailboxId(); |
|
7601 |
params.iActivatedExternally = EFalse; |
|
7602 |
iAppUi.LaunchEditorL( KEditorCmdCreateNew, params ); |
|
7603 |
} |
|
7604 |
||
7605 |
void CFSEmailUiMailListVisualiser::ReplyL( CFSMailMessage* aMsgPtr ) |
|
7606 |
{ |
|
7607 |
FUNC_LOG; |
|
7608 |
// Replying not possible from drafts folder |
|
7609 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
7610 |
{ |
|
7611 |
DoReplyForwardL( KEditorCmdReply, aMsgPtr ); |
|
7612 |
} |
|
7613 |
} |
|
7614 |
||
7615 |
void CFSEmailUiMailListVisualiser::ReplyAllL( CFSMailMessage* aMsgPtr ) |
|
7616 |
{ |
|
7617 |
FUNC_LOG; |
|
7618 |
// Replying all not possible from drafts folder |
|
7619 |
if ( iMailFolder && iMailFolder->GetFolderType() != EFSDraftsFolder ) |
|
7620 |
{ |
|
7621 |
DoReplyForwardL( KEditorCmdReplyAll, aMsgPtr ); |
|
7622 |
} |
|
7623 |
} |
|
7624 |
||
7625 |
void CFSEmailUiMailListVisualiser::ForwardL( CFSMailMessage* aMsgPtr ) |
|
7626 |
{ |
|
7627 |
FUNC_LOG; |
|
7628 |
DoReplyForwardL( KEditorCmdForward, aMsgPtr ); |
|
7629 |
} |
|
7630 |
||
7631 |
// --------------------------------------------------------------------------- |
|
7632 |
// DoReplyForwardL |
|
7633 |
// Launches editor with either reply all forward command |
|
7634 |
// --------------------------------------------------------------------------- |
|
7635 |
// |
|
7636 |
void CFSEmailUiMailListVisualiser::DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr ) |
|
7637 |
{ |
|
7638 |
FUNC_LOG; |
|
7639 |
// Reply, reply all, and forward commands are inavailable in the outbox |
|
7640 |
// <cmail> |
|
7641 |
if ( iModel->Count() && iMailFolder && iMailFolder->GetFolderType() != EFSOutbox ) |
|
7642 |
// </cmail> |
|
7643 |
{ |
|
7644 |
CFSMailMessage* messagePointer = aMsgPtr; |
|
7645 |
if ( !messagePointer ) |
|
7646 |
{ |
|
7647 |
RFsTreeItemIdList targetEntries; |
|
7648 |
CleanupClosePushL( targetEntries ); |
|
7649 |
GetActionsTargetEntriesL( targetEntries ); |
|
7650 |
// action is possible only when there's exactly one marked or focused mail item |
|
7651 |
if ( targetEntries.Count() == 1 ) |
|
7652 |
{ |
|
7653 |
messagePointer = &MsgPtrFromListIdL( targetEntries[0] ); |
|
7654 |
} |
|
7655 |
CleanupStack::PopAndDestroy( &targetEntries ); |
|
7656 |
} |
|
7657 |
if ( messagePointer ) |
|
7658 |
{ |
|
7659 |
// Opening editor is slower than opening most other views. |
|
7660 |
// Use longer transition effect to mask this. |
|
7661 |
SetNextTransitionOutLong( ETrue ); |
|
7662 |
||
7663 |
TEditorLaunchParams params; |
|
7664 |
params.iMailboxId = iAppUi.GetActiveMailboxId(); |
|
7665 |
params.iActivatedExternally = EFalse; |
|
7666 |
params.iMsgId = messagePointer->GetMessageId(); |
|
7667 |
iAppUi.LaunchEditorL( aMode, params ); |
|
7668 |
} |
|
7669 |
} |
|
7670 |
} |
|
7671 |
||
7672 |
// --------------------------------------------------------------------------- |
|
7673 |
// HandleMailBoxEventL |
|
7674 |
// Mailbox event handler, responds to events sent by the plugin. |
|
7675 |
// --------------------------------------------------------------------------- |
|
7676 |
// |
|
7677 |
void CFSEmailUiMailListVisualiser::HandleMailBoxEventL( TFSMailEvent aEvent, |
|
7678 |
TFSMailMsgId aMailboxId, TAny* aParam1, TAny* aParam2, TAny* aParam3 ) |
|
7679 |
{ |
|
7680 |
FUNC_LOG; |
|
7681 |
||
7682 |
// Complete any pending asynchronous redrawing before handling the event |
|
7683 |
// to make sure that all the arrays are in consistent state |
|
7684 |
CompletePendingRefresh(); |
|
7685 |
||
7686 |
// Handle the event |
|
7687 |
if ( iFirstStartCompleted && |
|
7688 |
aMailboxId == iAppUi.GetActiveMailboxId() ) // Safety, in list events that only concern active mailbox are handled |
|
7689 |
{ |
|
7690 |
if ( aEvent == TFSEventFoldersDeleted ) |
|
7691 |
{ |
|
7692 |
// Check whether the current folder gets deleted |
|
7693 |
// Change mail item icon or read status |
|
7694 |
RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 ); |
|
7695 |
if ( iMailFolder && removedEntries && removedEntries->Count() ) |
|
7696 |
{ |
|
7697 |
TFSMailMsgId currentFolderId = iMailFolder->GetFolderId(); |
|
7698 |
for ( TInt i = 0; i < removedEntries->Count(); i++ ) |
|
7699 |
{ |
|
7700 |
TFSMailMsgId entryId = (*removedEntries)[i]; |
|
7701 |
if ( entryId == currentFolderId ) |
|
7702 |
{ |
|
7703 |
// Current folder deleted, try to revert back to standard folder inbox. |
|
7704 |
iMailListModelUpdater->Cancel(); |
|
7705 |
SafeDelete(iMailFolder); |
|
7706 |
TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox ); |
|
7707 |
if ( !inboxId.IsNullId() ) |
|
7708 |
{ |
|
7709 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId ); |
|
7710 |
UpdateMailListModelL(); |
|
7711 |
RefreshL(); |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7712 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 7713 |
} |
7714 |
else |
|
7715 |
{ |
|
7716 |
// No standard folder inbox, go back to grid as a last option |
|
7717 |
HandleCommandL( EAknSoftkeyBack ); |
|
7718 |
} |
|
7719 |
break; |
|
7720 |
} |
|
7721 |
} |
|
7722 |
} |
|
7723 |
} |
|
7724 |
else if ( aEvent == TFSEventMailboxRenamed ) |
|
7725 |
{ |
|
7726 |
if ( iThisViewActive ) |
|
7727 |
{ |
|
7728 |
SetMailboxNameToStatusPaneL(); |
|
7729 |
} |
|
7730 |
} |
|
7731 |
else if ( (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && iMailFolder ) // <cmail> Added iMailFolder null safety check </cmail> |
|
7732 |
{ |
|
7733 |
// Change mail item icon or read status |
|
7734 |
RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>(aParam1); |
|
7735 |
if ( removedEntries && removedEntries->Count() ) |
|
7736 |
{ |
|
7737 |
TFSMailMsgId* parentFolderId = static_cast<TFSMailMsgId*>( aParam2 ); |
|
7738 |
TFSMailMsgId currentFolderId = iMailFolder->GetFolderId(); |
|
7739 |
if ( parentFolderId && ( *parentFolderId == currentFolderId ) ) |
|
7740 |
{ |
|
7741 |
// Refresh mailfolder to get correct actual data |
|
7742 |
/* |
|
7743 |
iMailListModelUpdater->Cancel(); |
|
7744 |
SafeDelete(iMailFolder); |
|
7745 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, currentFolderId ); |
|
7746 |
*/ |
|
7747 |
RemoveMsgItemsFromListIfFoundL( *removedEntries ); |
|
7748 |
} |
|
7749 |
} |
|
7750 |
} |
|
7751 |
else if ( aEvent == TFSEventNewMail ) |
|
7752 |
{ |
|
7753 |
// Switch to standardfolder inbox if we have null folderid. |
|
7754 |
// This is usually the case with first time sync. |
|
7755 |
if ( FolderId().IsNullId() ) |
|
7756 |
{ |
|
7757 |
// Refresh mailfolder to standard folder inbox in case of zero id |
|
7758 |
iMailListModelUpdater->Cancel(); |
|
7759 |
SafeDelete(iMailFolder); |
|
7760 |
TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox ); |
|
7761 |
if ( !inboxId.IsNullId() ) |
|
7762 |
{ |
|
7763 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId ); |
|
7764 |
// Check that mailfolder fetching succeeded |
|
7765 |
if ( iMailFolder ) |
|
7766 |
{ |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
7767 |
UpdateFolderAndMarkingModeTextsL(); |
25 | 7768 |
} |
7769 |
} |
|
7770 |
} |
|
7771 |
// Null pointer check is needed here because of special cases such as new mail |
|
7772 |
// creation in POP/IMAP before first sync where folder does not exists |
|
7773 |
if ( iMailFolder ) |
|
7774 |
{ |
|
7775 |
RArray<TFSMailMsgId>* newMessages = static_cast< RArray<TFSMailMsgId>* >( aParam1 ); |
|
7776 |
TFSMailMsgId* parentFolderId = static_cast<TFSMailMsgId*>( aParam2 ); |
|
7777 |
TFSMailMsgId currentFolderId = iMailFolder->GetFolderId(); |
|
7778 |
// Update the mail list only if the event is related to the currently open folder |
|
7779 |
if ( *parentFolderId == currentFolderId ) |
|
7780 |
{ |
|
7781 |
InsertNewMessagesL( *newMessages ); |
|
7782 |
} |
|
7783 |
} |
|
7784 |
} |
|
7785 |
else if ( aEvent == TFSEventMailMoved && iMailFolder ) // Added iMailFolder null safety check |
|
7786 |
{ |
|
7787 |
// If message was moved FROM this folder, just remove the entry from the list. |
|
7788 |
// If message is moved TO this folder, update the list completely. |
|
7789 |
// Otherwise, the event does not have an influence on the current folder. |
|
7790 |
RArray<TFSMailMsgId>* entries = static_cast< RArray<TFSMailMsgId>* >( aParam1 ); |
|
7791 |
TFSMailMsgId* toFolderId = static_cast<TFSMailMsgId*>( aParam2 ); |
|
7792 |
TFSMailMsgId* fromFolderId = static_cast<TFSMailMsgId*>( aParam3 ); |
|
7793 |
TFSMailMsgId currentFolderId = iMailFolder->GetFolderId(); |
|
7794 |
||
7795 |
if ( toFolderId && ( currentFolderId == *toFolderId ) ) |
|
7796 |
{ |
|
7797 |
InsertNewMessagesL( *entries ); |
|
7798 |
} |
|
7799 |
else if ( fromFolderId && ( currentFolderId == *fromFolderId ) ) |
|
7800 |
{ |
|
7801 |
// Refresh mailfolder to get correct actual data |
|
7802 |
/* |
|
7803 |
iMailListModelUpdater->Cancel(); |
|
7804 |
SafeDelete(iMailFolder); |
|
7805 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, currentFolderId ); |
|
7806 |
*/ |
|
7807 |
RemoveMsgItemsFromListIfFoundL( *entries ); |
|
7808 |
} |
|
7809 |
else |
|
7810 |
{ |
|
7811 |
// event is not related to the current folder => do nothing |
|
7812 |
} |
|
7813 |
} |
|
7814 |
else if ( aEvent == TFSEventMailChanged && iMailFolder ) // Added iMailFolder null safety check |
|
7815 |
{ |
|
7816 |
//if ( !iMailOpened ) // do not handle mail changed while viewer/editor is open. This may cause flickering |
|
7817 |
{ |
|
7818 |
// Change mail item icon or read status |
|
7819 |
RArray<TFSMailMsgId>* entries = static_cast<RArray<TFSMailMsgId>*>( aParam1 ); |
|
7820 |
TFSMailMsgId* parentFolderId = static_cast<TFSMailMsgId*>( aParam2 ); |
|
7821 |
TFSMailMsgId currentFolderId = iMailFolder->GetFolderId(); |
|
7822 |
if ( *parentFolderId == currentFolderId ) |
|
7823 |
{ |
|
7824 |
// Refresh mailfolder to get correct actual data |
|
7825 |
/* |
|
7826 |
iMailListModelUpdater->Cancel(); |
|
7827 |
SafeDelete(iMailFolder); |
|
7828 |
iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, currentFolderId ); |
|
7829 |
*/ |
|
7830 |
for ( TInt i=0 ; i<entries->Count() ; i++ ) |
|
7831 |
{ |
|
7832 |
TFSMailMsgId msgId = (*entries)[i]; |
|
7833 |
TInt idx = ItemIndexFromMessageId( msgId ); |
|
7834 |
if ( idx != KErrNotFound ) |
|
7835 |
{ |
|
7836 |
UpdateItemAtIndexL( idx ); |
|
7837 |
} |
|
7838 |
} |
|
7839 |
} |
|
7840 |
} |
|
7841 |
} |
|
7842 |
else if ( aEvent == TFSEventMailboxSyncStateChanged ) |
|
7843 |
{ |
|
7844 |
TSSMailSyncState* newSyncState = static_cast<TSSMailSyncState*>( aParam1 ); |
|
7845 |
if ( newSyncState != 0 && *newSyncState != 0 ) |
|
7846 |
{ |
|
7847 |
switch ( *newSyncState ) |
|
7848 |
{ |
|
7849 |
case StartingSync: |
|
7850 |
{ |
|
7851 |
//If sync was started by user, show the synchronisation indicator |
|
7852 |
if ( iManualMailBoxSync ) |
|
7853 |
{ |
|
7854 |
ManualMailBoxSync(EFalse); |
|
7855 |
} |
|
7856 |
} |
|
7857 |
break; |
|
7858 |
||
7859 |
case SyncCancelled: |
|
7860 |
{ |
|
7861 |
//If sync was started by user, show the synchronisation indicator |
|
7862 |
if ( iManualMailBoxSync ) |
|
7863 |
{ |
|
7864 |
ManualMailBoxSync(EFalse); |
|
7865 |
} |
|
7866 |
} |
|
7867 |
break; |
|
7868 |
||
7869 |
} |
|
7870 |
} |
|
7871 |
} |
|
7872 |
} |
|
7873 |
} |
|
7874 |
||
7875 |
// --------------------------------------------------------------------------- |
|
7876 |
// |
|
7877 |
// --------------------------------------------------------------------------- |
|
7878 |
// |
|
7879 |
void CFSEmailUiMailListVisualiser::TreeListEventL( const TFsTreeListEvent aEvent, |
|
7880 |
const TFsTreeItemId aId, |
|
7881 |
const TPoint& /*aPoint*/ ) |
|
7882 |
{ |
|
7883 |
FUNC_LOG; |
|
7884 |
switch( aEvent ) |
|
7885 |
{ |
|
7886 |
case EFsTreeListItemWillGetFocused: |
|
7887 |
{ |
|
7888 |
if( aId != KFsTreeNoneID ) |
|
7889 |
{ |
|
7890 |
UpdatePreviewPaneTextIfNecessaryL( aId, EFalse ); |
|
7891 |
} |
|
7892 |
break; |
|
7893 |
} |
|
7894 |
case EFsTreeListItemTouchFocused: |
|
7895 |
{ |
|
7896 |
break; |
|
7897 |
} |
|
7898 |
case EFsFocusVisibilityChange: |
|
7899 |
{ |
|
7900 |
iAppUi.SetFocusVisibility( EFalse ); |
|
7901 |
break; |
|
7902 |
} |
|
7903 |
default: |
|
7904 |
{ |
|
7905 |
// Do not handle other events |
|
7906 |
break; |
|
7907 |
} |
|
7908 |
||
7909 |
} |
|
7910 |
} |
|
7911 |
||
7912 |
// --------------------------------------------------------------------------- |
|
7913 |
// UpdateMailListSettingsL |
|
7914 |
// Function reads and updates mail list specific settings from the cen rep |
|
7915 |
// --------------------------------------------------------------------------- |
|
7916 |
// |
|
7917 |
void CFSEmailUiMailListVisualiser::UpdateMailListSettingsL() |
|
7918 |
{ |
|
7919 |
FUNC_LOG; |
|
7920 |
if ( iAppUi.GetCRHandler() ) |
|
7921 |
{ |
|
7922 |
iNodesInUse = iAppUi.GetCRHandler()->TitleDividers(); |
|
7923 |
TInt lineValue = iAppUi.GetCRHandler()->MessageListLayout(); |
|
7924 |
TInt bodyPreviewValue = iAppUi.GetCRHandler()->BodyPreview(); |
|
7925 |
if ( lineValue == 1 ) // 1-line layouts |
|
7926 |
{ |
|
7927 |
if ( bodyPreviewValue == 0 ) |
|
7928 |
{ |
|
7929 |
iListMode = EListControlTypeSingleLinePreviewOff; |
|
7930 |
} |
|
7931 |
else |
|
7932 |
{ |
|
7933 |
iListMode = EListControlTypeSingleLinePreviewOn; |
|
7934 |
} |
|
7935 |
} |
|
7936 |
else // |
|
7937 |
{ |
|
7938 |
if ( bodyPreviewValue == 0 ) |
|
7939 |
{ |
|
7940 |
iListMode = EListControlTypeDoubleLinePreviewOff; |
|
7941 |
} |
|
7942 |
else |
|
7943 |
{ |
|
7944 |
iListMode = EListControlTypeDoubleLinePreviewOn; |
|
7945 |
} |
|
7946 |
} |
|
7947 |
} |
|
7948 |
else |
|
7949 |
{ |
|
7950 |
iNodesInUse = EListControlSeparatorDisabled; |
|
7951 |
iListMode = EListControlTypeDoubleLinePreviewOff; |
|
7952 |
} |
|
7953 |
} |
|
7954 |
||
7955 |
void CFSEmailUiMailListVisualiser::UpdateMailListTimeDateSettings() |
|
7956 |
{ |
|
7957 |
FUNC_LOG; |
|
7958 |
TLocale currentLocaleSettings; |
|
7959 |
iDateFormats.iTimeFormat = currentLocaleSettings.TimeFormat(); |
|
7960 |
iDateFormats.iDateFormat = currentLocaleSettings.DateFormat(); |
|
7961 |
iDateFormats.iAmPmPosition = currentLocaleSettings.AmPmSymbolPosition(); |
|
7962 |
// Second time separartor |
|
7963 |
iDateFormats.iTimeSeparator = currentLocaleSettings.TimeSeparator( 1 ); |
|
7964 |
// Second date separartor |
|
7965 |
iDateFormats.iDateSeparator = currentLocaleSettings.DateSeparator( 1 ); |
|
7966 |
} |
|
7967 |
||
7968 |
STimeDateFormats CFSEmailUiMailListVisualiser::MailListTimeDateSettings() |
|
7969 |
{ |
|
7970 |
FUNC_LOG; |
|
7971 |
return iDateFormats; |
|
7972 |
} |
|
7973 |
||
7974 |
||
7975 |
void CFSEmailUiMailListVisualiser::SetMailboxNameToStatusPaneL() |
|
7976 |
{ |
|
7977 |
FUNC_LOG; |
|
7978 |
iAppUi.SetActiveMailboxNameToStatusPaneL(); |
|
7979 |
} |
|
7980 |
||
7981 |
void CFSEmailUiMailListVisualiser::SetBrandedMailBoxIconL() |
|
7982 |
{ |
|
7983 |
FUNC_LOG; |
|
7984 |
// Get and draw branded mailbox icon |
|
7985 |
MFSMailBrandManager& brandManager = iAppUi.GetMailClient()->GetBrandManagerL(); |
|
7986 |
CGulIcon* mailBoxIcon(0); |
|
7987 |
TRAPD( err, mailBoxIcon = brandManager.GetGraphicL( EFSMailboxIcon, iAppUi.GetActiveMailboxId() ) ); |
|
7988 |
if ( err == KErrNone && mailBoxIcon ) |
|
7989 |
{ |
|
7990 |
CleanupStack::PushL( mailBoxIcon ); |
|
7991 |
//<cmail> |
|
7992 |
TInt iconSize( iAppUi.LayoutHandler()->GetControlBarMailboxIconRect().Width() ); |
|
7993 |
TSize defaultIconSize ( iconSize, iconSize ); |
|
7994 |
//</cmail> |
|
7995 |
AknIconUtils::SetSize(mailBoxIcon->Bitmap(), defaultIconSize); |
|
7996 |
AknIconUtils::SetSize(mailBoxIcon->Mask(), defaultIconSize); |
|
7997 |
// Create texture into TextureManager, If not already existing |
|
7998 |
iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mailBoxIcon, |
|
7999 |
iAppUi.GetActiveMailboxId().PluginId(), |
|
8000 |
iAppUi.GetActiveMailboxId().Id(), |
|
8001 |
defaultIconSize ); |
|
8002 |
// Get branded mailbox icon |
|
8003 |
iMailBoxIconTexture = &iAppUi.FsTextureManager()->TextureByMailboxIdL( iAppUi.GetActiveMailboxId().PluginId(), |
|
8004 |
iAppUi.GetActiveMailboxId().Id(), |
|
8005 |
defaultIconSize ); |
|
8006 |
iFolderListButton->SetIconL( *iMailBoxIconTexture ); |
|
8007 |
CleanupStack::PopAndDestroy( mailBoxIcon ); |
|
8008 |
} |
|
8009 |
else |
|
8010 |
{ |
|
8011 |
iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) ); |
|
8012 |
} |
|
8013 |
} |
|
8014 |
||
8015 |
||
8016 |
void CFSEmailUiMailListVisualiser::SetBrandedListWatermarkL() |
|
8017 |
{ |
|
8018 |
FUNC_LOG; |
|
8019 |
MFSMailBrandManager& brandManager = iAppUi.GetMailClient()->GetBrandManagerL(); |
|
8020 |
CGulIcon* mailBoxWatermarkIcon(0); |
|
8021 |
TRAPD( err, mailBoxWatermarkIcon = brandManager.GetGraphicL( EFSWatermark, iAppUi.GetActiveMailboxId() ) ); |
|
8022 |
if ( err == KErrNone && mailBoxWatermarkIcon ) |
|
8023 |
{ |
|
8024 |
CleanupStack::PushL( mailBoxWatermarkIcon ); |
|
8025 |
TRect mainPaneRect; |
|
8026 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
8027 |
TInt xPos = mainPaneRect.iBr.iX/100*40; // 40% of main pane width |
|
8028 |
TInt yPos = mainPaneRect.iBr.iY/100*40; // 40% of main pane height |
|
8029 |
TSize defaultWaterMarkSize(xPos,yPos); |
|
8030 |
AknIconUtils::SetSize(mailBoxWatermarkIcon->Bitmap(), defaultWaterMarkSize); |
|
8031 |
AknIconUtils::SetSize(mailBoxWatermarkIcon->Mask(), defaultWaterMarkSize); |
|
8032 |
if ( !iMailBoxWatermarkTexture ) |
|
8033 |
{ |
|
8034 |
// iMailBoxWatermarkTexture = CAlfTexture::NewL( *iEnv, Id() ); // DOLATER - Replaced by line below, creates blank texture until UploadL's replaced by something |
|
8035 |
iMailBoxWatermarkTexture = &CAlfStatic::Env().TextureManager().BlankTexture(); |
|
8036 |
} |
|
8037 |
// DOLATER - Gone from Alfred, needs to be replaced with something |
|
8038 |
//iMailBoxWatermarkTexture->UploadL( *mailBoxWatermarkIcon->Bitmap(), mailBoxWatermarkIcon->Mask() ); |
|
8039 |
CleanupStack::PopAndDestroy( mailBoxWatermarkIcon ); |
|
8040 |
TPoint watermarkPosition( mainPaneRect.iBr.iX-xPos-20, mainPaneRect.iBr.iY-yPos-20 ); |
|
8041 |
iMailTreeListVisualizer->SetWatermarkPos( watermarkPosition ); |
|
8042 |
iMailTreeListVisualizer->SetWatermarkSize( defaultWaterMarkSize ); |
|
8043 |
iMailTreeListVisualizer->SetWatermarkOpacity( 0.3 ); |
|
8044 |
iMailTreeListVisualizer->SetWatermarkL( iMailBoxWatermarkTexture ); |
|
8045 |
} |
|
8046 |
else |
|
8047 |
{ |
|
8048 |
// Not found, hide watermark |
|
8049 |
iMailTreeListVisualizer->SetWatermarkOpacity( 0 ); |
|
8050 |
} |
|
8051 |
} |
|
8052 |
||
8053 |
TFsTreeItemId CFSEmailUiMailListVisualiser::ParentNode( TFsTreeItemId aItemId ) const |
|
8054 |
{ |
|
8055 |
FUNC_LOG; |
|
8056 |
if ( iNodesInUse ) |
|
8057 |
{ |
|
8058 |
TFsTreeItemId parentNodeId = iMailList->Parent( aItemId ); |
|
8059 |
if ( iMailList->IsNode( parentNodeId ) ) |
|
8060 |
{ |
|
8061 |
return parentNodeId; |
|
8062 |
} |
|
8063 |
} |
|
8064 |
return KErrNotFound; |
|
8065 |
} |
|
8066 |
||
8067 |
TBool CFSEmailUiMailListVisualiser::DoScrollMarkUnmarkL() |
|
8068 |
{ |
|
8069 |
FUNC_LOG; |
|
8070 |
TBool ret = EFalse; |
|
8071 |
||
8072 |
if ( !iMarkingMode ) |
|
8073 |
{ |
|
8074 |
EnterMarkingModeL(); |
|
8075 |
} |
|
8076 |
||
8077 |
// <cmail> |
|
8078 |
if ( iFocusedControl == EMailListComponent && iModel->Count() ) |
|
8079 |
// </cmail> |
|
8080 |
{ |
|
8081 |
CFSEmailUiMailListModelItem* item = |
|
8082 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) ); |
|
8083 |
||
8084 |
if ( item && item->ModelItemType() == ETypeMailItem ) // Separators are not markable |
|
8085 |
{ |
|
8086 |
if ( !iListMarkItemsState ) |
|
8087 |
{ |
|
8088 |
iMailList->MarkItemL( iMailList->FocusedItem(), EFalse ); |
|
8089 |
} |
|
8090 |
else |
|
8091 |
{ |
|
8092 |
iMailList->MarkItemL( iMailList->FocusedItem(), ETrue ); |
|
8093 |
} |
|
8094 |
ret = ETrue; |
|
8095 |
} |
|
8096 |
} |
|
8097 |
||
8098 |
return ret; |
|
8099 |
} |
|
8100 |
||
8101 |
// Mark / unmark all items under current separator |
|
8102 |
void CFSEmailUiMailListVisualiser::MarkItemsUnderSeparatorL( TBool aMarked, TInt aSeparatorId ) |
|
8103 |
{ |
|
8104 |
FUNC_LOG; |
|
8105 |
||
8106 |
if ( iTreeItemArray.Count() ) |
|
8107 |
{ |
|
8108 |
// Find all items under wanted separator. |
|
8109 |
for ( TInt i = aSeparatorId + 1; i < iTreeItemArray.Count(); i++ ) |
|
8110 |
{ |
|
8111 |
CFSEmailUiMailListModelItem* item = |
|
8112 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) ); |
|
8113 |
||
8114 |
// Mark / unmark mail items. |
|
8115 |
if ( item && |
|
8116 |
item->ModelItemType() == ETypeMailItem && |
|
8117 |
!iMailList->IsNode( iTreeItemArray[i].iListItemId ) ) |
|
8118 |
{ |
|
8119 |
iMailList->MarkItemL( iTreeItemArray[i].iListItemId, aMarked ); |
|
8120 |
} |
|
8121 |
else |
|
8122 |
{ |
|
8123 |
// Stop iteration since another iterator was reached. |
|
8124 |
break; |
|
8125 |
} |
|
8126 |
} |
|
8127 |
} |
|
8128 |
} |
|
8129 |
||
8130 |
// Check if all items under current separator are marked |
|
8131 |
TBool CFSEmailUiMailListVisualiser::AreAllItemsMarkedUnderSeparatorL( TInt aSeparatorId ) |
|
8132 |
{ |
|
8133 |
FUNC_LOG; |
|
8134 |
||
8135 |
TBool ret(ETrue); |
|
8136 |
||
8137 |
if ( iTreeItemArray.Count() ) |
|
8138 |
{ |
|
8139 |
// Find all items under wanted separator. |
|
8140 |
for ( TInt i = aSeparatorId + 1; i < iTreeItemArray.Count(); i++ ) |
|
8141 |
{ |
|
8142 |
CFSEmailUiMailListModelItem* item = |
|
8143 |
static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) ); |
|
8144 |
||
8145 |
// Mark / unmark mail items. |
|
8146 |
if ( item && |
|
8147 |
item->ModelItemType() == ETypeMailItem && |
|
8148 |
!iMailList->IsNode( iTreeItemArray[i].iListItemId ) ) |
|
8149 |
{ |
|
8150 |
if ( !iMailList->IsMarked( iTreeItemArray[i].iListItemId )) |
|
8151 |
{ |
|
8152 |
// Att least one unmarked item found |
|
8153 |
ret = EFalse; |
|
8154 |
break; |
|
8155 |
} |
|
8156 |
} |
|
8157 |
else |
|
8158 |
{ |
|
8159 |
// Stop iteration since another iterator was reached. |
|
8160 |
break; |
|
8161 |
} |
|
8162 |
} |
|
8163 |
} |
|
8164 |
return ret; |
|
8165 |
} |
|
8166 |
||
8167 |
// Navigation functions, used mainly from viewer |
|
8168 |
TBool CFSEmailUiMailListVisualiser::IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
8169 |
TFSMailMsgId& aFoundNextMsgId, |
|
8170 |
TFSMailMsgId& aFoundNextMsgFolder ) const |
|
8171 |
{ |
|
8172 |
FUNC_LOG; |
|
8173 |
TBool ret(EFalse); |
|
8174 |
TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
8175 |
if ( curIdx >= 0 ) |
|
8176 |
{ |
|
8177 |
TInt nextIdx = NextMessageIndex(curIdx); |
|
8178 |
if ( nextIdx >= 0 ) |
|
8179 |
{ |
|
8180 |
ret = ETrue; |
|
8181 |
aFoundNextMsgId = MsgIdFromIndex(nextIdx); |
|
8182 |
aFoundNextMsgFolder = iMailFolder->GetFolderId(); |
|
8183 |
} |
|
8184 |
} |
|
8185 |
||
8186 |
return ret; |
|
8187 |
} |
|
8188 |
||
8189 |
TBool CFSEmailUiMailListVisualiser::IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, |
|
8190 |
TFSMailMsgId& aFoundPreviousMsgId, |
|
8191 |
TFSMailMsgId& aFoundPrevMsgFolder ) const |
|
8192 |
{ |
|
8193 |
FUNC_LOG; |
|
8194 |
TBool ret(EFalse); |
|
8195 |
TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
8196 |
if ( curIdx >= 0 ) |
|
8197 |
{ |
|
8198 |
TInt prevIdx = PreviousMessageIndex(curIdx); |
|
8199 |
if ( prevIdx >= 0 ) |
|
8200 |
{ |
|
8201 |
ret = ETrue; |
|
8202 |
aFoundPreviousMsgId = MsgIdFromIndex(prevIdx); |
|
8203 |
aFoundPrevMsgFolder = iMailFolder->GetFolderId(); |
|
8204 |
} |
|
8205 |
} |
|
8206 |
||
8207 |
return ret; |
|
8208 |
} |
|
8209 |
||
8210 |
TInt CFSEmailUiMailListVisualiser::MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId ) |
|
8211 |
{ |
|
8212 |
FUNC_LOG; |
|
8213 |
TInt ret(KErrNotFound); |
|
8214 |
||
8215 |
TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
8216 |
TInt nextIdx = NextMessageIndex( curIdx ); |
|
8217 |
||
8218 |
if ( curIdx >= 0 && nextIdx >= 0 ) |
|
8219 |
{ |
|
8220 |
// Focus the new message |
|
8221 |
// <cmail> |
|
8222 |
iMailTreeListVisualizer->SetFocusedItemL( iTreeItemArray[nextIdx].iListItemId, EFalse ); |
|
8223 |
// </cmail> |
|
8224 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
8225 |
||
8226 |
aFoundNextMsgId = MsgIdFromIndex( nextIdx ); |
|
8227 |
ret = KErrNone; |
|
8228 |
} |
|
8229 |
if ( ret == KErrNone ) |
|
8230 |
{ |
|
8231 |
OpenHighlightedMailL(); |
|
8232 |
} |
|
8233 |
return ret; |
|
8234 |
} |
|
8235 |
||
8236 |
TInt CFSEmailUiMailListVisualiser::MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId ) |
|
8237 |
{ |
|
8238 |
FUNC_LOG; |
|
8239 |
TInt ret(KErrNotFound); |
|
8240 |
||
8241 |
TInt curIdx = ItemIndexFromMessageId( aCurrentMsgId ); |
|
8242 |
TInt prevIdx = PreviousMessageIndex( curIdx ); |
|
8243 |
||
8244 |
if ( curIdx >= 0 && prevIdx >= 0 ) |
|
8245 |
{ |
|
8246 |
// Focus the new message |
|
8247 |
// <cmail> |
|
8248 |
iMailTreeListVisualizer->SetFocusedItemL( iTreeItemArray[prevIdx].iListItemId, EFalse ); |
|
8249 |
// </cmail> |
|
8250 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
8251 |
aFoundPreviousMsgId = MsgIdFromIndex( prevIdx ); |
|
8252 |
ret = KErrNone; |
|
8253 |
} |
|
8254 |
||
8255 |
if ( ret == KErrNone ) |
|
8256 |
{ |
|
8257 |
OpenHighlightedMailL(); |
|
8258 |
} |
|
8259 |
return ret; |
|
8260 |
} |
|
8261 |
||
8262 |
TInt CFSEmailUiMailListVisualiser::MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId ) |
|
8263 |
{ |
|
8264 |
FUNC_LOG; |
|
8265 |
TInt ret(KErrNotFound); |
|
8266 |
||
8267 |
TInt idx = ItemIndexFromMessageId( aFoundPreviousMsgId ); |
|
8268 |
if ( idx >= 0 ) |
|
8269 |
{ |
|
8270 |
// Focus the previous message |
|
8271 |
iMailTreeListVisualizer->SetFocusedItemL( iTreeItemArray[idx].iListItemId, EFalse ); |
|
8272 |
ChangeReadStatusOfHighlightedL( ETrue ); |
|
8273 |
ret = KErrNone; |
|
8274 |
} |
|
8275 |
||
8276 |
if ( ret == KErrNone ) |
|
8277 |
{ |
|
8278 |
OpenHighlightedMailL(); |
|
8279 |
} |
|
8280 |
||
8281 |
return ret; |
|
8282 |
} |
|
8283 |
||
8284 |
void CFSEmailUiMailListVisualiser::ManualMailBoxSync( TBool aManualMailBoxSync ) |
|
8285 |
{ |
|
8286 |
FUNC_LOG; |
|
8287 |
iManualMailBoxSync = aManualMailBoxSync; |
|
8288 |
} |
|
8289 |
||
8290 |
TBool CFSEmailUiMailListVisualiser::GetLatestSyncState() |
|
8291 |
{ |
|
8292 |
FUNC_LOG; |
|
8293 |
CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox(); |
|
8294 |
||
8295 |
TBool ret = EFalse; |
|
8296 |
||
8297 |
if ( activeMailbox ) |
|
8298 |
{ |
|
8299 |
TSSMailSyncState latestSyncstate = activeMailbox->CurrentSyncState(); |
|
8300 |
if(latestSyncstate == InboxSyncing || |
|
8301 |
latestSyncstate == StartingSync || |
|
8302 |
latestSyncstate == EmailSyncing || |
|
8303 |
latestSyncstate == OutboxSyncing || |
|
8304 |
latestSyncstate == SentItemsSyncing || |
|
8305 |
latestSyncstate == DraftsSyncing || |
|
8306 |
latestSyncstate == CalendarSyncing || |
|
8307 |
latestSyncstate == ContactsSyncing || |
|
8308 |
latestSyncstate == TasksSyncing || |
|
8309 |
latestSyncstate == NotesSyncing || |
|
8310 |
latestSyncstate == FilesSyncing || |
|
8311 |
latestSyncstate == DataSyncStarting ) |
|
8312 |
{ |
|
8313 |
ret = ETrue; |
|
8314 |
} |
|
8315 |
} |
|
8316 |
||
8317 |
return ret; |
|
8318 |
} |
|
8319 |
||
8320 |
void CFSEmailUiMailListVisualiser::ConnectionIconHandling() |
|
8321 |
{ |
|
8322 |
FUNC_LOG; |
|
8323 |
iAppUi.UpdateTitlePaneConnectionStatus(); |
|
8324 |
} |
|
8325 |
||
8326 |
void CFSEmailUiMailListVisualiser::SetListAndCtrlBarFocusL() |
|
8327 |
{ |
|
8328 |
FUNC_LOG; |
|
8329 |
if ( iFocusedControl == EMailListComponent ) |
|
8330 |
{ |
|
8331 |
iMailList->SetFocusedL( ETrue ); |
|
8332 |
iControlBarControl->SetFocusL( EFalse ); |
|
8333 |
} |
|
8334 |
else |
|
8335 |
{ |
|
8336 |
if( iStylusPopUpMenuVisible ) |
|
8337 |
{ |
|
8338 |
return; |
|
8339 |
} |
|
8340 |
||
8341 |
iMailList->SetFocusedL( EFalse ); |
|
8342 |
TInt focusedBtnId = KErrNotFound; |
|
8343 |
MFsControlButtonInterface* focusedBtn = iControlBarControl->GetFocusedButton(); |
|
8344 |
if ( focusedBtn ) |
|
8345 |
{ |
|
8346 |
focusedBtnId = focusedBtn->Id(); |
|
8347 |
} |
|
8348 |
iControlBarControl->SetFocusL( ETrue ); |
|
8349 |
if ( focusedBtnId != KErrNotFound ) |
|
8350 |
{ |
|
8351 |
iControlBarControl->SetFocusByIdL( focusedBtnId ); |
|
8352 |
} |
|
8353 |
iControlBarControl->MakeSelectorVisible( IsFocusShown() ); |
|
8354 |
} |
|
8355 |
} |
|
8356 |
||
8357 |
void CFSEmailUiMailListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const |
|
8358 |
{ |
|
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8359 |
if ( iScreenAnchorLayout ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8360 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8361 |
aLayoutArray.AppendL( iScreenAnchorLayout ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8362 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8363 |
if ( iControlBarControl ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8364 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8365 |
aLayoutArray.AppendL( iControlBarControl->Visual() ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8366 |
} |
25 | 8367 |
} |
8368 |
||
8369 |
// hide or show CAlfVisuals ( used for activation or deactivation ) |
|
8370 |
void CFSEmailUiMailListVisualiser::FadeOut(TBool aDirectionOut) |
|
8371 |
{ |
|
8372 |
FUNC_LOG; |
|
8373 |
TAlfTimedValue timedValue( 0, 0 ); |
|
8374 |
if ( !aDirectionOut ) |
|
8375 |
{ |
|
8376 |
timedValue.SetTarget( 1, 0 ); |
|
8377 |
} |
|
8378 |
if ( iScreenAnchorLayout != NULL ) |
|
8379 |
{ |
|
8380 |
iScreenAnchorLayout->SetOpacity( timedValue ); |
|
8381 |
} |
|
8382 |
if (iControlBarControl && iControlBarControl->Visual() != NULL ) |
|
8383 |
{ |
|
8384 |
iControlBarControl->Visual()->SetOpacity( timedValue ); |
|
8385 |
} |
|
8386 |
} |
|
8387 |
||
8388 |
// Sets aActiveMailboxId and aActiveFolderId from iMailFolder if available |
|
8389 |
TInt CFSEmailUiMailListVisualiser::GetActiveFolderId(TFSMailMsgId& aActiveMailboxId, TFSMailMsgId& aActiveFolderId) const |
|
8390 |
{ |
|
8391 |
if (iMailFolder != NULL) |
|
8392 |
{ |
|
8393 |
aActiveMailboxId = iMailFolder->GetMailBoxId(); |
|
8394 |
aActiveFolderId = iMailFolder->GetFolderId(); |
|
8395 |
return KErrNone; |
|
8396 |
} |
|
8397 |
else |
|
8398 |
{ |
|
8399 |
return KErrNotFound; |
|
8400 |
} |
|
8401 |
} |
|
8402 |
||
8403 |
void CFSEmailUiMailListVisualiser::CreateExtensionL() |
|
8404 |
{ |
|
8405 |
CFSMailBox* box = iAppUi.GetActiveMailbox(); |
|
8406 |
CEmailExtension* ext=NULL; |
|
8407 |
if (box) |
|
8408 |
{ |
|
8409 |
ext = box->ExtensionL( KEmailMailboxStateExtensionUid ); |
|
8410 |
} |
|
8411 |
if (ext) |
|
8412 |
{ |
|
8413 |
iExtension = reinterpret_cast<CMailboxStateExtension*>( ext ); |
|
8414 |
iExtension->SetStateDataProvider( this ); |
|
8415 |
} |
|
8416 |
} |
|
8417 |
||
8418 |
TBool CFSEmailUiMailListVisualiser::CheckAutoSyncSettingL() |
|
8419 |
{ |
|
8420 |
CEmailExtension* ext=NULL; |
|
8421 |
TBool manualSync = EFalse; |
|
8422 |
CFSMailBox* box = iAppUi.GetActiveMailbox(); |
|
8423 |
if (box) |
|
8424 |
{ |
|
8425 |
ext = box->ExtensionL( KEmailSettingExtensionUid ); |
|
8426 |
if (ext) |
|
8427 |
{ |
|
8428 |
CEmailSettingsExtension* extension = reinterpret_cast<CEmailSettingsExtension*>( ext ); |
|
8429 |
extension->SetMailBoxId(box->GetId()); |
|
8430 |
manualSync = extension->IsSetL(EmailSyncInterval); |
|
8431 |
box->ReleaseExtension(extension); |
|
8432 |
} |
|
8433 |
} |
|
8434 |
return manualSync; |
|
8435 |
} |
|
8436 |
||
26
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8437 |
|
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8438 |
void CFSEmailUiMailListVisualiser::UpdateFolderAndMarkingModeTextsL() |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8439 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8440 |
if ( iAppUi.CurrentActiveView()->Id() == MailListId ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8441 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8442 |
HBufC* folder = CreateFolderNameLC( iMailFolder ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8443 |
if( Layout_Meta_Data::IsLandscapeOrientation() ) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8444 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8445 |
iFolderListButton->SetTextL( KNullDesC ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8446 |
if (iMarkingMode) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8447 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8448 |
RemoveMarkingModeTextOnButtonsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8449 |
HBufC* txt = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MARKINGMODE ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8450 |
iAppUi.SetNaviPaneTextL( *txt ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8451 |
CleanupStack::PopAndDestroy( txt ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8452 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8453 |
else |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8454 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8455 |
iAppUi.SetNaviPaneTextL( *folder ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8456 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8457 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8458 |
else // Portrait orientation |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8459 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8460 |
iAppUi.SetNaviPaneTextL( KNullDesC ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8461 |
if (iMarkingMode) |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8462 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8463 |
DisplayMarkingModeTextOnButtonsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8464 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8465 |
else |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8466 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8467 |
RemoveMarkingModeTextOnButtonsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8468 |
iFolderListButton->SetTextL( *folder ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8469 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8470 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8471 |
CleanupStack::PopAndDestroy( folder ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8472 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8473 |
else |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8474 |
{ |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8475 |
iAppUi.SetNaviPaneTextL( KNullDesC ); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8476 |
RemoveMarkingModeTextOnButtonsL(); |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8477 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8478 |
} |
968773a0b6ef
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
8479 |
|
25 | 8480 |
////////////////////////////////////////////////////////////////// |
8481 |
// Class implementation CMailListUpdater |
|
8482 |
/////////////////////////////////////////////////////////////////// |
|
8483 |
||
8484 |
||
8485 |
// ----------------------------------------------------------------------------- |
|
8486 |
// CMailListUpdater::NewL |
|
8487 |
// NewL function. Returns timer object. |
|
8488 |
// ----------------------------------------------------------------------------- |
|
8489 |
// |
|
8490 |
CMailListUpdater* CMailListUpdater::NewL( CFSEmailUiMailListVisualiser* aMailListVisualiser ) |
|
8491 |
{ |
|
8492 |
FUNC_LOG; |
|
8493 |
CMailListUpdater* self = new (ELeave) CMailListUpdater( aMailListVisualiser ); |
|
8494 |
CleanupStack::PushL( self ); |
|
8495 |
self->ConstructL(); |
|
8496 |
CleanupStack::Pop( self ); |
|
8497 |
return self; |
|
8498 |
} |
|
8499 |
||
8500 |
// ----------------------------------------------------------------------------- |
|
8501 |
// CMailListUpdater::~CMailListUpdater |
|
8502 |
// D'tor |
|
8503 |
// ----------------------------------------------------------------------------- |
|
8504 |
// |
|
8505 |
CMailListUpdater::~CMailListUpdater() |
|
8506 |
{ |
|
8507 |
FUNC_LOG; |
|
8508 |
Cancel(); |
|
8509 |
} |
|
8510 |
||
8511 |
// ----------------------------------------------------------------------------- |
|
8512 |
// CMailListUpdater::CMailListUpdater |
|
8513 |
// C'tor |
|
8514 |
// ----------------------------------------------------------------------------- |
|
8515 |
// |
|
8516 |
CMailListUpdater::CMailListUpdater( CFSEmailUiMailListVisualiser* aMailListVisualiser ) |
|
8517 |
: CTimer( EPriorityStandard ), |
|
8518 |
iMailListVisualiser( aMailListVisualiser ) |
|
8519 |
{ |
|
8520 |
FUNC_LOG; |
|
8521 |
CActiveScheduler::Add( this ); |
|
8522 |
} |
|
8523 |
||
8524 |
// ----------------------------------------------------------------------------- |
|
8525 |
// CMailListUpdater::RunL |
|
8526 |
// Timer trigger function. |
|
8527 |
// ----------------------------------------------------------------------------- |
|
8528 |
// |
|
8529 |
void CMailListUpdater::RunL() |
|
8530 |
{ |
|
8531 |
FUNC_LOG; |
|
8532 |
if ( iIsSorting ) |
|
8533 |
{ |
|
8534 |
iMailListVisualiser->UpdateMailListModelL(); |
|
8535 |
iMailListVisualiser->RefreshL(); |
|
8536 |
// Sorting is completed |
|
8537 |
iIsSorting = EFalse; |
|
8538 |
// Dismiss wait note. |
|
8539 |
if ( iWaitNote ) |
|
8540 |
{ |
|
8541 |
iWaitNote->ProcessFinishedL(); |
|
8542 |
} |
|
8543 |
} |
|
8544 |
else |
|
8545 |
{ |
|
8546 |
// Store the list of marked items. The markings are erased when the list |
|
8547 |
// is repopulated and, hence, the markings need to be reset after the |
|
8548 |
// refreshing is done. The marked items must be identified by the message |
|
8549 |
// ID rather than with the list ID because refreshing may change the list IDs. |
|
8550 |
RArray<TFSMailMsgId> markedMessages; |
|
8551 |
CleanupClosePushL( markedMessages ); |
|
8552 |
iMailListVisualiser->GetMarkedMessagesL( markedMessages ); |
|
8553 |
||
8554 |
// Store the message ID of the focused item |
|
8555 |
TFSMailMsgId msgIdBeforeRefresh; |
|
8556 |
TFsTreeItemId firstVisibleListId = iMailListVisualiser->iMailTreeListVisualizer->FirstVisibleItem(); |
|
8557 |
TInt modelFirstIndexBeforeUpdate = iMailListVisualiser->ModelIndexFromListId( firstVisibleListId ); |
|
8558 |
TInt highlightedIndexBeforeUpdate = iMailListVisualiser->HighlightedIndex(); |
|
8559 |
TInt modelCountBeforeUpdate = iMailListVisualiser->iModel->Count(); |
|
8560 |
if ( iMailListVisualiser->iModel->Count() ) |
|
8561 |
{ |
|
8562 |
CFSEmailUiMailListModelItem* item = |
|
8563 |
static_cast<CFSEmailUiMailListModelItem*>(iMailListVisualiser->iModel->Item( highlightedIndexBeforeUpdate ) ); |
|
8564 |
if ( item && item->ModelItemType() == ETypeMailItem ) |
|
8565 |
{ |
|
8566 |
msgIdBeforeRefresh = item->MessagePtr().GetMessageId(); |
|
8567 |
} |
|
8568 |
} |
|
8569 |
||
8570 |
iMailListVisualiser->UpdateMailListModelL(); |
|
8571 |
iMailListVisualiser->RefreshL( &msgIdBeforeRefresh ); |
|
8572 |
||
8573 |
// Focus is set to last focused item. After this, try to keep the same first item that previous |
|
8574 |
// Check how many messages have been added |
|
8575 |
TInt modelIndexDifference = highlightedIndexBeforeUpdate-modelFirstIndexBeforeUpdate; // 0 or more |
|
8576 |
if ( modelIndexDifference < 0 ) |
|
8577 |
{ |
|
8578 |
modelIndexDifference = 0; // safety |
|
8579 |
} |
|
8580 |
TInt toBeFirstIdx = iMailListVisualiser->HighlightedIndex() - modelIndexDifference; |
|
8581 |
CFSEmailUiMailListModelItem* toBeFirstVisItem = |
|
8582 |
static_cast<CFSEmailUiMailListModelItem*>( iMailListVisualiser->iModel->Item(toBeFirstIdx) ); |
|
8583 |
if ( toBeFirstVisItem ) |
|
8584 |
{ |
|
8585 |
// <cmail> |
|
8586 |
iMailListVisualiser->iMailTreeListVisualizer->SetFirstVisibleItemL( toBeFirstVisItem->CorrespondingListId() ); |
|
8587 |
// </cmail> |
|
8588 |
} |
|
8589 |
||
8590 |
// Restore the marking status |
|
8591 |
iMailListVisualiser->MarkMessagesIfFoundL( markedMessages ); |
|
8592 |
CleanupStack::PopAndDestroy( &markedMessages ); |
|
8593 |
} |
|
8594 |
Cancel(); |
|
8595 |
} |
|
8596 |
||
8597 |
// ----------------------------------------------------------------------------- |
|
8598 |
// CMailListUpdater::Start |
|
8599 |
// Timer starting function. |
|
8600 |
// ----------------------------------------------------------------------------- |
|
8601 |
// |
|
8602 |
void CMailListUpdater::StartL( TBool aIsSorting ) |
|
8603 |
{ |
|
8604 |
FUNC_LOG; |
|
8605 |
if ( iWaitNote ) |
|
8606 |
{ |
|
8607 |
iWaitNote->ProcessFinishedL(); |
|
8608 |
} |
|
8609 |
||
8610 |
iIsSorting = aIsSorting; |
|
8611 |
Cancel(); |
|
8612 |
if ( iIsSorting ) |
|
8613 |
{ |
|
8614 |
// Start wait note |
|
8615 |
TFsEmailUiUtility::ShowWaitNoteL( iWaitNote, R_FSE_WAIT_SORTING_TEXT, EFalse, ETrue ); |
|
8616 |
After( 10 ); // Update shortly after selection has been made. |
|
8617 |
} |
|
8618 |
else |
|
8619 |
{ |
|
8620 |
// Mail added update |
|
8621 |
After( KMsgUpdaterTimerDelay ); // Update after 1,5 seconds |
|
8622 |
} |
|
8623 |
} |
|
8624 |
||
8625 |
// ----------------------------------------------------------------------------- |
|
8626 |
// CMailListUpdater::Stop |
|
8627 |
// Timer stopping function |
|
8628 |
// ----------------------------------------------------------------------------- |
|
8629 |
// |
|
8630 |
void CMailListUpdater::Stop() |
|
8631 |
{ |
|
8632 |
FUNC_LOG; |
|
8633 |
Cancel(); |
|
8634 |
} |
|
8635 |
||
8636 |
||
8637 |
||
8638 |
////////////////////////////////////////////////////////////////// |
|
8639 |
// Class implementation CMsgMovedNoteTimer |
|
8640 |
/////////////////////////////////////////////////////////////////// |
|
8641 |
||
8642 |
||
8643 |
// ----------------------------------------------------------------------------- |
|
8644 |
// CMsgMovedNoteTimer::NewL |
|
8645 |
// NewL function. Returns timer object. |
|
8646 |
// ----------------------------------------------------------------------------- |
|
8647 |
// |
|
8648 |
CMsgMovedNoteTimer* CMsgMovedNoteTimer::NewL( CFreestyleEmailUiAppUi* aAppUi, CFSEmailUiMailListVisualiser* aMailListVisualiser ) |
|
8649 |
{ |
|
8650 |
FUNC_LOG; |
|
8651 |
CMsgMovedNoteTimer* self = new (ELeave) CMsgMovedNoteTimer( aAppUi, aMailListVisualiser ); |
|
8652 |
CleanupStack::PushL( self ); |
|
8653 |
self->ConstructL(); |
|
8654 |
CleanupStack::Pop( self ); |
|
8655 |
return self; |
|
8656 |
} |
|
8657 |
||
8658 |
// ----------------------------------------------------------------------------- |
|
8659 |
// CMsgMovedNoteTimer::CMsgMovedNoteTimer |
|
8660 |
// D'tor |
|
8661 |
// ----------------------------------------------------------------------------- |
|
8662 |
// |
|
8663 |
CMsgMovedNoteTimer::~CMsgMovedNoteTimer() |
|
8664 |
{ |
|
8665 |
FUNC_LOG; |
|
8666 |
Cancel(); |
|
8667 |
} |
|
8668 |
||
8669 |
// ----------------------------------------------------------------------------- |
|
8670 |
// CMailListUpdater::CMailListUpdater |
|
8671 |
// C'tor |
|
8672 |
// ----------------------------------------------------------------------------- |
|
8673 |
// |
|
8674 |
CMsgMovedNoteTimer::CMsgMovedNoteTimer( CFreestyleEmailUiAppUi* aAppUi, CFSEmailUiMailListVisualiser* aMailListVisualiser ) |
|
8675 |
: CTimer( EPriorityStandard ), |
|
8676 |
iAppUi( aAppUi), |
|
8677 |
iMailListVisualiser( aMailListVisualiser ) |
|
8678 |
{ |
|
8679 |
FUNC_LOG; |
|
8680 |
CActiveScheduler::Add( this ); |
|
8681 |
} |
|
8682 |
||
8683 |
// ----------------------------------------------------------------------------- |
|
8684 |
// CMsgMovedNoteTimer::RunL |
|
8685 |
// Timer trigger function. |
|
8686 |
// ----------------------------------------------------------------------------- |
|
8687 |
// |
|
8688 |
void CMsgMovedNoteTimer::RunL() |
|
8689 |
{ |
|
8690 |
FUNC_LOG; |
|
8691 |
TFsEmailUiUtility::DisplayMsgsMovedNoteL( iMsgCount, iDestinationFolderId, EFalse ); |
|
8692 |
Cancel(); |
|
8693 |
} |
|
8694 |
||
8695 |
// ----------------------------------------------------------------------------- |
|
8696 |
// CMsgMovedNoteTimer::Start |
|
8697 |
// Timer starting function. |
|
8698 |
// ----------------------------------------------------------------------------- |
|
8699 |
// |
|
8700 |
void CMsgMovedNoteTimer::Start( TInt aMsgCount, const TFSMailMsgId aDestinationFolderId ) |
|
8701 |
{ |
|
8702 |
FUNC_LOG; |
|
8703 |
Cancel(); |
|
8704 |
iMsgCount = aMsgCount, |
|
8705 |
iDestinationFolderId = aDestinationFolderId; |
|
8706 |
TInt viewSlideinTime = iAppUi->LayoutHandler()->ViewSlideEffectTime(); |
|
8707 |
if ( viewSlideinTime == 0 ) |
|
8708 |
{ |
|
8709 |
viewSlideinTime = 100; |
|
8710 |
} |
|
8711 |
After( viewSlideinTime ); |
|
8712 |
} |
|
8713 |
||
8714 |
// ----------------------------------------------------------------------------- |
|
8715 |
// CMsgMovedNoteTimer::Stop |
|
8716 |
// Timer stopping function |
|
8717 |
// ----------------------------------------------------------------------------- |
|
8718 |
// |
|
8719 |
void CMsgMovedNoteTimer::Stop() |
|
8720 |
{ |
|
8721 |
FUNC_LOG; |
|
8722 |
Cancel(); |
|
8723 |
} |
|
8724 |
||
8725 |
||
8726 |
////////////////////////////////////////////////////////////////// |
|
8727 |
// Class implementation CDateChnageTimer |
|
8728 |
/////////////////////////////////////////////////////////////////// |
|
8729 |
||
8730 |
// ----------------------------------------------------------------------------- |
|
8731 |
// CMsgMovedNoteTimer::NewL |
|
8732 |
// Two phased constructor |
|
8733 |
// ----------------------------------------------------------------------------- |
|
8734 |
// |
|
8735 |
CDateChangeTimer* CDateChangeTimer::NewL( CFSEmailUiMailListVisualiser& aMailListVisualiser ) |
|
8736 |
{ |
|
8737 |
FUNC_LOG; |
|
8738 |
CDateChangeTimer* self = new ( ELeave ) CDateChangeTimer( aMailListVisualiser ); |
|
8739 |
CleanupStack::PushL( self ); |
|
8740 |
self->ConstructL(); |
|
8741 |
CleanupStack::Pop( self ); |
|
8742 |
return self; |
|
8743 |
} |
|
8744 |
||
8745 |
// ----------------------------------------------------------------------------- |
|
8746 |
// CMsgMovedNoteTimer::CDateChangeTimer |
|
8747 |
// First phase constructor |
|
8748 |
// ----------------------------------------------------------------------------- |
|
8749 |
// |
|
8750 |
CDateChangeTimer::CDateChangeTimer( CFSEmailUiMailListVisualiser& aMailListVisualiser ) |
|
8751 |
: CTimer( EPriorityStandard ), iMailListVisualiser( aMailListVisualiser ) |
|
8752 |
{ |
|
8753 |
FUNC_LOG; |
|
8754 |
CActiveScheduler::Add( this ); |
|
8755 |
iDayCount = DayCount(); |
|
8756 |
} |
|
8757 |
||
8758 |
// ----------------------------------------------------------------------------- |
|
8759 |
// CMsgMovedNoteTimer::~CDateChangeTimer |
|
8760 |
// Destructor |
|
8761 |
// ----------------------------------------------------------------------------- |
|
8762 |
// |
|
8763 |
CDateChangeTimer::~CDateChangeTimer() |
|
8764 |
{ |
|
8765 |
FUNC_LOG; |
|
8766 |
// no implementation needed |
|
8767 |
} |
|
8768 |
||
8769 |
// ----------------------------------------------------------------------------- |
|
8770 |
// CMsgMovedNoteTimer::Start |
|
8771 |
// Request event at 00:00 tomorrow |
|
8772 |
// ----------------------------------------------------------------------------- |
|
8773 |
// |
|
8774 |
void CDateChangeTimer::Start() |
|
8775 |
{ |
|
8776 |
FUNC_LOG; |
|
8777 |
TTime now; |
|
8778 |
now.HomeTime(); |
|
8779 |
||
8780 |
// Construct target time |
|
8781 |
TTime eventTime = now + TTimeIntervalDays( 1 ); |
|
8782 |
TDateTime eventDateTime = eventTime.DateTime(); |
|
8783 |
eventDateTime.SetHour(0); |
|
8784 |
eventDateTime.SetMinute(0); |
|
8785 |
eventDateTime.SetSecond(0); |
|
8786 |
eventDateTime.SetMicroSecond(0); |
|
8787 |
eventTime = TTime( eventDateTime ); |
|
8788 |
||
8789 |
// Issue the request |
|
8790 |
At( eventTime ); |
|
8791 |
} |
|
8792 |
||
8793 |
// ----------------------------------------------------------------------------- |
|
8794 |
// CMsgMovedNoteTimer::RunL |
|
8795 |
// Function gets called when system time reaches the 00:00 in the next day or |
|
8796 |
// when the system time has been changed by the user. Both cases can be handled |
|
8797 |
// in the same way. |
|
8798 |
// ----------------------------------------------------------------------------- |
|
8799 |
// |
|
8800 |
void CDateChangeTimer::RunL() |
|
8801 |
{ |
|
8802 |
FUNC_LOG; |
|
8803 |
||
8804 |
if (iStatus.Int() != KErrNone) |
|
8805 |
{ |
|
8806 |
INFO_1("### CDateChangeTimer::RunL (err=%d) ###", iStatus.Int()); |
|
8807 |
} |
|
8808 |
||
8809 |
||
8810 |
TBool dayChanged = EFalse; |
|
8811 |
TInt dayCount = DayCount(); |
|
8812 |
if (dayCount != iDayCount) |
|
8813 |
{ |
|
8814 |
||
8815 |
iDayCount = dayCount; |
|
8816 |
dayChanged = ETrue; |
|
8817 |
} |
|
8818 |
||
8819 |
||
8820 |
if ( KErrCancel == iStatus.Int() ) |
|
8821 |
{ |
|
8822 |
; |
|
8823 |
} |
|
8824 |
else if ( KErrAbort == iStatus.Int() ) // System time changed |
|
8825 |
{ |
|
8826 |
if (dayChanged) |
|
8827 |
{ |
|
8828 |
TRAP_IGNORE( iMailListVisualiser.NotifyDateChangedL() ); |
|
8829 |
} |
|
8830 |
Start(); |
|
8831 |
} |
|
8832 |
else // interval is over |
|
8833 |
{ |
|
8834 |
// Update mail list and reissue the request for timer event |
|
8835 |
TRAP_IGNORE( iMailListVisualiser.NotifyDateChangedL() ); |
|
8836 |
Start(); |
|
8837 |
} |
|
8838 |
||
8839 |
} |
|
8840 |
||
8841 |
||
8842 |
TInt CDateChangeTimer::DayCount() |
|
8843 |
{ |
|
8844 |
TTime now; |
|
8845 |
now.HomeTime(); |
|
8846 |
TTime minTime = Time::MinTTime(); |
|
8847 |
TTimeIntervalDays days = now.DaysFrom(minTime); |
|
8848 |
return days.Int(); |
|
8849 |
} |
|
8850 |
||
8851 |
||
8852 |
||
8853 |
||
8854 |
||
8855 |
||
8856 |
||
8857 |