summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-11-19 18:41:52 -0800
committerMerov Linden <merov@lindenlab.com>2012-11-19 18:41:52 -0800
commit834ded33ae4926b59074f00c13fa3dbf228a3ba0 (patch)
treeb8bc3bc57b6bf39a4abb1ceba5a3a4c9a96a945a
parent61f3c1b41ddedc16f2026c62600475105621b305 (diff)
CHUI-470 : Fixed : Enable contextual menu in torn off conversations
-rw-r--r--indra/llui/llfolderview.h1
-rw-r--r--indra/newview/llfloaterimcontainer.cpp3
-rw-r--r--indra/newview/llfloaterimcontainer.h11
-rw-r--r--indra/newview/llfloaterimsessiontab.cpp39
-rw-r--r--indra/newview/llfloaterimsessiontab.h4
-rw-r--r--indra/newview/llinventoryfunctions.cpp2
6 files changed, 54 insertions, 6 deletions
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 487391a477..525efe425a 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -148,7 +148,6 @@ public:
virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
virtual std::set<LLFolderViewItem*> getSelectionList() const;
- S32 getNumSelectedItems() { return mSelectedItems.size(); }
// Make sure if ancestor is selected, descendants are not
void sanitizeSelection();
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index aebfdb5bce..65a8aee4ce 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -869,6 +869,7 @@ void LLFloaterIMContainer::getParticipantUUIDs(uuid_vec_t& selected_uuids)
void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec_t& selectedIDS)
{
+ // *TODO : This is where we need to handle a *list* of participant correctly
if(selectedIDS.size() > 0)
{
const LLUUID& userID = selectedIDS.front();
@@ -981,6 +982,8 @@ void LLFloaterIMContainer::doToSelected(const LLSD& userdata)
if(conversationItem != NULL)
{
getParticipantUUIDs(selected_uuids);
+
+ llinfos << "Merov debug : doToSelected, command = " << command << ", name = " << conversationItem->getName() << ", uuid size = " << selected_uuids.size() << llendl;
if(conversationItem->getType() == LLConversationItem::CONV_PARTICIPANT)
{
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index afc8d00174..78c312629d 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -99,6 +99,13 @@ public:
void onNearbyChatClosed();
+ // 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);
+ void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS);
+
private:
typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
avatarID_panel_map_t mSessions;
@@ -127,12 +134,8 @@ private:
void getSelectedUUIDs(uuid_vec_t& selected_uuids);
const LLConversationItem * getCurSelectedViewModelItem();
void getParticipantUUIDs(uuid_vec_t& selected_uuids);
- void doToSelected(const LLSD& userdata);
void doToSelectedConversation(const std::string& command, uuid_vec_t& selectedIDS);
- void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS);
void doToSelectedGroup(const LLSD& userdata);
- bool checkContextMenuItem(const LLSD& userdata);
- bool enableContextMenuItem(const LLSD& userdata);
static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
bool enableModerateContextMenuItem(const std::string& userdata);
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 69b42cdd6d..ef36a485a8 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -69,6 +69,12 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id)
boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2));
mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable",
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.EnableItem", boost::bind(&LLFloaterIMContainer::enableContextMenuItem, floater_container, _2));
+ mCommitCallbackRegistrar.add("Avatar.DoToSelected", boost::bind(&LLFloaterIMSessionTab::doToSelected, this, _2));
}
LLFloaterIMSessionTab::~LLFloaterIMSessionTab()
@@ -395,6 +401,7 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant()
p.view_model = &mConversationViewModel;
p.root = NULL;
p.use_ellipses = true;
+ p.options_menu = "menu_conversation.xml";
mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p);
mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
// Attach that root to the scroller
@@ -763,3 +770,35 @@ bool LLFloaterIMSessionTab::checkIfTornOff()
return isTorn;
}
+
+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();
+ floater_container->doToParticipants(command, selected_uuids);
+}
+
+void LLFloaterIMSessionTab::getSelectedUUIDs(uuid_vec_t& selected_uuids)
+{
+ const std::set<LLFolderViewItem*> selected_items = mConversationsRoot->getSelectionList();
+
+ std::set<LLFolderViewItem*>::const_iterator it = selected_items.begin();
+ const std::set<LLFolderViewItem*>::const_iterator it_end = selected_items.end();
+
+ for (; it != it_end; ++it)
+ {
+ LLConversationItem* conversation_item = static_cast<LLConversationItem *>((*it)->getViewModelItem());
+ selected_uuids.push_back(conversation_item->getUUID());
+ }
+}
+
+
diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h
index b765d121de..5980416dff 100644
--- a/indra/newview/llfloaterimsessiontab.h
+++ b/indra/newview/llfloaterimsessiontab.h
@@ -157,6 +157,10 @@ protected:
LLButton* mCloseBtn;
private:
+ // Handling selection and contextual menu
+ void getSelectedUUIDs(uuid_vec_t& selected_uuids);
+ void doToSelected(const LLSD& userdata);
+
/// Refreshes the floater at a constant rate.
virtual void refresh() = 0;
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 1ae6fd91ce..1426567196 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1068,7 +1068,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
if ("delete" == action)
{
LLSD args;
- args["QUESTION"] = LLTrans::getString(root->getNumSelectedItems() > 1 ? "DeleteItems" : "DeleteItem");
+ args["QUESTION"] = LLTrans::getString(root->getSelectedCount() > 1 ? "DeleteItems" : "DeleteItem");
LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root));
return;
}