diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 066cb71677..e9509d12b4 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -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()); + // Blocklist multi selection + //LLBlockedListItem* item = getBlockedItem(); + //action_enabled = item && (LLMute::AGENT == item->getType()); + + std::vector panels; + getSelectedItems(panels); + if (panels.size() == 1) + { + LLBlockedListItem* item = dynamic_cast(panels.front()); + action_enabled = item && (LLMute::AGENT == item->getType()); + } + else + { + action_enabled = false; + } + // } if ("unblock_item" == command_name) @@ -216,16 +230,34 @@ void LLBlockList::onCustomAction(const LLSD& userdata) return; } - LLBlockedListItem* item = getBlockedItem(); + // 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); + // Blocklist multi selection + //LLMute mute(item->getUUID(), item->getName()); + //LLMuteList::getInstance()->remove(mute); + + std::vector panels; + getSelectedItems(panels); + for (std::vector::iterator it = panels.begin(); it != panels.end(); ++it) + { + LLBlockedListItem* item = dynamic_cast(*it); + if (item) + { + LLMute mute(item->getUUID(), item->getName()); + LLMuteList::getInstance()->remove(mute); + } + } + // } else if ("profile_item" == command_name) { + // Blocklist multi selection + LLBlockedListItem* item = getBlockedItem(); + switch(item->getType()) { diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 115114bb53..6dbfc68084 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -78,6 +78,10 @@ BOOL LLPanelBlockedList::postBuild() { mBlockedList = getChild("blocked"); mBlockedList->setCommitOnSelectionChange(TRUE); + // Performance tweak + mBlockedList->setCommitCallback(boost::bind(&LLPanelBlockedList::onSelectionChanged, this)); + // 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(); + // Performance tweak + //updateButtons(); LLPanel::draw(); } @@ -123,13 +128,26 @@ void LLPanelBlockedList::onOpen(const LLSD& key) void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id) { + // 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)); + // 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)); + } + // } @@ -145,12 +163,27 @@ void LLPanelBlockedList::updateButtons() void LLPanelBlockedList::unblockItem() { - LLBlockedListItem* item = mBlockedList->getBlockedItem(); - if (item) + // Blocklist multi selection + //LLBlockedListItem* item = mBlockedList->getBlockedItem(); + //if (item) + //{ + // LLMute mute(item->getUUID(), item->getName()); + // LLMuteList::instance().remove(mute); + //} + + std::vector panels; + mBlockedList->getSelectedItems(panels); + for (std::vector::iterator it = panels.begin(); it != panels.end(); ++it) { - LLMute mute(item->getUUID(), item->getName()); - LLMuteList::instance().remove(mute); + LLBlockedListItem* item = dynamic_cast(*it); + if (item) + { + LLMute mute(item->getUUID(), item->getName()); + LLMuteList::getInstance()->remove(mute); + } } + onSelectionChanged(); + // } void LLPanelBlockedList::onCustomAction(const LLSD& userdata) @@ -225,6 +258,13 @@ void LLPanelBlockedList::onFilterEdit(const std::string& search_string) mBlockedList->setNameFilter(filter); } +// Performance tweak +void LLPanelBlockedList::onSelectionChanged() +{ + updateButtons(); +} +// + void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector names) { if (names.empty() || ids.empty()) return; diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 07f0437656..e55fdf668a 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -70,6 +70,9 @@ private: void blockObjectByName(); void onFilterEdit(const std::string& search_string); + // Performance tweak + void onSelectionChanged(); + // List commnads void onCustomAction(const LLSD& userdata); BOOL isActionChecked(const LLSD& userdata);