application/src/PodcastSearchView.cpp
branch3rded
changeset 343 9c56bf585696
parent 176 1c8b56cb6409
child 390 d7abecc9d189
equal deleted inserted replaced
281:1cae65a87b5e 343:9c56bf585696
    24 #include "PodcastApp.h"
    24 #include "PodcastApp.h"
    25 #include "PodcastUtils.h"
    25 #include "PodcastUtils.h"
    26 #include <caknfileselectiondialog.h> 
    26 #include <caknfileselectiondialog.h> 
    27 #include <podcast.rsg>
    27 #include <podcast.rsg>
    28 #include <podcast.mbg>
    28 #include <podcast.mbg>
       
    29 #include <akntitle.h>
    29 #include <gulicon.h>
    30 #include <gulicon.h>
    30 #include <eikenv.h>
    31 #include <eikenv.h>
    31 #include <e32const.h>
    32 #include <e32const.h>
    32 #include <eikdialg.h>
    33 #include <eikdialg.h>
    33 #include <aknquerydialog.h>
    34 #include <aknquerydialog.h>
    80 	CleanupStack::PushL( bitmap );		
    81 	CleanupStack::PushL( bitmap );		
    81 	CleanupStack::PushL( mask );		
    82 	CleanupStack::PushL( mask );		
    82 	icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
    83 	icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
    83 	CleanupStack::Pop(2); // bitmap, mask
    84 	CleanupStack::Pop(2); // bitmap, mask
    84 	
    85 	
    85 	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
    86 	iListContainer->SetListboxIcons(icons);
    86 	CleanupStack::Pop(icons); // icons
    87 	CleanupStack::Pop(icons); // icons
    87 
       
    88 	iListContainer->Listbox()->SetListBoxObserver(this);
       
    89 	
    88 	
    90 	SetEmptyTextL(R_PODCAST_EMPTY_SEARCH);
    89 	SetEmptyTextL(R_PODCAST_EMPTY_SEARCH);
    91 }
    90 }
    92     
    91     
    93 CPodcastSearchView::~CPodcastSearchView()
    92 CPodcastSearchView::~CPodcastSearchView()
   104 	                                  TUid aCustomMessageId,
   103 	                                  TUid aCustomMessageId,
   105 	                                  const TDesC8& aCustomMessage)
   104 	                                  const TDesC8& aCustomMessage)
   106 {
   105 {
   107 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   106 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   108 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   107 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   109 	
   108 		
   110     ((CPodcastAppUi*)AppUi())->NaviSetTextL(R_SEARCH_RESULTS);
   109 	HBufC* text =  iEikonEnv->AllocReadResourceLC(R_SEARCH_RESULTS);
   111     
   110 	 
       
   111 	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   112 		  ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   113 	
       
   114 	titlePane->SetTextL(*text , ETrue );
       
   115 	CleanupStack::PopAndDestroy(text);
   112 	UpdateListboxItemsL();
   116 	UpdateListboxItemsL();
   113 }
   117 }
   114 
   118 
   115 void CPodcastSearchView::DoDeactivate()
   119 void CPodcastSearchView::DoDeactivate()
   116 {
   120 {
   117 	CPodcastListView::DoDeactivate();
   121 	CPodcastListView::DoDeactivate();
   118 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->NaviShowTabGroupL());
   122 	
       
   123 	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   124 			  ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   125 		
       
   126 	titlePane->SetTextToDefaultL();
   119 }
   127 }
   120 
   128 
   121 
   129 
   122 void CPodcastSearchView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
   130 void CPodcastSearchView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
   123 {
   131 {
   210 				message.Format(templ, &newInfo->Title());
   218 				message.Format(templ, &newInfo->Title());
   211 				if(ShowQueryMessageL(message)) {
   219 				if(ShowQueryMessageL(message)) {
   212 					TBool added = iPodcastModel.FeedEngine().AddFeedL(*newInfo);
   220 					TBool added = iPodcastModel.FeedEngine().AddFeedL(*newInfo);
   213 					
   221 					
   214 					if (added)
   222 					if (added)
   215 						{					
   223 						{
   216 						// ask if user wants to update it now
   224 						// this is a bit of a hack, first we activate the feeds view normally
   217 						TBuf<KMaxMessageLength> message;
   225 						AppUi()->ActivateLocalViewL(KUidPodcastFeedViewID,  TUid::Uid(0), KNullDesC8);
   218 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
   226 						// and then we send the UID of the recently added feed back to feed view for updating
   219 						if(ShowQueryMessageL(message))
   227 						// this is needed so the update? query comes on top of feed view, not search view
   220 							{
   228 						AppUi()->ActivateLocalViewL(KUidPodcastFeedViewID,  TUid::Uid(newInfo->Uid()), KNullDesC8);
   221 							CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newInfo->Uid());
       
   222 							
       
   223 							iPodcastModel.SetActiveFeedInfo(info);			
       
   224 							AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID,  TUid::Uid(0), KNullDesC8());
       
   225 							iPodcastModel.FeedEngine().UpdateFeedL(info->Uid());
       
   226 							}
       
   227 						}
   229 						}
   228 					else
   230 					else
   229 						{
   231 						{
   230 						TBuf<KMaxMessageLength> message;
   232 						TBuf<KMaxMessageLength> message;
   231 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
   233 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);