79
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Pure virtua class for message view to handle listbox.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef MCEMESSAGELISTCONTAINERBASE_H
|
|
22 |
#define MCEMESSAGELISTCONTAINERBASE_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <coecntrl.h> // CCoeControl
|
|
26 |
#include <msvapi.h>
|
|
27 |
#include <aknmarkingmodeobserver.h>
|
|
28 |
//#include "MceListContainer.h"
|
|
29 |
//#include "MceMessageListContTimer.h"
|
|
30 |
|
|
31 |
#include "mcetemplate.h"
|
|
32 |
#include "MceUtils.h"
|
|
33 |
#include "MceListItem.h"
|
|
34 |
#include <centralrepository.h> //CRepository
|
|
35 |
#include <bldvariant.hrh>
|
|
36 |
#include <eikcmobs.h>
|
|
37 |
#include <e32property.h>
|
|
38 |
|
|
39 |
// FORWARD DECLARATIONS
|
|
40 |
class CMceMessageListView;
|
|
41 |
class MMtmUiDataRegistryObserver;
|
|
42 |
|
|
43 |
//CONSTS
|
|
44 |
//const TInt KMceSelectionReplacementSize = 5;
|
|
45 |
enum TMceContainerFlags
|
|
46 |
{
|
|
47 |
EMceOneRowFlagOptionsMenuOpen = 0x01, // options menu open status
|
|
48 |
EMceOneRowFlagFirstSubtitleOpen = 0x02
|
|
49 |
};
|
|
50 |
|
|
51 |
|
|
52 |
// CLASS DECLARATION
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Base class for all the message list containers.
|
|
56 |
* This class is used by message list view.
|
|
57 |
* @since S60 5.0
|
|
58 |
*/
|
|
59 |
class CMceMessageListContainerBase :
|
|
60 |
public CCoeControl,
|
|
61 |
public MEikCommandObserver,
|
|
62 |
public MAknMarkingModeObserver
|
|
63 |
{
|
|
64 |
public: // Constructors and destructor
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Destructor.
|
|
68 |
*/
|
|
69 |
virtual ~CMceMessageListContainerBase();
|
|
70 |
|
|
71 |
public: // From MAknMarkingModeObserver
|
|
72 |
|
|
73 |
/**
|
|
74 |
* This method is called when marking mode is activated or deactivated.
|
|
75 |
*
|
|
76 |
* @param aActivated @c ETrue if marking mode was activate, @c EFalse
|
|
77 |
* if marking mode was deactivated.
|
|
78 |
*/
|
|
79 |
void MarkingModeStatusChanged( TBool aActivated );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* This method is called just before marking mode is closed. Client can
|
|
83 |
* either accept or decline closing.
|
|
84 |
*
|
|
85 |
* @return @c ETrue if marking mode should be closed, otherwise @c EFalse.
|
|
86 |
*/
|
|
87 |
TBool ExitMarkingMode() const;
|
|
88 |
|
|
89 |
public:
|
|
90 |
|
|
91 |
/**
|
|
92 |
* TODO: Needed?
|
|
93 |
* 1 = two row
|
|
94 |
* 2 = hierachical list
|
|
95 |
*/
|
|
96 |
virtual TInt MceListId() const = 0;
|
|
97 |
|
|
98 |
/**
|
|
99 |
* @return number of items in list (total list item count, including ALL the items with one row list)
|
|
100 |
*/
|
|
101 |
virtual TInt Count() const = 0;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* @return message count
|
|
105 |
*/
|
|
106 |
virtual TInt MessageCount() const = 0;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* @return folder count
|
|
110 |
* TODO: some other count also needed? Subtitle row count?
|
|
111 |
*/
|
|
112 |
virtual TInt FolderCount() const = 0;
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Changes currently opened folder
|
|
116 |
* @param aFolderId: id of the folder to be opened.
|
|
117 |
* TODO: should this open inbox in case of imap?
|
|
118 |
*/
|
|
119 |
virtual void SetFolderL( TMsvId aFolderId ) = 0;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Returns id of the currently opened folder
|
|
123 |
* @return folder id
|
|
124 |
*/
|
|
125 |
virtual TMsvId CurrentFolderId() const = 0;
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Returns the currently opened folder entry.
|
|
129 |
* @return TMsvEntry of the opened folder.
|
|
130 |
*/
|
|
131 |
virtual const TMsvEntry& FolderEntry() const = 0;
|
|
132 |
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Returns message id of the currently focused item
|
|
136 |
* @return TMsvId of the entry
|
|
137 |
* TODO: should this be TInt so that it could be used to subtitles?
|
|
138 |
*/
|
|
139 |
virtual TMsvId CurrentItemId() const = 0;
|
|
140 |
|
|
141 |
/**
|
|
142 |
* TMessageListItemType
|
|
143 |
* different list item types, CurrentItemType
|
|
144 |
*/
|
|
145 |
enum TMessageListItemType
|
|
146 |
{
|
|
147 |
/**
|
|
148 |
* unknown item (list is empty?)
|
|
149 |
*/
|
|
150 |
EMessageListItemUnknown = 0,
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Item can be found from message store (CurrentItemId() returns TMsvId)
|
|
154 |
*/
|
|
155 |
EMessageListItemMsvItem,
|
|
156 |
|
|
157 |
/**
|
|
158 |
* something else ( one row list; subtitle?)
|
|
159 |
*/
|
|
160 |
EMessageListItemSubtitle,
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Tree list root
|
|
164 |
*/
|
|
165 |
EMessageListItemRoot
|
|
166 |
};
|
|
167 |
|
|
168 |
/**
|
|
169 |
* @return Type of the currently focused item
|
|
170 |
*/
|
|
171 |
virtual TMessageListItemType CurrentItemType() const = 0;
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Changes focus to the entry of the given id.
|
|
175 |
* @return ETrue if aEntryId found otherwise EFalse.
|
|
176 |
*/
|
|
177 |
virtual TBool SetCurrentItemIdL( TMsvId aEntryId ) = 0;
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Changes focus to the first entry.
|
|
181 |
*/
|
|
182 |
virtual void ResetCurrentItemL() = 0;
|
|
183 |
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Searches aMatchString from the list and returns first found entry id.
|
|
187 |
* Returns KErrNotFound if not found.
|
|
188 |
* TODO: container should move focus automatically?
|
|
189 |
*/
|
|
190 |
virtual TMsvId FindEntry( const TDesC& aMatchString ) const = 0;
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Finds first unread message from the opened folder.
|
|
194 |
* aEntry is set KErrNotFound if no unread messages in the folder,
|
|
195 |
* otherwise id of the first unread message.
|
|
196 |
* @return ETrue if exactly one unread message in current folder
|
|
197 |
* EFalse otherwise.
|
|
198 |
*/
|
|
199 |
virtual TBool FindFirstUnreadMessageL( TMsvId& aEntryId ) const = 0;
|
|
200 |
|
|
201 |
/**
|
|
202 |
* TODO: that is not needed if container would be msv session observer
|
|
203 |
*/
|
|
204 |
virtual void ItemCountChangedL( TBool aItemsAdded, CArrayFix<TInt>*
|
|
205 |
aAddedIndexes = 0 ) = 0;
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Redraw the listbox.
|
|
209 |
*/
|
|
210 |
virtual void RefreshListbox() = 0;
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Returns array of currently selected (marked) messages.
|
|
214 |
* (Focus is added, if no other markings)
|
|
215 |
* Caller's responsibility to destroy array!
|
|
216 |
* @return Array of selected items.
|
|
217 |
*/
|
|
218 |
virtual CMsvEntrySelection* CurrentItemSelectionL() = 0;
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Refreshes selection by calling MarkItemSelectionL and
|
|
222 |
* then returns selection by calling CurrentItemSelectionL
|
|
223 |
* Caller's responsibility to destroy array!
|
|
224 |
* @return Array of selected items.
|
|
225 |
*/
|
|
226 |
virtual CMsvEntrySelection* CurrentItemSelectionRefreshL() = 0;
|
|
227 |
|
|
228 |
/**
|
|
229 |
* Returns number of marked items including focus if no other selections.
|
|
230 |
* @return Number of items marked, if no marked items then 1 is returned (focus).
|
|
231 |
* 0 is returned only if list is empty.
|
|
232 |
*/
|
|
233 |
virtual TInt CurrentItemSelectionCount() const = 0;
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Returns number of selected/marked messages, focus is not included.
|
|
237 |
* @return Number of items selected (0 or more)
|
|
238 |
*/
|
|
239 |
virtual TInt SelectionCount() const = 0;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Returns ETrue if aItemId is marked.
|
|
243 |
*/
|
|
244 |
virtual TBool IsItemSelected( TMsvId aItemId ) = 0;
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Clears selection.
|
|
248 |
*/
|
|
249 |
virtual void ClearSelection() = 0;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Reads selected item indexes from the listbox and then stores
|
|
253 |
* selected items TMsvId's to iSelectedEntries array.
|
|
254 |
* If no items marked then currently selected item is added to array
|
|
255 |
*
|
|
256 |
* This can be called when for example opening options menu. Options menu
|
|
257 |
* can overlap whole list box and if then new message is received it is selected
|
|
258 |
* on background. Now if user selected 'Delete' then message which was selected
|
|
259 |
* before opening options menu is deleted, not just received message because
|
|
260 |
* it is stored by this function.
|
|
261 |
*/
|
|
262 |
virtual void MarkItemSelectionL() = 0;
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Adds currently focused item to marked array.
|
|
266 |
*/
|
|
267 |
virtual void AddCurrentItemToSelectionL() = 0;
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Removes currently selected item (== 'cursor') from selected array
|
|
271 |
*/
|
|
272 |
virtual void RemoveCurrentItemFromSelection() = 0;
|
|
273 |
|
|
274 |
/**
|
|
275 |
* TODO: update description for more generic. Now it is only for old list:
|
|
276 |
* Updates selection indexes by reading selected message's TMsvIds from iSelectedEntries
|
|
277 |
* and creates new CSelectionIndexArray.
|
|
278 |
* @param aForceUpdate: set ETrue if index update is wanted to be done even when
|
|
279 |
* listbox's selection does not include any items.
|
|
280 |
* Usually this is set true only when calling from CMceBaseListView::HandleEntriesDeletedL
|
|
281 |
*/
|
|
282 |
virtual void RefreshSelectionIndexesL( TBool aForceUpdate ) = 0 ;
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Adds all the messages to listbox selection index array
|
|
286 |
*/
|
|
287 |
virtual void AddAllToSelectionL() = 0;
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Mark all read messages.
|
|
291 |
*/
|
|
292 |
virtual void MarkAllReadMessagesL() = 0;
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Return the count of marked items. if there is no marked item, returns 0;
|
|
296 |
*/
|
|
297 |
virtual TInt MarkedItemsCount() = 0;
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Checks if currently selected item is folder.
|
|
301 |
* @return ETrue if item aItemId is folder.
|
|
302 |
* NOTE: aItemId must be found from msg store.
|
|
303 |
* if item not found, returns EFalse;
|
|
304 |
*/
|
|
305 |
virtual TBool IsItemFolder( TMsvId aItemId ) const = 0;
|
|
306 |
|
|
307 |
/**
|
|
308 |
* Returns ETrue if aItemId is under remote service
|
|
309 |
*/
|
|
310 |
virtual TBool IsItemRemote( TMsvId aItemId ) const = 0;
|
|
311 |
|
|
312 |
/**
|
|
313 |
* checks if aFolderId is currently opened
|
|
314 |
* Return ETrue if currently opened folder is aFolderId
|
|
315 |
* For example if needs to be checked if outbox is opened call:
|
|
316 |
* IsOpenedFolder( KMsvGlobalOutBoxIndexEntryId )
|
|
317 |
*/
|
|
318 |
virtual TBool IsOpenedFolder( TMsvId aFolderId ) const = 0;
|
|
319 |
|
|
320 |
/**
|
|
321 |
* Sets sort order
|
|
322 |
* @param aSortType: from MceCommands.hrh
|
|
323 |
* @param aOrdering: sort ordering(ascending/descending)
|
|
324 |
*/
|
|
325 |
virtual void SetSortTypeL( TInt aSortType, TBool aOrdering ) = 0;
|
|
326 |
|
|
327 |
/**
|
|
328 |
*
|
|
329 |
*/
|
|
330 |
virtual void SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver ) = 0;
|
|
331 |
|
|
332 |
/**
|
|
333 |
* Sets empty text for the listbox.
|
|
334 |
* @param aText: empty text
|
|
335 |
*/
|
|
336 |
virtual void SetListEmptyTextL(const TDesC& aText) = 0;
|
|
337 |
|
|
338 |
/**
|
|
339 |
* TMessageListOperationType
|
|
340 |
* different mailbox operation types to handle cursor
|
|
341 |
*/
|
|
342 |
enum TMessageListOperationType
|
|
343 |
{
|
|
344 |
/**
|
|
345 |
*
|
|
346 |
*/
|
|
347 |
EMessageListOperationGeneral = 0,
|
|
348 |
|
|
349 |
/**
|
|
350 |
*
|
|
351 |
*/
|
|
352 |
EMessageListOperationConnect,
|
|
353 |
|
|
354 |
/**
|
|
355 |
*
|
|
356 |
*/
|
|
357 |
EMessageListOperationFetchSelected,
|
|
358 |
|
|
359 |
/**
|
|
360 |
*
|
|
361 |
*/
|
|
362 |
EMessageListOperationFetchNew,
|
|
363 |
|
|
364 |
/**
|
|
365 |
*
|
|
366 |
*/
|
|
367 |
EMessageListOperationDelete,
|
|
368 |
|
|
369 |
/**
|
|
370 |
* Called when operation is completed
|
|
371 |
* NOTE: this is not 100% to be called when operation is ready.
|
|
372 |
* For example imap4 create connection operation is not completed
|
|
373 |
* when connection is created, onle when connection is closed!
|
|
374 |
*/
|
|
375 |
EMessageListOperationCompleted
|
|
376 |
};
|
|
377 |
|
|
378 |
|
|
379 |
/**
|
|
380 |
* Called by application when operation is started.
|
|
381 |
* List container can set anchor item or what ever it wants to keep
|
|
382 |
* focus in sensible place during the operation.
|
|
383 |
* OPEN:
|
|
384 |
* Problem is that operation completion is not informed so
|
|
385 |
* listcontainer should handle that somehow...?
|
|
386 |
*/
|
|
387 |
virtual void SetAnchorItemIdL(
|
|
388 |
TMessageListOperationType aOperationType ) = 0;
|
|
389 |
|
|
390 |
/**
|
|
391 |
* TODO: that is not needed if container would be msv session observer
|
|
392 |
* TODO: remove ItemCountChangedL
|
|
393 |
* @param aEvent: notified events:
|
|
394 |
* EMsvEntriesDeleted, EMsvEntriesCreated, EMsvEntriesChanged
|
|
395 |
* @param aSelection: CMsvEntrySelection of the entries changed/deleted/created.
|
|
396 |
* @param aDrawNow: EFalse means CMceUi has ViewUpdateSuppressionFlag ON
|
|
397 |
* so listbox should not redraw itself, then only update anchor item etc.
|
|
398 |
* When operation is completed then container will get
|
|
399 |
* SetAnchorItemIdL call with parameter EMessageListOperationCompleted.
|
|
400 |
* ETrue means that listbox can redraw itself if needed.
|
|
401 |
* See also SetAnchorItemIdL
|
|
402 |
*/
|
|
403 |
virtual void HandleMsvSessionEventL(
|
|
404 |
MMsvSessionObserver::TMsvSessionEvent aEvent,
|
|
405 |
CMsvEntrySelection& aSelection,
|
|
406 |
TBool aDraw ) = 0;
|
|
407 |
|
|
408 |
/**
|
|
409 |
* Returns ETrue if empty list or there are items selected.
|
|
410 |
*/
|
|
411 |
virtual TBool DisplayOptionsMenuFromSelectionKey() const = 0;
|
|
412 |
|
|
413 |
|
|
414 |
/**
|
|
415 |
* Used to show different menu command offered by message list view
|
|
416 |
* At the moment there are only Expand and Collapse options menu items
|
|
417 |
* but there can be more...
|
|
418 |
*/
|
|
419 |
enum
|
|
420 |
{
|
|
421 |
/**
|
|
422 |
* Return TMessageListCommandNone if all the menu items dimmed,
|
|
423 |
* otherwise corresponding flag value.
|
|
424 |
*/
|
|
425 |
TMessageListCommandNone = 0,
|
|
426 |
/**
|
|
427 |
* TMessageListCommandExpand: return this if expand command is visible.
|
|
428 |
*/
|
|
429 |
TMessageListCommandExpand = 0x01,
|
|
430 |
/**
|
|
431 |
* TMessageListCommandCollapse1: return this if collapse, which is
|
|
432 |
* immediately after expand command, is visible.
|
|
433 |
*/
|
|
434 |
TMessageListCommandCollapse1 = 0x02,
|
|
435 |
/**
|
|
436 |
* TMessageListCommandCollapse2: return this if collapse, which is
|
|
437 |
* after reply command, is visible.
|
|
438 |
*/
|
|
439 |
TMessageListCommandCollapse2 = 0x04
|
|
440 |
};
|
|
441 |
|
|
442 |
/**
|
|
443 |
* Return correct flag to set command visible in message
|
|
444 |
* list view's options menu.
|
|
445 |
* if expand valid command, then return TMessageListCommandExpand,
|
|
446 |
* if collapse valid command, then return either TMessageListCommandCollapse1
|
|
447 |
* or TMessageListCommandCollapse2 but NOT both.
|
|
448 |
*/
|
|
449 |
virtual TUint OptionsCommandSupported() const = 0;
|
|
450 |
|
|
451 |
/**
|
|
452 |
*
|
|
453 |
*/
|
|
454 |
virtual void HandleOptionsCommandL( TInt aCommand ) = 0;
|
|
455 |
|
|
456 |
/**
|
|
457 |
* Called when time or date format has been changed or
|
|
458 |
* midnight is passed.
|
|
459 |
* @param aChangeFlag: flag defined in TChanges in e32const.h.
|
|
460 |
* Notifies only the following events:
|
|
461 |
* - EChangesLocale
|
|
462 |
* - EChangesMidnightCrossover
|
|
463 |
* - EChangesSystemTime
|
|
464 |
*/
|
|
465 |
virtual void DateTimeFormatChangedL( TInt aChangeFlag ) = 0;
|
|
466 |
|
|
467 |
/**
|
|
468 |
* Returns container Msk
|
|
469 |
*/
|
|
470 |
virtual TInt SetSpecialMskL() = 0;
|
|
471 |
|
|
472 |
/**
|
|
473 |
* Sets message list container flags
|
|
474 |
* @param aFlag: Name of the flag
|
|
475 |
* @param aState: State for the flag
|
|
476 |
*/
|
|
477 |
virtual void SetContainerFlag( TMceContainerFlags aFlag, TBool aState ) = 0;
|
|
478 |
|
|
479 |
/**
|
|
480 |
* Updates icon array in case MTM is released (one row list)
|
|
481 |
*/
|
|
482 |
virtual void UpdateIconArrayL() = 0;
|
|
483 |
|
|
484 |
/**
|
|
485 |
* Sets Marking mode Off
|
|
486 |
*/
|
|
487 |
|
|
488 |
virtual void SetMarkingModeOff() = 0;
|
|
489 |
|
|
490 |
protected:
|
|
491 |
|
|
492 |
/**
|
|
493 |
*
|
|
494 |
*/
|
|
495 |
CMceMessageListContainerBase( CMceMessageListView& aOwningView );
|
|
496 |
|
|
497 |
protected:
|
|
498 |
|
|
499 |
CMceMessageListView& iOwningView;
|
|
500 |
|
|
501 |
};
|
|
502 |
|
|
503 |
|
|
504 |
#endif
|
|
505 |
|
|
506 |
// End of file
|