A Name List that's double clicked should open a profile

Unless other behavior already exists, name lists aren't all scroll lists,
void where prohibited, other restrictions may apply.
This commit is contained in:
Liru Færs
2019-08-25 17:02:48 -04:00
parent a399bd7b62
commit 2c3e37024e
6 changed files with 21 additions and 45 deletions

View File

@@ -40,7 +40,6 @@
#include "lluictrlfactory.h"
// project include
#include "llavataractions.h"
#include "llfloateravatarpicker.h"
#include "llgroupactions.h"
#include "llmutelist.h"
@@ -187,22 +186,6 @@ LLFloaterMute::LLFloaterMute(const LLSD& seed)
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mute.xml", NULL, FALSE);
}
void LLFloaterMute::showProfile() const
{
if (const auto item = mMuteList->getFirstSelected())
{
const auto type = item->getColumn(0)->getValue().asString();
if (type == mAvatarIcon->getName())
{
LLAvatarActions::showProfile(item->getUUID());
}
else if (type == mGroupIcon->getName())
{
LLGroupActions::show(item->getUUID());
}
}
}
BOOL LLFloaterMute::postBuild()
{
childSetCommitCallback("mutes", boost::bind(&LLFloaterMute::updateButtons, this));
@@ -217,7 +200,6 @@ BOOL LLFloaterMute::postBuild()
mMuteList = getChild<LLNameListCtrl>("mutes");
mMuteList->setCommitOnSelectionChange(TRUE);
mMuteList->setDoubleClickCallback(boost::bind(&LLFloaterMute::showProfile, this));
LLMuteList::getInstance()->addObserver(this);

View File

@@ -33,6 +33,8 @@
#include "llavatarnamecache.h"
#include "llcachename.h"
#include "llagent.h"
#include "llavataractions.h"
#include "llgroupactions.h"
#include "llinventory.h"
#include "llscrolllistitem.h"
#include "llscrolllistcolumn.h"
@@ -121,6 +123,24 @@ BOOL LLNameListCtrl::handleDragAndDrop(
return handled;
}
BOOL LLNameListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
{
bool handled = LLScrollListCtrl::handleDoubleClick(x, y, mask);
if (!handled)
{
if (auto item = static_cast<LLNameListItem*>(hitItem(x, y)))
{
switch (item->getNameType())
{
case LLNameListItem::INDIVIDUAL: LLAvatarActions::showProfile(item->getValue()); break;
case LLNameListItem::GROUP: LLGroupActions::show(item->getValue()); break;
default: return false;
}
handled = true;
}
}
return handled;
}
// public
void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos,

View File

@@ -147,6 +147,7 @@ public:
BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept,
std::string& tooltip_msg);
BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override;
void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; }

View File

@@ -43,7 +43,6 @@
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "lldbstrings.h"
#include "llavataractions.h"
#include "llgroupactions.h"
#include "llimview.h"
#include "lllineeditor.h"
@@ -159,10 +158,6 @@ BOOL LLPanelGroupGeneral::postBuild()
mFounderName = getChild<LLNameBox>("founder_name");
mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
if (mListVisibleMembers)
{
mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers), false));
}
// Options
mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);

View File

@@ -34,7 +34,6 @@
#include "llcheckboxctrl.h"
#include "llagent.h"
#include "llavataractions.h"
#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llfiltereditor.h"
@@ -860,8 +859,6 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
// We want to be notified whenever a member is selected.
mMembersList->setCommitOnSelectionChange(TRUE);
mMembersList->setCommitCallback(boost::bind(&LLPanelGroupMembersSubTab::onMemberSelect,_1,this));
// Show the member's profile on double click.
mMembersList->setDoubleClickCallback(boost::bind(&LLPanelGroupMembersSubTab::onMemberDoubleClick,this));
LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
if ( button )
@@ -1150,13 +1147,6 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
mEjectBtn->setEnabled(can_eject_members);
}
// static
void LLPanelGroupMembersSubTab::onMemberDoubleClick(void* user_data)
{
LLPanelGroupMembersSubTab* self = static_cast<LLPanelGroupMembersSubTab*>(user_data);
self->handleMemberDoubleClick();
}
//static
void LLPanelGroupMembersSubTab::onInviteMember(void *userdata)
{
@@ -1334,15 +1324,6 @@ void LLPanelGroupMembersSubTab::onRoleCheck(LLUICtrl* ctrl, void* user_data)
}
}
void LLPanelGroupMembersSubTab::handleMemberDoubleClick()
{
LLScrollListItem* selected = mMembersList->getFirstSelected();
if (selected)
{
LLAvatarActions::showProfile(selected->getUUID());
}
}
void LLPanelGroupMembersSubTab::activate()
{
LLPanelGroupSubTab::activate();

View File

@@ -175,9 +175,6 @@ public:
static void onMemberSelect(LLUICtrl*, void*);
void handleMemberSelect();
static void onMemberDoubleClick(void*);
void handleMemberDoubleClick();
static void onInviteMember(void*);
void handleInviteMember();