|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: FreestyleEmailUi folder list model and model item |
|
15 * classes definitions |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __FREESTYLEEMAILUI_FOLDERLISTMODEL_H__ |
|
22 #define __FREESTYLEEMAILUI_FOLDERLISTMODEL_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 //<cmail> |
|
27 #include "fstreelistconstants.h" |
|
28 //</cmail> |
|
29 |
|
30 class CFSMailFolder; |
|
31 class CFSMailBox; |
|
32 |
|
33 // LIST ITEM MODEL DEFINITION |
|
34 class CFSEmailUiFolderListItem : public CBase |
|
35 { |
|
36 public: |
|
37 static CFSEmailUiFolderListItem* NewL(); |
|
38 static CFSEmailUiFolderListItem* NewLC(); |
|
39 |
|
40 ~CFSEmailUiFolderListItem(); |
|
41 |
|
42 private: |
|
43 CFSEmailUiFolderListItem(); |
|
44 |
|
45 public: |
|
46 TFsTreeItemId iListId; |
|
47 |
|
48 TFSMailMsgId iFolderId; |
|
49 |
|
50 TFSMailMsgId iMailboxId; |
|
51 |
|
52 TFSMailSortField iSortField; |
|
53 }; |
|
54 |
|
55 /** |
|
56 * An interface for a folder list/mailbox model. |
|
57 */ |
|
58 class CFSEmailUiFolderListModel : public CBase |
|
59 { |
|
60 public: |
|
61 /** |
|
62 * Constructor. |
|
63 */ |
|
64 CFSEmailUiFolderListModel(); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 ~CFSEmailUiFolderListModel(); |
|
70 |
|
71 /** |
|
72 * Add an item to the end of the list. |
|
73 */ |
|
74 void AppendL( TFsTreeItemId aListId, CFSMailFolder* aFolder ); |
|
75 |
|
76 /** |
|
77 * Add an item to the end of the list. |
|
78 */ |
|
79 void AppendL( TFsTreeItemId aListId, CFSMailBox* aMailbox ); |
|
80 |
|
81 /** |
|
82 * Add an item to the end of the list. |
|
83 */ |
|
84 void AppendL( TFsTreeItemId aListId, TFSMailSortField aSortField ); |
|
85 |
|
86 /** |
|
87 * Remove item by list item id. |
|
88 */ |
|
89 void Remove( TFsTreeItemId aListId ); |
|
90 |
|
91 /** |
|
92 * Remove all items. |
|
93 */ |
|
94 void RemoveAll(); |
|
95 |
|
96 /** |
|
97 * Get an item by list item id. |
|
98 * |
|
99 * @return Model item or NULL if not found. Ownership not trnasferred. |
|
100 */ |
|
101 CFSEmailUiFolderListItem* ItemByListId(TFsTreeItemId aListId) const; |
|
102 |
|
103 /** |
|
104 * Get an item by list index |
|
105 * |
|
106 * @return Model item or NULL if not found. Ownership not trnasferred. |
|
107 */ |
|
108 CFSEmailUiFolderListItem* ItemByIndex( TInt aModelIndex ) const; |
|
109 |
|
110 /** |
|
111 * Get number of items in list. |
|
112 * |
|
113 * @return Number of items. |
|
114 */ |
|
115 TInt Count() const; |
|
116 |
|
117 /** |
|
118 * Get number of separators in list. |
|
119 * |
|
120 * @return Number of separators in list. |
|
121 */ |
|
122 TInt SeparatorCount() const; |
|
123 |
|
124 /** |
|
125 * Increase list's separator count. |
|
126 * |
|
127 * @param aIncreaseBy How much separator count is increased, defaut is 1. |
|
128 * If parameter is negative, then the count is decreased. |
|
129 */ |
|
130 void IncreaseSeparatorCount( TInt aIncreaseBy = 1 ); |
|
131 |
|
132 private: |
|
133 /** |
|
134 * Get the array index of the spcified item. |
|
135 * |
|
136 * @return Array index of the item. |
|
137 */ |
|
138 TInt Index( TFsTreeItemId aListId ) const; |
|
139 |
|
140 private: |
|
141 RPointerArray<CFSEmailUiFolderListItem> iItemArray; |
|
142 |
|
143 // Number of separators, is zeroed in RemoveAll |
|
144 TInt iSeparatorCount; |
|
145 |
|
146 }; |
|
147 |
|
148 #endif //__FREESTYLEEMAILUI_FOLDERLISTMODEL_H__ |