diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp index 16ae3f75f8..c539c67b6b 100644 --- a/src/gui/search/SearchController.cpp +++ b/src/gui/search/SearchController.cpp @@ -119,6 +119,12 @@ void SearchController::DoSearch(std::string query, bool now) //searchModel->UpdateSaveList(1, query); } +void SearchController::Refresh() +{ + ClearSelection(); + searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery()); +} + void SearchController::PrevPage() { if (searchModel->GetPageNum()>1) @@ -240,9 +246,10 @@ void SearchController::removeSelectedC() { class RemoveSavesTask : public Task { + SearchController *c; std::vector saves; public: - RemoveSavesTask(std::vector saves_) { saves = saves_; } + RemoveSavesTask(std::vector saves_, SearchController *c_) { saves = saves_; c = c_; } virtual bool doWork() { for(int i = 0; i < saves.size(); i++) @@ -258,12 +265,13 @@ void SearchController::removeSelectedC() } notifyProgress((float(i+1)/float(saves.size())*100)); } + c->Refresh(); return true; } }; std::vector selected = searchModel->GetSelected(); - new TaskWindow("Removing saves", new RemoveSavesTask(selected)); + new TaskWindow("Removing saves", new RemoveSavesTask(selected, this)); ClearSelection(); searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery()); } @@ -294,8 +302,9 @@ void SearchController::unpublishSelectedC() class UnpublishSavesTask : public Task { std::vector saves; + SearchController *c; public: - UnpublishSavesTask(std::vector saves_) { saves = saves_; } + UnpublishSavesTask(std::vector saves_, SearchController *c_) { saves = saves_; c = c_; } virtual bool doWork() { for(int i = 0; i < saves.size(); i++) @@ -312,14 +321,13 @@ void SearchController::unpublishSelectedC() } notifyProgress((float(i+1)/float(saves.size())*100)); } + c->Refresh(); return true; } }; std::vector selected = searchModel->GetSelected(); - new TaskWindow("Unpublishing saves", new UnpublishSavesTask(selected)); - ClearSelection(); - searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery()); + new TaskWindow("Unpublishing saves", new UnpublishSavesTask(selected, this)); } void SearchController::FavouriteSelected() diff --git a/src/gui/search/SearchController.h b/src/gui/search/SearchController.h index d8f11286d8..f2e1f6eabf 100644 --- a/src/gui/search/SearchController.h +++ b/src/gui/search/SearchController.h @@ -32,6 +32,7 @@ class SearchController SearchView * GetView() { return searchView; } void Exit(); void DoSearch(std::string query, bool now = false); + void Refresh(); void NextPage(); void PrevPage(); void SetPage(int page); diff --git a/src/tasks/Task.h b/src/tasks/Task.h index d562f77fc7..03fa6f8334 100644 --- a/src/tasks/Task.h +++ b/src/tasks/Task.h @@ -5,6 +5,7 @@ #include #undef GetUserName //God dammit microsoft! #include "TaskListener.h" +#include "Config.h" class TaskListener; class Task {