SL-15144 FIXED The "Remove" button is enabled with no selection

meow-7.2.2
Mnikolenko Productengine 2021-04-23 14:56:01 +03:00
parent a391cf9cbc
commit 70bc98c4b0
5 changed files with 15 additions and 2 deletions

View File

@ -285,6 +285,10 @@ LLToggleableMenu* LLLandmarksPanel::getCreateMenu()
void LLLandmarksPanel::updateVerbs()
{
if (sRemoveBtn)
{
sRemoveBtn->setEnabled(isActionEnabled("delete") && (isFolderSelected() || isLandmarkSelected()));
}
}
void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus)
@ -425,6 +429,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list
{
inventory_list->getFilter().setEmptyLookupMessage("PlacesNoMatchingItems");
inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK);
inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::updateVerbs, this));
inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate");
@ -1032,6 +1037,7 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg
break;
}
updateVerbs();
return true;
}

View File

@ -1229,6 +1229,9 @@ void LLPanelPlaces::createTabs()
// favorites and inventory can remove items, history can clear history
childSetVisible("trash_btn_panel", TRUE);
mActivePanel->setRemoveBtn(mRemoveSelectedBtn);
mActivePanel->updateVerbs();
}
mTabsCreated = true;

View File

@ -38,6 +38,7 @@
#include "llworldmap.h"
std::string LLPanelPlacesTab::sFilterSubString = LLStringUtil::null;
LLButton* LLPanelPlacesTab::sRemoveBtn = NULL;
bool LLPanelPlacesTab::isTabVisible()
{

View File

@ -67,9 +67,12 @@ public:
const std::string& getFilterSubString() { return sFilterSubString; }
void setFilterSubString(const std::string& string) { sFilterSubString = string; }
void setRemoveBtn(LLButton* trash_btn) { sRemoveBtn = trash_btn; }
protected:
// Search string for filtering landmarks and teleport history locations
static std::string sFilterSubString;
static LLButton* sRemoveBtn;
};
#endif //LL_LLPANELPLACESTAB_H

View File

@ -570,9 +570,9 @@ void LLTeleportHistoryPanel::updateVerbs()
if (!isTabVisible())
return;
if (!mLastSelectedFlatlList)
if (sRemoveBtn)
{
return;
sRemoveBtn->setEnabled(true);
}
}