diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-05 19:24:46 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-05 19:24:46 (GMT) |
| commit | 37129abbc6fd94f2cd9ae094bde5282ff71750a4 (patch) | |
| tree | a98bb20509d3a0adf989a58721c60868e4220090 /src/search/SearchController.cpp | |
| parent | 5da70ef8a633328d7441fd08c7e8592247f52f7b (diff) | |
| download | powder-37129abbc6fd94f2cd9ae094bde5282ff71750a4.zip powder-37129abbc6fd94f2cd9ae094bde5282ff71750a4.tar.gz | |
Allow mass unfavouring, unfavouring from the preview view. Fixes #149
Diffstat (limited to 'src/search/SearchController.cpp')
| -rw-r--r-- | src/search/SearchController.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/search/SearchController.cpp b/src/search/SearchController.cpp index d7d422c..2c6b78f 100644 --- a/src/search/SearchController.cpp +++ b/src/search/SearchController.cpp @@ -316,7 +316,34 @@ void SearchController::FavouriteSelected() } }; + class UnfavouriteSavesTask : public Task + { + std::vector<int> saves; + public: + UnfavouriteSavesTask(std::vector<int> saves_) { saves = saves_; } + virtual bool doWork() + { + for(int i = 0; i < saves.size(); i++) + { + std::stringstream saveID; + saveID << "Unfavouring save [" << saves[i] << "] ..."; + notifyStatus(saveID.str()); + if(Client::Ref().FavouriteSave(saves[i], false)!=RequestOkay) + { + std::stringstream saveIDF; + saveIDF << "\boFailed to remove [" << saves[i] << "] ..."; + notifyStatus(saveIDF.str()); + } + notifyProgress((float(i+1)/float(saves.size())*100)); + } + return true; + } + }; + std::vector<int> selected = searchModel->GetSelected(); - new TaskWindow("Favouring saves", new FavouriteSavesTask(selected)); + if(!searchModel->GetShowFavourite()) + new TaskWindow("Favouring saves", new FavouriteSavesTask(selected)); + else + new TaskWindow("Unfavouring saves", new UnfavouriteSavesTask(selected)); ClearSelection(); } |
