diff --git a/indra/newview/fspanelprofile.cpp b/indra/newview/fspanelprofile.cpp index 93097800e2..2826870487 100644 --- a/indra/newview/fspanelprofile.cpp +++ b/indra/newview/fspanelprofile.cpp @@ -1577,12 +1577,17 @@ std::string FSPanelPick::createLocationText(const std::string& owner_name, const ////////////////////////////////////////////////////////////////////////// FSPanelProfilePicks::FSPanelProfilePicks() - : FSPanelProfileTab() + : FSPanelProfileTab(), + mRlvBehaviorCallbackConnection() { } FSPanelProfilePicks::~FSPanelProfilePicks() { + if (mRlvBehaviorCallbackConnection.connected()) + { + mRlvBehaviorCallbackConnection.disconnect(); + } } void FSPanelProfilePicks::onOpen(const LLSD& key) @@ -1611,6 +1616,9 @@ BOOL FSPanelProfilePicks::postBuild() mNewButton->setCommitCallback(boost::bind(&FSPanelProfilePicks::onClickNewBtn, this)); mDeleteButton->setCommitCallback(boost::bind(&FSPanelProfilePicks::onClickDelete, this)); + mRlvBehaviorCallbackConnection = gRlvHandler.setBehaviourCallback(boost::bind(&FSPanelProfilePicks::updateRlvRestrictions, this, _1, _2)); + mNewButton->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + return TRUE; } @@ -1768,6 +1776,14 @@ void FSPanelProfilePicks::updateData() } } +void FSPanelProfilePicks::updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type) +{ + if (behavior == RLV_BHVR_SHOWLOC) + { + mNewButton->setEnabled(type != RLV_TYPE_ADD); + } +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/fspanelprofile.h b/indra/newview/fspanelprofile.h index 4fc728994a..829429605a 100644 --- a/indra/newview/fspanelprofile.h +++ b/indra/newview/fspanelprofile.h @@ -536,6 +536,9 @@ private: void onClickDelete(); bool callbackDeletePick(const LLSD& notification, const LLSD& response); + boost::signals2::connection mRlvBehaviorCallbackConnection; + void updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type); + LLTabContainer* mTabContainer; LLUICtrl* mNoItemsLabel; LLButton* mNewButton; diff --git a/indra/newview/fspanelprofileclassifieds.cpp b/indra/newview/fspanelprofileclassifieds.cpp index 75e83359ca..156a25a291 100644 --- a/indra/newview/fspanelprofileclassifieds.cpp +++ b/indra/newview/fspanelprofileclassifieds.cpp @@ -74,7 +74,8 @@ FSPanelClassifieds::FSPanelClassifieds() mPopupMenu(NULL), mClassifiedsList(NULL), mPanelClassifiedInfo(NULL), - mNoClassifieds(false) + mNoClassifieds(false), + mRlvBehaviorCallbackConnection() { } @@ -84,6 +85,11 @@ FSPanelClassifieds::~FSPanelClassifieds() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } + + if (mRlvBehaviorCallbackConnection.connected()) + { + mRlvBehaviorCallbackConnection.disconnect(); + } } void* FSPanelClassifieds::create(void* data /* = NULL */) @@ -182,11 +188,12 @@ BOOL FSPanelClassifieds::postBuild() mNoItemsLabel = getChild("picks_panel_text"); + childSetAction(XML_BTN_NEW, boost::bind(&FSPanelClassifieds::createNewClassified, this)); childSetAction(XML_BTN_DELETE, boost::bind(&FSPanelClassifieds::onClickDelete, this)); childSetAction(XML_BTN_TELEPORT, boost::bind(&FSPanelClassifieds::onClickTeleport, this)); childSetAction(XML_BTN_SHOW_ON_MAP, boost::bind(&FSPanelClassifieds::onClickMap, this)); childSetAction(XML_BTN_INFO, boost::bind(&FSPanelClassifieds::onClickInfo, this)); - + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; registar.add("Classified.Info", boost::bind(&FSPanelClassifieds::onClickInfo, this)); registar.add("Classified.Edit", boost::bind(&FSPanelClassifieds::onClickMenuEdit, this)); @@ -197,9 +204,10 @@ BOOL FSPanelClassifieds::postBuild() enable_registar.add("Classified.Enable", boost::bind(&FSPanelClassifieds::onEnableMenuItem, this, _2)); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_classifieds.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - - childSetAction(XML_BTN_NEW, boost::bind(&FSPanelClassifieds::createNewClassified, this)); - + + mRlvBehaviorCallbackConnection = gRlvHandler.setBehaviourCallback(boost::bind(&FSPanelClassifieds::updateRlvRestrictions, this, _1, _2)); + childSetEnabled(XML_BTN_NEW, !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + return TRUE; } @@ -659,6 +667,15 @@ void FSPanelClassifieds::closePanel(LLPanel* panel) } } +void FSPanelClassifieds::updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type) +{ + if (behavior == RLV_BHVR_SHOWLOC) + { + childSetEnabled(XML_BTN_NEW, type != RLV_TYPE_ADD); + } +} + + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/fspanelprofileclassifieds.h b/indra/newview/fspanelprofileclassifieds.h index 55af21fe5e..738352af0d 100644 --- a/indra/newview/fspanelprofileclassifieds.h +++ b/indra/newview/fspanelprofileclassifieds.h @@ -85,6 +85,9 @@ private: void onListCommit(const LLFlatListView* f_list); + boost::signals2::connection mRlvBehaviorCallbackConnection; + void updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type); + //------------------------------------------------ // Callbacks which require panel toggling //------------------------------------------------ diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index d73a5b402e..9caa748fc6 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -54,6 +54,8 @@ #include "llpanelpick.h" #include "llpanelclassified.h" +#include "rlvhandler.h" + static const std::string XML_BTN_NEW = "new_btn"; static const std::string XML_BTN_DELETE = "trash_btn"; static const std::string XML_BTN_INFO = "info_btn"; @@ -341,7 +343,8 @@ LLPanelPicks::LLPanelPicks() mClassifiedsAccTab(NULL), mPanelClassifiedInfo(NULL), mNoClassifieds(false), - mNoPicks(false) + mNoPicks(false), + mRlvBehaviorCallbackConnection() // FIRE-15556: Picks can circumvent RLVa @showloc restriction { } @@ -351,6 +354,13 @@ LLPanelPicks::~LLPanelPicks() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } + + // FIRE-15556: Picks can circumvent RLVa @showloc restriction + if (mRlvBehaviorCallbackConnection.connected()) + { + mRlvBehaviorCallbackConnection.disconnect(); + } + // } void* LLPanelPicks::create(void* data /* = NULL */) @@ -551,6 +561,11 @@ BOOL LLPanelPicks::postBuild() mEnableCallbackRegistrar.add("Picks.Plus.Enable", boost::bind(&LLPanelPicks::isActionEnabled, this, _2)); mPlusMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_picks_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + // FIRE-15556: Picks can circumvent RLVa @showloc restriction + mRlvBehaviorCallbackConnection = gRlvHandler.setBehaviourCallback(boost::bind(&LLPanelPicks::updateRlvRestrictions, this, _1, _2)); + childSetEnabled(XML_BTN_NEW, !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + // + return TRUE; } @@ -1226,6 +1241,16 @@ inline LLPanelProfile* LLPanelPicks::getProfilePanel() return mProfilePanel; } +// FIRE-15556: Picks can circumvent RLVa @showloc restriction +void LLPanelPicks::updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type) +{ + if (behavior == RLV_BHVR_SHOWLOC) + { + childSetEnabled(XML_BTN_NEW, type != RLV_TYPE_ADD); + } +} +// + //----------------------------------------------------------------------------- // LLPanelPicks //----------------------------------------------------------------------------- diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index 3bb7413ac3..78b26ba187 100755 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -33,6 +33,7 @@ #include "llavatarpropertiesprocessor.h" #include "llpanelavatar.h" #include "llregistry.h" +#include "rlvdefines.h" class LLAccordionCtrlTab; class LLPanelProfile; @@ -101,6 +102,11 @@ private: void onListCommit(const LLFlatListView* f_list); void onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab); + // FIRE-15556: Picks can circumvent RLVa @showloc restriction + boost::signals2::connection mRlvBehaviorCallbackConnection; + void updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type); + // + //------------------------------------------------ // Callbacks which require panel toggling //------------------------------------------------