# HG changeset patch # User Sebastian Brannstrom # Date 1288533524 0 # Node ID a231cc38849876aa564b8ce026fd80a7cfd9fb5d # Parent 5afc95a6ad83b0077b32affc4cfb63f446e011d8 Improved event handling diff -r 5afc95a6ad83 -r a231cc388498 application/inc/PodcastFeedView.h --- a/application/inc/PodcastFeedView.h Sun Oct 31 13:41:59 2010 +0000 +++ b/application/inc/PodcastFeedView.h Sun Oct 31 13:58:44 2010 +0000 @@ -100,7 +100,6 @@ // from MImageHandlerCallback void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel); - void SizeChanged(); private: void FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating = EFalse); void HandleAddFeedL(); diff -r 5afc95a6ad83 -r a231cc388498 application/inc/PodcastListView.h --- a/application/inc/PodcastListView.h Sun Oct 31 13:41:59 2010 +0000 +++ b/application/inc/PodcastListView.h Sun Oct 31 13:58:44 2010 +0000 @@ -58,6 +58,7 @@ void HandleResourceChange(TInt aType); virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); void SetContainerListener(MContainerListener *aContainerListener); + void SetListboxObserver(MEikListBoxObserver *aObserver); CEikColumnListBox* Listbox(); void SetListboxIcons(CArrayPtr< CGulIcon >* aIcons); @@ -81,13 +82,13 @@ class CPodcastListView : public CAknView, public MAknToolbarObserver, -public MProgressDialogCallback, public MContainerListener +public MProgressDialogCallback, public MContainerListener, MEikListBoxObserver { public: ~CPodcastListView(); virtual void UpdateToolbar(TBool aVisible=ETrue) = 0; TBool IsVisible(); - + protected: void SwitchListbox(); void ConstructL(); @@ -146,9 +147,10 @@ // from MContainerListener virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - virtual void SizeChanged() = 0; + virtual void SizeChanged() {}; void ResetContainer(); - + + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)=0; protected: CPodcastListContainer* iListContainer; /** Previous activated view */ diff -r 5afc95a6ad83 -r a231cc388498 application/inc/PodcastSearchView.h --- a/application/inc/PodcastSearchView.h Sun Oct 31 13:41:59 2010 +0000 +++ b/application/inc/PodcastSearchView.h Sun Oct 31 13:58:44 2010 +0000 @@ -78,8 +78,7 @@ * @param aCommand ID of the command to respond to. */ void HandleCommandL(TInt aCommand); - - void SizeChanged(); + private: CPodcastModel& iPodcastModel; TBool iSearchRunning; diff -r 5afc95a6ad83 -r a231cc388498 application/inc/PodcastShowsView.h --- a/application/inc/PodcastShowsView.h Sun Oct 31 13:41:59 2010 +0000 +++ b/application/inc/PodcastShowsView.h Sun Oct 31 13:58:44 2010 +0000 @@ -108,9 +108,7 @@ void HandleDeleteShow(); void UpdateViewTitleL(); void GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode); - - void SizeChanged(); - + protected: CPodcastModel& iPodcastModel; diff -r 5afc95a6ad83 -r a231cc388498 application/src/PodcastFeedView.cpp --- a/application/src/PodcastFeedView.cpp Sun Oct 31 13:41:59 2010 +0000 +++ b/application/src/PodcastFeedView.cpp Sun Oct 31 13:58:44 2010 +0000 @@ -63,14 +63,6 @@ return self; } -void CPodcastFeedView::SizeChanged() - { - DP("CPodcastFeedView::SizeChanged BEGIN"); - iListContainer->Listbox()->SetListBoxObserver(this); - iListContainer->DrawNow(); - DP("CPodcastFeedView::SizeChanged END"); - } - void CPodcastFeedView::LoadIcons() { iFeedIdForIconArray.Reset(); diff -r 5afc95a6ad83 -r a231cc388498 application/src/PodcastListView.cpp --- a/application/src/PodcastListView.cpp Sun Oct 31 13:41:59 2010 +0000 +++ b/application/src/PodcastListView.cpp Sun Oct 31 13:58:44 2010 +0000 @@ -184,7 +184,12 @@ return iListbox; } - +void CPodcastListContainer::SetListboxObserver(MEikListBoxObserver *aObserver) + { + iListboxLandscape->SetListBoxObserver(aObserver); + iListboxPortrait->SetListBoxObserver(aObserver); + } + void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons) { iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons); @@ -258,6 +263,7 @@ iListContainer->SetListboxTextArrays(iItemArray, iItemArrayShort); iListContainer->SetContainerListener(this); + iListContainer->SetListboxObserver(this); if (Toolbar()) { iToolbar = Toolbar(); @@ -464,4 +470,3 @@ } return EKeyWasNotConsumed; } - diff -r 5afc95a6ad83 -r a231cc388498 application/src/PodcastQueueView.cpp --- a/application/src/PodcastQueueView.cpp Sun Oct 31 13:41:59 2010 +0000 +++ b/application/src/PodcastQueueView.cpp Sun Oct 31 13:58:44 2010 +0000 @@ -61,8 +61,6 @@ CPodcastListView::ConstructL(); CreateIconsL(); - - iListContainer->Listbox()->SetListBoxObserver(this); iPodcastModel.FeedEngine().AddObserver(this); iPodcastModel.ShowEngine().AddObserver(this); diff -r 5afc95a6ad83 -r a231cc388498 application/src/PodcastSearchView.cpp --- a/application/src/PodcastSearchView.cpp Sun Oct 31 13:41:59 2010 +0000 +++ b/application/src/PodcastSearchView.cpp Sun Oct 31 13:58:44 2010 +0000 @@ -87,8 +87,6 @@ iListContainer->SetListboxIcons(icons); CleanupStack::Pop(icons); // icons - - iListContainer->Listbox()->SetListBoxObserver(this); SetEmptyTextL(R_PODCAST_EMPTY_SEARCH); } @@ -100,11 +98,6 @@ DP("CPodcastSearchView::~CPodcastSearchView END"); } -void CPodcastSearchView::SizeChanged() - { - - } - TUid CPodcastSearchView::Id() const { return KUidPodcastSearchViewID; diff -r 5afc95a6ad83 -r a231cc388498 application/src/PodcastShowsView.cpp --- a/application/src/PodcastShowsView.cpp Sun Oct 31 13:41:59 2010 +0000 +++ b/application/src/PodcastShowsView.cpp Sun Oct 31 13:58:44 2010 +0000 @@ -104,21 +104,13 @@ { } -void CPodcastShowsView::SizeChanged() - { - - } - - void CPodcastShowsView::ConstructL() { BaseConstructL(R_PODCAST_SHOWSVIEW); CPodcastListView::ConstructL(); CreateIconsL(); - - iListContainer->Listbox()->SetListBoxObserver(this); - + iPodcastModel.FeedEngine().AddObserver(this); iPodcastModel.ShowEngine().AddObserver(this); }