application/src/PodcastSearchView.cpp
changeset 66 41d00e97e2f7
parent 54 c5cd47bc11ef
child 80 50345a6ad0c3
equal deleted inserted replaced
65:523e04129df6 66:41d00e97e2f7
    35 #include <caknfilenamepromptdialog.h> 
    35 #include <caknfilenamepromptdialog.h> 
    36 #include <BAUTILS.H> 
    36 #include <BAUTILS.H> 
    37 #include <pathinfo.h> 
    37 #include <pathinfo.h> 
    38 #include <f32file.h>
    38 #include <f32file.h>
    39 #include <akntoolbarextension.h>
    39 #include <akntoolbarextension.h>
    40 #include <akntitle.h>
       
    41 
    40 
    42 const TInt KMaxFeedNameLength = 100;
    41 const TInt KMaxFeedNameLength = 100;
    43 const TInt KDefaultGran = 5;
    42 const TInt KDefaultGran = 5;
    44 const TInt KNumberOfFilesMaxLength = 4;
    43 const TInt KNumberOfFilesMaxLength = 4;
    45 #define KMaxMessageLength 200
    44 #define KMaxMessageLength 200
   126 		
   125 		
   127 void CPodcastSearchView::DoActivateL(const TVwsViewId& aPrevViewId,
   126 void CPodcastSearchView::DoActivateL(const TVwsViewId& aPrevViewId,
   128 	                                  TUid aCustomMessageId,
   127 	                                  TUid aCustomMessageId,
   129 	                                  const TDesC8& aCustomMessage)
   128 	                                  const TDesC8& aCustomMessage)
   130 {
   129 {
   131 	UpdateToolbar();
       
   132 	
       
   133 	 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   134 		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   135 
       
   136     ((CPodcastAppUi*)AppUi())->NaviSetTextL(R_SEARCH_RESULTS);
       
   137 
       
   138 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   130 	CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);
   139 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   131 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
       
   132 	
       
   133     ((CPodcastAppUi*)AppUi())->NaviSetTextL(R_SEARCH_RESULTS);
       
   134     
       
   135 	UpdateListboxItemsL();
       
   136 	UpdateToolbar();
   140 }
   137 }
   141 
   138 
   142 void CPodcastSearchView::DoDeactivate()
   139 void CPodcastSearchView::DoDeactivate()
   143 {
   140 {
   144 	CPodcastListView::DoDeactivate();
   141 	CPodcastListView::DoDeactivate();
   145 	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
       
   146 		     ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   147 	titlePane->SetTextToDefaultL();
       
   148 	((CPodcastAppUi*)AppUi())->NaviShowTabGroupL();
   142 	((CPodcastAppUi*)AppUi())->NaviShowTabGroupL();
   149 }
   143 }
   150 
   144 
   151 
   145 
   152 void CPodcastSearchView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
   146 void CPodcastSearchView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
   237 				TBuf<KMaxMessageLength> templ;
   231 				TBuf<KMaxMessageLength> templ;
   238 				TBuf<KMaxMessageLength> message;
   232 				TBuf<KMaxMessageLength> message;
   239 								
   233 								
   240 				iEikonEnv->ReadResourceL(templ, R_ADD_FEED_QUERY);
   234 				iEikonEnv->ReadResourceL(templ, R_ADD_FEED_QUERY);
   241 				message.Format(templ, &newInfo->Title());
   235 				message.Format(templ, &newInfo->Title());
   242 				if(ShowQueryMessage(message)) {
   236 				if(ShowQueryMessageL(message)) {
   243 					TBool added = iPodcastModel.FeedEngine().AddFeedL(*newInfo);
   237 					TBool added = iPodcastModel.FeedEngine().AddFeedL(*newInfo);
   244 					
   238 					
   245 					if (added)
   239 					if (added)
   246 						{					
   240 						{					
   247 						// ask if user wants to update it now
   241 						// ask if user wants to update it now
   248 						TBuf<KMaxMessageLength> message;
   242 						TBuf<KMaxMessageLength> message;
   249 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
   243 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
   250 						if(ShowQueryMessage(message))
   244 						if(ShowQueryMessageL(message))
   251 							{
   245 							{
   252 							CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newInfo->Uid());
   246 							CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newInfo->Uid());
   253 							
   247 							
   254 							iPodcastModel.ActiveShowList().Reset();
   248 							iPodcastModel.ActiveShowList().Reset();
   255 							iPodcastModel.SetActiveFeedInfo(info);			
   249 							iPodcastModel.SetActiveFeedInfo(info);			
   259 						}
   253 						}
   260 					else
   254 					else
   261 						{
   255 						{
   262 						TBuf<KMaxMessageLength> message;
   256 						TBuf<KMaxMessageLength> message;
   263 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
   257 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
   264 						ShowErrorMessage(message);
   258 						ShowErrorMessageL(message);
   265 						}		
   259 						}		
   266 				}
   260 				}
   267 				}
   261 				}
   268 			}
   262 			}
   269 			break;
   263 			break;
   275 	}
   269 	}
   276 
   270 
   277 void CPodcastSearchView::OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/)
   271 void CPodcastSearchView::OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/)
   278 	{
   272 	{
   279 	DP("CPodcastSearchView::OpmlParsingComplete BEGIN");
   273 	DP("CPodcastSearchView::OpmlParsingComplete BEGIN");
   280 	UpdateListboxItemsL();
   274 
   281 	UpdateToolbar();
       
   282 	DP("CPodcastSearchView::OpmlParsingComplete END");
   275 	DP("CPodcastSearchView::OpmlParsingComplete END");
   283 	}
   276 	}
   284 
   277 
   285 void CPodcastSearchView::UpdateToolbar(TBool aVisible)
   278 void CPodcastSearchView::UpdateToolbar(TBool aVisible)
   286 {
   279 {