application/src/PodcastListView.cpp
changeset 66 41d00e97e2f7
parent 55 31e34b8e2878
child 93 c2f1ea38ec70
equal deleted inserted replaced
65:523e04129df6 66:41d00e97e2f7
    27 #include <aknsbasicbackgroundcontrolcontext.h>
    27 #include <aknsbasicbackgroundcontrolcontext.h>
    28 #include <akntabgrp.h>
    28 #include <akntabgrp.h>
    29 #include <akntoolbarextension.h>
    29 #include <akntoolbarextension.h>
    30 #include <aknquerydialog.h>
    30 #include <aknquerydialog.h>
    31 #include <barsread.h>
    31 #include <barsread.h>
       
    32 #include <akntitle.h>
    32 
    33 
    33 const TInt KDefaultGran = 5;
    34 const TInt KDefaultGran = 5;
    34 
    35 
    35 CPodcastListContainer::CPodcastListContainer()
    36 CPodcastListContainer::CPodcastListContainer()
    36 {
    37 {
    98         default:
    99         default:
    99             return NULL;
   100             return NULL;
   100         }
   101         }
   101     }
   102     }
   102 
   103 
   103 void CPodcastListContainer::SetLongTapDetected(TBool aLongTapDetected)
   104 void CPodcastListContainer::SetLongTapDetectedL(TBool aLongTapDetected)
   104 	{
   105 	{
   105 	iLongTapDetected = aLongTapDetected;
   106 	iLongTapDetected = aLongTapDetected;
   106 	
   107 	
   107 	if (aLongTapDetected == EFalse)
   108 	if (aLongTapDetected == EFalse)
   108 		{
   109 		{
   260 		iListContainer->SetMopParent(this);
   261 		iListContainer->SetMopParent(this);
   261 		
   262 		
   262 		AppUi()->AddToStackL(*this, iListContainer);
   263 		AppUi()->AddToStackL(*this, iListContainer);
   263 		iListContainer->MakeVisible(ETrue);
   264 		iListContainer->MakeVisible(ETrue);
   264 	}
   265 	}
       
   266 	
       
   267 	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   268 		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   269 	titlePane->SetTextToDefaultL();
       
   270 
   265 	DP("CPodcastListView::DoActivateL() END");
   271 	DP("CPodcastListView::DoActivateL() END");
   266 
   272 
   267 }
   273 }
   268 
   274 
   269 void CPodcastListView::DoDeactivate()
   275 void CPodcastListView::DoDeactivate()
   294             break;
   300             break;
   295 		}
   301 		}
   296 	case EAknSoftkeyBack:
   302 	case EAknSoftkeyBack:
   297 		{
   303 		{
   298 		AppUi()->ActivateViewL(iPreviousView);
   304 		AppUi()->ActivateViewL(iPreviousView);
   299 		if (iPreviousView.iViewUid == KUidPodcastFeedViewID) {
   305 		((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdFeeds);
   300 			((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdFeeds);
   306 		}
   301 		}
   307 		break;
   302 		}break;
       
   303 	case EPodcastSettings:
   308 	case EPodcastSettings:
   304 		AppUi()->ActivateLocalViewL(KUidPodcastSettingsViewID);
   309 		AppUi()->ActivateLocalViewL(KUidPodcastSettingsViewID);
   305 		break;
   310 		break;
   306 	case EPodcastAbout:
   311 	case EPodcastAbout:
   307 		RunAboutDialogL();
   312 		RunAboutDialogL();
   309 	default:
   314 	default:
   310 		AppUi()->HandleCommandL(aCommand);
   315 		AppUi()->HandleCommandL(aCommand);
   311 	}
   316 	}
   312 }
   317 }
   313 
   318 
       
   319 TBool CPodcastListView::IsVisible()
       
   320 	{
       
   321 	return iListContainer->IsVisible();
       
   322 	}
   314 
   323 
   315 void CPodcastListView::RunAboutDialogL()
   324 void CPodcastListView::RunAboutDialogL()
   316 {
   325 {
   317 	CAknNoteDialog* dlg = new(ELeave) CAknNoteDialog();
   326 	CAknNoteDialog* dlg = new(ELeave) CAknNoteDialog();
   318 	dlg->ExecuteLD(R_DLG_ABOUT);
   327 	dlg->ExecuteLD(R_DLG_ABOUT);
   323 	HBufC* emptyText =  iEikonEnv->AllocReadResourceLC(aResourceId);
   332 	HBufC* emptyText =  iEikonEnv->AllocReadResourceLC(aResourceId);
   324 	iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText);
   333 	iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText);
   325 	CleanupStack::PopAndDestroy(emptyText);	
   334 	CleanupStack::PopAndDestroy(emptyText);	
   326 	}
   335 	}
   327 
   336 
   328 void CPodcastListView::ShowOkMessage(TDesC &aText)
   337 void CPodcastListView::ShowOkMessageL(TDesC &aText)
   329 	{
   338 	{
   330 	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
   339 	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
   331 	CleanupStack::PushL(dlg);
   340 	CleanupStack::PushL(dlg);
   332 	dlg->SetTextL(aText);
   341 	dlg->SetTextL(aText);
   333 	CleanupStack::Pop(dlg);
   342 	CleanupStack::Pop(dlg);
   334 	dlg->ExecuteLD(R_MESSAGEDLG_OK);
   343 	dlg->ExecuteLD(R_MESSAGEDLG_OK);
   335 	}
   344 	}
   336 
   345 
   337 void CPodcastListView::ShowErrorMessage(TDesC &aText)
   346 void CPodcastListView::ShowErrorMessageL(TDesC &aText)
   338 	{
   347 	{
   339 	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
   348 	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
   340 	CleanupStack::PushL(dlg);
   349 	CleanupStack::PushL(dlg);
   341 	dlg->SetTextL(aText);
   350 	dlg->SetTextL(aText);
   342 	CleanupStack::Pop(dlg);
   351 	CleanupStack::Pop(dlg);
   343 	dlg->ExecuteLD(R_ERRORDLG_OK);
   352 	dlg->ExecuteLD(R_ERRORDLG_OK);
   344 	}
   353 	}
   345 
   354 
   346 TInt CPodcastListView::ShowQueryMessage(TDesC &aText)
   355 TInt CPodcastListView::ShowQueryMessageL(TDesC &aText)
   347 	{
   356 	{
   348 	CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog();
   357 	CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog();
   349 	
   358 	
   350 	CleanupStack::PushL(dlg);
   359 	CleanupStack::PushL(dlg);
   351 	dlg->SetPromptL(aText);
   360 	dlg->SetPromptL(aText);
   373 
   382 
   374 
   383 
   375 void CPodcastListView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
   384 void CPodcastListView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
   376 {
   385 {
   377 	DP("CPodcastListView::HandleLongTapEventL BEGIN");
   386 	DP("CPodcastListView::HandleLongTapEventL BEGIN");
   378 	iListContainer->SetLongTapDetected(ETrue);
       
   379 	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
   387 	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
   380 	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
   388 	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
   381 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
   389 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
   382 
   390 
   383     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
   391     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
   384     {
   392     {
       
   393 		iListContainer->SetLongTapDetectedL(ETrue);
   385 		iStylusPopupMenu->ShowMenu();
   394 		iStylusPopupMenu->ShowMenu();
   386 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   395 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   387     }
   396     }
       
   397     
   388 	DP("CPodcastListView::HandleLongTapEventL END");
   398 	DP("CPodcastListView::HandleLongTapEventL END");
   389 }
   399 }
   390 
   400 
   391 
   401 
   392 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/)
   402 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/)
   419 	if (aType==EEventKey)
   429 	if (aType==EEventKey)
   420 		{
   430 		{
   421 		switch (aKeyEvent.iCode)
   431 		switch (aKeyEvent.iCode)
   422 			{
   432 			{
   423 			case EKeyRightArrow:
   433 			case EKeyRightArrow:
   424 				((CPodcastAppUi*)AppUi())->TabRight();
   434 				((CPodcastAppUi*)AppUi())->TabRightL();
   425 				return EKeyWasConsumed;
   435 				return EKeyWasConsumed;
   426 			case EKeyLeftArrow:
   436 			case EKeyLeftArrow:
   427 				((CPodcastAppUi*)AppUi())->TabLeft();
   437 				((CPodcastAppUi*)AppUi())->TabLeftL();
   428 				return EKeyWasConsumed;
   438 				return EKeyWasConsumed;
   429 			}
   439 			}
   430 		}
   440 		}
   431 	return EKeyWasNotConsumed;
   441 	return EKeyWasNotConsumed;
   432 	}
   442 	}