FIRE-15556: Picks can circumvent RLVa @showloc restriction

Ansariel 2015-02-14 01:41:37 +01:00
parent 4d32d7bc7d
commit 6bb35cc3b8
6 changed files with 77 additions and 7 deletions

View File

@ -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);
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -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;

View File

@ -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<LLUICtrl>("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<LLContextMenu>("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);
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -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
//------------------------------------------------

View File

@ -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() // <FS:Ansariel> FIRE-15556: Picks can circumvent RLVa @showloc restriction
{
}
@ -351,6 +354,13 @@ LLPanelPicks::~LLPanelPicks()
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
}
// <FS:Ansariel> FIRE-15556: Picks can circumvent RLVa @showloc restriction
if (mRlvBehaviorCallbackConnection.connected())
{
mRlvBehaviorCallbackConnection.disconnect();
}
// </FS:Ansariel>
}
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<LLToggleableMenu>("menu_picks_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
// <FS:Ansariel> 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));
// </FS:Ansariel>
return TRUE;
}
@ -1226,6 +1241,16 @@ inline LLPanelProfile* LLPanelPicks::getProfilePanel()
return mProfilePanel;
}
// <FS:Ansariel> 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);
}
}
// </FS:Ansariel>
//-----------------------------------------------------------------------------
// LLPanelPicks
//-----------------------------------------------------------------------------

View File

@ -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);
// <FS:Ansariel> FIRE-15556: Picks can circumvent RLVa @showloc restriction
boost::signals2::connection mRlvBehaviorCallbackConnection;
void updateRlvRestrictions(ERlvBehaviour behavior, ERlvParamType type);
// </FS:Ansariel>
//------------------------------------------------
// Callbacks which require panel toggling
//------------------------------------------------