summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelblockedlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelblockedlist.cpp')
-rw-r--r--indra/newview/llpanelblockedlist.cpp280
1 files changed, 140 insertions, 140 deletions
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 3a4fc613b7..5cc567395c 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @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$
*/
@@ -60,10 +60,10 @@ const std::string BLOCKED_PARAM_NAME = "blocked_to_select";
//-----------------------------------------------------------------------------
LLPanelBlockedList::LLPanelBlockedList()
-: LLPanel()
+: LLPanel()
{
- mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2));
- mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2));
+ mCommitCallbackRegistrar.add("Block.Action", boost::bind(&LLPanelBlockedList::onCustomAction, this, _2));
+ mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2));
}
void LLPanelBlockedList::removePicker()
@@ -76,61 +76,61 @@ void LLPanelBlockedList::removePicker()
BOOL LLPanelBlockedList::postBuild()
{
- mBlockedList = getChild<LLBlockList>("blocked");
- mBlockedList->setCommitOnSelectionChange(TRUE);
+ mBlockedList = getChild<LLBlockList>("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<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
- }
-
- getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this));
- getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2));
-
- return LLPanel::postBuild();
+ 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<LLMenuButton>("blocked_gear_btn")->setMenu(blocked_gear_menu, LLMenuButton::MP_BOTTOM_LEFT);
+ }
+
+ getChild<LLButton>("unblock_btn")->setCommitCallback(boost::bind(&LLPanelBlockedList::unblockItem, this));
+ getChild<LLFilterEditor>("blocked_filter_input")->setCommitCallback(boost::bind(&LLPanelBlockedList::onFilterEdit, this, _2));
+
+ return LLPanel::postBuild();
}
void LLPanelBlockedList::draw()
{
- updateButtons();
- LLPanel::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());
- }
+ 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);
+ 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));
+ LLFloaterSidePanelContainer::showPanel("people", "panel_people",
+ LLSD().with("people_panel_tab_name", "blocked_panel").with(BLOCKED_PARAM_NAME, idToSelect));
}
@@ -139,75 +139,75 @@ void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
//////////////////////////////////////////////////////////////////////////
void LLPanelBlockedList::updateButtons()
{
- bool hasSelected = NULL != mBlockedList->getSelectedItem();
- getChildView("unblock_btn")->setEnabled(hasSelected);
- getChildView("blocked_gear_btn")->setEnabled(hasSelected);
+ bool hasSelected = NULL != mBlockedList->getSelectedItem();
+ getChildView("unblock_btn")->setEnabled(hasSelected);
+ getChildView("blocked_gear_btn")->setEnabled(hasSelected);
- getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize()));
- getChild<LLUICtrl>("block_limit")->setTextArg("[LIMIT]", llformat("%d", gSavedSettings.getS32("MuteListLimit")));
+ getChild<LLUICtrl>("block_limit")->setTextArg("[COUNT]", llformat("%d", mBlockedList->getMuteListSize()));
+ getChild<LLUICtrl>("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);
- }
+ 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);
- }
+ 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;
+ 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;
-
+ const BOOL allow_multiple = FALSE;
+ const BOOL close_on_select = TRUE;
+
LLView * button = findChild<LLButton>("plus_btn", TRUE);
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2),
+ 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);
@@ -218,40 +218,40 @@ void LLPanelBlockedList::blockResidentByName()
void LLPanelBlockedList::blockObjectByName()
{
- LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
+ LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
}
void LLPanelBlockedList::onFilterEdit(const std::string& search_string)
{
- std::string filter = search_string;
- LLStringUtil::trimHead(filter);
+ std::string filter = search_string;
+ LLStringUtil::trimHead(filter);
- mBlockedList->setNameFilter(filter);
+ mBlockedList->setNameFilter(filter);
}
void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
{
- if (names.empty() || ids.empty()) return;
+ if (names.empty() || ids.empty()) return;
LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT);
- LLMuteList::getInstance()->add(mute);
- showPanelAndSelect(mute.mID);
+ 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");
- }
+ if (text.empty()) return;
+
+ LLMute mute(LLUUID::null, text, LLMute::BY_NAME);
+ BOOL success = LLMuteList::getInstance()->add(mute);
+ if (!success)
+ {
+ LLNotificationsUtil::add("MuteByNameFailed");
+ }
}
//////////////////////////////////////////////////////////////////////////
-// LLFloaterGetBlockedObjectName
+// LLFloaterGetBlockedObjectName
//////////////////////////////////////////////////////////////////////////
// Constructor/Destructor
@@ -264,63 +264,63 @@ LLFloaterGetBlockedObjectName::LLFloaterGetBlockedObjectName(const LLSD& key)
// Destroys the object
LLFloaterGetBlockedObjectName::~LLFloaterGetBlockedObjectName()
{
- gFocusMgr.releaseFocusIfNeeded( this );
+ gFocusMgr.releaseFocusIfNeeded( this );
}
BOOL LLFloaterGetBlockedObjectName::postBuild()
{
- getChild<LLButton>("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this));
- getChild<LLButton>("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this));
- center();
+ getChild<LLButton>("OK")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::applyBlocking, this));
+ getChild<LLButton>("Cancel")-> setCommitCallback(boost::bind(&LLFloaterGetBlockedObjectName::cancelBlocking, this));
+ center();
- return LLFloater::postBuild();
+ 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);
+ 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<LLFloaterGetBlockedObjectName>("mute_object_by_name");
+ LLFloaterGetBlockedObjectName* floater = LLFloaterReg::showTypedInstance<LLFloaterGetBlockedObjectName>("mute_object_by_name");
- floater->mGetObjectNameCallback = callback;
+ floater->mGetObjectNameCallback = callback;
- // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed?
- // old Floater dependency is not enable in panel
- // addDependentFloater(floater);
+ // *TODO: mantipov: should LLFloaterGetBlockedObjectName be closed when panel is closed?
+ // old Floater dependency is not enable in panel
+ // addDependentFloater(floater);
- return floater;
+ return floater;
}
//////////////////////////////////////////////////////////////////////////
// Private Section
void LLFloaterGetBlockedObjectName::applyBlocking()
{
- if (mGetObjectNameCallback)
- {
- const std::string& text = getChild<LLUICtrl>("object_name")->getValue().asString();
- mGetObjectNameCallback(text);
- }
- closeFloater();
+ if (mGetObjectNameCallback)
+ {
+ const std::string& text = getChild<LLUICtrl>("object_name")->getValue().asString();
+ mGetObjectNameCallback(text);
+ }
+ closeFloater();
}
void LLFloaterGetBlockedObjectName::cancelBlocking()
{
- closeFloater();
+ closeFloater();
}
//EOF