24 #include <aknlists.h> |
24 #include <aknlists.h> |
25 #include <aknviewappui.h> |
25 #include <aknviewappui.h> |
26 #include <aknnotedialog.h> |
26 #include <aknnotedialog.h> |
27 #include <aknsbasicbackgroundcontrolcontext.h> |
27 #include <aknsbasicbackgroundcontrolcontext.h> |
28 #include <akntabgrp.h> |
28 #include <akntabgrp.h> |
29 #include <akntoolbarextension.h> |
|
30 #include <aknquerydialog.h> |
29 #include <aknquerydialog.h> |
31 #include <barsread.h> |
30 #include <barsread.h> |
32 #include <akntitle.h> |
31 #include <akntitle.h> |
33 |
32 |
34 #include "buildno.h" |
33 #include "buildno.h" |
95 default: |
94 default: |
96 return NULL; |
95 return NULL; |
97 } |
96 } |
98 } |
97 } |
99 |
98 |
100 void CPodcastListContainer::SetLongTapDetectedL(TBool aLongTapDetected) |
|
101 { |
|
102 DP("CPodcastListContainer::SetLongTapDetectedL BEGIN"); |
|
103 iLongTapDetected = aLongTapDetected; |
|
104 |
|
105 if (aLongTapDetected == EFalse) |
|
106 { |
|
107 TPointerEvent event; |
|
108 event.iType = TPointerEvent::EButton1Up; |
|
109 //CCoeControl::HandlePointerEventL(event); |
|
110 } |
|
111 DP("CPodcastListContainer::SetLongTapDetectedL END"); |
|
112 } |
|
113 |
|
114 void CPodcastListContainer::HandleResourceChange(TInt aType) |
99 void CPodcastListContainer::HandleResourceChange(TInt aType) |
115 { |
100 { |
116 switch( aType ) |
101 switch( aType ) |
117 { |
102 { |
118 case KEikDynamicLayoutVariantSwitch: |
103 case KEikDynamicLayoutVariantSwitch: |
171 { |
156 { |
172 if (iPointerListener) |
157 if (iPointerListener) |
173 iPointerListener->PointerEventL(aPointerEvent); |
158 iPointerListener->PointerEventL(aPointerEvent); |
174 |
159 |
175 // Call base class HandlePointerEventL() if not a long tap |
160 // Call base class HandlePointerEventL() if not a long tap |
176 if (!iLongTapDetected) |
161 CCoeControl::HandlePointerEventL(aPointerEvent); |
177 { |
|
178 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
179 } |
|
180 } |
162 } |
181 |
163 |
182 |
164 |
183 void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener) |
165 void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener) |
184 { |
166 { |
199 iListContainer->ActivateL(); |
181 iListContainer->ActivateL(); |
200 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
182 iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); |
201 iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); |
183 iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); |
202 iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
184 iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); |
203 |
185 |
204 if (Toolbar()) { |
|
205 iToolbar = Toolbar(); |
|
206 iToolbar->SetToolbarObserver(this); |
|
207 } |
|
208 |
|
209 iLongTapDetector = CAknLongTapDetector::NewL(this); |
|
210 iListContainer->SetPointerListener(this); |
186 iListContainer->SetPointerListener(this); |
211 iListContainer->SetKeyEventListener(this); |
187 iListContainer->SetKeyEventListener(this); |
212 |
188 |
213 DP("CPodcastListView::ConstructL END"); |
189 DP("CPodcastListView::ConstructL END"); |
214 } |
190 } |
240 AppUi()->RemoveFromStack(iListContainer); |
216 AppUi()->RemoveFromStack(iListContainer); |
241 delete iListContainer; |
217 delete iListContainer; |
242 } |
218 } |
243 |
219 |
244 delete iItemArray; |
220 delete iItemArray; |
245 delete iLongTapDetector; |
|
246 iItemIdArray.Close(); |
221 iItemIdArray.Close(); |
247 } |
222 } |
248 |
223 |
249 |
224 |
250 void CPodcastListView::DoActivateL(const TVwsViewId& /*aPrevViewId */, |
225 void CPodcastListView::DoActivateL(const TVwsViewId& /*aPrevViewId */, |
363 dlg->SetPromptL(aText); |
338 dlg->SetPromptL(aText); |
364 CleanupStack::Pop(dlg); |
339 CleanupStack::Pop(dlg); |
365 return dlg->ExecuteLD(R_QUERYDLG); |
340 return dlg->ExecuteLD(R_QUERYDLG); |
366 } |
341 } |
367 |
342 |
368 void CPodcastListView::CloseToolbarExtension() |
|
369 { |
|
370 CAknToolbar* toolbar = Toolbar(); |
|
371 if (toolbar) { |
|
372 CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension(); |
|
373 if (toolbarExtension) { |
|
374 toolbarExtension->SetShown( EFalse ); |
|
375 } |
|
376 } |
|
377 } |
|
378 |
|
379 void CPodcastListView::PointerEventL(const TPointerEvent& aPointerEvent) |
343 void CPodcastListView::PointerEventL(const TPointerEvent& aPointerEvent) |
380 { |
344 { |
381 //DP1("CPodcastListView::PointerEventL, iType=%d", aPointerEvent.iType); |
345 //DP1("CPodcastListView::PointerEventL, iType=%d", aPointerEvent.iType); |
382 // Pass the pointer event to Long tap detector component |
346 // Pass the pointer event to Long tap detector component |
383 iLongTapDetector->PointerEventL(aPointerEvent); |
347 } |
384 } |
|
385 |
|
386 |
|
387 void CPodcastListView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
|
388 { |
|
389 DP("CPodcastListView::HandleLongTapEventL BEGIN"); |
|
390 iListContainer->SetLongTapDetectedL(ETrue); |
|
391 |
|
392 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
|
393 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
|
394 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
|
395 |
|
396 if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
|
397 { |
|
398 iStylusPopupMenu->ShowMenu(); |
|
399 iStylusPopupMenu->SetPosition(aPenEventLocation); |
|
400 } |
|
401 |
|
402 DP("CPodcastListView::HandleLongTapEventL END"); |
|
403 } |
|
404 |
348 |
405 |
349 |
406 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/) |
350 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/) |
407 { |
351 { |
408 } |
352 } |