Disable buttons/menu items in places/teleport history if their actions are denied due to RLVa restrictions

meow-7.2.2
Ansariel 2021-12-15 09:49:25 +01:00
parent 18aa775e23
commit 049fd7f0ab
3 changed files with 37 additions and 8 deletions

View File

@ -57,6 +57,7 @@
#include "llviewerregion.h"
#include "fsfloaterplacedetails.h"
// [RLVa:KB]
#include "rlvactions.h"
#include "rlvhandler.h"
// [/RLVa:KB]
@ -753,7 +754,9 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
if (asset_uuid.isNull()) return false;
// Disable "Show on Map" if landmark loading is in progress.
return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid);
// <FS:Ansariel> RLVa fix
//return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid);
return !gLandmarkList.isAssetInLoadedCallbackMap(asset_uuid) && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP);
}
else if ("rename" == command_name)
{
@ -762,6 +765,12 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
return canItemBeModified(command_name, selected_item);
}
// <FS:Ansariel> RLVa fix
else if ("teleport" == command_name)
{
return !gRlvHandler.hasBehaviour(RLV_BHVR_TPLM);
}
// </FS:Ansariel>
return true;
}

View File

@ -79,6 +79,7 @@
#include "fsfloaterplacedetails.h"
#include "fscommon.h"
#include "rlvactions.h"
#include "rlvhandler.h"
// Constants
static const F32 PLACE_INFO_UPDATE_INTERVAL = 3.0;
@ -1395,6 +1396,7 @@ void LLPanelPlaces::updateVerbs()
mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
// <FS:Ansariel> FIRE-31033: Keep Teleport/Map/Profile buttons on places floater
mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn && !is_pick_panel_visible);
mShowOnMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP));
bool show_options_btn = is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn;
mOverflowBtn->setVisible(show_options_btn);
@ -1417,13 +1419,18 @@ void LLPanelPlaces::updateVerbs()
}
// <FS:Ansariel> FIRE-9536: Teleport button disabled if standalone TP history & sidepanel TP history detail
//else if (mPlaceInfoType == LANDMARK_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE)
else if (mPlaceInfoType == LANDMARK_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE || mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
//{
// mTeleportBtn->setEnabled(have_3d_pos);
//}
else if (mPlaceInfoType == LANDMARK_INFO_TYPE)
{
// <FS:Ansariel> FIRE-21863: TP restrictions can be circumvented via parcel SLURL
//mTeleportBtn->setEnabled(have_3d_pos);
mTeleportBtn->setEnabled(have_3d_pos && RlvActions::canTeleportToLocation());
// </FS:Ansariel>
mTeleportBtn->setEnabled(have_3d_pos && !gRlvHandler.hasBehaviour(RLV_BHVR_TPLM));
}
else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE || mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE)
{
mTeleportBtn->setEnabled(have_3d_pos && RlvActions::canTeleportToLocation());
}
// </FS:Ansariel>
}
else
{

View File

@ -50,6 +50,8 @@
#include <boost/algorithm/string/replace.hpp>
//</FS:Beq>
#include "llviewercontrol.h"
#include "rlvactions.h"
#include "rlvhandler.h"
#include "fsfloaterplacedetails.h"
@ -673,9 +675,9 @@ void LLTeleportHistoryPanel::updateVerbs()
LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
mTeleportBtn->setEnabled(NULL != itemp);
mTeleportBtn->setEnabled(NULL != itemp && RlvActions::canTeleportToLocation());
mShowProfile->setEnabled(NULL != itemp);
mShowOnMapBtn->setEnabled(NULL != itemp);
mShowOnMapBtn->setEnabled(NULL != itemp && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP));
// </FS:Ansariel>
}
@ -1318,6 +1320,17 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
return false;
}
LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
// <FS:Ansariel> RLVa fix
if ("teleport" == command_name)
{
return itemp && RlvActions::canTeleportToLocation();
}
else if ("show_on_map" == command_name)
{
return itemp && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP);
}
// </FS:Ansariel>
return itemp != NULL;
}