Improved event handling twolistboxes
authorSebastian Brannstrom <sebastianb@symbian.org>
Sun, 31 Oct 2010 13:58:44 +0000
branchtwolistboxes
changeset 318 a231cc388498
parent 317 5afc95a6ad83
child 319 0ad6784f49b8
Improved event handling
application/inc/PodcastFeedView.h
application/inc/PodcastListView.h
application/inc/PodcastSearchView.h
application/inc/PodcastShowsView.h
application/src/PodcastFeedView.cpp
application/src/PodcastListView.cpp
application/src/PodcastQueueView.cpp
application/src/PodcastSearchView.cpp
application/src/PodcastShowsView.cpp
--- 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();
--- 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 */
--- 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;
--- 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;
--- 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();
--- 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;
 	}
-
--- 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);
--- 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;
--- 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);
 	}