27 #include <aknsbasicbackgroundcontrolcontext.h> |
27 #include <aknsbasicbackgroundcontrolcontext.h> |
28 #include <akntabgrp.h> |
28 #include <akntabgrp.h> |
29 #include <aknquerydialog.h> |
29 #include <aknquerydialog.h> |
30 #include <barsread.h> |
30 #include <barsread.h> |
31 #include <akntitle.h> |
31 #include <akntitle.h> |
|
32 #include <akniconarray.h> |
|
33 #include <EIKCLBD.H> |
32 |
34 |
33 #include "buildno.h" |
35 #include "buildno.h" |
34 |
36 |
35 const TInt KDefaultGran = 5; |
37 const TInt KDefaultGran = 5; |
36 |
38 |
37 CPodcastListContainer::CPodcastListContainer() |
39 CPodcastListContainer::CPodcastListContainer() |
38 { |
40 { |
39 } |
41 } |
40 |
42 |
41 void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener) |
43 void CPodcastListContainer::SetContainerListener(MContainerListener *aContainerListener) |
42 { |
44 { |
43 iKeyEventListener = aKeyEventListener; |
45 iContainerListener = aContainerListener; |
44 } |
46 } |
45 |
47 |
46 TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
48 TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
47 { |
49 { |
48 TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType); |
50 TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType); |
49 if (iKeyEventListener) |
51 if (iContainerListener) |
50 iKeyEventListener->OfferKeyEventL(aKeyEvent, aType); |
52 iContainerListener->OfferKeyEventL(aKeyEvent, aType); |
51 |
53 |
52 return response; |
54 return response; |
53 } |
55 } |
54 |
56 |
55 void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags ) |
57 void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags ) |
56 { |
58 { |
|
59 DP("CPodcastListContainer::ConstructL BEGIN"); |
57 CreateWindowL(); |
60 CreateWindowL(); |
58 |
61 |
59 iBgContext = |
62 iBgContext = |
60 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
63 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
61 aRect, |
64 aRect, |
73 iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); |
76 iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); |
74 |
77 |
75 iListbox->SetSize(aRect.Size()); |
78 iListbox->SetSize(aRect.Size()); |
76 iListbox->MakeVisible(ETrue); |
79 iListbox->MakeVisible(ETrue); |
77 MakeVisible(EFalse); |
80 MakeVisible(EFalse); |
78 |
81 |
|
82 // Set the windows size |
|
83 SetRect( aRect ); |
|
84 |
79 // Activate the window, which makes it ready to be drawn |
85 // Activate the window, which makes it ready to be drawn |
80 ActivateL(); |
86 ActivateL(); |
|
87 DP("CPodcastListContainer::ConstructL END"); |
81 } |
88 } |
82 |
89 |
83 TInt CPodcastListContainer::CountComponentControls() const |
90 TInt CPodcastListContainer::CountComponentControls() const |
84 { |
91 { |
85 return 1; // return number of controls inside this container |
92 return 1; // return number of controls inside this container |
137 CEikFormattedCellListBox* CPodcastListContainer::Listbox() |
144 CEikFormattedCellListBox* CPodcastListContainer::Listbox() |
138 { |
145 { |
139 return iListbox; |
146 return iListbox; |
140 } |
147 } |
141 |
148 |
|
149 void CPodcastListContainer::SetListboxObserver(MEikListBoxObserver *aObserver) |
|
150 { |
|
151 iListbox->SetListBoxObserver(aObserver); |
|
152 } |
|
153 |
|
154 void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) |
|
155 { |
|
156 iListbox->ItemDrawer()->ColumnData()->SetIconArray(aIcons); |
|
157 } |
|
158 |
|
159 CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons() |
|
160 { |
|
161 return iListbox->ItemDrawer()->FormattedCellData()->IconArray(); |
|
162 } |
|
163 |
|
164 void CPodcastListContainer::SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray) |
|
165 { |
|
166 iListbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
167 iListbox->Model()->SetItemTextArray(aPortraitArray); |
|
168 } |
142 |
169 |
143 CPodcastListContainer::~CPodcastListContainer() |
170 CPodcastListContainer::~CPodcastListContainer() |
144 { |
171 { |
145 delete iListbox; |
172 delete iListbox; |
146 delete iBgContext; |
173 delete iBgContext; |
147 } |
174 } |
148 |
175 |
|
176 void CPodcastListContainer::SetEmptyText(const TDesC &aText) |
|
177 { |
|
178 iListbox->View()->SetListEmptyTextL(aText); |
|
179 } |
149 |
180 |
150 void CPodcastListContainer::Draw(const TRect& aRect) const |
181 void CPodcastListContainer::Draw(const TRect& aRect) const |
151 { |
182 { |
152 CWindowGc& gc = SystemGc(); |
183 CWindowGc& gc = SystemGc(); |
153 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
184 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
166 return CCoeControl::MopSupplyObject(aId); |
197 return CCoeControl::MopSupplyObject(aId); |
167 } |
198 } |
168 |
199 |
169 void CPodcastListContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
200 void CPodcastListContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
170 { |
201 { |
171 if (iPointerListener) |
202 if (iContainerListener) |
172 iPointerListener->PointerEventL(aPointerEvent); |
203 iContainerListener->PointerEventL(aPointerEvent); |
173 |
204 |
174 // Call base class HandlePointerEventL() if not a long tap |
205 // Call base class HandlePointerEventL() if not a long tap |
175 CCoeControl::HandlePointerEventL(aPointerEvent); |
206 CCoeControl::HandlePointerEventL(aPointerEvent); |
176 } |
207 } |
177 |
208 |
178 |
|
179 void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener) |
|
180 { |
|
181 iPointerListener = aPointerListener; |
|
182 } |
|
183 |
|
184 |
|
185 CPodcastListView::CPodcastListView() |
209 CPodcastListView::CPodcastListView() |
186 { |
210 { |
187 } |
211 } |
188 |
212 |
189 void CPodcastListView::ConstructL() |
213 void CPodcastListView::ConstructL() |
190 { |
214 { |
191 DP("CPodcastListView::ConstructL BEGIN"); |
215 DP("CPodcastListView::ConstructL BEGIN"); |
|
216 |
192 iListContainer = new (ELeave) CPodcastListContainer; |
217 iListContainer = new (ELeave) CPodcastListContainer; |
193 iListContainer->ConstructL(ClientRect(), iListboxFlags); |
218 TRect rect = ClientRect(); |
|
219 |
|
220 iListContainer->ConstructL(rect, iListboxFlags); |
194 iListContainer->SetMopParent(this); |
221 iListContainer->SetMopParent(this); |
195 iListContainer->ActivateL(); |
222 iListContainer->ActivateL(); |
|
223 |
196 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
224 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
197 iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); |
225 iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); |
198 iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
226 iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
199 |
227 |
200 iListContainer->SetPointerListener(this); |
228 iListContainer->SetContainerListener(this); |
201 iListContainer->SetKeyEventListener(this); |
229 iListContainer->SetListboxObserver(this); |
202 |
230 |
203 DP("CPodcastListView::ConstructL END"); |
231 DP("CPodcastListView::ConstructL END"); |
204 } |
232 } |
205 |
233 |
206 void CPodcastListView::HandleViewRectChange() |
234 void CPodcastListView::HandleViewRectChange() |
213 |
241 |
214 void CPodcastListView::HandleStatusPaneSizeChange() |
242 void CPodcastListView::HandleStatusPaneSizeChange() |
215 { |
243 { |
216 DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
244 DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); |
217 |
245 |
218 if ( iListContainer ) |
246 HandleViewRectChange(); |
219 { |
|
220 iListContainer->SetRect( ClientRect() ); |
|
221 } |
|
222 |
|
223 } |
247 } |
224 |
248 |
225 |
249 |
226 CPodcastListView::~CPodcastListView() |
250 CPodcastListView::~CPodcastListView() |
227 { |
251 { |
279 void CPodcastListView::HandleCommandL(TInt aCommand) |
303 void CPodcastListView::HandleCommandL(TInt aCommand) |
280 { |
304 { |
281 DP1("CPodcastListView::HandleCommandL=%d", aCommand); |
305 DP1("CPodcastListView::HandleCommandL=%d", aCommand); |
282 switch(aCommand) |
306 switch(aCommand) |
283 { |
307 { |
284 case EAknSoftkeyExit: |
308 case EPodcastHide: |
285 case EEikCmdExit: |
309 AppUi()->HandleCommandL(EEikCmdExit); |
286 { |
310 break; |
287 AppUi()->Exit(); |
|
288 break; |
|
289 } |
|
290 case EAknSoftkeyBack: |
311 case EAknSoftkeyBack: |
291 { |
312 { |
292 AppUi()->ActivateViewL(iPreviousView); |
313 AppUi()->ActivateViewL(iPreviousView); |
293 ((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdFeeds); |
314 ((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdFeeds); |
294 } |
315 } |
321 } |
342 } |
322 |
343 |
323 void CPodcastListView::SetEmptyTextL(TInt aResourceId) |
344 void CPodcastListView::SetEmptyTextL(TInt aResourceId) |
324 { |
345 { |
325 HBufC* emptyText = iEikonEnv->AllocReadResourceLC(aResourceId); |
346 HBufC* emptyText = iEikonEnv->AllocReadResourceLC(aResourceId); |
326 iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText); |
347 iListContainer->SetEmptyText(*emptyText); |
327 CleanupStack::PopAndDestroy(emptyText); |
348 CleanupStack::PopAndDestroy(emptyText); |
328 } |
349 } |
329 |
350 |
330 void CPodcastListView::ShowOkMessageL(TDesC &aText) |
351 void CPodcastListView::ShowOkMessageL(TDesC &aText) |
331 { |
352 { |