diff options
Diffstat (limited to 'indra/newview/llfloatermyenvironment.cpp')
-rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 89 |
1 files changed, 18 insertions, 71 deletions
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index c0405c106e..891e16a8ef 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -38,9 +38,7 @@ #include "llcheckboxctrl.h" #include "llviewerinventory.h" #include "llenvironment.h" -#include "llnotificationsutil.h" #include "llparcel.h" -#include "lltrans.h" #include "llviewerparcelmgr.h" //========================================================================= @@ -225,13 +223,16 @@ void LLFloaterMyEnvironment::onFilterEdit(const std::string& search_string) mInventoryList->setFilterSubString(search_string); } -void LLFloaterMyEnvironment::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, uuid_vec_t item_ids) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) +void LLFloaterMyEnvironment::onDeleteSelected() { + uuid_vec_t selected; + + getSelectedIds(selected); + if (selected.empty()) + return; + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - for (const LLUUID& itemid : item_ids) + for (const LLUUID& itemid: selected) { LLInventoryItem* inv_item = gInventory.getItem(itemid); @@ -252,27 +253,6 @@ void LLFloaterMyEnvironment::onItemsRemovalConfirmation(const LLSD& notification } gInventory.notifyObservers(); } -} - -void LLFloaterMyEnvironment::onDeleteSelected() -{ - uuid_vec_t selected; - - getSelectedIds(selected); - if (selected.empty()) - return; - - LLSD args; - args["QUESTION"] = LLTrans::getString(selected.size() > 1 ? "DeleteItems" : "DeleteItem"); - LLNotificationsUtil::add( - "DeleteItems", - args, - LLSD(), - [this, selected](const LLSD& notification, const LLSD& response) - { - onItemsRemovalConfirmation(notification, response, selected); - }); -} void LLFloaterMyEnvironment::onDoCreate(const LLSD &data) @@ -338,13 +318,13 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) if (context == PARAMETER_EDIT) { - return (selected.size() == 1) && isSettingId(selected.front()); + return (selected.size() == 1) && isSettingSelected(selected.front()); } else if (context == PARAMETER_COPY) { for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++) { - if(!isSettingId(*it)) + if(!isSettingSelected(*it)) { return false; } @@ -362,7 +342,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) LLClipboard::instance().pasteFromClipboard(ids); for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { - if (!isSettingId(*it)) + if (!isSettingSelected(*it)) { return false; } @@ -371,7 +351,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) } else if (context == PARAMETER_COPYUUID) { - return (selected.size() == 1) && isSettingId(selected.front()); + return (selected.size() == 1) && isSettingSelected(selected.front()); } return false; @@ -387,42 +367,16 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context) if (context == PARAMETER_REGION) { - return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateRegionEnvironment(); + return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); } else if (context == PARAMETER_PARCEL) { - return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateParcelEnvironment(); + return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); } - else if (context == PARAMETER_LOCAL) - { - return isSettingId(selected.front()); - } - - return false; -} - -bool can_delete(const LLUUID& id) -{ - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if (id == trash_id || gInventory.isObjectDescendentOf(id, trash_id)) - { - return false; - } - - LLViewerInventoryCategory* cat = gInventory.getCategory(id); - if (cat) - { - if (!get_is_category_removable(&gInventory, id)) - { - return false; - } - } - else if (!get_is_item_removable(&gInventory, id, false)) + else { - return false; + return (context == PARAMETER_LOCAL); } - - return true; } //------------------------------------------------------------------------- @@ -435,14 +389,7 @@ void LLFloaterMyEnvironment::refreshButtonStates() getChild<LLUICtrl>(BUTTON_GEAR)->setEnabled(settings_ok); getChild<LLUICtrl>(BUTTON_NEWSETTINGS)->setEnabled(true); - - bool enable_delete = false; - if(settings_ok && !selected.empty()) - { - enable_delete = can_delete(selected.front()); - } - - getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(enable_delete); + getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(settings_ok && !selected.empty()); } //------------------------------------------------------------------------- @@ -491,7 +438,7 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_ return LLUUID::null; } -bool LLFloaterMyEnvironment::isSettingId(const LLUUID& item_id) +bool LLFloaterMyEnvironment::isSettingSelected(LLUUID item_id) { LLInventoryItem* itemp = gInventory.getItem(item_id); |