diff options
Diffstat (limited to 'linden/indra/newview/llpanelinventory.cpp')
-rw-r--r-- | linden/indra/newview/llpanelinventory.cpp | 113 |
1 files changed, 62 insertions, 51 deletions
diff --git a/linden/indra/newview/llpanelinventory.cpp b/linden/indra/newview/llpanelinventory.cpp index 2089a6c..13cee05 100644 --- a/linden/indra/newview/llpanelinventory.cpp +++ b/linden/indra/newview/llpanelinventory.cpp | |||
@@ -1,4 +1,4 @@ | |||
1 | /** | 1 | /** |
2 | * @file llpanelinventory.cpp | 2 | * @file llpanelinventory.cpp |
3 | * @brief LLPanelInventory class implementation | 3 | * @brief LLPanelInventory class implementation |
4 | * | 4 | * |
@@ -72,7 +72,7 @@ | |||
72 | #include "llviewerregion.h" | 72 | #include "llviewerregion.h" |
73 | #include "llviewerimagelist.h" | 73 | #include "llviewerimagelist.h" |
74 | #include "llviewerinventory.h" | 74 | #include "llviewerinventory.h" |
75 | #include "llviewermessage.h" | 75 | #include "llviewermessage.h" |
76 | #include "llviewerobject.h" | 76 | #include "llviewerobject.h" |
77 | #include "llviewerobjectlist.h" | 77 | #include "llviewerobjectlist.h" |
78 | #include "llviewerwindow.h" | 78 | #include "llviewerwindow.h" |
@@ -197,7 +197,7 @@ struct LLBuyInvItemData | |||
197 | LLUUID mTaskID; | 197 | LLUUID mTaskID; |
198 | LLUUID mItemID; | 198 | LLUUID mItemID; |
199 | LLAssetType::EType mType; | 199 | LLAssetType::EType mType; |
200 | 200 | ||
201 | LLBuyInvItemData(const LLUUID& task, | 201 | LLBuyInvItemData(const LLUUID& task, |
202 | const LLUUID& item, | 202 | const LLUUID& item, |
203 | LLAssetType::EType type) : | 203 | LLAssetType::EType type) : |
@@ -217,34 +217,45 @@ void LLTaskInvFVBridge::buyItem() | |||
217 | const LLSaleInfo& sale_info = item->getSaleInfo(); | 217 | const LLSaleInfo& sale_info = item->getSaleInfo(); |
218 | const LLPermissions& perm = item->getPermissions(); | 218 | const LLPermissions& perm = item->getPermissions(); |
219 | const LLString owner_name; // no owner name currently... FIXME? | 219 | const LLString owner_name; // no owner name currently... FIXME? |
220 | |||
221 | LLString::format_map_t args; | ||
222 | args["[PRICE]"] = llformat("%d",sale_info.getSalePrice()); | ||
223 | args["[OWNER]"] = owner_name; | ||
224 | if (sale_info.getSaleType() != LLSaleInfo::FS_CONTENTS) | ||
225 | { | ||
226 | U32 next_owner_mask = perm.getMaskNextOwner(); | ||
227 | args["[MODIFYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_MODIFY) ? "PermYes" : "PermNo"); | ||
228 | args["[COPYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_COPY) ? "PermYes" : "PermNo"); | ||
229 | args["[RESELLPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_TRANSFER) ? "PermYes" : "PermNo"); | ||
230 | } | ||
231 | 220 | ||
232 | LLString alertdesc; | 221 | LLViewerObject* obj; |
233 | switch(sale_info.getSaleType()) | 222 | if( ( obj = gObjectList.findObject( mPanel->getTaskUUID() ) ) && obj->isAttachment() ) |
234 | { | 223 | { |
235 | case LLSaleInfo::FS_ORIGINAL: | 224 | gViewerWindow->alertXml("Cannot_Purchase_an_Attachment"); |
236 | alertdesc = owner_name.empty() ? "BuyOriginalNoOwner" : "BuyOriginal"; | 225 | llinfos << "Attempt to purchase an attachment" << llendl; |
237 | break; | ||
238 | case LLSaleInfo::FS_COPY: | ||
239 | default: | ||
240 | alertdesc = owner_name.empty() ? "BuyCopyNoOwner" : "BuyCopy"; | ||
241 | break; | ||
242 | case LLSaleInfo::FS_CONTENTS: | ||
243 | alertdesc = owner_name.empty() ? "BuyContentsNoOwner" : "BuyContents"; | ||
244 | break; | ||
245 | } | 226 | } |
246 | 227 | else | |
247 | gViewerWindow->alertXml(alertdesc, args, LLTaskInvFVBridge::commitBuyItem, (void*)inv); | 228 | { |
229 | |||
230 | |||
231 | LLString::format_map_t args; | ||
232 | args["[PRICE]"] = llformat("%d",sale_info.getSalePrice()); | ||
233 | args["[OWNER]"] = owner_name; | ||
234 | if (sale_info.getSaleType() != LLSaleInfo::FS_CONTENTS) | ||
235 | { | ||
236 | U32 next_owner_mask = perm.getMaskNextOwner(); | ||
237 | args["[MODIFYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_MODIFY) ? "PermYes" : "PermNo"); | ||
238 | args["[COPYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_COPY) ? "PermYes" : "PermNo"); | ||
239 | args["[RESELLPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_TRANSFER) ? "PermYes" : "PermNo"); | ||
240 | } | ||
241 | |||
242 | LLString alertdesc; | ||
243 | switch(sale_info.getSaleType()) | ||
244 | { | ||
245 | case LLSaleInfo::FS_ORIGINAL: | ||
246 | alertdesc = owner_name.empty() ? "BuyOriginalNoOwner" : "BuyOriginal"; | ||
247 | break; | ||
248 | case LLSaleInfo::FS_COPY: | ||
249 | default: | ||
250 | alertdesc = owner_name.empty() ? "BuyCopyNoOwner" : "BuyCopy"; | ||
251 | break; | ||
252 | case LLSaleInfo::FS_CONTENTS: | ||
253 | alertdesc = owner_name.empty() ? "BuyContentsNoOwner" : "BuyContents"; | ||
254 | break; | ||
255 | } | ||
256 | |||
257 | gViewerWindow->alertXml(alertdesc, args, LLTaskInvFVBridge::commitBuyItem, (void*)inv); | ||
258 | } | ||
248 | } | 259 | } |
249 | 260 | ||
250 | S32 LLTaskInvFVBridge::getPrice() | 261 | S32 LLTaskInvFVBridge::getPrice() |
@@ -269,7 +280,7 @@ void LLTaskInvFVBridge::commitBuyItem(S32 option, void* data) | |||
269 | { | 280 | { |
270 | LLViewerObject* object = gObjectList.findObject(inv->mTaskID); | 281 | LLViewerObject* object = gObjectList.findObject(inv->mTaskID); |
271 | if(!object || !object->getRegion()) return; | 282 | if(!object || !object->getRegion()) return; |
272 | 283 | ||
273 | 284 | ||
274 | LLMessageSystem* msg = gMessageSystem; | 285 | LLMessageSystem* msg = gMessageSystem; |
275 | msg->newMessageFast(_PREHASH_BuyObjectInventory); | 286 | msg->newMessageFast(_PREHASH_BuyObjectInventory); |
@@ -289,12 +300,12 @@ void LLTaskInvFVBridge::commitBuyItem(S32 option, void* data) | |||
289 | const LLString& LLTaskInvFVBridge::getName() const | 300 | const LLString& LLTaskInvFVBridge::getName() const |
290 | { | 301 | { |
291 | return mName; | 302 | return mName; |
292 | } | 303 | } |
293 | 304 | ||
294 | const LLString& LLTaskInvFVBridge::getDisplayName() const | 305 | const LLString& LLTaskInvFVBridge::getDisplayName() const |
295 | { | 306 | { |
296 | LLInventoryItem* item = findItem(); | 307 | LLInventoryItem* item = findItem(); |
297 | if(item) | 308 | if(item) |
298 | { | 309 | { |
299 | mDisplayName.assign(item->getName()); | 310 | mDisplayName.assign(item->getName()); |
300 | 311 | ||
@@ -316,9 +327,9 @@ const LLString& LLTaskInvFVBridge::getDisplayName() const | |||
316 | mDisplayName.append(" (no transfer)"); | 327 | mDisplayName.append(" (no transfer)"); |
317 | } | 328 | } |
318 | } | 329 | } |
319 | 330 | ||
320 | return mDisplayName; | 331 | return mDisplayName; |
321 | } | 332 | } |
322 | 333 | ||
323 | // BUG: No creation dates for task inventory | 334 | // BUG: No creation dates for task inventory |
324 | U32 LLTaskInvFVBridge::getCreationDate() const | 335 | U32 LLTaskInvFVBridge::getCreationDate() const |
@@ -444,7 +455,7 @@ BOOL LLTaskInvFVBridge::removeItem() | |||
444 | { | 455 | { |
445 | // just do it. | 456 | // just do it. |
446 | object->removeInventory(mUUID); | 457 | object->removeInventory(mUUID); |
447 | return TRUE; | 458 | return TRUE; |
448 | } | 459 | } |
449 | else | 460 | else |
450 | { | 461 | { |
@@ -542,20 +553,20 @@ BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) | |||
542 | if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID))) | 553 | if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID))) |
543 | { | 554 | { |
544 | const LLPermissions& perm = inv->getPermissions(); | 555 | const LLPermissions& perm = inv->getPermissions(); |
545 | bool can_copy = gAgent.allowOperation(PERM_COPY, perm, | 556 | bool can_copy = gAgent.allowOperation(PERM_COPY, perm, |
546 | GP_OBJECT_MANIPULATE); | 557 | GP_OBJECT_MANIPULATE); |
547 | if (object->isAttachment() && !can_copy) | 558 | if (object->isAttachment() && !can_copy) |
548 | { | 559 | { |
549 | //RN: no copy contents of attachments cannot be dragged out | 560 | //RN: no copy contents of attachments cannot be dragged out |
550 | // due to a race condition and possible exploit where | 561 | // due to a race condition and possible exploit where |
551 | // attached objects do not update their inventory items | 562 | // attached objects do not update their inventory items |
552 | // when their contents are manipulated | 563 | // when their contents are manipulated |
553 | return FALSE; | 564 | return FALSE; |
554 | } | 565 | } |
555 | if((can_copy && perm.allowTransferTo(gAgent.getID())) | 566 | if((can_copy && perm.allowTransferTo(gAgent.getID())) |
556 | || object->permYouOwner()) | 567 | || object->permYouOwner()) |
557 | // || gAgent.isGodlike()) | 568 | // || gAgent.isGodlike()) |
558 | 569 | ||
559 | { | 570 | { |
560 | *type = LLAssetType::lookupDragAndDropType(inv->getType()); | 571 | *type = LLAssetType::lookupDragAndDropType(inv->getType()); |
561 | 572 | ||
@@ -621,7 +632,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) | |||
621 | std::vector<LLString> items; | 632 | std::vector<LLString> items; |
622 | std::vector<LLString> disabled_items; | 633 | std::vector<LLString> disabled_items; |
623 | 634 | ||
624 | if(gAgent.allowOperation(PERM_OWNER, item->getPermissions(), | 635 | if(gAgent.allowOperation(PERM_OWNER, item->getPermissions(), |
625 | GP_OBJECT_MANIPULATE) | 636 | GP_OBJECT_MANIPULATE) |
626 | && item->getSaleInfo().isForSale()) | 637 | && item->getSaleInfo().isForSale()) |
627 | { | 638 | { |
@@ -755,12 +766,12 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) | |||
755 | if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID))) | 766 | if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID))) |
756 | { | 767 | { |
757 | const LLPermissions& perm = inv->getPermissions(); | 768 | const LLPermissions& perm = inv->getPermissions(); |
758 | bool can_copy = gAgent.allowOperation(PERM_COPY, perm, | 769 | bool can_copy = gAgent.allowOperation(PERM_COPY, perm, |
759 | GP_OBJECT_MANIPULATE); | 770 | GP_OBJECT_MANIPULATE); |
760 | if((can_copy && perm.allowTransferTo(gAgent.getID())) | 771 | if((can_copy && perm.allowTransferTo(gAgent.getID())) |
761 | || object->permYouOwner()) | 772 | || object->permYouOwner()) |
762 | // || gAgent.isGodlike()) | 773 | // || gAgent.isGodlike()) |
763 | 774 | ||
764 | { | 775 | { |
765 | *type = LLAssetType::lookupDragAndDropType(inv->getType()); | 776 | *type = LLAssetType::lookupDragAndDropType(inv->getType()); |
766 | 777 | ||
@@ -776,7 +787,7 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) | |||
776 | BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop, | 787 | BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop, |
777 | EDragAndDropType cargo_type, | 788 | EDragAndDropType cargo_type, |
778 | void* cargo_data) | 789 | void* cargo_data) |
779 | { | 790 | { |
780 | //llinfos << "LLTaskCategoryBridge::dragOrDrop()" << llendl; | 791 | //llinfos << "LLTaskCategoryBridge::dragOrDrop()" << llendl; |
781 | BOOL accept = FALSE; | 792 | BOOL accept = FALSE; |
782 | LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); | 793 | LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); |
@@ -1060,7 +1071,7 @@ LLTaskLandmarkBridge::LLTaskLandmarkBridge( | |||
1060 | LLTaskInvFVBridge(panel, uuid, name) | 1071 | LLTaskInvFVBridge(panel, uuid, name) |
1061 | { | 1072 | { |
1062 | } | 1073 | } |
1063 | 1074 | ||
1064 | LLViewerImage* LLTaskLandmarkBridge::getIcon() const | 1075 | LLViewerImage* LLTaskLandmarkBridge::getIcon() const |
1065 | { | 1076 | { |
1066 | return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, 0, FALSE); | 1077 | return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, 0, FALSE); |
@@ -1091,7 +1102,7 @@ LLTaskCallingCardBridge::LLTaskCallingCardBridge( | |||
1091 | LLTaskInvFVBridge(panel, uuid, name) | 1102 | LLTaskInvFVBridge(panel, uuid, name) |
1092 | { | 1103 | { |
1093 | } | 1104 | } |
1094 | 1105 | ||
1095 | LLViewerImage* LLTaskCallingCardBridge::getIcon() const | 1106 | LLViewerImage* LLTaskCallingCardBridge::getIcon() const |
1096 | { | 1107 | { |
1097 | return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, 0, FALSE); | 1108 | return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, 0, FALSE); |
@@ -1476,7 +1487,7 @@ LLTaskWearableBridge::LLTaskWearableBridge( | |||
1476 | mAssetType( asset_type ) | 1487 | mAssetType( asset_type ) |
1477 | { | 1488 | { |
1478 | } | 1489 | } |
1479 | 1490 | ||
1480 | LLViewerImage* LLTaskWearableBridge::getIcon() const | 1491 | LLViewerImage* LLTaskWearableBridge::getIcon() const |
1481 | { | 1492 | { |
1482 | return get_item_icon(mAssetType, LLInventoryType::IT_WEARABLE, mFlags, FALSE ); | 1493 | return get_item_icon(mAssetType, LLInventoryType::IT_WEARABLE, mFlags, FALSE ); |
@@ -1648,7 +1659,7 @@ void LLPanelInventory::inventoryChanged(LLViewerObject* object, | |||
1648 | { | 1659 | { |
1649 | if(!object) return; | 1660 | if(!object) return; |
1650 | 1661 | ||
1651 | //llinfos << "invetnory arrived: \n" | 1662 | //llinfos << "invetnory arrived: \n" |
1652 | // << " panel UUID: " << panel->mTaskUUID << "\n" | 1663 | // << " panel UUID: " << panel->mTaskUUID << "\n" |
1653 | // << " task UUID: " << object->mID << llendl; | 1664 | // << " task UUID: " << object->mID << llendl; |
1654 | if(mTaskUUID == object->mID) | 1665 | if(mTaskUUID == object->mID) |
@@ -1686,7 +1697,7 @@ void LLPanelInventory::inventoryChanged(LLViewerObject* object, | |||
1686 | 1697 | ||
1687 | void LLPanelInventory::updateInventory() | 1698 | void LLPanelInventory::updateInventory() |
1688 | { | 1699 | { |
1689 | //llinfos << "inventory arrived: \n" | 1700 | //llinfos << "inventory arrived: \n" |
1690 | // << " panel UUID: " << panel->mTaskUUID << "\n" | 1701 | // << " panel UUID: " << panel->mTaskUUID << "\n" |
1691 | // << " task UUID: " << object->mID << llendl; | 1702 | // << " task UUID: " << object->mID << llendl; |
1692 | // We're still interested in this task's inventory. | 1703 | // We're still interested in this task's inventory. |
@@ -1865,7 +1876,7 @@ void LLPanelInventory::refresh() | |||
1865 | // Otherwise we show the old stuff until the update comes in | 1876 | // Otherwise we show the old stuff until the update comes in |
1866 | clearContents(); | 1877 | clearContents(); |
1867 | 1878 | ||
1868 | // Register for updates from this object, | 1879 | // Register for updates from this object, |
1869 | registerVOInventoryListener(object,NULL); | 1880 | registerVOInventoryListener(object,NULL); |
1870 | } | 1881 | } |
1871 | 1882 | ||
@@ -1978,7 +1989,7 @@ BOOL LLPanelInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDr | |||
1978 | } | 1989 | } |
1979 | } | 1990 | } |
1980 | 1991 | ||
1981 | //static | 1992 | //static |
1982 | void LLPanelInventory::idle(void* user_data) | 1993 | void LLPanelInventory::idle(void* user_data) |
1983 | { | 1994 | { |
1984 | LLPanelInventory* self = (LLPanelInventory*)user_data; | 1995 | LLPanelInventory* self = (LLPanelInventory*)user_data; |