From 6be708677eee1cad00e618bce7d7e7ba27c7a547 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 28 Oct 2010 12:14:43 +0300 Subject: STORM-459 FIXED Delete outfit confirmation message doesn't appear if use context or gear menu on 'My Outfits' tab Added confirmation dialog before deleting outfit from context menu and gear menu button of My Appearance -> My Outfits - Deleted method that shows confirmation dialog in LLPanelOutfitsInventory. Moved it to the LLOutfitsList. Now confirmation dialog called before calling LLOutfitsList::removeSelected. - Replaced native methods of deleting outfit in gear menu and context menu with LLOutfitsList::removeSelected. --- indra/newview/lloutfitslist.cpp | 35 +++++++++++++++++-------------- indra/newview/lloutfitslist.h | 2 ++ indra/newview/llpaneloutfitsinventory.cpp | 10 --------- indra/newview/llpaneloutfitsinventory.h | 1 - 4 files changed, 21 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 70295259b3..6435126fc0 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -115,7 +115,7 @@ public: registrar.add("Gear.Wear", boost::bind(&LLOutfitListGearMenu::onWear, this)); registrar.add("Gear.TakeOff", boost::bind(&LLOutfitListGearMenu::onTakeOff, this)); registrar.add("Gear.Rename", boost::bind(&LLOutfitListGearMenu::onRename, this)); - registrar.add("Gear.Delete", boost::bind(&LLOutfitListGearMenu::onDelete, this)); + registrar.add("Gear.Delete", boost::bind(&LLOutfitsList::removeSelected, mOutfitList)); registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2)); registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenu::onAdd, this)); @@ -197,15 +197,6 @@ private: } } - void onDelete() - { - const LLUUID& selected_outfit_id = getSelectedOutfitID(); - if (selected_outfit_id.notNull()) - { - remove_category(&gInventory, selected_outfit_id); - } - } - void onCreate(const LLSD& data) { LLWearableType::EType type = LLWearableType::typeNameToType(data.asString()); @@ -260,6 +251,12 @@ private: class LLOutfitContextMenu : public LLListContextMenu { +public: + + LLOutfitContextMenu(LLOutfitsList* outfit_list) + : LLListContextMenu(), + mOutfitList(outfit_list) + {} protected: /* virtual */ LLContextMenu* createMenu() { @@ -275,7 +272,7 @@ protected: boost::bind(&LLAppearanceMgr::takeOffOutfit, &LLAppearanceMgr::instance(), selected_id)); registrar.add("Outfit.Edit", boost::bind(editOutfit)); registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id)); - registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id)); + registrar.add("Outfit.Delete", boost::bind(&LLOutfitsList::removeSelected, mOutfitList)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitContextMenu::onVisible, this, _2)); @@ -338,10 +335,8 @@ protected: LLAppearanceMgr::instance().renameOutfit(outfit_cat_id); } - static void deleteOutfit(const LLUUID& outfit_cat_id) - { - remove_category(&gInventory, outfit_cat_id); - } +private: + LLOutfitsList* mOutfitList; }; ////////////////////////////////////////////////////////////////////////// @@ -358,7 +353,7 @@ LLOutfitsList::LLOutfitsList() mCategoriesObserver = new LLInventoryCategoriesObserver(); mGearMenu = new LLOutfitListGearMenu(this); - mOutfitMenu = new LLOutfitContextMenu(); + mOutfitMenu = new LLOutfitContextMenu(this); } LLOutfitsList::~LLOutfitsList() @@ -635,6 +630,14 @@ void LLOutfitsList::performAction(std::string action) void LLOutfitsList::removeSelected() { + LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLOutfitsList::onOutfitsRemovalConfirmation, this, _1, _2)); +} + +void LLOutfitsList::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 0) return; // canceled + if (mSelectedOutfitUUID.notNull()) { remove_category(&gInventory, mSelectedOutfitUUID); diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 5fecbb83e7..a0598737f1 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -110,6 +110,8 @@ public: private: + void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response); + /** * Wrapper for LLCommonUtils::computeDifference. @see LLCommonUtils::computeDifference */ diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 4f2cfa2bbc..a90f864ae2 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -258,17 +258,7 @@ void LLPanelOutfitsInventory::updateListCommands() void LLPanelOutfitsInventory::onTrashButtonClick() { - LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLPanelOutfitsInventory::onOutfitsRemovalConfirmation, this, _1, _2)); -} - -void LLPanelOutfitsInventory::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return; // canceled - mMyOutfitsPanel->removeSelected(); - updateListCommands(); - updateVerbs(); } bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index f1ca1dbfeb..a7917b457c 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -89,7 +89,6 @@ protected: void onWearButtonClick(); void showGearMenu(); void onTrashButtonClick(); - void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response); bool isActionEnabled(const LLSD& userdata); void setWearablesLoading(bool val); void onWearablesLoaded(); -- cgit v1.2.3