CHUI-470 : Fixed : Enable contextual menu in torn off conversations

meow-7.2.2
Merov Linden 2012-11-19 18:41:52 -08:00
parent 61f3c1b41d
commit 834ded33ae
6 changed files with 54 additions and 6 deletions

View File

@ -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();

View File

@ -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)
{

View File

@ -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);

View File

@ -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());
}
}

View File

@ -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;

View File

@ -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;
}