# HG changeset patch # User teknolog # Date 1270394590 -3600 # Node ID 403412eb5292302076a4896f627ea771a897b1ff # Parent 223f270fa7ff86cf3ab6fecec0aec97acb470132 Added "Reset database" option in settings. Further robustness fixes for Feeds. diff -r 223f270fa7ff -r 403412eb5292 application/data/PodcastClient_english.rls --- a/application/data/PodcastClient_english.rls Sun Apr 04 15:54:17 2010 +0100 +++ b/application/data/PodcastClient_english.rls Sun Apr 04 16:23:10 2010 +0100 @@ -61,6 +61,9 @@ rls_string STRING_r_podcast_select_folder "Select folder" rls_string STRING_r_on "On" rls_string STRING_r_off "Off" +rls_string STRING_r_podcast_setting_reset_db "Reset database" +rls_string STRING_r_podcast_setting_reset_db_query "Reset database? All data will be lost!" + // Choicelist for autodownload diff -r 223f270fa7ff -r 403412eb5292 application/data/PodcastSettingsView.ra --- a/application/data/PodcastSettingsView.ra Sun Apr 04 15:54:17 2010 +0100 +++ b/application/data/PodcastSettingsView.ra Sun Apr 04 16:23:10 2010 +0100 @@ -30,9 +30,14 @@ { MENU_ITEM { + command = EPodcastResetDb; + txt = STRING_r_podcast_setting_reset_db; + }, + MENU_ITEM + { command = EPodcastHelp; txt = STRING_r_view_help; - } + } }; } diff -r 223f270fa7ff -r 403412eb5292 application/data/PodcastStrings.ra --- a/application/data/PodcastStrings.ra Sun Apr 04 15:54:17 2010 +0100 +++ b/application/data/PodcastStrings.ra Sun Apr 04 16:23:10 2010 +0100 @@ -71,3 +71,5 @@ RESOURCE TBUF r_error_general {buf=STRING_r_error_general;} RESOURCE TBUF r_error_http {buf=STRING_r_error_http;} RESOURCE TBUF r_error_invalid_address {buf=STRING_r_error_invalid_address;} + +RESOURCE TBUF r_reset_db_query {buf = STRING_r_podcast_setting_reset_db_query;} diff -r 223f270fa7ff -r 403412eb5292 application/inc/Podcast.hrh --- a/application/inc/Podcast.hrh Sun Apr 04 15:54:17 2010 +0100 +++ b/application/inc/Podcast.hrh Sun Apr 04 16:23:10 2010 +0100 @@ -59,7 +59,8 @@ EPodcastHide, EPodcastHelp, EPodcastSearch, - EPodcastAddSearchResult + EPodcastAddSearchResult, + EPodcastResetDb }; enum TPodcastControl diff -r 223f270fa7ff -r 403412eb5292 application/src/PodcastSettingsView.cpp --- a/application/src/PodcastSettingsView.cpp Sun Apr 04 15:54:17 2010 +0100 +++ b/application/src/PodcastSettingsView.cpp Sun Apr 04 16:23:10 2010 +0100 @@ -27,6 +27,7 @@ #include #include +#include class CIapSetting: public CAknEnumeratedTextPopupSettingItem @@ -540,7 +541,21 @@ iListbox->StoreSettings(); AppUi()->ActivateViewL(iPreviousView); } - break; + break; + case EPodcastResetDb: + CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog(); + + CleanupStack::PushL(dlg); + HBufC *text = iCoeEnv->AllocReadResourceLC(R_RESET_DB_QUERY); + dlg->SetPromptL(*text); + CleanupStack::PopAndDestroy(text); + CleanupStack::Pop(dlg); + if(dlg->ExecuteLD(R_QUERYDLG)) + { + iPodcastModel.DropDB(); + AppUi()->Exit(); + } + break; default: AppUi()->HandleCommandL(aCommand); break; diff -r 223f270fa7ff -r 403412eb5292 engine/inc/PodcastModel.h --- a/engine/inc/PodcastModel.h Sun Apr 04 15:54:17 2010 +0100 +++ b/engine/inc/PodcastModel.h Sun Apr 04 16:23:10 2010 +0100 @@ -85,6 +85,7 @@ TInt GetIapId(); sqlite3* DB(); + void DropDB(); void ResetDB(); IMPORT_C void GetAllShowsL(); diff -r 223f270fa7ff -r 403412eb5292 engine/src/FeedEngine.cpp --- a/engine/src/FeedEngine.cpp Sun Apr 04 15:54:17 2010 +0100 +++ b/engine/src/FeedEngine.cpp Sun Apr 04 16:23:10 2010 +0100 @@ -623,7 +623,9 @@ { // now the image has been downloaded, so we set it again in the FeedInfo to start // converting it - TRAP_IGNORE(iActiveFeed->SetImageFileNameL(iActiveFeed->ImageFileName(), &iPodcastModel)); + HBufC *fileNameCopy = iActiveFeed->ImageFileName().AllocLC(); + TRAP_IGNORE(iActiveFeed->SetImageFileNameL(*fileNameCopy, &iPodcastModel)); + CleanupStack::PopAndDestroy(fileNameCopy); } DBUpdateFeedL(*iActiveFeed); NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError); diff -r 223f270fa7ff -r 403412eb5292 engine/src/PodcastModel.cpp --- a/engine/src/PodcastModel.cpp Sun Apr 04 15:54:17 2010 +0100 +++ b/engine/src/PodcastModel.cpp Sun Apr 04 16:23:10 2010 +0100 @@ -253,10 +253,8 @@ } } -void CPodcastModel::ResetDB() +void CPodcastModel::DropDB() { - DP("CPodcastModel::ResetDB BEGIN"); - if (iDB != NULL) { sqlite3_close(iDB); @@ -272,6 +270,23 @@ { BaflUtils::DeleteFile(iFsSession, dbFileName); } + } + +void CPodcastModel::ResetDB() + { + DP("CPodcastModel::ResetDB BEGIN"); + + DropDB(); + + TFileName dbFileName; + dbFileName.Copy(iSettingsEngine->PrivatePath()); + dbFileName.Append(KDBFileName); + + // remove the old DB file + if (BaflUtils::FileExists(iFsSession, dbFileName)) + { + BaflUtils::DeleteFile(iFsSession, dbFileName); + } // copy template to new DB TFileName dbTemplate;