From f3288e268529d897f1a65443042c7d828b9e1090 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 21 Nov 2014 12:40:30 +0200 Subject: ACME-1620 FIXED Newly acquired experience does not always show in Experience floater after being created --- indra/newview/llfloaterexperiences.cpp | 39 ++++++++++++++++++++++------------ indra/newview/llfloaterexperiences.h | 2 ++ 2 files changed, 28 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index d973fe5b33..777dc382cd 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterexperiences.h" +#include "llfloaterreg.h" #include "llagent.h" #include "llevents.h" @@ -206,19 +207,8 @@ void LLFloaterExperiences::refreshContents() LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); } - lookup_url = region->getCapability("GetAdminExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Admin_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); - } - - lookup_url = region->getCapability("GetCreatorExperiences"); - if(!lookup_url.empty()) - { - nameMap["experience_ids"]="Contrib_Experiences_Tab"; - LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); - } + updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); lookup_url = region->getCapability("AgentExperiences"); if(!lookup_url.empty()) @@ -308,6 +298,24 @@ void LLFloaterExperiences::onClose( bool app_quitting ) void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const { panel->enableButton(content.has("purchase")); + + LLFloaterExperiences::findInstance()->updateInfo("GetAdminExperiences","Admin_Experiences_Tab"); + LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab"); +} + +void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + LLExperienceListResponder::NameMap nameMap; + std::string lookup_url = region->getCapability(experiences); + if(!lookup_url.empty()) + { + nameMap["experience_ids"]=tab; + LLHTTPClient::get(lookup_url, new LLExperienceListResponder(getDerivedHandle(), nameMap)); + } + } } void LLFloaterExperiences::sendPurchaseRequest() const @@ -325,3 +333,8 @@ void LLFloaterExperiences::sendPurchaseRequest() const LLHTTPClient::post(url, content, responder); } } + +LLFloaterExperiences* LLFloaterExperiences::findInstance() +{ + return LLFloaterReg::findTypedInstance("experiences"); +} diff --git a/indra/newview/llfloaterexperiences.h b/indra/newview/llfloaterexperiences.h index f1a0f49245..769283ff07 100644 --- a/indra/newview/llfloaterexperiences.h +++ b/indra/newview/llfloaterexperiences.h @@ -39,6 +39,7 @@ public: virtual void onClose(bool app_quitting); virtual void onOpen(const LLSD& key); + static LLFloaterExperiences* findInstance(); protected: void clearFromRecent(const LLSD& ids); void resizeToTabs(); @@ -50,6 +51,7 @@ protected: bool updatePermissions(const LLSD& permission); void sendPurchaseRequest() const; void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const; + void updateInfo(std::string experiences, std::string tab); private: -- cgit v1.2.3