--- a/application/data/PodcastClient_english.rls Mon Jul 26 10:54:02 2010 +0100
+++ b/application/data/PodcastClient_english.rls Mon Jul 26 17:17:02 2010 +0100
@@ -38,7 +38,7 @@
rls_string STRING_r_tabgroup_queue_counter "Queue (%d)"
// Question dialogs
-rls_string STRING_r_add_feed_prompt "Enter search terms or feed address"
+rls_string STRING_r_add_feed_prompt "Enter feed address"
rls_string STRING_r_edit_feed_prompt "Feed address"
rls_string STRING_r_add_feed_title_prompt "Feed title"
rls_string STRING_r_remove_feed_prompt "Remove feed '%S'?"
@@ -152,3 +152,7 @@
rls_string STRING_r_error_general "Error: General error %d"
rls_string STRING_r_error_http "Error: HTTP error %d"
rls_string STRING_r_error_disk_full "Error: Disk full"
+rls_string STRING_r_add_url_or_search "Add feed"
+rls_string STRING_r_add_url "Enter URL"
+rls_string STRING_r_add_search "Search for feed"
+rls_string STRING_r_search_feed_prompt "Enter search terms"
--- a/application/data/PodcastFeedView.ra Mon Jul 26 10:54:02 2010 +0100
+++ b/application/data/PodcastFeedView.ra Mon Jul 26 17:17:02 2010 +0100
@@ -270,3 +270,33 @@
}
};
}
+
+RESOURCE ARRAY r_feedview_add_url_or_search_array
+{
+ items =
+ {
+ LBUF { txt = STRING_r_add_url; },
+ LBUF { txt = STRING_r_add_search; }
+ };
+}
+
+RESOURCE AVKON_LIST_QUERY r_feedview_add_url_or_search
+{
+ softkeys=R_AVKON_SOFTKEYS_SELECT_CANCEL;
+ items =
+ {
+ AVKON_LIST_QUERY_DLG_LINE
+ {
+ control = AVKON_LIST_QUERY_CONTROL
+ {
+ listtype = EAknCtSinglePopupMenuListBox;
+ heading = STRING_r_add_url_or_search;
+ listbox = AVKON_LIST_QUERY_LIST
+ {
+ // array of items will be defined dynamically
+ };
+ };
+ }
+ };
+}
+
--- a/application/data/PodcastStrings.ra Mon Jul 26 10:54:02 2010 +0100
+++ b/application/data/PodcastStrings.ra Mon Jul 26 17:17:02 2010 +0100
@@ -76,3 +76,4 @@
RESOURCE TBUF r_error_disk_full {buf = STRING_r_error_disk_full; }
RESOURCE TBUF r_error_playback_failed {buf = STRING_r_error_playback_failed; }
+RESOURCE TBUF r_podcast_searchfeed_prompt {buf = STRING_r_search_feed_prompt;}
--- a/application/inc/PodcastFeedView.h Mon Jul 26 10:54:02 2010 +0100
+++ b/application/inc/PodcastFeedView.h Mon Jul 26 17:17:02 2010 +0100
@@ -103,6 +103,8 @@
private:
void FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating = EFalse);
void HandleAddFeedL();
+ void HandleAddFeedUrlL();
+ void HandleAddFeedSearchL();
void HandleEditFeedL();
void HandleRemoveFeedL();
void HandleImportFeedsL();
--- a/application/src/PodcastFeedView.cpp Mon Jul 26 10:54:02 2010 +0100
+++ b/application/src/PodcastFeedView.cpp Mon Jul 26 17:17:02 2010 +0100
@@ -570,68 +570,108 @@
void CPodcastFeedView::HandleAddFeedL()
{
+ TInt selection;
+ CDesCArrayFlat* array = iCoeEnv->ReadDesC16ArrayResourceL(R_FEEDVIEW_ADD_URL_OR_SEARCH_ARRAY );
+ CleanupStack::PushL( array );
+
+ CAknListQueryDialog* dialog = new ( ELeave ) CAknListQueryDialog( &selection );
+ CleanupStack::PushL( dialog );
+ dialog->PrepareLC( R_FEEDVIEW_ADD_URL_OR_SEARCH );
+ CleanupStack::Pop( dialog );
+
+ dialog->SetItemTextArray( array );
+ dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+ if ( dialog->RunLD() )
+ {
+ if (selection == 0)
+ {
+ // Enter URL selected
+ HandleAddFeedUrlL();
+ }
+ else
+ {
+ // Search selected
+ HandleAddFeedSearchL();
+ }
+ }
+ CleanupStack::PopAndDestroy( array );
+ }
+
+void CPodcastFeedView::HandleAddFeedUrlL()
+ {
TBuf<KFeedUrlLength> url;
url.Copy(_L("http://"));
+
CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url);
dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG);
+
HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_ADDFEED_PROMPT);
dlg->SetPromptL(*prompt);
CleanupStack::PopAndDestroy(prompt);
if(dlg->RunLD())
{
+ PodcastUtils::FixProtocolsL(url);
+
+ CFeedInfo* newFeedInfo = CFeedInfo::NewL();
+ CleanupStack::PushL(newFeedInfo);
+ newFeedInfo->SetUrlL(url);
+ newFeedInfo->SetTitleL(newFeedInfo->Url());
- // if no :// we do a search
- if (url.Find(_L("://")) == KErrNotFound)
+ TBool added = iPodcastModel.FeedEngine().AddFeedL(*newFeedInfo);
+
+ if (added)
{
- HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING);
- ShowWaitDialogL(*waitText);
- CleanupStack::PopAndDestroy(waitText);
-
- iOpmlState = EOpmlSearching;
- TRAPD(err, iPodcastModel.FeedEngine().SearchForFeedL(url));
+ UpdateListboxItemsL();
- if (err != KErrNone)
+ // ask if users wants to update it now
+ TBuf<KMaxMessageLength> message;
+ iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
+ if(ShowQueryMessageL(message))
{
- delete iWaitDialog;
- iOpmlState = EOpmlIdle;
+ CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newFeedInfo->Uid());
+
+ iPodcastModel.SetActiveFeedInfo(info);
+ AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID, TUid::Uid(0), KNullDesC8());
+ iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid());
}
}
else
{
- PodcastUtils::FixProtocolsL(url);
+ TBuf<KMaxMessageLength> message;
+ iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
+ ShowErrorMessageL(message);
+ }
+
+ CleanupStack::PopAndDestroy(newFeedInfo);
+ }
+ }
+
+void CPodcastFeedView::HandleAddFeedSearchL()
+ {
+ TBuf<KFeedUrlLength> url;
- CFeedInfo* newFeedInfo = CFeedInfo::NewL();
- CleanupStack::PushL(newFeedInfo);
- newFeedInfo->SetUrlL(url);
- newFeedInfo->SetTitleL(newFeedInfo->Url());
-
- TBool added = iPodcastModel.FeedEngine().AddFeedL(*newFeedInfo);
-
- if (added)
- {
- UpdateListboxItemsL();
-
- // ask if users wants to update it now
- TBuf<KMaxMessageLength> message;
- iEikonEnv->ReadResourceL(message, R_ADD_FEED_SUCCESS);
- if(ShowQueryMessageL(message))
- {
- CFeedInfo *info = iPodcastModel.FeedEngine().GetFeedInfoByUid(newFeedInfo->Uid());
-
- iPodcastModel.SetActiveFeedInfo(info);
- AppUi()->ActivateLocalViewL(KUidPodcastShowsViewID, TUid::Uid(0), KNullDesC8());
- iPodcastModel.FeedEngine().UpdateFeedL(newFeedInfo->Uid());
- }
- }
- else
- {
- TBuf<KMaxMessageLength> message;
- iEikonEnv->ReadResourceL(message, R_ADD_FEED_EXISTS);
- ShowErrorMessageL(message);
- }
-
- CleanupStack::PopAndDestroy(newFeedInfo);
+ CAknTextQueryDialog * dlg =CAknTextQueryDialog::NewL(url);
+ dlg->PrepareLC(R_PODCAST_ADD_FEED_DLG);
+
+ HBufC* prompt = iEikonEnv->AllocReadResourceLC(R_PODCAST_SEARCHFEED_PROMPT);
+ dlg->SetPromptL(*prompt);
+ CleanupStack::PopAndDestroy(prompt);
+
+ if(dlg->RunLD())
+ {
+ HBufC *waitText = iEikonEnv->AllocReadResourceLC(R_SEARCHING);
+ ShowWaitDialogL(*waitText);
+ CleanupStack::PopAndDestroy(waitText);
+
+ iOpmlState = EOpmlSearching;
+ TRAPD(err, iPodcastModel.FeedEngine().SearchForFeedL(url));
+
+ if (err != KErrNone)
+ {
+ delete iWaitDialog;
+ iOpmlState = EOpmlIdle;
}
}
}