CHUI-429 : Completed this though it still doesn't work on Nearby Chat.
parent
a12464b9cb
commit
7ca2508cc2
|
|
@ -98,7 +98,6 @@ LLFloaterIMContainer::~LLFloaterIMContainer()
|
|||
|
||||
void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg)
|
||||
{
|
||||
llinfos << "Merov debug : sessionAdded, uuid = " << session_id << ", name = " << name << llendl;
|
||||
addConversationListItem(session_id);
|
||||
LLFloaterIMSessionTab::addToHost(session_id);
|
||||
}
|
||||
|
|
@ -998,8 +997,6 @@ void LLFloaterIMContainer::doToSelected(const LLSD& userdata)
|
|||
{
|
||||
getParticipantUUIDs(selected_uuids);
|
||||
|
||||
llinfos << "Merov debug : doToSelected, command = " << command << ", name = " << conversationItem->getName() << ", uuid size = " << selected_uuids.size() << llendl;
|
||||
|
||||
if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT)
|
||||
{
|
||||
doToParticipants(command, selected_uuids);
|
||||
|
|
@ -1070,22 +1067,25 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
|
|||
}
|
||||
|
||||
// Handle all other options
|
||||
if (item == std::string("can_block"))
|
||||
if (("can_invite" == item) || ("can_chat_history" == item) || ("can_share" == item) || ("can_pay" == item))
|
||||
{
|
||||
// Those menu items are enable only if a single avatar is selected
|
||||
return is_single_select;
|
||||
}
|
||||
else if ("can_block" == item)
|
||||
{
|
||||
return (is_single_select ? LLAvatarActions::canBlock(single_id) : false);
|
||||
}
|
||||
else if (item == std::string("can_add"))
|
||||
else if ("can_add" == item)
|
||||
{
|
||||
// We can add friends if:
|
||||
// - there is only 1 selected avatar (EXT-7389)
|
||||
// - this avatar is not a friend yet
|
||||
// - this avatar is not already a friend
|
||||
return (is_single_select ? !LLAvatarActions::isFriend(single_id) : false);
|
||||
}
|
||||
else if (item == std::string("can_delete"))
|
||||
else if ("can_delete" == item)
|
||||
{
|
||||
// We can remove friends if:
|
||||
// - there are selected people
|
||||
// - and there are only friends among the selection
|
||||
// We can remove friends if there are only friends among the selection
|
||||
bool result = true;
|
||||
for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id)
|
||||
{
|
||||
|
|
@ -1093,20 +1093,21 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
|
|||
}
|
||||
return result;
|
||||
}
|
||||
else if (item == std::string("can_call"))
|
||||
else if ("can_call" == item)
|
||||
{
|
||||
return LLAvatarActions::canCall();
|
||||
}
|
||||
else if (item == std::string("can_show_on_map"))
|
||||
else if ("can_show_on_map" == item)
|
||||
{
|
||||
return (is_single_select ? (LLAvatarTracker::instance().isBuddyOnline(single_id) && is_agent_mappable(single_id)) || gAgent.isGodlike() : false);
|
||||
}
|
||||
else if (item == std::string("can_offer_teleport"))
|
||||
else if ("can_offer_teleport" == item)
|
||||
{
|
||||
return LLAvatarActions::canOfferTeleport(uuids);
|
||||
}
|
||||
else if ("can_moderate_voice" == item || "can_allow_text_chat" == item || "can_mute" == item || "can_unmute" == item)
|
||||
else if (("can_moderate_voice" == item) || ("can_allow_text_chat" == item) || ("can_mute" == item) || ("can_unmute" == item))
|
||||
{
|
||||
// *TODO : get that out of here...
|
||||
return enableModerateContextMenuItem(item);
|
||||
}
|
||||
|
||||
|
|
@ -1117,14 +1118,19 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
|
|||
bool LLFloaterIMContainer::checkContextMenuItem(const LLSD& userdata)
|
||||
{
|
||||
std::string item = userdata.asString();
|
||||
uuid_vec_t mUUIDs;
|
||||
getParticipantUUIDs(mUUIDs);
|
||||
uuid_vec_t uuids;
|
||||
getParticipantUUIDs(uuids);
|
||||
|
||||
return checkContextMenuItem(item, uuids);
|
||||
}
|
||||
|
||||
if(mUUIDs.size() > 0 )
|
||||
bool LLFloaterIMContainer::checkContextMenuItem(const std::string& item, uuid_vec_t& uuids)
|
||||
{
|
||||
if (uuids.size() == 1)
|
||||
{
|
||||
if ("is_blocked" == item)
|
||||
{
|
||||
return LLAvatarActions::isBlocked(mUUIDs.front());
|
||||
return LLAvatarActions::isBlocked(uuids.front());
|
||||
}
|
||||
else if ("is_allowed_text_chat" == item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,9 +101,7 @@ public:
|
|||
|
||||
// Handling of lists of participants is public so to be common with llfloatersessiontab
|
||||
// *TODO : Find a better place for this.
|
||||
void doToSelected(const LLSD& userdata);
|
||||
bool checkContextMenuItem(const LLSD& userdata);
|
||||
bool enableContextMenuItem(const LLSD& userdata);
|
||||
bool checkContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS);
|
||||
bool enableContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS);
|
||||
void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS);
|
||||
|
||||
|
|
@ -135,6 +133,9 @@ private:
|
|||
void getSelectedUUIDs(uuid_vec_t& selected_uuids);
|
||||
const LLConversationItem * getCurSelectedViewModelItem();
|
||||
void getParticipantUUIDs(uuid_vec_t& selected_uuids);
|
||||
void doToSelected(const LLSD& userdata);
|
||||
bool checkContextMenuItem(const LLSD& userdata);
|
||||
bool enableContextMenuItem(const LLSD& userdata);
|
||||
void doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS);
|
||||
void doToSelectedGroup(const LLSD& userdata);
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ BOOL LLFloaterIMNearbyChat::postBuild()
|
|||
{
|
||||
setIsSingleInstance(TRUE);
|
||||
BOOL result = LLFloaterIMSessionTab::postBuild();
|
||||
|
||||
mInputEditor->setCommitCallback(boost::bind(&LLFloaterIMNearbyChat::onChatBoxCommit, this));
|
||||
mInputEditor->setKeystrokeCallback(boost::bind(&onChatBoxKeystroke, _1, this));
|
||||
mInputEditor->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this));
|
||||
|
|
@ -122,24 +123,24 @@ BOOL LLFloaterIMNearbyChat::postBuild()
|
|||
// mOutputMonitor->setVisible(FALSE);
|
||||
|
||||
// Register for font change notifications
|
||||
LLViewerChat::setFontChangedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatFontChange, this, _1));
|
||||
// LLViewerChat::setFontChangedCallback(boost::bind(&LLFloaterIMNearbyChat::onChatFontChange, this, _1));
|
||||
|
||||
// title must be defined BEFORE call addConversationListItem() because
|
||||
// it is used for show the item's name in the conversations list
|
||||
setTitle(LLTrans::getString("NearbyChatTitle"));
|
||||
|
||||
//for menu
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
// LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
// LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
|
||||
enable_registrar.add("NearbyChat.Check", boost::bind(&LLFloaterIMNearbyChat::onNearbyChatCheckContextMenuItem, this, _2));
|
||||
registrar.add("NearbyChat.Action", boost::bind(&LLFloaterIMNearbyChat::onNearbyChatContextMenuItemClicked, this, _2));
|
||||
// enable_registrar.add("NearbyChat.Check", boost::bind(&LLFloaterIMNearbyChat::onNearbyChatCheckContextMenuItem, this, _2));
|
||||
// registrar.add("NearbyChat.Action", boost::bind(&LLFloaterIMNearbyChat::onNearbyChatContextMenuItemClicked, this, _2));
|
||||
|
||||
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
if(menu)
|
||||
{
|
||||
mPopupMenuHandle = menu->getHandle();
|
||||
}
|
||||
// LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
// if(menu)
|
||||
// {
|
||||
// mPopupMenuHandle = menu->getHandle();
|
||||
// }
|
||||
|
||||
// obsolete, but may be needed for backward compatibility?
|
||||
gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", true);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ private:
|
|||
|
||||
/*virtual*/ void refresh();
|
||||
|
||||
LLHandle<LLView> mPopupMenuHandle;
|
||||
// LLHandle<LLView> mPopupMenuHandle;
|
||||
std::vector<LLChat> mMessageArchive;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
|
|||
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2));
|
||||
|
||||
// Right click menu handling
|
||||
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
|
||||
mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMContainer::checkContextMenuItem, floater_container, _2));
|
||||
mEnableCallbackRegistrar.add("Avatar.CheckItem", boost::bind(&LLFloaterIMSessionTab::checkContextMenuItem, this, _2));
|
||||
mEnableCallbackRegistrar.add("Avatar.EnableItem", boost::bind(&LLFloaterIMSessionTab::enableContextMenuItem, this, _2));
|
||||
mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMSessionTab::doToSelected, this, _2));
|
||||
}
|
||||
|
|
@ -774,35 +773,40 @@ bool LLFloaterIMSessionTab::checkIfTornOff()
|
|||
void LLFloaterIMSessionTab::doToSelected(const LLSD& userdata)
|
||||
{
|
||||
// Get the list of selected items in the tab
|
||||
// Note: By construction, those can only be participants so we do not check if they are sessions or something else
|
||||
std::string command = userdata.asString();
|
||||
uuid_vec_t selected_uuids;
|
||||
getSelectedUUIDs(selected_uuids);
|
||||
|
||||
llinfos << "Merov debug : doToSelected, command = " << command << ", uuid size = " << selected_uuids.size() << llendl;
|
||||
|
||||
// Perform the command (IM, profile, etc...) on the list using the general conversation container method
|
||||
// *TODO : Move this method to LLAvatarActions
|
||||
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
|
||||
// Note: By construction, those can only be participants so we can call doToParticipants() directly
|
||||
floater_container->doToParticipants(command, selected_uuids);
|
||||
}
|
||||
|
||||
bool LLFloaterIMSessionTab::enableContextMenuItem(const LLSD& userdata)
|
||||
{
|
||||
// Get the list of selected items in the tab
|
||||
// Note: By construction, those can only be participants so we do not check if they are sessions or something else
|
||||
std::string command = userdata.asString();
|
||||
uuid_vec_t selected_uuids;
|
||||
getSelectedUUIDs(selected_uuids);
|
||||
|
||||
llinfos << "Merov debug : enableContextMenuItem, command = " << command << ", uuid size = " << selected_uuids.size() << llendl;
|
||||
|
||||
// Perform the command (IM, profile, etc...) on the list using the general conversation container method
|
||||
// *TODO : Move this method to LLAvatarActions
|
||||
// Perform the item enable test on the list using the general conversation container method
|
||||
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
|
||||
return floater_container->enableContextMenuItem(command, selected_uuids);
|
||||
}
|
||||
|
||||
bool LLFloaterIMSessionTab::checkContextMenuItem(const LLSD& userdata)
|
||||
{
|
||||
// Get the list of selected items in the tab
|
||||
std::string command = userdata.asString();
|
||||
uuid_vec_t selected_uuids;
|
||||
getSelectedUUIDs(selected_uuids);
|
||||
|
||||
// Perform the item check on the list using the general conversation container method
|
||||
LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance();
|
||||
return floater_container->checkContextMenuItem(command, selected_uuids);
|
||||
}
|
||||
|
||||
void LLFloaterIMSessionTab::getSelectedUUIDs(uuid_vec_t& selected_uuids)
|
||||
{
|
||||
const std::set<LLFolderViewItem*> selected_items = mConversationsRoot->getSelectionList();
|
||||
|
|
|
|||
|
|
@ -158,9 +158,11 @@ protected:
|
|||
|
||||
private:
|
||||
// Handling selection and contextual menu
|
||||
void getSelectedUUIDs(uuid_vec_t& selected_uuids);
|
||||
void doToSelected(const LLSD& userdata);
|
||||
bool enableContextMenuItem(const LLSD& userdata);
|
||||
bool checkContextMenuItem(const LLSD& userdata);
|
||||
|
||||
void getSelectedUUIDs(uuid_vec_t& selected_uuids);
|
||||
|
||||
/// Refreshes the floater at a constant rate.
|
||||
virtual void refresh() = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue