From 8c2ccb5ed3b2acdf562acf0c1a180215d49742c8 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 27 Jul 2010 15:59:11 +0300 Subject: EXT-7015 FIXED Avoided wearing item moved to trash. Details: Disabled wear button and hidden related context menu entries if base object of inventory link is in trash. reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/806/ --HG-- branch : product-engine --- indra/newview/lloutfitslist.cpp | 32 +++++++++++++++++++++++++++++++- indra/newview/lloutfitslist.h | 5 +++++ indra/newview/llwearableitemslist.cpp | 15 ++++++++++++--- 3 files changed, 48 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 63ffb80ff2..ccde5be900 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -665,7 +665,14 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata) } if (command_name == "wear") { - return !gAgentWearables.isCOFChangeInProgress(); + if (gAgentWearables.isCOFChangeInProgress()) + { + return false; + } + uuid_vec_t ids; + getSelectedItemsUUIDs(ids); + + return !ids.empty() && !isSelectedInTrash(); } if (command_name == "take_off") { @@ -711,6 +718,29 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const } } +bool LLOutfitsList::isSelectedInTrash() +{ + bool res = false; + const LLUUID trash_id = gInventory.findCategoryUUIDForType( + LLFolderType::FT_TRASH); + + uuid_vec_t selected_uuids; + getSelectedItemsUUIDs(selected_uuids); + + for (uuid_vec_t::const_iterator it = selected_uuids.begin(); it != selected_uuids.end(); it++) + { + const LLInventoryItem* item = gInventory.getItem(*it); + if (item != NULL && gInventory.isObjectDescendentOf( + item->getLinkedUUID(), trash_id)) + { + res = true; + break; + } + } + + return res; +} + boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index d7cf8a8c08..dbb35c4d5f 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -105,6 +105,11 @@ public: void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const; + /** + * Returns true in case any of selected item is in trash. + */ + bool isSelectedInTrash(); + boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb); // Collects selected items from all selected lists and wears them(if possible- adds, else replaces) diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index b614860b74..1ce89b13ac 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -767,6 +767,9 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu U32 n_links = 0; // number of links among the selected items U32 n_editable = 0; // number of editable items among the selected ones + bool item_in_trash = false; + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLUUID id = *it; @@ -802,16 +805,22 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu { ++n_already_worn; } + + // if any in trash + if (!item_in_trash) + { + item_in_trash = gInventory.isObjectDescendentOf(item->getLinkedUUID(), trash_id); + } } // for bool standalone = mParent ? mParent->isStandalone() : false; // *TODO: eliminate multiple traversals over the menu items - setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0); + setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && !item_in_trash); setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0 && n_worn == 0); - setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0); + setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0 && !item_in_trash); setMenuItemEnabled(menu, "wear_add", n_items == 1 && canAddWearable(ids.front()) && n_already_worn != 0); - setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0); + setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && !item_in_trash); //visible only when one item selected and this item is worn setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1); setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1); -- cgit v1.2.3 From 872c7fd9573b9d694b32431d9827dd814dbb8fee Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Tue, 27 Jul 2010 18:00:37 +0300 Subject: Performed necessary refactoring after merge rev. 14093:babb41195f70 --HG-- branch : product-engine --- indra/newview/llinventoryfunctions.cpp | 10 ++++++++++ indra/newview/lloutfitslist.cpp | 23 ----------------------- indra/newview/lloutfitslist.h | 5 ----- indra/newview/llwearableitemslist.cpp | 13 ++++++------- 4 files changed, 16 insertions(+), 35 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index f20acbd016..2517db2678 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -251,6 +251,16 @@ BOOL get_can_item_be_worn(const LLUUID& id) if (!item) return FALSE; + const LLUUID trash_id = gInventory.findCategoryUUIDForType( + LLFolderType::FT_TRASH); + + // item can't be worn if base obj in trash, see EXT-7015 + if (gInventory.isObjectDescendentOf(item->getLinkedUUID(), + trash_id)) + { + return false; + } + switch(item->getType()) { case LLAssetType::AT_OBJECT: diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1ed7ca22f5..c3eee1d1ad 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -723,29 +723,6 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const } } -bool LLOutfitsList::isSelectedInTrash() -{ - bool res = false; - const LLUUID trash_id = gInventory.findCategoryUUIDForType( - LLFolderType::FT_TRASH); - - uuid_vec_t selected_uuids; - getSelectedItemsUUIDs(selected_uuids); - - for (uuid_vec_t::const_iterator it = selected_uuids.begin(); it != selected_uuids.end(); it++) - { - const LLInventoryItem* item = gInventory.getItem(*it); - if (item != NULL && gInventory.isObjectDescendentOf( - item->getLinkedUUID(), trash_id)) - { - res = true; - break; - } - } - - return res; -} - boost::signals2::connection LLOutfitsList::setSelectionChangeCallback(selection_change_callback_t cb) { return mSelectionChangeSignal.connect(cb); diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index af094c28d4..206854b232 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -105,11 +105,6 @@ public: void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const; - /** - * Returns true in case any of selected item is in trash. - */ - bool isSelectedInTrash(); - boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb); // Collects selected items from all selected lists and wears them(if possible- adds, else replaces) diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 98ebd68564..8035cd2d93 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -769,8 +769,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu U32 n_links = 0; // number of links among the selected items U32 n_editable = 0; // number of editable items among the selected ones - bool item_in_trash = false; - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + bool can_be_worn = false; for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -809,20 +808,20 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu } // if any in trash - if (!item_in_trash) + if (!can_be_worn) { - item_in_trash = gInventory.isObjectDescendentOf(item->getLinkedUUID(), trash_id); + can_be_worn = get_can_item_be_worn(item->getLinkedUUID()); } } // for bool standalone = mParent ? mParent->isStandalone() : false; // *TODO: eliminate multiple traversals over the menu items - setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && !item_in_trash); + setMenuItemVisible(menu, "wear_wear", n_already_worn == 0 && n_worn == 0 && can_be_worn); setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0 && n_worn == 0); - setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0 && !item_in_trash); + setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0 && can_be_worn); setMenuItemEnabled(menu, "wear_add", n_items == 1 && canAddWearable(ids.front()) && n_already_worn != 0); - setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && !item_in_trash); + setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0 && can_be_worn); //visible only when one item selected and this item is worn setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1); setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1); -- cgit v1.2.3 From 0156e91c50ec77c92a6971c452a4cfe7a5f2bcab Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 27 Jul 2010 18:30:35 +0300 Subject: EXT-2707 FIXED Fixed incorrectness of coalesced objects icons in inventory. Bug was caused by multiobject's icon name index substitution with ordinary object's one. It happened because index was set depending on asset type in switch that followed "if" which set index for multiobject regardless of its result. - Added returning index icon name inside of "if" block to avoid change of the index by switch for multiobject. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/804/ --HG-- branch : product-engine --- indra/newview/llpanelgroupgeneral.cpp | 20 ++++++++------------ indra/newview/llpanelgroupgeneral.h | 1 - 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 8e1b7ba4d9..2302772803 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -184,8 +184,7 @@ BOOL LLPanelGroupGeneral::postBuild() mComboActiveTitle = getChild("active_title", recurse); if (mComboActiveTitle) { - mComboActiveTitle->setCommitCallback(onCommitTitle, this); - mComboActiveTitle->resetDirty(); + mComboActiveTitle->setCommitCallback(onCommitAny, this); } mIncompleteMemberDataStr = getString("incomplete_member_data_str"); @@ -277,16 +276,6 @@ void LLPanelGroupGeneral::onCommitEnrollment(LLUICtrl* ctrl, void* data) } } -// static -void LLPanelGroupGeneral::onCommitTitle(LLUICtrl* ctrl, void* data) -{ - LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data; - if (self->mGroupID.isNull() || !self->mAllowEdit) return; - LLGroupMgr::getInstance()->sendGroupTitleUpdate(self->mGroupID,self->mComboActiveTitle->getCurrentID()); - self->update(GC_TITLES); - self->mComboActiveTitle->resetDirty(); -} - // static void LLPanelGroupGeneral::onClickInfo(void *userdata) { @@ -356,6 +345,13 @@ void LLPanelGroupGeneral::draw() bool LLPanelGroupGeneral::apply(std::string& mesg) { + if (!mGroupID.isNull() && mAllowEdit && mComboActiveTitle && mComboActiveTitle->isDirty()) + { + LLGroupMgr::getInstance()->sendGroupTitleUpdate(mGroupID,mComboActiveTitle->getCurrentID()); + update(GC_TITLES); + mComboActiveTitle->resetDirty(); + } + BOOL has_power_in_group = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY); if (has_power_in_group || mGroupID.isNull()) diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h index 6f4fa994da..358d353074 100644 --- a/indra/newview/llpanelgroupgeneral.h +++ b/indra/newview/llpanelgroupgeneral.h @@ -77,7 +77,6 @@ private: static void onFocusEdit(LLFocusableElement* ctrl, void* data); static void onCommitAny(LLUICtrl* ctrl, void* data); static void onCommitUserOnly(LLUICtrl* ctrl, void* data); - static void onCommitTitle(LLUICtrl* ctrl, void* data); static void onCommitEnrollment(LLUICtrl* ctrl, void* data); static void onClickInfo(void* userdata); static void onReceiveNotices(LLUICtrl* ctrl, void* data); -- cgit v1.2.3