application/src/PodcastSearchView.cpp
changeset 60 4d230e702aa3
parent 24 ca50ea154990
child 65 bcd88ba95046
equal deleted inserted replaced
59:9569ea080d5a 60:4d230e702aa3
    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*>
   142 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->NaviShowTabGroupL());
   146 		     ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   147 	titlePane->SetTextToDefaultL();
       
   148 	((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)
   153 {
   147 {
   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();
       
   255 							iPodcastModel.SetActiveFeedInfo(info);			
   248 							iPodcastModel.SetActiveFeedInfo(info);			
   256 							AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID,  TUid::Uid(0), KNullDesC8());
   249 							AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID,  TUid::Uid(0), KNullDesC8());
   257 							iPodcastModel.FeedEngine().UpdateFeedL(info->Uid());
   250 							iPodcastModel.FeedEngine().UpdateFeedL(info->Uid());
   258 							}
   251 							}
   259 						}
   252 						}
   260 					else
   253 					else
   261 						{
   254 						{
   262 						TBuf<KMaxMessageLength> message;
   255 						TBuf<KMaxMessageLength> message;
   263 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
   256 						iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
   264 						ShowErrorMessage(message);
   257 						ShowErrorMessageL(message);
   265 						}		
   258 						}		
   266 				}
   259 				}
   267 				}
   260 				}
   268 			}
   261 			}
   269 			break;
   262 			break;
   275 	}
   268 	}
   276 
   269 
   277 void CPodcastSearchView::OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/)
   270 void CPodcastSearchView::OpmlParsingComplete(TInt /*aError*/, TUint /*aNumFeedsImported*/)
   278 	{
   271 	{
   279 	DP("CPodcastSearchView::OpmlParsingComplete BEGIN");
   272 	DP("CPodcastSearchView::OpmlParsingComplete BEGIN");
   280 	UpdateListboxItemsL();
   273 
   281 	UpdateToolbar();
       
   282 	DP("CPodcastSearchView::OpmlParsingComplete END");
   274 	DP("CPodcastSearchView::OpmlParsingComplete END");
   283 	}
   275 	}
   284 
   276 
   285 void CPodcastSearchView::UpdateToolbar(TBool aVisible)
   277 void CPodcastSearchView::UpdateToolbar(TBool aVisible)
   286 {
   278 {