|
1 /* |
|
2 * Copyright (c) 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: MVIMPSTStorageItemModel |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MVIMPSTSTORAGECONTACTLISTMODEL_H |
|
21 #define MVIMPSTSTORAGECONTACTLISTMODEL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "tvimpstenums.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <bamdesca.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MVIMPSTStorageContactList; |
|
31 class MVIMPSTStorageContact; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Contact list model for UI. |
|
37 * Wrapper between UI and storage, hides multiple contact list handling logic. |
|
38 * |
|
39 * @lib vimpststorage.lib |
|
40 * @since 5.0 |
|
41 */ |
|
42 class MVIMPSTStorageItemModel : public MDesCArray |
|
43 { |
|
44 |
|
45 public: // Enumerations and typedefs |
|
46 |
|
47 /** |
|
48 * An Enum |
|
49 * To define Type of the item. |
|
50 * not used. |
|
51 */ |
|
52 enum TItemType |
|
53 { |
|
54 EInvalid, /* Not a valid item*/ |
|
55 EOwnStatus, /* own data item*/ |
|
56 EContactList, /* Contact list item*/ |
|
57 EContactItem, /* contact item*/ |
|
58 EAll /* all item includes owndata, contactlist, contact */ |
|
59 }; |
|
60 |
|
61 /** |
|
62 * structure |
|
63 * To package the data of type of item(contact list/contact) |
|
64 * if its a contactl list the third variable iContact will be null. |
|
65 * not used. |
|
66 */ |
|
67 struct SItem |
|
68 { |
|
69 TItemType iType;/*Type of the item*/ |
|
70 MVIMPSTStorageContactList* iContactList; /*ocntact list*/ |
|
71 MVIMPSTStorageContact* iContact;/*contact*/ |
|
72 }; |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * @return TInt Count of items |
|
78 */ |
|
79 virtual TInt Count() const = 0; |
|
80 |
|
81 /** |
|
82 * Returns List item at given index. |
|
83 * @param aIndex |
|
84 * @return SItem List item |
|
85 */ |
|
86 virtual SItem Item( TInt aIndex ) const = 0; |
|
87 |
|
88 |
|
89 /** |
|
90 * Get index for contact. |
|
91 * @param aContact. Contact item to be found. |
|
92 * @return TInt Index of contact. If contact not found returns KErrNotFound |
|
93 */ |
|
94 virtual TInt IndexOfContact( MVIMPSTStorageContact* aContact ) const = 0; |
|
95 |
|
96 /** |
|
97 * Get index for list |
|
98 * @param aList. Contact item to be found. |
|
99 * @param aIgnoreOwnItem. If ETrue own item is not taken into account |
|
100 * when resolving index. |
|
101 * @param aIgnoreEmptyLists If ETrue, empty lists are ignored. |
|
102 * @return TInt Index of list. If list not found returns KErrNotFound |
|
103 */ |
|
104 virtual TInt IndexOfList( MVIMPSTStorageContactList* aList, |
|
105 TBool aIgnoreOwnItem = EFalse, |
|
106 TBool aIgnoreEmptyLists = ETrue ) const = 0; |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 public: // From MDesCArray |
|
113 |
|
114 /** |
|
115 * @see MDesCArray |
|
116 */ |
|
117 TPtrC MdcaPoint( TInt aIndex ) const = 0; |
|
118 |
|
119 /** |
|
120 * @see MDesCArray |
|
121 */ |
|
122 TInt MdcaCount() const = 0; |
|
123 |
|
124 |
|
125 |
|
126 protected: // prevent deletion through this interface |
|
127 |
|
128 /** |
|
129 * Destructor. |
|
130 */ |
|
131 virtual ~MVIMPSTStorageItemModel() {}; |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // MVIMPSTStorageContactListModel_H |
|
136 |
|
137 // End of File |