MAINT-2129 "Block" button doesn't become disabled
parent
9ffc67ef84
commit
efa716b5fc
|
|
@ -177,6 +177,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
|
|||
: LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)),
|
||||
mURLClickSignal(NULL),
|
||||
mIsFriendSignal(NULL),
|
||||
mIsObjectBlockedSignal(NULL),
|
||||
mMaxTextByteLength( p.max_text_length ),
|
||||
mFont(p.font),
|
||||
mFontShadow(p.font_shadow),
|
||||
|
|
@ -1942,6 +1943,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
|
|||
registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url));
|
||||
registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url, true));
|
||||
registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url));
|
||||
registrar.add("Url.Unblock", boost::bind(&LLUrlAction::unblockObject, url));
|
||||
registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url));
|
||||
registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url));
|
||||
registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url));
|
||||
|
|
@ -1968,6 +1970,19 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
|
|||
removeFriendButton->setEnabled(isFriend);
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsObjectBlockedSignal)
|
||||
{
|
||||
bool is_blocked = *(*mIsObjectBlockedSignal)(LLUUID(LLUrlAction::getObjectId(url)), LLUrlAction::getObjectName(url));
|
||||
LLView* blockButton = mPopupMenu->getChild<LLView>("block_object");
|
||||
LLView* unblockButton = mPopupMenu->getChild<LLView>("unblock_object");
|
||||
|
||||
if (blockButton && unblockButton)
|
||||
{
|
||||
blockButton->setVisible(!is_blocked);
|
||||
unblockButton->setVisible(is_blocked);
|
||||
}
|
||||
}
|
||||
|
||||
if (mPopupMenu)
|
||||
{
|
||||
|
|
@ -3022,6 +3037,15 @@ boost::signals2::connection LLTextBase::setIsFriendCallback(const is_friend_sign
|
|||
return mIsFriendSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLTextBase::setIsObjectBlockedCallback(const is_blocked_signal_t::slot_type& cb)
|
||||
{
|
||||
if (!mIsObjectBlockedSignal)
|
||||
{
|
||||
mIsObjectBlockedSignal = new is_blocked_signal_t();
|
||||
}
|
||||
return mIsObjectBlockedSignal->connect(cb);
|
||||
}
|
||||
|
||||
//
|
||||
// LLTextSegment
|
||||
//
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ public:
|
|||
friend class LLUICtrlFactory;
|
||||
|
||||
typedef boost::signals2::signal<bool (const LLUUID& user_id)> is_friend_signal_t;
|
||||
typedef boost::signals2::signal<bool (const LLUUID& blocked_id, const std::string from)> is_blocked_signal_t;
|
||||
|
||||
struct LineSpacingParams : public LLInitParam::ChoiceBlock<LineSpacingParams>
|
||||
{
|
||||
|
|
@ -456,6 +457,7 @@ public:
|
|||
virtual void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
|
||||
boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setIsFriendCallback(const is_friend_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setIsObjectBlockedCallback(const is_blocked_signal_t::slot_type& cb);
|
||||
|
||||
void setWordWrap(bool wrap);
|
||||
LLScrollContainer* getScrollContainer() const { return mScroller; }
|
||||
|
|
@ -685,6 +687,7 @@ protected:
|
|||
|
||||
// Used to check if user with given ID is avatar's friend
|
||||
is_friend_signal_t* mIsFriendSignal;
|
||||
is_blocked_signal_t* mIsObjectBlockedSignal;
|
||||
|
||||
LLUIString mLabel; // text label that is visible when no user text provided
|
||||
};
|
||||
|
|
|
|||
|
|
@ -231,3 +231,13 @@ void LLUrlAction::blockObject(std::string url)
|
|||
executeSLURL("secondlife:///app/agent/" + object_id + "/block/" + LLURI::escape(object_name));
|
||||
}
|
||||
}
|
||||
|
||||
void LLUrlAction::unblockObject(std::string url)
|
||||
{
|
||||
std::string object_id = getObjectId(url);
|
||||
std::string object_name = getObjectName(url);
|
||||
if (LLUUID::validate(object_id))
|
||||
{
|
||||
executeSLURL("secondlife:///app/agent/" + object_id + "/unblock/" + object_name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ public:
|
|||
static void addFriend(std::string url);
|
||||
static void removeFriend(std::string url);
|
||||
static void blockObject(std::string url);
|
||||
static void unblockObject(std::string url);
|
||||
|
||||
/// specify the callbacks to enable this class's functionality
|
||||
typedef boost::function<void (const std::string&)> url_callback_t;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,10 @@ public:
|
|||
LLFloaterSidePanelContainer::showPanel("people", "panel_people",
|
||||
LLSD().with("people_panel_tab_name", "blocked_panel").with("blocked_to_select", getAvatarId()));
|
||||
}
|
||||
else if (level == "unblock")
|
||||
{
|
||||
LLMuteList::getInstance()->remove(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
|
||||
}
|
||||
else if (level == "map")
|
||||
{
|
||||
std::string url = "secondlife://" + mObjectData["slurl"].asString();
|
||||
|
|
@ -169,10 +173,14 @@ public:
|
|||
|
||||
}
|
||||
|
||||
bool onObjectIconContextMenuItemEnabled(const LLSD& userdata)
|
||||
bool onObjectIconContextMenuItemVisible(const LLSD& userdata)
|
||||
{
|
||||
std::string level = userdata.asString();
|
||||
if (level == "is_blocked")
|
||||
{
|
||||
return LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat);
|
||||
}
|
||||
else if (level == "not_blocked")
|
||||
{
|
||||
return !LLMuteList::getInstance()->isMuted(getAvatarId(), mFrom, LLMute::flagTextChat);
|
||||
}
|
||||
|
|
@ -285,7 +293,7 @@ public:
|
|||
registrar.add("AvatarIcon.Action", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemClicked, this, _2));
|
||||
registrar_enable.add("AvatarIcon.Check", boost::bind(&LLChatHistoryHeader::onAvatarIconContextMenuItemChecked, this, _2));
|
||||
registrar.add("ObjectIcon.Action", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemClicked, this, _2));
|
||||
registrar_enable.add("ObjectIcon.Enable", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemEnabled, this, _2));
|
||||
registrar_enable.add("ObjectIcon.Visible", boost::bind(&LLChatHistoryHeader::onObjectIconContextMenuItemVisible, this, _2));
|
||||
|
||||
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_avatar_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
mPopupMenuHandleAvatar = menu->getHandle();
|
||||
|
|
@ -730,6 +738,8 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
|
|||
editor_params.trusted_content = false;
|
||||
mEditor = LLUICtrlFactory::create<LLTextEditor>(editor_params, this);
|
||||
mEditor->setIsFriendCallback(LLAvatarActions::isFriend);
|
||||
mEditor->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0));
|
||||
|
||||
}
|
||||
|
||||
LLSD LLChatHistory::getValue() const
|
||||
|
|
|
|||
|
|
@ -176,6 +176,16 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
if (verb == "unblock")
|
||||
{
|
||||
if (params.size() > 2)
|
||||
{
|
||||
const std::string object_name = params[2].asString();
|
||||
LLMute mute(avatar_id, object_name, LLMute::OBJECT);
|
||||
LLMuteList::getInstance()->remove(mute);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
|
|||
mTextBox->setContentTrusted(is_content_trusted);
|
||||
mTextBox->setValue(mNotification->getMessage());
|
||||
mTextBox->setIsFriendCallback(LLAvatarActions::isFriend);
|
||||
mTextBox->setIsObjectBlockedCallback(boost::bind(&LLMuteList::isMuted, LLMuteList::getInstance(), _1, _2, 0));
|
||||
|
||||
// add buttons for a script notification
|
||||
if (mIsTip)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,19 @@
|
|||
<menu_item_call.on_click
|
||||
function="ObjectIcon.Action"
|
||||
parameter="block" />
|
||||
<menu_item_call.on_enable
|
||||
function="ObjectIcon.Enable"
|
||||
<menu_item_call.on_visible
|
||||
function="ObjectIcon.Visible"
|
||||
parameter="not_blocked" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Unblock"
|
||||
layout="topleft"
|
||||
name="Unblock">
|
||||
<menu_item_call.on_click
|
||||
function="ObjectIcon.Action"
|
||||
parameter="unblock" />
|
||||
<menu_item_call.on_visible
|
||||
function="ObjectIcon.Visible"
|
||||
parameter="is_blocked" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@
|
|||
<menu_item_call.on_click
|
||||
function="Url.Block" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Unblock"
|
||||
layout="topleft"
|
||||
name="unblock_object">
|
||||
<menu_item_call.on_click
|
||||
function="Url.Unblock" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft" />
|
||||
<menu_item_call
|
||||
|
|
|
|||
Loading…
Reference in New Issue