|
1 /* |
|
2 * Copyright (c) 2009 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: List box model class for Events Management UI. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDES |
|
19 #include <aknsfld.h> // For SearchField |
|
20 #include "evtmgmtuilistboxmodel.h" |
|
21 #include "evtmgmtuimodel.h" |
|
22 #include "evtmgmtuifiltermodel.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CEvtMgmtUiListBoxModel::~CEvtMgmtUiListBoxModel |
|
26 // |
|
27 // (other items were commented in a header). |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CEvtMgmtUiListBoxModel::~CEvtMgmtUiListBoxModel() |
|
31 { |
|
32 delete iEvtMgmtUiFilterModel; |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CEvtMgmtUiListBoxModel::NewLC |
|
37 // |
|
38 // (other items were commented in a header). |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CEvtMgmtUiListBoxModel* CEvtMgmtUiListBoxModel::NewL( ) |
|
42 { |
|
43 CEvtMgmtUiListBoxModel* self = NewLC( ); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CEvtMgmtUiListBoxModel::NewLC |
|
50 // |
|
51 // (other items were commented in a header). |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CEvtMgmtUiListBoxModel* CEvtMgmtUiListBoxModel::NewLC( ) |
|
55 { |
|
56 CEvtMgmtUiListBoxModel* self = new ( ELeave )CEvtMgmtUiListBoxModel( ); |
|
57 CleanupStack::PushL( self ); |
|
58 self->ConstructL( ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CEvtMgmtUiListBoxModel::CEvtMgmtUiListBoxModel |
|
64 // |
|
65 // (other items were commented in a header). |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CEvtMgmtUiListBoxModel::CEvtMgmtUiListBoxModel() |
|
69 { |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CEvtMgmtUiListBoxModel::ConstructL |
|
74 // |
|
75 // (other items were commented in a header). |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CEvtMgmtUiListBoxModel::ConstructL() |
|
79 { |
|
80 iEvtMgmtUiFilterModel = CEvtMgmtUiFilterModel::NewL(); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CEvtMgmtUiListBoxModel::MatchableTextArray |
|
85 // |
|
86 // (other items were commented in a header). |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 const MDesCArray* CEvtMgmtUiListBoxModel::MatchableTextArray() const |
|
90 { |
|
91 return this; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // TInt CEvtMgmtUiListBoxModel::MdcaCount() const |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CEvtMgmtUiListBoxModel::MdcaCount() const |
|
99 { |
|
100 return iEvtMgmtUiFilterModel->MdcaCount(); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // TPtrC16 CEvtMgmtUiListBoxModel::MdcaPoint() const |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 TPtrC16 CEvtMgmtUiListBoxModel::MdcaPoint( TInt aIndex ) const |
|
108 { |
|
109 if (Filter()) |
|
110 { |
|
111 return Filter()->DefaultMatchableItemFromItem(iEvtMgmtUiFilterModel->MdcaPoint(aIndex)); |
|
112 } |
|
113 else |
|
114 { |
|
115 return iEvtMgmtUiFilterModel->MdcaPoint(aIndex); |
|
116 } |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CEvtMgmtUiListBoxModel::NumberOfItems |
|
121 // |
|
122 // (other items were commented in a header). |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 TInt CEvtMgmtUiListBoxModel::NumberOfItems() const |
|
126 { |
|
127 return Filter() ? |
|
128 Filter()->FilteredNumberOfItems(): CTextListBoxModel::NumberOfItems(); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CEvtMgmtUiListBoxModel::ItemText |
|
133 // |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 TPtrC CEvtMgmtUiListBoxModel::ItemText(TInt aItemIndex) const |
|
138 { |
|
139 if(aItemIndex==0) |
|
140 { |
|
141 return iEvtMgmtUiFilterModel->GetZeroIndex(); |
|
142 } |
|
143 else |
|
144 { |
|
145 return CTextListBoxModel::ItemText( Filter() ? |
|
146 Filter()->FilteredItemIndex(aItemIndex) : aItemIndex); |
|
147 } |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CEvtMgmtUiListBoxModel::NumberOfItems |
|
152 // |
|
153 // (other items were commented in a header). |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void CEvtMgmtUiListBoxModel::SetItemTextArrayToFilterModel() |
|
157 { |
|
158 iEvtMgmtUiFilterModel->SetItemTextArray(ItemTextArray()); |
|
159 SetItemTextArray(iEvtMgmtUiFilterModel); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CEvtMgmtUiListBoxModel::NumberOfItems |
|
164 // |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 void CEvtMgmtUiListBoxModel::SetFindToFilterModel(CAknSearchField* aSearchField) |
|
169 { |
|
170 iEvtMgmtUiFilterModel->SetSearchField(aSearchField); |
|
171 } |
|
172 |
|
173 // End of File |
|
174 |