application/src/PodcastAppui.cpp
changeset 24 ca50ea154990
parent 16 7a4b769d94c8
child 35 66c5303f3610
child 48 f8fd68d71cfd
child 60 4d230e702aa3
child 97 b52f6033af15
--- a/application/src/PodcastAppui.cpp	Sun Feb 28 12:06:30 2010 +0000
+++ b/application/src/PodcastAppui.cpp	Sun Feb 28 19:35:33 2010 +0000
@@ -79,11 +79,21 @@
 
 CPodcastAppUi::~CPodcastAppUi()
     {
-    if(iNaviDecorator)
+    if (iNaviStyle != ENaviEmpty)
+    	{
+    	iNaviPane->Pop();
+    	}
+
+    if(iNaviTabGroup)
     	{
-    	iNaviPane->Pop(iNaviDecorator);
-    	delete iNaviDecorator;
+    	delete iNaviTabGroup;
     	}
+    
+    if (iNaviText)
+    	{
+    	delete iNaviText;
+    	}
+    
 	delete iStartTimer;
     }
 
@@ -149,11 +159,32 @@
     return array;
 	}
 
+void CPodcastAppUi::NaviSetTextL(TInt aResourceId)
+	{
+	
+	if (iNaviStyle != ENaviEmpty) {
+		iNaviPane->Pop();
+	}
+
+	HBufC* naviText =  iEikonEnv->AllocReadResourceLC(aResourceId);
+	iNaviText  = iNaviPane->CreateNavigationLabelL(*naviText);
+	
+	iNaviPane->PushL(*iNaviText);
+
+	CleanupStack::PopAndDestroy(naviText);	
+	
+	iNaviStyle = ENaviText;
+	}
+
 void CPodcastAppUi::NaviShowTabGroupL()
 	{
-	iNaviDecorator = iNaviPane->CreateTabGroupL();
+	if (iNaviStyle != ENaviEmpty) {
+		iNaviPane->Pop();
+	}
 	
-	iTabGroup = STATIC_CAST(CAknTabGroup*, iNaviDecorator->DecoratedControl());
+	iNaviTabGroup = iNaviPane->CreateTabGroupL();
+	
+	iTabGroup = STATIC_CAST(CAknTabGroup*, iNaviTabGroup->DecoratedControl());
 	iTabGroup->SetTabFixedWidthL(EAknTabWidthWithTwoTabs);
 
 	HBufC *label1 = iEikonEnv->AllocReadResourceLC(R_TABGROUP_FEEDS);
@@ -168,9 +199,9 @@
 	iTabGroup->SetActiveTabByIndex(0);
 	iTabGroup->SetObserver(this);
 
-	iNaviPane->Pop();
-	SetTabsVisibleL(ETrue);
-	
+	iNaviPane->PushL(*iNaviTabGroup);
+	iNaviStyle = ENaviTabGroup;
+
 	UpdateQueueTab(iPodcastModel->ShowEngine().GetNumDownloadingShows());
 	}
 
