diff -r 1cae65a87b5e -r 9c56bf585696 application/src/PodcastListView.cpp --- a/application/src/PodcastListView.cpp Sat Oct 23 17:30:22 2010 +0100 +++ b/application/src/PodcastListView.cpp Sat Nov 13 13:54:36 2010 +0000 @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "buildno.h" @@ -38,22 +40,23 @@ { } -void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener) +void CPodcastListContainer::SetContainerListener(MContainerListener *aContainerListener) { - iKeyEventListener = aKeyEventListener; + iContainerListener = aContainerListener; } TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) { TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType); - if (iKeyEventListener) - iKeyEventListener->OfferKeyEventL(aKeyEvent, aType); + if (iContainerListener) + iContainerListener->OfferKeyEventL(aKeyEvent, aType); return response; } void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags ) { + DP("CPodcastListContainer::ConstructL BEGIN"); CreateWindowL(); iBgContext = @@ -75,9 +78,13 @@ iListbox->SetSize(aRect.Size()); iListbox->MakeVisible(ETrue); MakeVisible(EFalse); - + + // Set the windows size + SetRect( aRect ); + // Activate the window, which makes it ready to be drawn ActivateL(); + DP("CPodcastListContainer::ConstructL END"); } TInt CPodcastListContainer::CountComponentControls() const @@ -139,6 +146,26 @@ return iListbox; } +void CPodcastListContainer::SetListboxObserver(MEikListBoxObserver *aObserver) + { + iListbox->SetListBoxObserver(aObserver); + } + +void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) +{ + iListbox->ItemDrawer()->ColumnData()->SetIconArray(aIcons); +} + +CArrayPtr* CPodcastListContainer::ListboxIcons() + { + return iListbox->ItemDrawer()->FormattedCellData()->IconArray(); + } + +void CPodcastListContainer::SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray) + { + iListbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); + iListbox->Model()->SetItemTextArray(aPortraitArray); + } CPodcastListContainer::~CPodcastListContainer() { @@ -146,6 +173,10 @@ delete iBgContext; } +void CPodcastListContainer::SetEmptyText(const TDesC &aText) + { + iListbox->View()->SetListEmptyTextL(aText); + } void CPodcastListContainer::Draw(const TRect& aRect) const { @@ -168,20 +199,13 @@ void CPodcastListContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) { - if (iPointerListener) - iPointerListener->PointerEventL(aPointerEvent); + if (iContainerListener) + iContainerListener->PointerEventL(aPointerEvent); // Call base class HandlePointerEventL() if not a long tap CCoeControl::HandlePointerEventL(aPointerEvent); } - -void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener) - { - iPointerListener = aPointerListener; - } - - CPodcastListView::CPodcastListView() { } @@ -189,16 +213,20 @@ void CPodcastListView::ConstructL() { DP("CPodcastListView::ConstructL BEGIN"); + iListContainer = new (ELeave) CPodcastListContainer; - iListContainer->ConstructL(ClientRect(), iListboxFlags); + TRect rect = ClientRect(); + + iListContainer->ConstructL(rect, iListboxFlags); iListContainer->SetMopParent(this); iListContainer->ActivateL(); + iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran); iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray); iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); - iListContainer->SetPointerListener(this); - iListContainer->SetKeyEventListener(this); + iListContainer->SetContainerListener(this); + iListContainer->SetListboxObserver(this); DP("CPodcastListView::ConstructL END"); } @@ -215,11 +243,7 @@ { DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height()); - if ( iListContainer ) - { - iListContainer->SetRect( ClientRect() ); - } - + HandleViewRectChange(); } @@ -281,12 +305,9 @@ DP1("CPodcastListView::HandleCommandL=%d", aCommand); switch(aCommand) { - case EAknSoftkeyExit: - case EEikCmdExit: - { - AppUi()->Exit(); - break; - } + case EPodcastHide: + AppUi()->HandleCommandL(EEikCmdExit); + break; case EAknSoftkeyBack: { AppUi()->ActivateViewL(iPreviousView); @@ -323,7 +344,7 @@ void CPodcastListView::SetEmptyTextL(TInt aResourceId) { HBufC* emptyText = iEikonEnv->AllocReadResourceLC(aResourceId); - iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText); + iListContainer->SetEmptyText(*emptyText); CleanupStack::PopAndDestroy(emptyText); }