From b0cadec6fbd3c8d0ca21d5804061d2ce366b52dc Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 28 Sep 2010 22:14:22 +0300 Subject: STORM-248 FIXED The 'Share' button in My Inventory now respects multiple selection. - The button is now enabled only if all selected items are shareable. (it had checked only one currently selected item) - Eliminated some copy&paste. --- indra/newview/llsidepanelinventory.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 23e96c22fa..1e585ece23 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -311,18 +311,17 @@ bool LLSidepanelInventory::canShare() LLPanelMainInventory* panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); - LLFolderView* root_folder = - panel_main_inventory->getActivePanel()->getRootFolder(); - - LLFolderViewItem* current_item = root_folder->hasVisibleChildren() - ? root_folder->getCurSelectedItem() - : NULL; + if (!panel_main_inventory) + { + llwarns << "Failed to get the main inventory panel" << llendl; + return false; + } - LLInvFVBridge* bridge = current_item - ? dynamic_cast (current_item->getListener()) - : NULL; + LLInventoryPanel* active_panel = panel_main_inventory->getActivePanel(); + // Avoid flicker in the Recent tab while inventory is being loaded. + if (!active_panel->getRootFolder()->hasVisibleChildren()) return false; - return bridge ? bridge->canShare() : false; + return LLAvatarActions::canShareSelectedItems(active_panel); } LLInventoryItem *LLSidepanelInventory::getSelectedItem() -- cgit v1.2.3 From 16a973feea87016bd6dc0154d610e4eedeb1b1cf Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 28 Sep 2010 22:49:45 +0300 Subject: STORM-249 FIXED The Wear button in My Inventory now respects multiple selection. - The button is now enabled only when all selected items can be worn. - Pressing it wears all selected items. --- indra/newview/llsidepanelinventory.cpp | 46 +++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'indra/newview/llsidepanelinventory.cpp') diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 23e96c22fa..5b4c530f06 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -182,8 +182,26 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action) void LLSidepanelInventory::onWearButtonClicked() { - performActionOnSelection("wear"); - performActionOnSelection("attach"); + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); + if (!panel_main_inventory) + { + llassert(panel_main_inventory != NULL); + return; + } + + // Get selected items set. + const std::set selected_uuids_set = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + if (selected_uuids_set.empty()) return; // nothing selected + + // Convert the set to a vector. + uuid_vec_t selected_uuids_vec; + for (std::set::const_iterator it = selected_uuids_set.begin(); it != selected_uuids_set.end(); ++it) + { + selected_uuids_vec.push_back(*it); + } + + // Wear all selected items. + wear_multiple(selected_uuids_vec, true); } void LLSidepanelInventory::onPlayButtonClicked() @@ -286,7 +304,7 @@ void LLSidepanelInventory::updateVerbs() case LLInventoryType::IT_OBJECT: case LLInventoryType::IT_ATTACHMENT: mWearBtn->setVisible(TRUE); - mWearBtn->setEnabled(get_can_item_be_worn(item->getLinkedUUID())); + mWearBtn->setEnabled(canWearSelected()); mShopBtn->setVisible(FALSE); break; case LLInventoryType::IT_SOUND: @@ -325,6 +343,28 @@ bool LLSidepanelInventory::canShare() return bridge ? bridge->canShare() : false; } +bool LLSidepanelInventory::canWearSelected() +{ + LLPanelMainInventory* panel_main_inventory = + mInventoryPanel->findChild("panel_main_inventory"); + + if (!panel_main_inventory) + { + llassert(panel_main_inventory != NULL); + return false; + } + + std::set selected_uuids = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + for (std::set::const_iterator it = selected_uuids.begin(); + it != selected_uuids.end(); + ++it) + { + if (!get_can_item_be_worn(*it)) return false; + } + + return true; +} + LLInventoryItem *LLSidepanelInventory::getSelectedItem() { LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild("panel_main_inventory"); -- cgit v1.2.3