Refresh buttons in contacts floater if relevant RLV restrictions change

Ansariel 2014-07-18 14:32:50 +02:00
parent aae467dbba
commit 06a5240add
2 changed files with 25 additions and 7 deletions

View File

@ -51,7 +51,6 @@
#include "llvoiceclient.h"
#include "fscommon.h"
#include "llviewermenu.h"
#include "rlvhandler.h"
//Maximum number of people you can select to do an operation on at once.
const U32 MAX_FRIEND_SELECT = 20;
@ -166,6 +165,8 @@ BOOL FSFloaterContacts::postBuild()
mGroupsTab->childSetAction("invite_btn", boost::bind(&FSFloaterContacts::onGroupInviteButtonClicked, this));
mGroupsTab->setDefaultBtn("chat_btn");
gRlvHandler.setBehaviourCallback(boost::bind(&FSFloaterContacts::updateRlvRestrictions, this, _1));
return TRUE;
}
@ -462,11 +463,7 @@ void FSFloaterContacts::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
if (cur_tab == FRIENDS_TAB_NAME)
{
std::vector<LLScrollListItem*> selected = mFriendsList->getAllSelected();
for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
{
selected_uuids.push_back((*itr)->getUUID());
}
getCurrentFriendItemIDs(selected_uuids);
}
else if (cur_tab == GROUP_TAB_NAME)
{
@ -474,6 +471,15 @@ void FSFloaterContacts::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
}
}
void FSFloaterContacts::getCurrentFriendItemIDs(uuid_vec_t& selected_uuids) const
{
std::vector<LLScrollListItem*> selected = mFriendsList->getAllSelected();
for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
{
selected_uuids.push_back((*itr)->getUUID());
}
}
void FSFloaterContacts::sortFriendList()
{
mFriendsList->updateLineHeight();
@ -697,7 +703,7 @@ void FSFloaterContacts::updateFriendItem(const LLUUID& agent_id, const LLRelatio
void FSFloaterContacts::refreshRightsChangeList()
{
uuid_vec_t friends;
getCurrentItemIDs(friends);
getCurrentFriendItemIDs(friends);
size_t num_selected = friends.size();
@ -999,4 +1005,12 @@ void FSFloaterContacts::childShowTab(const std::string& id, const std::string& t
child->selectTabByName(tabname);
}
void FSFloaterContacts::updateRlvRestrictions(ERlvBehaviour behavior)
{
if (behavior == RLV_BHVR_SHOWLOC ||
behavior == RLV_BHVR_SHOWWORLDMAP)
{
refreshUI();
}
}
// EOF

View File

@ -30,6 +30,7 @@
#define FS_FLOATERCONTACTS_H
#include "llfloater.h"
#include "rlvhandler.h"
class LLAvatarList;
class LLAvatarName;
@ -73,6 +74,7 @@ private:
std::string getActiveTabName() const;
LLUUID getCurrentItemID() const;
void getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
void getCurrentFriendItemIDs(uuid_vec_t& selected_uuids) const;
void onAvatarListDoubleClicked(LLUICtrl* ctrl);
enum FRIENDS_COLUMN_ORDER
@ -142,6 +144,8 @@ private:
std::string mFriendListFontName;
void childShowTab(const std::string& id, const std::string& tabname);
void updateRlvRestrictions(ERlvBehaviour behavior);
};