From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/newview/llpanelblockedlist.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelblockedlist.cpp') diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 3a4fc613b7..3c710c7ba0 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -74,7 +74,7 @@ void LLPanelBlockedList::removePicker() } } -BOOL LLPanelBlockedList::postBuild() +bool LLPanelBlockedList::postBuild() { mBlockedList = getChild("blocked"); mBlockedList->setCommitOnSelectionChange(TRUE); @@ -267,7 +267,7 @@ LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName() gFocusMgr.releaseFocusIfNeeded( this ); } -BOOL LLFloaterGetBlockedObjectName::postBuild() +bool LLFloaterGetBlockedObjectName::postBuild() { getChild("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this)); getChild("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this)); @@ -276,17 +276,17 @@ BOOL LLFloaterGetBlockedObjectName::postBuild() return LLFloater::postBuild(); } -BOOL LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) +bool LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) { if (key == KEY_RETURN && mask == MASK_NONE) { applyBlocking(); - return TRUE; + return true; } else if (key == KEY_ESCAPE && mask == MASK_NONE) { cancelBlocking(); - return TRUE; + return true; } return LLFloater::handleKeyHere(key, mask); -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/llpanelblockedlist.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelblockedlist.cpp') diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 3c710c7ba0..1b481dde7d 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -77,7 +77,7 @@ void LLPanelBlockedList::removePicker() bool LLPanelBlockedList::postBuild() { mBlockedList = getChild("blocked"); - mBlockedList->setCommitOnSelectionChange(TRUE); + mBlockedList->setCommitOnSelectionChange(true); this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this)); switch (gSavedSettings.getU32("BlockPeopleSortOrder")) @@ -181,7 +181,7 @@ void LLPanelBlockedList::onCustomAction(const LLSD& userdata) } } -BOOL LLPanelBlockedList::isActionChecked(const LLSD& userdata) +bool LLPanelBlockedList::isActionChecked(const LLSD& userdata) { std::string item = userdata.asString(); U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder"); @@ -200,13 +200,13 @@ BOOL LLPanelBlockedList::isActionChecked(const LLSD& userdata) void LLPanelBlockedList::blockResidentByName() { - const BOOL allow_multiple = FALSE; - const BOOL close_on_select = TRUE; + const bool allow_multiple = false; + const bool close_on_select = true; - LLView * button = findChild("plus_btn", TRUE); + LLView * button = findChild("plus_btn", true); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), - allow_multiple, close_on_select, FALSE, root_floater->getName(), button); + allow_multiple, close_on_select, false, root_floater->getName(), button); if (root_floater) { @@ -243,7 +243,7 @@ void LLPanelBlockedList::callbackBlockByName(const std::string& text) if (text.empty()) return; LLMute mute(LLUUID::null, text, LLMute::BY_NAME); - BOOL success = LLMuteList::getInstance()->add(mute); + bool success = LLMuteList::getInstance()->add(mute); if (!success) { LLNotificationsUtil::add("MuteByNameFailed"); -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/llpanelblockedlist.cpp | 652 +++++++++++++++++------------------ 1 file changed, 326 insertions(+), 326 deletions(-) (limited to 'indra/newview/llpanelblockedlist.cpp') diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 6608b8169d..0de22fce25 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -1,326 +1,326 @@ -/** - * @file llpanelblockedlist.cpp - * @brief Container for blocked Residents & Objects list - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llpanelblockedlist.h" - -// library include -#include "llavatarname.h" -#include "llfiltereditor.h" -#include "llfloater.h" -#include "llfloaterreg.h" -#include "llnotificationsutil.h" -#include "llscrolllistctrl.h" -#include "llmenubutton.h" - -// project include -#include "llavatarlistitem.h" -#include "llblocklist.h" -#include "llblockedlistitem.h" -#include "llfloateravatarpicker.h" -#include "llfloatersidepanelcontainer.h" -#include "llinventorylistitem.h" -#include "llinventorymodel.h" -#include "llsidetraypanelcontainer.h" -#include "llviewercontrol.h" - -static LLPanelInjector t_panel_blocked_list("panel_block_list_sidetray"); - -// -// Constants -// -const std::string BLOCKED_PARAM_NAME = "blocked_to_select"; - -//----------------------------------------------------------------------------- -// LLPanelBlockedList() -//----------------------------------------------------------------------------- - -LLPanelBlockedList::LLPanelBlockedList() -: LLPanel() -{ - mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2)); - mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2)); -} - -void LLPanelBlockedList::removePicker() -{ - if(mPicker.get()) - { - mPicker.get()->closeFloater(); - } -} - -bool LLPanelBlockedList::postBuild() -{ - mBlockedList = getChild("blocked"); - mBlockedList->setCommitOnSelectionChange(true); - this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this)); - - switch (gSavedSettings.getU32("BlockPeopleSortOrder")) - { - case E_SORT_BY_NAME: - mBlockedList->sortByName(); - break; - - case E_SORT_BY_TYPE: - mBlockedList->sortByType(); - break; - default: - LL_WARNS() << "Unrecognized sort order for blocked list" << LL_ENDL; - break; - } - - // Use the context menu of the Block list for the Block tab gear menu. - LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu(); - if (blocked_gear_menu) - { - getChild("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); - } - - getChild("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); - getChild("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2)); - - return LLPanel::postBuild(); -} - -void LLPanelBlockedList::draw() -{ - updateButtons(); - LLPanel::draw(); -} - -void LLPanelBlockedList::onOpen(const LLSD& key) -{ - if (key.has(BLOCKED_PARAM_NAME) && key[BLOCKED_PARAM_NAME].asUUID().notNull()) - { - selectBlocked(key[BLOCKED_PARAM_NAME].asUUID()); - } -} - -void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id) -{ - 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)); -} - - -////////////////////////////////////////////////////////////////////////// -// Private Section -////////////////////////////////////////////////////////////////////////// -void LLPanelBlockedList::updateButtons() -{ - bool hasSelected = NULL != mBlockedList->getSelectedItem(); - getChildView("unblock_btn")->setEnabled(hasSelected); - getChildView("blocked_gear_btn")->setEnabled(hasSelected); - - getChild("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); - getChild("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit"))); -} - -void LLPanelBlockedList::unblockItem() -{ - LLBlockedListItem* item = mBlockedList->getBlockedItem(); - if (item) - { - LLMute mute(item->getUUID(), item->getName()); - LLMuteList::instance().remove(mute); - } -} - -void LLPanelBlockedList::onCustomAction(const LLSD& userdata) -{ - const std::string command_name = userdata.asString(); - - if ("block_obj_by_name" == command_name) - { - blockObjectByName(); - } - else if ("block_res_by_name" == command_name) - { - blockResidentByName(); - } - else if ("sort_by_name" == command_name) - { - mBlockedList->sortByName(); - gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_NAME); - } - else if ("sort_by_type" == command_name) - { - mBlockedList->sortByType(); - gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_TYPE); - } -} - -bool LLPanelBlockedList::isActionChecked(const LLSD& userdata) -{ - std::string item = userdata.asString(); - U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder"); - - if ("sort_by_name" == item) - { - return E_SORT_BY_NAME == sort_order; - } - else if ("sort_by_type" == item) - { - return E_SORT_BY_TYPE == sort_order; - } - - return false; -} - -void LLPanelBlockedList::blockResidentByName() -{ - const bool allow_multiple = false; - const bool close_on_select = true; - - LLView * button = findChild("plus_btn", true); - LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), - allow_multiple, close_on_select, false, root_floater->getName(), button); - - if (root_floater) - { - root_floater->addDependentFloater(picker); - } - - mPicker = picker->getHandle(); -} - -void LLPanelBlockedList::blockObjectByName() -{ - LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName); -} - -void LLPanelBlockedList::onFilterEdit(const std::string& search_string) -{ - std::string filter = search_string; - LLStringUtil::trimHead(filter); - - mBlockedList->setNameFilter(filter); -} - -void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector names) -{ - if (names.empty() || ids.empty()) return; - LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT); - LLMuteList::getInstance()->add(mute); - showPanelAndSelect(mute.mID); -} - -//static -void LLPanelBlockedList::callbackBlockByName(const std::string& text) -{ - if (text.empty()) return; - - LLMute mute(LLUUID::null, text, LLMute::BY_NAME); - bool success = LLMuteList::getInstance()->add(mute); - if (!success) - { - LLNotificationsUtil::add("MuteByNameFailed"); - } -} - -////////////////////////////////////////////////////////////////////////// -// LLFloaterGetBlockedObjectName -////////////////////////////////////////////////////////////////////////// - -// Constructor/Destructor -LLFloaterGetBlockedObjectName::LLFloaterGetBlockedObjectName(const LLSD& key) -: LLFloater(key) -, mGetObjectNameCallback(NULL) -{ -} - -// Destroys the object -LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName() -{ - gFocusMgr.releaseFocusIfNeeded( this ); -} - -bool LLFloaterGetBlockedObjectName::postBuild() -{ - getChild("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this)); - getChild("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this)); - center(); - - return LLFloater::postBuild(); -} - -bool LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) -{ - if (key == KEY_RETURN && mask == MASK_NONE) - { - applyBlocking(); - return true; - } - else if (key == KEY_ESCAPE && mask == MASK_NONE) - { - cancelBlocking(); - return true; - } - - return LLFloater::handleKeyHere(key, mask); -} - -// static -LLFloaterGetBlockedObjectName* LLFloaterGetBlockedObjectName::show(get_object_name_callback_t callback) -{ - LLFloaterGetBlockedObjectName* floater = LLFloaterReg::showTypedInstance("mute_object_by_name"); - - floater->mGetObjectNameCallback = callback; - - // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed? - // old Floater dependency is not enable in panel - // addDependentFloater(floater); - - return floater; -} - -////////////////////////////////////////////////////////////////////////// -// Private Section -void LLFloaterGetBlockedObjectName::applyBlocking() -{ - if (mGetObjectNameCallback) - { - const std::string& text = getChild("object_name")->getValue().asString(); - mGetObjectNameCallback(text); - } - closeFloater(); -} - -void LLFloaterGetBlockedObjectName::cancelBlocking() -{ - closeFloater(); -} - -//EOF +/** + * @file llpanelblockedlist.cpp + * @brief Container for blocked Residents & Objects list + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelblockedlist.h" + +// library include +#include "llavatarname.h" +#include "llfiltereditor.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "llnotificationsutil.h" +#include "llscrolllistctrl.h" +#include "llmenubutton.h" + +// project include +#include "llavatarlistitem.h" +#include "llblocklist.h" +#include "llblockedlistitem.h" +#include "llfloateravatarpicker.h" +#include "llfloatersidepanelcontainer.h" +#include "llinventorylistitem.h" +#include "llinventorymodel.h" +#include "llsidetraypanelcontainer.h" +#include "llviewercontrol.h" + +static LLPanelInjector t_panel_blocked_list("panel_block_list_sidetray"); + +// +// Constants +// +const std::string BLOCKED_PARAM_NAME = "blocked_to_select"; + +//----------------------------------------------------------------------------- +// LLPanelBlockedList() +//----------------------------------------------------------------------------- + +LLPanelBlockedList::LLPanelBlockedList() +: LLPanel() +{ + mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2)); +} + +void LLPanelBlockedList::removePicker() +{ + if(mPicker.get()) + { + mPicker.get()->closeFloater(); + } +} + +bool LLPanelBlockedList::postBuild() +{ + mBlockedList = getChild("blocked"); + mBlockedList->setCommitOnSelectionChange(true); + this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this)); + + switch (gSavedSettings.getU32("BlockPeopleSortOrder")) + { + case E_SORT_BY_NAME: + mBlockedList->sortByName(); + break; + + case E_SORT_BY_TYPE: + mBlockedList->sortByType(); + break; + default: + LL_WARNS() << "Unrecognized sort order for blocked list" << LL_ENDL; + break; + } + + // Use the context menu of the Block list for the Block tab gear menu. + LLToggleableMenu* blocked_gear_menu = mBlockedList->getContextMenu(); + if (blocked_gear_menu) + { + getChild("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + } + + getChild("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this)); + getChild("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2)); + + return LLPanel::postBuild(); +} + +void LLPanelBlockedList::draw() +{ + updateButtons(); + LLPanel::draw(); +} + +void LLPanelBlockedList::onOpen(const LLSD& key) +{ + if (key.has(BLOCKED_PARAM_NAME) && key[BLOCKED_PARAM_NAME].asUUID().notNull()) + { + selectBlocked(key[BLOCKED_PARAM_NAME].asUUID()); + } +} + +void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id) +{ + 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)); +} + + +////////////////////////////////////////////////////////////////////////// +// Private Section +////////////////////////////////////////////////////////////////////////// +void LLPanelBlockedList::updateButtons() +{ + bool hasSelected = NULL != mBlockedList->getSelectedItem(); + getChildView("unblock_btn")->setEnabled(hasSelected); + getChildView("blocked_gear_btn")->setEnabled(hasSelected); + + getChild("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize())); + getChild("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit"))); +} + +void LLPanelBlockedList::unblockItem() +{ + LLBlockedListItem* item = mBlockedList->getBlockedItem(); + if (item) + { + LLMute mute(item->getUUID(), item->getName()); + LLMuteList::instance().remove(mute); + } +} + +void LLPanelBlockedList::onCustomAction(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + + if ("block_obj_by_name" == command_name) + { + blockObjectByName(); + } + else if ("block_res_by_name" == command_name) + { + blockResidentByName(); + } + else if ("sort_by_name" == command_name) + { + mBlockedList->sortByName(); + gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_NAME); + } + else if ("sort_by_type" == command_name) + { + mBlockedList->sortByType(); + gSavedSettings.setU32("BlockPeopleSortOrder", E_SORT_BY_TYPE); + } +} + +bool LLPanelBlockedList::isActionChecked(const LLSD& userdata) +{ + std::string item = userdata.asString(); + U32 sort_order = gSavedSettings.getU32("BlockPeopleSortOrder"); + + if ("sort_by_name" == item) + { + return E_SORT_BY_NAME == sort_order; + } + else if ("sort_by_type" == item) + { + return E_SORT_BY_TYPE == sort_order; + } + + return false; +} + +void LLPanelBlockedList::blockResidentByName() +{ + const bool allow_multiple = false; + const bool close_on_select = true; + + LLView * button = findChild("plus_btn", true); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), + allow_multiple, close_on_select, false, root_floater->getName(), button); + + if (root_floater) + { + root_floater->addDependentFloater(picker); + } + + mPicker = picker->getHandle(); +} + +void LLPanelBlockedList::blockObjectByName() +{ + LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName); +} + +void LLPanelBlockedList::onFilterEdit(const std::string& search_string) +{ + std::string filter = search_string; + LLStringUtil::trimHead(filter); + + mBlockedList->setNameFilter(filter); +} + +void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector names) +{ + if (names.empty() || ids.empty()) return; + LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT); + LLMuteList::getInstance()->add(mute); + showPanelAndSelect(mute.mID); +} + +//static +void LLPanelBlockedList::callbackBlockByName(const std::string& text) +{ + if (text.empty()) return; + + LLMute mute(LLUUID::null, text, LLMute::BY_NAME); + bool success = LLMuteList::getInstance()->add(mute); + if (!success) + { + LLNotificationsUtil::add("MuteByNameFailed"); + } +} + +////////////////////////////////////////////////////////////////////////// +// LLFloaterGetBlockedObjectName +////////////////////////////////////////////////////////////////////////// + +// Constructor/Destructor +LLFloaterGetBlockedObjectName::LLFloaterGetBlockedObjectName(const LLSD& key) +: LLFloater(key) +, mGetObjectNameCallback(NULL) +{ +} + +// Destroys the object +LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName() +{ + gFocusMgr.releaseFocusIfNeeded( this ); +} + +bool LLFloaterGetBlockedObjectName::postBuild() +{ + getChild("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this)); + getChild("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this)); + center(); + + return LLFloater::postBuild(); +} + +bool LLFloaterGetBlockedObjectName::handleKeyHere(KEY key, MASK mask) +{ + if (key == KEY_RETURN && mask == MASK_NONE) + { + applyBlocking(); + return true; + } + else if (key == KEY_ESCAPE && mask == MASK_NONE) + { + cancelBlocking(); + return true; + } + + return LLFloater::handleKeyHere(key, mask); +} + +// static +LLFloaterGetBlockedObjectName* LLFloaterGetBlockedObjectName::show(get_object_name_callback_t callback) +{ + LLFloaterGetBlockedObjectName* floater = LLFloaterReg::showTypedInstance("mute_object_by_name"); + + floater->mGetObjectNameCallback = callback; + + // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed? + // old Floater dependency is not enable in panel + // addDependentFloater(floater); + + return floater; +} + +////////////////////////////////////////////////////////////////////////// +// Private Section +void LLFloaterGetBlockedObjectName::applyBlocking() +{ + if (mGetObjectNameCallback) + { + const std::string& text = getChild("object_name")->getValue().asString(); + mGetObjectNameCallback(text); + } + closeFloater(); +} + +void LLFloaterGetBlockedObjectName::cancelBlocking() +{ + closeFloater(); +} + +//EOF -- cgit v1.2.3