@@ -178,30 +209,31 @@
 	{
 	DP("CPodcastListView::TabChangedL ");
 	
-	if (!iTabsVisible)
+	if (iNaviStyle == ENaviTabGroup)
 		{
-		return;
+		TUid newview = TUid::Uid(0);
+		TUid messageUid = TUid::Uid(0);
+		
+		if (aIndex == KTabIdFeeds) {
+			newview = KUidPodcastFeedViewID;
+		} else if (aIndex == KTabIdQueue) {
+			newview = KUidPodcastQueueViewID;
+		} else {
+			User::Leave(KErrTooBig);
 		}
-	
-	TUid newview = TUid::Uid(0);
-	TUid messageUid = TUid::Uid(0);
-	
-	if (aIndex == KTabIdFeeds) {
-		newview = KUidPodcastFeedViewID;
-	} else if (aIndex == KTabIdQueue) {
-		newview = KUidPodcastQueueViewID;
-	} else {
-		User::Leave(KErrTooBig);
-	}
-	
-	if(newview.iUid != 0)
-		{			
-		ActivateLocalViewL(newview,  messageUid, KNullDesC8());
+		
+		if(newview.iUid != 0)
+			{			
+			ActivateLocalViewL(newview,  messageUid, KNullDesC8());
+			}
 		}
 	}
 
 void CPodcastAppUi::SetActiveTab(TInt aIndex) {
-	iTabGroup->SetActiveTabByIndex(aIndex);
+	if (iNaviStyle == ENaviTabGroup)
+		{
+		iTabGroup->SetActiveTabByIndex(aIndex);
+		}
 }
 
 void CPodcastAppUi::HandleTimeout(const CTimeout& /*aId*/, TInt /*aError*/)
@@ -211,66 +243,51 @@
 
 void CPodcastAppUi::UpdateQueueTab(TInt aQueueLength)
 	{
-	if (aQueueLength == 0)
-		{
-		HBufC *queue = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE);
-		iTabGroup->ReplaceTabL(KTabIdQueue, *queue);
-		CleanupStack::PopAndDestroy(queue);
-		}
-	else
+	if (iNaviStyle == ENaviTabGroup)
 		{
-		HBufC *queueTemplate = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE_COUNTER);
-		HBufC *queueCounter = HBufC::NewLC(queueTemplate->Length()+2);
-		queueCounter->Des().Format(*queueTemplate, aQueueLength);
-		
-		iTabGroup->ReplaceTabL(KTabIdQueue, *queueCounter);
-		CleanupStack::PopAndDestroy(queueCounter);
-		CleanupStack::PopAndDestroy(queueTemplate);	
+		if (aQueueLength == 0)
+			{
+			HBufC *queue = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE);
+			iTabGroup->ReplaceTabL(KTabIdQueue, *queue);
+			CleanupStack::PopAndDestroy(queue);
+			}
+		else
+			{
+			HBufC *queueTemplate = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE_COUNTER);
+			HBufC *queueCounter = HBufC::NewLC(queueTemplate->Length()+2);
+			queueCounter->Des().Format(*queueTemplate, aQueueLength);
+			
+			iTabGroup->ReplaceTabL(KTabIdQueue, *queueCounter);
+			CleanupStack::PopAndDestroy(queueCounter);
+			CleanupStack::PopAndDestroy(queueTemplate);	
+			}
 		}
 	}
 
 void CPodcastAppUi::TabLeft()
 	{
-	if (!iTabsVisible)
+	if (iNaviStyle == ENaviTabGroup) 
 		{
-		return;
+		TInt ati = iTabGroup->ActiveTabIndex();
+		if(ati > 0)
+			{
+			SetActiveTab(ati-1);
+			TabChangedL(ati-1);
+			}
 		}
-	
-	TInt ati = iTabGroup->ActiveTabIndex();
-	if(ati > 0) {
-		SetActiveTab(ati-1);
-		TabChangedL(ati-1);
-	}
 	}
 
 void CPodcastAppUi::TabRight()
 	{
-	if (!iTabsVisible)
+	if (iNaviStyle == ENaviTabGroup) 
 		{
-		return;
-		}
-	
-	TInt ati = iTabGroup->ActiveTabIndex();
-	if(ati < iTabGroup->TabCount()-1) {
-		SetActiveTab(ati+1);
-		TabChangedL(ati+1);
-	}
-	}
-
-void CPodcastAppUi::SetTabsVisibleL(TBool aVisible)
-	{
-	if (aVisible)
-		{
-		if(!iTabsVisible && iNaviDecorator)
+		TInt ati = iTabGroup->ActiveTabIndex();
+		if(ati < iTabGroup->TabCount()-1)
 			{
-			iNaviPane->PushL(*iNaviDecorator);
+			SetActiveTab(ati+1);
+			TabChangedL(ati+1);
 			}
 		}
-	else if (iTabsVisible) {
-		iNaviPane->Pop(iNaviDecorator);
-	}
-	
-	iTabsVisible=aVisible;
 	}
 
 void CPodcastAppUi::ConnectionSelectionStart()