summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorybridge.cpp51
-rw-r--r--indra/newview/llinventorybridge.h2
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp9
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml13
4 files changed, 69 insertions, 6 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 228ab7ebd6..a979454938 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1405,13 +1405,56 @@ BOOL LLItemBridge::removeItem()
{
return FALSE;
}
+
+
// move it to the trash
LLPreview::hide(mUUID, TRUE);
LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
- const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
+
+ // Already in trash
+ if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;
+
+ LLNotification::Params params("ConfirmItemDeleteHasLinks");
+ params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2));
+
+ if (!item->getIsLinkType())
+ {
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ LLLinkedItemIDMatches is_linked_item_match(mUUID);
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
+ cat_array,
+ item_array,
+ LLInventoryModel::INCLUDE_TRASH,
+ is_linked_item_match);
+ U32 num_links = cat_array.size() + item_array.size();
+ if (num_links > 0)
+ {
+ LLNotifications::instance().add(params);
+ return FALSE;
+ }
+ }
+
+ LLNotifications::instance().forceResponse(params, 0);
+ return TRUE;
+}
+
+BOOL LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return FALSE;
+
+ LLInventoryModel* model = getInventoryModel();
+ if (!model) return FALSE;
+
LLViewerInventoryItem* item = getItem();
+ if (!item) return FALSE;
+ const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
// if item is not already in trash
if(item && !model->isObjectDescendentOf(mUUID, trash_id))
{
@@ -1420,11 +1463,7 @@ BOOL LLItemBridge::removeItem()
// delete was successful
return TRUE;
}
- else
- {
- // tried to delete already item in trash (should purge?)
- return FALSE;
- }
+ return FALSE;
}
BOOL LLItemBridge::isItemCopyable() const
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index c45e376cab..aa3b36e7e2 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -267,6 +267,8 @@ protected:
virtual BOOL isItemPermissive() const;
static void buildDisplayName(LLInventoryItem* item, std::string& name);
mutable std::string mDisplayName;
+
+ BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
};
class LLFolderBridge : public LLInvFVBridge
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index e36e63521e..111894b31c 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -91,6 +91,15 @@ BOOL LLPanelOutfitsInventory::postBuild()
initTabPanels();
initListCommandsHandlers();
+ // Fetch your outfits folder so that the links are in memory.
+ // ( This is only necessary if we want to show a warning if a user deletes an item that has a
+ // a link in an outfit, see "ConfirmItemDeleteHasLinks". )
+ const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTFIT, false);
+ if (outfits_cat.notNull())
+ {
+ LLInventoryModelBackgroundFetch::instance().start(outfits_cat);
+ }
+
return TRUE;
}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 10914285dd..149a254f49 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2124,6 +2124,19 @@ Please enter a higher price.
<notification
icon="alertmodal.tga"
+ name="ConfirmItemDeleteHasLinks"
+ type="alertmodal">
+At least one of the items you has link items that point to it. If you delete this item, its links will permanently stop working. It is strongly advised to delete the links first.
+
+Are you sure you want to delete these items?
+ <usetemplate
+ name="okcancelbuttons"
+ notext="Cancel"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="ConfirmObjectDeleteLock"
type="alertmodal">
At least one of the items you have selected is locked.