Fix so listbox position is kept when removing a show from queue
authorSebastian Brannstrom <sebastianb@symbian.org>
Thu, 15 Jul 2010 21:29:09 +0100
changeset 185 92eadaba67e6
parent 180 74d497f911e0
child 187 45e21fd808cd
Fix so listbox position is kept when removing a show from queue
application/inc/PodcastQueueView.h
application/src/PodcastQueueView.cpp
--- a/application/inc/PodcastQueueView.h	Wed Jul 14 14:53:21 2010 +0100
+++ b/application/inc/PodcastQueueView.h	Thu Jul 15 21:29:09 2010 +0100
@@ -80,6 +80,9 @@
 	void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
 	
 	virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation);
+	
+private:
+	TBool iDontUpdateList;
 	};
 
 #endif
--- a/application/src/PodcastQueueView.cpp	Wed Jul 14 14:53:21 2010 +0100
+++ b/application/src/PodcastQueueView.cpp	Thu Jul 15 21:29:09 2010 +0100
@@ -156,7 +156,7 @@
 
 void CPodcastQueueView::UpdateListboxItemsL()
 	{
-	if (iListContainer->IsVisible())
+	if (iListContainer->IsVisible() && !iDontUpdateList)
 		{
 		TListItemProperties itemProps;
 		TInt len = 0;
@@ -250,7 +250,17 @@
 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
 				{
+				// this is an ugly hack to prevent UpdateListboxItemsL from being
+				// triggered from the show engine, which causes focus to jump
+				// around in an ugly fashion
+				iDontUpdateList = ETrue;
 				TRAP_IGNORE(iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()));
+				iDontUpdateList = EFalse;
+				}
+			UpdateListboxItemsL();
+			if (index > 0)
+				{
+				iListContainer->Listbox()->SetCurrentItemIndex(index - 1);
 				}
 			}
 			break;