summaryrefslogtreecommitdiff
path: root/src/search/SearchController.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-19 14:22:18 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-19 14:22:18 (GMT)
commitc4bace95bf97546ecb2fff4343fe82d0540d34ab (patch)
treea35378f9a3062041751606239d82fd45e92b7062 /src/search/SearchController.cpp
parente9fc64eed6e5cbf5e750063e1ad2e30887840dbf (diff)
downloadpowder-c4bace95bf97546ecb2fff4343fe82d0540d34ab.zip
powder-c4bace95bf97546ecb2fff4343fe82d0540d34ab.tar.gz
Allow deleting of stamps
Diffstat (limited to 'src/search/SearchController.cpp')
-rw-r--r--src/search/SearchController.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/search/SearchController.cpp b/src/search/SearchController.cpp
index b0936ef..ec5f805 100644
--- a/src/search/SearchController.cpp
+++ b/src/search/SearchController.cpp
@@ -220,6 +220,7 @@ void SearchController::removeSelectedC()
std::vector<int> selected = searchModel->GetSelected();
new TaskWindow("Removing saves", new RemoveSavesTask(selected));
ClearSelection();
+ searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery());
}
void SearchController::UnpublishSelected()
@@ -272,10 +273,37 @@ void SearchController::unpublishSelectedC()
std::vector<int> selected = searchModel->GetSelected();
new TaskWindow("Unpublishing saves", new UnpublishSavesTask(selected));
ClearSelection();
+ searchModel->UpdateSaveList(searchModel->GetPageNum(), searchModel->GetLastQuery());
}
void SearchController::FavouriteSelected()
{
- new ErrorMessage("Not impletemented", "Not ermplermerterd");
+ class FavouriteSavesTask : public Task
+ {
+ std::vector<int> saves;
+ public:
+ FavouriteSavesTask(std::vector<int> saves_) { saves = saves_; }
+ virtual void doWork()
+ {
+ for(int i = 0; i < saves.size(); i++)
+ {
+ std::stringstream saveID;
+ saveID << "Favouring save [" << saves[i] << "] ...";
+ notifyStatus(saveID.str());
+ if(Client::Ref().FavouriteSave(saves[i], true)!=RequestOkay)
+ {
+ std::stringstream saveIDF;
+ saveIDF << "\boFailed to favourite [" << saves[i] << "] ...";
+ notifyStatus(saveIDF.str());
+ usleep(500*1000);
+ }
+ usleep(100*1000);
+ notifyProgress((float(i+1)/float(saves.size())*100));
+ }
+ }
+ };
+
+ std::vector<int> selected = searchModel->GetSelected();
+ new TaskWindow("Favouring saves", new FavouriteSavesTask(selected));
ClearSelection();
}