From d0998174ffc7ca028cc33274a1bcc9759713589d Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 19 Dec 2018 15:16:48 -0800 Subject: [PATCH] Un-wear things when trashing them if worn --- .../hifi/commerce/purchases/PurchasedItem.qml | 30 ++++++++++++++----- .../qml/hifi/commerce/purchases/Purchases.qml | 10 +++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index 12a9912e8e..f7dc26df5f 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -313,6 +313,10 @@ Item { Commerce.uninstallApp(root.itemHref); } } + + onVisibleChanged: { + trashButton.updateProperties(); + } } Loader { @@ -342,6 +346,10 @@ Item { }); } } + + onVisibleChanged: { + trashButton.updateProperties(); + } } Loader { @@ -355,6 +363,20 @@ Item { onLoaded: { item.buttonGlyphText = hifi.glyphs.trash; + updateProperties(); + item.buttonClicked = function() { + sendToPurchases({method: 'showTrashLightbox', + isInstalled: root.isInstalled, + itemHref: root.itemHref, + itemName: root.itemName, + certID: root.certificateId, + itemType: root.itemType, + wornEntityID: root.wornEntityID + }); + } + } + + function updateProperties() { if (updateButton.visible && uninstallButton.visible) { item.buttonText = ""; item.glyphSize = 20; @@ -362,14 +384,6 @@ Item { item.buttonText = "Send to Trash"; item.glyphSize = 30; } - item.buttonClicked = function() { - sendToPurchases({method: 'showTrashLightbox', - isInstalled: root.isInstalled, - itemHref: root.itemHref, - itemName: root.itemName, - certID: root.certificateId - }); - } } } } diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index f50ce0bda3..873e8bef1d 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -664,6 +664,16 @@ Rectangle { if (msg.isInstalled) { Commerce.uninstallApp(msg.itemHref); } + + if (MyAvatar.skeletonModelURL === msg.itemHref) { + MyAvatar.useFullAvatarURL(''); + } + + if (msg.itemType === "wearable" && msg.wornEntityID !== '') { + Entities.deleteEntity(msg.wornEntityID); + purchasesModel.setProperty(index, 'wornEntityID', ''); + } + Commerce.transferAssetToUsername("trashbot", msg.certID, 1, "Sent " + msg.itemName + " to trash."); lightboxPopup.titleText = '"' + msg.itemName + '" Sent to Trash';