aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:56 -0500
committerJacek Antonelli2008-08-15 23:44:56 -0500
commitc07901e29ed545bbb02e3bddf148fe1104b94e9f (patch)
treef1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/newview/llinventorybridge.cpp
parentSecond Life viewer sources 1.15.0.2 (diff)
downloadmeta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.zip
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.gz
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.bz2
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.xz
Second Life viewer sources 1.15.1.3
Diffstat (limited to 'linden/indra/newview/llinventorybridge.cpp')
-rw-r--r--linden/indra/newview/llinventorybridge.cpp85
1 files changed, 59 insertions, 26 deletions
diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp
index 05334d7..a7b80ae 100644
--- a/linden/indra/newview/llinventorybridge.cpp
+++ b/linden/indra/newview/llinventorybridge.cpp
@@ -569,10 +569,10 @@ const char* safe_inv_type_lookup(LLInventoryType::EType inv_type)
569} 569}
570 570
571LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, 571LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
572 LLInventoryType::EType inv_type, 572 LLInventoryType::EType inv_type,
573 LLInventoryPanel* inventory, 573 LLInventoryPanel* inventory,
574 const LLUUID& uuid, 574 const LLUUID& uuid,
575 U32 flags) 575 U32 flags)
576{ 576{
577 LLInvFVBridge* new_listener = NULL; 577 LLInvFVBridge* new_listener = NULL;
578 switch(asset_type) 578 switch(asset_type)
@@ -677,7 +677,11 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
677 break; 677 break;
678 } 678 }
679 679
680 new_listener->mInvType = inv_type; 680 if (new_listener)
681 {
682 new_listener->mInvType = inv_type;
683 }
684
681 return new_listener; 685 return new_listener;
682} 686}
683 687
@@ -907,16 +911,20 @@ BOOL LLItemBridge::removeItem()
907 if(!model) return FALSE; 911 if(!model) return FALSE;
908 LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH); 912 LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH);
909 LLViewerInventoryItem* item = getItem(); 913 LLViewerInventoryItem* item = getItem();
910 if(item) 914
915 // if item is not already in trash
916 if(item && !model->isObjectDescendentOf(mUUID, trash_id))
911 { 917 {
912 // restamp on move to trash. 918 // move to trash, and restamp
913 LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE); 919 LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
920 // delete was successful
921 return TRUE;
922 }
923 else
924 {
925 // tried to delete already item in trash (should purge?)
926 return FALSE;
914 } 927 }
915
916 // return false anyway, so that if it's called from the folder
917 // view, it doesn't remove the view - it's just being moved to the
918 // trash.
919 return FALSE;
920} 928}
921 929
922BOOL LLItemBridge::isItemCopyable() const 930BOOL LLItemBridge::isItemCopyable() const
@@ -1462,11 +1470,20 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
1462 { 1470 {
1463 LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); 1471 LLViewerInventoryCategory* category = gInventory.getCategory(mCatID);
1464 1472
1465 if (category->getDescendentCount() == mContentsCount) 1473 if (NULL == category)
1466 { 1474 {
1467 gInventory.removeObserver(this); 1475 llwarns << "gInventory.getCategory(" << mCatID
1468 wear_inventory_category(category, FALSE, TRUE); 1476 << ") was NULL" << llendl;
1469 delete this; 1477 }
1478 else
1479 {
1480 if (category->getDescendentCount() ==
1481 mContentsCount)
1482 {
1483 gInventory.removeObserver(this);
1484 wear_inventory_category(category, FALSE, TRUE);
1485 delete this;
1486 }
1470 } 1487 }
1471 } 1488 }
1472 1489
@@ -1682,11 +1699,7 @@ BOOL LLFolderBridge::removeItem()
1682 LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE); 1699 LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE);
1683 } 1700 }
1684 1701
1685 // return false anyway, so that if it's called from the folder 1702 return TRUE;
1686 // view, it doesn't remove the view - it's just being moved to the
1687 // trash.
1688 return FALSE;
1689
1690} 1703}
1691 1704
1692BOOL LLFolderBridge::isClipboardPasteable() const 1705BOOL LLFolderBridge::isClipboardPasteable() const
@@ -2178,10 +2191,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
2178 // everything in the active window so that we don't follow 2191 // everything in the active window so that we don't follow
2179 // the selection to its new location (which is very 2192 // the selection to its new location (which is very
2180 // annoying). 2193 // annoying).
2181 LLInventoryPanel* active_panel = LLInventoryView::getActiveInventory()->getPanel(); 2194 if (LLInventoryView::getActiveInventory())
2182 if (mInventoryPanel != active_panel)
2183 { 2195 {
2184 active_panel->unSelectAll(); 2196 LLInventoryPanel* active_panel = LLInventoryView::getActiveInventory()->getPanel();
2197 if (active_panel && (mInventoryPanel != active_panel))
2198 {
2199 active_panel->unSelectAll();
2200 }
2185 } 2201 }
2186 2202
2187 // restamp if the move is into the trash. 2203 // restamp if the move is into the trash.
@@ -3117,7 +3133,16 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
3117 gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); 3133 gMessageSystem->sendReliable( gAgent.getRegion()->getHost() );
3118 } 3134 }
3119 // this object might have been selected, so let the selection manager know it's gone now 3135 // this object might have been selected, so let the selection manager know it's gone now
3120 gSelectMgr->remove(gObjectList.findObject(item->getUUID())); 3136 LLViewerObject *found_obj =
3137 gObjectList.findObject(item->getUUID());
3138 if (found_obj)
3139 {
3140 gSelectMgr->remove(found_obj);
3141 }
3142 else
3143 {
3144 llwarns << "object not found - ignoring" << llendl;
3145 }
3121 } 3146 }
3122 else LLItemBridge::performAction(folder, model, action); 3147 else LLItemBridge::performAction(folder, model, action);
3123} 3148}
@@ -4027,7 +4052,15 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
4027 gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); 4052 gMessageSystem->sendReliable( gAgent.getRegion()->getHost() );
4028 4053
4029 // this object might have been selected, so let the selection manager know it's gone now 4054 // this object might have been selected, so let the selection manager know it's gone now
4030 gSelectMgr->remove(gObjectList.findObject( obj_item_array.get(i)->getUUID()) ); 4055 LLViewerObject *found_obj = gObjectList.findObject( obj_item_array.get(i)->getUUID());
4056 if (found_obj)
4057 {
4058 gSelectMgr->remove(found_obj);
4059 }
4060 else
4061 {
4062 llwarns << "object not found, ignoring" << llendl;
4063 }
4031 } 4064 }
4032 } 4065 }
4033 4066