63 iBgContext = |
63 iBgContext = |
64 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
64 CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
65 aRect, |
65 aRect, |
66 ETrue ); |
66 ETrue ); |
67 |
67 |
68 if (iListbox) |
68 iItemArrayShort = new (ELeave)CDesCArrayFlat(KDefaultGran); |
69 delete iListbox; |
69 |
|
70 iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox; |
|
71 iListboxLandscape->ConstructL(this, aListboxFlags); |
|
72 iListboxLandscape->SetMopParent( this ); |
|
73 iListboxLandscape->SetContainerWindowL(*this); |
|
74 iListboxLandscape->CreateScrollBarFrameL(ETrue); |
|
75 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
76 iListboxLandscape->SetSize(aRect.Size()); |
|
77 iListboxLandscape->MakeVisible(EFalse); |
|
78 |
|
79 iListboxPortrait = new (ELeave) CAknDoubleLargeStyleListBox; |
|
80 iListboxPortrait->ConstructL(this, aListboxFlags); |
|
81 iListboxPortrait->SetMopParent( this ); |
|
82 iListboxPortrait->SetContainerWindowL(*this); |
|
83 iListboxPortrait->CreateScrollBarFrameL(ETrue); |
|
84 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
85 iListboxPortrait->SetSize(aRect.Size()); |
|
86 iListboxPortrait->MakeVisible(EFalse); |
70 |
87 |
71 if (aRect.Width() > aRect.Height()) |
88 if (aRect.Width() > aRect.Height()) |
72 { |
89 { |
73 DP("Landscape mode"); |
90 DP("Landscape mode"); |
74 iLandscape = ETrue; |
91 iLandscape = ETrue; |
75 iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox; |
92 iListbox = iListboxLandscape; |
76 iListboxLandscape->ConstructL(this, aListboxFlags); |
|
77 iListboxLandscape->SetMopParent( this ); |
|
78 iListboxLandscape->SetContainerWindowL(*this); |
|
79 iListboxLandscape->CreateScrollBarFrameL(ETrue); |
|
80 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
81 iListboxLandscape->SetSize(aRect.Size()); |
|
82 iListboxLandscape->MakeVisible(ETrue); |
93 iListboxLandscape->MakeVisible(ETrue); |
83 iListbox = iListboxLandscape; |
|
84 } |
94 } |
85 else |
95 else |
86 { |
96 { |
87 DP("Portrait mode"); |
97 DP("Portrait mode"); |
88 iLandscape = EFalse; |
98 iLandscape = EFalse; |
89 iListboxPortrait = new (ELeave) CAknDoubleLargeStyleListBox; |
|
90 iListboxPortrait->ConstructL(this, aListboxFlags); |
|
91 iListboxPortrait->SetMopParent( this ); |
|
92 iListboxPortrait->SetContainerWindowL(*this); |
|
93 iListboxPortrait->CreateScrollBarFrameL(ETrue); |
|
94 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
95 iListboxPortrait->SetSize(aRect.Size()); |
|
96 iListboxPortrait->MakeVisible(ETrue); |
99 iListboxPortrait->MakeVisible(ETrue); |
97 iListbox = (CEikColumnListBox*) iListboxPortrait; |
100 iListbox = (CEikColumnListBox*) iListboxPortrait; |
98 } |
101 } |
99 |
102 |
100 MakeVisible(EFalse); |
103 MakeVisible(EFalse); |
145 } |
151 } |
146 |
152 |
147 void CPodcastListContainer::SizeChanged() |
153 void CPodcastListContainer::SizeChanged() |
148 { |
154 { |
149 DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight); |
155 DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight); |
150 |
156 |
151 if (iListbox == NULL) |
157 //TBool nowLandscape = ETrue;//!iLandscape; |
152 return; |
158 TBool nowLandscape = Size().iWidth > Size().iHeight; |
153 |
159 //TBool orientationChanged = nowLandscape && !iLandscape; |
154 iListbox->SetSize(Size()); |
160 |
155 |
161 iLandscape = nowLandscape; |
|
162 |
156 if (iContainerListener) |
163 if (iContainerListener) |
157 iContainerListener->SizeChanged(); |
164 iContainerListener->SizeChanged(); |
158 |
165 |
|
166 if (nowLandscape) |
|
167 { |
|
168 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
169 iListboxPortrait->UpdateScrollBarsL(); |
|
170 iListboxPortrait->MakeVisible(EFalse); |
|
171 iListboxLandscape->MakeVisible(ETrue); |
|
172 iListboxLandscape->SetFocus(ETrue, EDrawNow); |
|
173 iListbox = iListboxLandscape; |
|
174 iListboxLandscape->SetMopParent( this ); |
|
175 iListboxLandscape->SetContainerWindowL(*this); |
|
176 iListboxLandscape->CreateScrollBarFrameL(ETrue); |
|
177 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
178 } |
|
179 else |
|
180 { |
|
181 iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
182 iListboxLandscape->UpdateScrollBarsL(); |
|
183 iListboxPortrait->MakeVisible(ETrue); |
|
184 iListboxLandscape->MakeVisible(EFalse); |
|
185 iListboxPortrait->SetFocus(ETrue, EDrawNow); |
|
186 iListbox = (CEikColumnListBox*) iListboxPortrait; |
|
187 iListboxPortrait->SetMopParent( this ); |
|
188 iListboxPortrait->SetContainerWindowL(*this); |
|
189 iListboxPortrait->CreateScrollBarFrameL(ETrue); |
|
190 iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto ); |
|
191 } |
|
192 |
|
193 iListbox->SetSize(Size()); |
|
194 ActivateL(); |
|
195 DrawNow(); |
159 DP("CPodcastListContainer::SizeChanged END"); |
196 DP("CPodcastListContainer::SizeChanged END"); |
160 } |
197 } |
161 |
198 |
162 CEikColumnListBox* CPodcastListContainer::Listbox() |
199 CEikColumnListBox* CPodcastListContainer::Listbox() |
163 { |
200 { |
165 } |
202 } |
166 |
203 |
167 |
204 |
168 void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) |
205 void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) |
169 { |
206 { |
170 if (iListboxLandscape == iListbox) |
207 iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons); |
171 iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons); |
208 iListboxPortrait->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons); |
172 else |
|
173 iListboxPortrait->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons); |
|
174 } |
209 } |
175 |
210 |
176 CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons() |
211 CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons() |
177 { |
212 { |
178 if (iListboxLandscape == iListbox) |
213 if (iListboxLandscape == iListbox) |
181 return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray(); |
216 return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray(); |
182 } |
217 } |
183 |
218 |
184 void CPodcastListContainer::SetTextArray(CDesCArray* aArray) |
219 void CPodcastListContainer::SetTextArray(CDesCArray* aArray) |
185 { |
220 { |
186 iListbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
221 DP1("SetTextArray, aArray.Count=%d", aArray->Count()); |
187 iListbox->Model()->SetItemTextArray(aArray); |
222 iItemArrayShort->Reset(); |
|
223 DP("after reset"); |
|
224 for (int i=0;i<aArray->Count();i++) |
|
225 { |
|
226 TBuf<1024> line; |
|
227 line.Copy((*aArray)[i]); |
|
228 TInt tpos = line.LocateReverse('\t'); |
|
229 if (tpos != -1) |
|
230 { |
|
231 line = line.Left(tpos); |
|
232 } |
|
233 |
|
234 //DP1("line: %S", line); |
|
235 iItemArrayShort->AppendL(line); |
|
236 } |
|
237 |
|
238 iListboxLandscape->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
239 iListboxLandscape->Model()->SetItemTextArray(iItemArrayShort); |
|
240 iListboxPortrait->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
|
241 iListboxPortrait->Model()->SetItemTextArray(aArray); |
188 } |
242 } |
189 |
243 |
190 CPodcastListContainer::~CPodcastListContainer() |
244 CPodcastListContainer::~CPodcastListContainer() |
191 { |
245 { |
192 delete iListbox; |
246 delete iListbox; |
193 delete iBgContext; |
247 delete iBgContext; |
|
248 delete iItemArrayShort; |
194 } |
249 } |
195 |
250 |
196 void CPodcastListView::SwitchListbox() |
251 void CPodcastListView::SwitchListbox() |
197 { |
252 { |
198 HandleViewRectChange(); |
253 HandleViewRectChange(); |
270 |
325 |
271 void CPodcastListView::HandleViewRectChange() |
326 void CPodcastListView::HandleViewRectChange() |
272 { |
327 { |
273 TBool wasVisible = iListContainer->IsVisible(); |
328 TBool wasVisible = iListContainer->IsVisible(); |
274 |
329 |
275 if (wasVisible) |
330 // if (wasVisible) |
276 { |
331 // { |
277 AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8); |
332 // AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8); |
278 |
333 // |
279 DoDeactivate(); |
334 // DoDeactivate(); |
280 } |
335 // } |
281 |
336 // |
282 ResetContainer(); |
337 // ResetContainer(); |
283 |
338 // |
284 if (wasVisible) |
339 // if (wasVisible) |
285 { |
340 // { |
286 AppUi()->ActivateLocalViewL(ViewId().iViewUid, TUid::Uid(0), KNullDesC8); |
341 // AppUi()->ActivateLocalViewL(ViewId().iViewUid, TUid::Uid(0), KNullDesC8); |
287 } |
342 // } |
288 |
343 |
289 if ( iListContainer ) |
344 if ( iListContainer ) |
290 { |
345 { |
291 iListContainer->SetRect( ClientRect() ); |
346 iListContainer->SetRect( ClientRect() ); |
292 } |
347 } |