More blocklist fixing: Don't update buttons on each frame & re-enable multiselection to allow bulk removal of mutes
parent
f77b76071d
commit
a7e871174b
|
|
@ -197,8 +197,22 @@ bool LLBlockList::isActionEnabled(const LLSD& userdata)
|
|||
|
||||
if ("profile_item" == command_name)
|
||||
{
|
||||
LLBlockedListItem* item = getBlockedItem();
|
||||
action_enabled = item && (LLMute::AGENT == item->getType());
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
//LLBlockedListItem* item = getBlockedItem();
|
||||
//action_enabled = item && (LLMute::AGENT == item->getType());
|
||||
|
||||
std::vector<LLPanel*> panels;
|
||||
getSelectedItems(panels);
|
||||
if (panels.size() == 1)
|
||||
{
|
||||
LLBlockedListItem* item = dynamic_cast<LLBlockedListItem*>(panels.front());
|
||||
action_enabled = item && (LLMute::AGENT == item->getType());
|
||||
}
|
||||
else
|
||||
{
|
||||
action_enabled = false;
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
if ("unblock_item" == command_name)
|
||||
|
|
@ -216,16 +230,34 @@ void LLBlockList::onCustomAction(const LLSD& userdata)
|
|||
return;
|
||||
}
|
||||
|
||||
LLBlockedListItem* item = getBlockedItem();
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
//LLBlockedListItem* item = getBlockedItem();
|
||||
const std::string command_name = userdata.asString();
|
||||
|
||||
if ("unblock_item" == command_name)
|
||||
{
|
||||
LLMute mute(item->getUUID(), item->getName());
|
||||
LLMuteList::getInstance()->remove(mute);
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
//LLMute mute(item->getUUID(), item->getName());
|
||||
//LLMuteList::getInstance()->remove(mute);
|
||||
|
||||
std::vector<LLPanel*> panels;
|
||||
getSelectedItems(panels);
|
||||
for (std::vector<LLPanel*>::iterator it = panels.begin(); it != panels.end(); ++it)
|
||||
{
|
||||
LLBlockedListItem* item = dynamic_cast<LLBlockedListItem*>(*it);
|
||||
if (item)
|
||||
{
|
||||
LLMute mute(item->getUUID(), item->getName());
|
||||
LLMuteList::getInstance()->remove(mute);
|
||||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
else if ("profile_item" == command_name)
|
||||
{
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
LLBlockedListItem* item = getBlockedItem();
|
||||
|
||||
switch(item->getType())
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ BOOL LLPanelBlockedList::postBuild()
|
|||
{
|
||||
mBlockedList = getChild<LLBlockList>("blocked");
|
||||
mBlockedList->setCommitOnSelectionChange(TRUE);
|
||||
// <FS:Ansariel> Performance tweak
|
||||
mBlockedList->setCommitCallback(boost::bind(&LLPanelBlockedList::onSelectionChanged, this));
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
mBlockedList->setAllowMultipleSelection(true);
|
||||
this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this));
|
||||
|
||||
switch (gSavedSettings.getU32("BlockPeopleSortOrder"))
|
||||
|
|
@ -109,7 +113,8 @@ BOOL LLPanelBlockedList::postBuild()
|
|||
|
||||
void LLPanelBlockedList::draw()
|
||||
{
|
||||
updateButtons();
|
||||
// <FS:Ansariel> Performance tweak
|
||||
//updateButtons();
|
||||
LLPanel::draw();
|
||||
}
|
||||
|
||||
|
|
@ -123,13 +128,26 @@ void LLPanelBlockedList::onOpen(const LLSD& key)
|
|||
|
||||
void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id)
|
||||
{
|
||||
// <FS:Ansariel> Clear selection first before selecting new
|
||||
mBlockedList->resetSelection();
|
||||
mBlockedList->selectItemByUUID(mute_id);
|
||||
}
|
||||
|
||||
void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
|
||||
{
|
||||
LLFloaterSidePanelContainer::showPanel("people", "panel_people",
|
||||
LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
|
||||
// <FS:Ansariel> Optional standalone blocklist floater
|
||||
//LLFloaterSidePanelContainer::showPanel("people", "panel_people",
|
||||
// LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
|
||||
if (gSavedSettings.getBOOL("FSUseStandaloneBlocklistFloater"))
|
||||
{
|
||||
LLFloaterReg::showInstance("fs_blocklist", LLSD().with(BLOCKED_PARAM_NAME, idToSelect));
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterSidePanelContainer::showPanel("people", "panel_people",
|
||||
LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -145,12 +163,27 @@ void LLPanelBlockedList::updateButtons()
|
|||
|
||||
void LLPanelBlockedList::unblockItem()
|
||||
{
|
||||
LLBlockedListItem* item = mBlockedList->getBlockedItem();
|
||||
if (item)
|
||||
// <FS:Ansariel> Blocklist multi selection
|
||||
//LLBlockedListItem* item = mBlockedList->getBlockedItem();
|
||||
//if (item)
|
||||
//{
|
||||
// LLMute mute(item->getUUID(), item->getName());
|
||||
// LLMuteList::instance().remove(mute);
|
||||
//}
|
||||
|
||||
std::vector<LLPanel*> panels;
|
||||
mBlockedList->getSelectedItems(panels);
|
||||
for (std::vector<LLPanel*>::iterator it = panels.begin(); it != panels.end(); ++it)
|
||||
{
|
||||
LLMute mute(item->getUUID(), item->getName());
|
||||
LLMuteList::instance().remove(mute);
|
||||
LLBlockedListItem* item = dynamic_cast<LLBlockedListItem*>(*it);
|
||||
if (item)
|
||||
{
|
||||
LLMute mute(item->getUUID(), item->getName());
|
||||
LLMuteList::getInstance()->remove(mute);
|
||||
}
|
||||
}
|
||||
onSelectionChanged();
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
void LLPanelBlockedList::onCustomAction(const LLSD& userdata)
|
||||
|
|
@ -225,6 +258,13 @@ void LLPanelBlockedList::onFilterEdit(const std::string& search_string)
|
|||
mBlockedList->setNameFilter(filter);
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Performance tweak
|
||||
void LLPanelBlockedList::onSelectionChanged()
|
||||
{
|
||||
updateButtons();
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
|
||||
{
|
||||
if (names.empty() || ids.empty()) return;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ private:
|
|||
void blockObjectByName();
|
||||
void onFilterEdit(const std::string& search_string);
|
||||
|
||||
// <FS:Ansariel> Performance tweak
|
||||
void onSelectionChanged();
|
||||
|
||||
// List commnads
|
||||
void onCustomAction(const LLSD& userdata);
|
||||
BOOL isActionChecked(const LLSD& userdata);
|
||||
|
|
|
|||
Loading…
Reference in New Issue