diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llinventorymodel.cpp | 134 |
1 files changed, 47 insertions, 87 deletions
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index ddd229b..8e95156 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "llviewerprecompiledheaders.h" | 29 | #include "llviewerprecompiledheaders.h" |
30 | |||
30 | #include "llinventorymodel.h" | 31 | #include "llinventorymodel.h" |
31 | 32 | ||
32 | #include "llassetstorage.h" | 33 | #include "llassetstorage.h" |
@@ -41,6 +42,7 @@ | |||
41 | #include "llfocusmgr.h" | 42 | #include "llfocusmgr.h" |
42 | #include "llinventoryview.h" | 43 | #include "llinventoryview.h" |
43 | #include "llviewerinventory.h" | 44 | #include "llviewerinventory.h" |
45 | #include "llviewermessage.h" | ||
44 | #include "llviewerwindow.h" | 46 | #include "llviewerwindow.h" |
45 | #include "viewer.h" | 47 | #include "viewer.h" |
46 | #include "lldbstrings.h" | 48 | #include "lldbstrings.h" |
@@ -2282,7 +2284,7 @@ void LLInventoryModel::processUseCachedInventory(LLMessageSystem* msg, void**) | |||
2282 | void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, void**) | 2284 | void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, void**) |
2283 | { | 2285 | { |
2284 | // do accounting and highlight new items if they arrive | 2286 | // do accounting and highlight new items if they arrive |
2285 | if (gInventory.messageUpdateCore(msg, true, true)) | 2287 | if (gInventory.messageUpdateCore(msg, true)) |
2286 | { | 2288 | { |
2287 | U32 callback_id; | 2289 | U32 callback_id; |
2288 | LLUUID item_id; | 2290 | LLUUID item_id; |
@@ -2298,12 +2300,15 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo | |||
2298 | void LLInventoryModel::processFetchInventoryReply(LLMessageSystem* msg, void**) | 2300 | void LLInventoryModel::processFetchInventoryReply(LLMessageSystem* msg, void**) |
2299 | { | 2301 | { |
2300 | // no accounting | 2302 | // no accounting |
2301 | gInventory.messageUpdateCore(msg, false, false); | 2303 | gInventory.messageUpdateCore(msg, false); |
2302 | } | 2304 | } |
2303 | 2305 | ||
2304 | 2306 | ||
2305 | bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, bool highlight_new) | 2307 | bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) |
2306 | { | 2308 | { |
2309 | //make sure our added inventory observer is active -Gigs | ||
2310 | start_new_inventory_observer(); | ||
2311 | |||
2307 | LLUUID agent_id; | 2312 | LLUUID agent_id; |
2308 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); | 2313 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); |
2309 | if(agent_id != gAgent.getID()) | 2314 | if(agent_id != gAgent.getID()) |
@@ -2312,16 +2317,15 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo | |||
2312 | << llendl; | 2317 | << llendl; |
2313 | return false; | 2318 | return false; |
2314 | } | 2319 | } |
2315 | LLPointer<LLViewerInventoryItem> lastitem; // hack | ||
2316 | item_array_t items; | 2320 | item_array_t items; |
2317 | update_map_t update; | 2321 | update_map_t update; |
2318 | S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); | 2322 | S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); |
2319 | bool all_one_folder = true; | 2323 | bool all_one_folder = true; |
2320 | LLUUID folder_id; | 2324 | LLUUID folder_id; |
2325 | // Does this loop ever execute more than once? -Gigs | ||
2321 | for(S32 i = 0; i < count; ++i) | 2326 | for(S32 i = 0; i < count; ++i) |
2322 | { | 2327 | { |
2323 | LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; | 2328 | LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; |
2324 | lastitem = titem; | ||
2325 | titem->unpackMessage(msg, _PREHASH_InventoryData, i); | 2329 | titem->unpackMessage(msg, _PREHASH_InventoryData, i); |
2326 | lldebugs << "LLInventoryModel::messageUpdateCore() item id:" | 2330 | lldebugs << "LLInventoryModel::messageUpdateCore() item id:" |
2327 | << titem->getUUID() << llendl; | 2331 | << titem->getUUID() << llendl; |
@@ -2359,6 +2363,7 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo | |||
2359 | } | 2363 | } |
2360 | 2364 | ||
2361 | U32 changes = 0x0; | 2365 | U32 changes = 0x0; |
2366 | //as above, this loop never seems to loop more than once per call | ||
2362 | for (item_array_t::iterator it = items.begin(); it != items.end(); ++it) | 2367 | for (item_array_t::iterator it = items.begin(); it != items.end(); ++it) |
2363 | { | 2368 | { |
2364 | changes |= gInventory.updateItem(*it); | 2369 | changes |= gInventory.updateItem(*it); |
@@ -2366,88 +2371,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo | |||
2366 | gInventory.notifyObservers(); | 2371 | gInventory.notifyObservers(); |
2367 | gViewerWindow->getWindow()->decBusyCount(); | 2372 | gViewerWindow->getWindow()->decBusyCount(); |
2368 | 2373 | ||
2369 | // *HACK: Do the 'show' logic for a new item in the inventory if | ||
2370 | // it is a newly created item. | ||
2371 | if (highlight_new | ||
2372 | && (changes & LLInventoryObserver::ADD) == LLInventoryObserver::ADD) | ||
2373 | { | ||
2374 | LLUUID trash_id; | ||
2375 | trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); | ||
2376 | if(!gInventory.isObjectDescendentOf(lastitem->getUUID(), trash_id)) | ||
2377 | { | ||
2378 | LLMultiPreview* multi_previewp = LLMultiPreview::getAutoOpenInstance(folder_id); | ||
2379 | if (!multi_previewp && all_one_folder && count > 1) | ||
2380 | { | ||
2381 | S32 left, top; | ||
2382 | gFloaterView->getNewFloaterPosition(&left, &top); | ||
2383 | |||
2384 | multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100)); | ||
2385 | LLMultiPreview::setAutoOpenInstance(multi_previewp, folder_id); | ||
2386 | } | ||
2387 | |||
2388 | LLFloater::setFloaterHost(multi_previewp); | ||
2389 | |||
2390 | bool show_keep_discard = lastitem->getPermissions().getCreator() != gAgent.getID(); | ||
2391 | switch(lastitem->getType()) | ||
2392 | { | ||
2393 | case LLAssetType::AT_NOTECARD: | ||
2394 | open_notecard( | ||
2395 | lastitem->getUUID(), | ||
2396 | LLString("Note: ") + lastitem->getName(), | ||
2397 | show_keep_discard, | ||
2398 | LLUUID::null, | ||
2399 | FALSE); | ||
2400 | break; | ||
2401 | case LLAssetType::AT_LANDMARK: | ||
2402 | open_landmark( | ||
2403 | lastitem->getUUID(), | ||
2404 | LLString(" ") + lastitem->getName(), | ||
2405 | show_keep_discard, | ||
2406 | LLUUID::null, | ||
2407 | FALSE); | ||
2408 | break; | ||
2409 | case LLAssetType::AT_TEXTURE: | ||
2410 | open_texture( | ||
2411 | lastitem->getUUID(), | ||
2412 | LLString("Texture: ") + lastitem->getName(), | ||
2413 | show_keep_discard, | ||
2414 | LLUUID::null, | ||
2415 | FALSE); | ||
2416 | break; | ||
2417 | default: | ||
2418 | break; | ||
2419 | } | ||
2420 | |||
2421 | LLFloater::setFloaterHost(NULL); | ||
2422 | if (multi_previewp) | ||
2423 | { | ||
2424 | multi_previewp->open(); | ||
2425 | } | ||
2426 | |||
2427 | LLInventoryView* view = LLInventoryView::getActiveInventory(); | ||
2428 | if(view) | ||
2429 | { | ||
2430 | LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND); | ||
2431 | BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view); | ||
2432 | BOOL user_is_away = gAwayTimer.getStarted(); | ||
2433 | |||
2434 | // don't select lost and found items if an active user is working in the inventory | ||
2435 | if (!gInventory.isObjectDescendentOf(lastitem->getUUID(), lost_and_found_id) || | ||
2436 | !inventory_has_focus || | ||
2437 | user_is_away) | ||
2438 | { | ||
2439 | LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); | ||
2440 | LLFocusMgr::FocusLostCallback callback = gFocusMgr.getFocusCallback(); | ||
2441 | view->getPanel()->setSelection(lastitem->getUUID(), TAKE_FOCUS_NO); | ||
2442 | // HACK to open inventory offers that are | ||
2443 | // accepted. This information really needs to | ||
2444 | // flow through the instant messages and | ||
2445 | // inventory restore keyboard focus | ||
2446 | gFocusMgr.setKeyboardFocus(focus_ctrl, callback); | ||
2447 | } | ||
2448 | } | ||
2449 | } | ||
2450 | } | ||
2451 | return true; | 2374 | return true; |
2452 | } | 2375 | } |
2453 | 2376 | ||
@@ -3452,6 +3375,43 @@ void LLInventoryExistenceObserver::changed(U32 mask) | |||
3452 | } | 3375 | } |
3453 | } | 3376 | } |
3454 | 3377 | ||
3378 | void LLInventoryAddedObserver::changed(U32 mask) | ||
3379 | { | ||
3380 | if(!(mask & LLInventoryObserver::ADD)) | ||
3381 | { | ||
3382 | return; | ||
3383 | } | ||
3384 | |||
3385 | // *HACK: If this was in response to a packet off | ||
3386 | // the network, figure out which item was updated. | ||
3387 | // Code from Gigs Taggert, sin allowed by JC. | ||
3388 | LLMessageSystem* msg = gMessageSystem; | ||
3389 | const char* msg_name = msg->getMessageName(); | ||
3390 | if (!msg_name) return; | ||
3391 | |||
3392 | // We only want newly created inventory items. JC | ||
3393 | if ( strcmp(msg_name, "UpdateCreateInventoryItem") ) | ||
3394 | { | ||
3395 | return; | ||
3396 | } | ||
3397 | |||
3398 | LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; | ||
3399 | S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData); | ||
3400 | for(S32 i = 0; i < num_blocks; ++i) | ||
3401 | { | ||
3402 | titem->unpackMessage(msg, _PREHASH_InventoryData, i); | ||
3403 | if (!(titem->getUUID().isNull())) | ||
3404 | { | ||
3405 | //we don't do anything with null keys | ||
3406 | mAdded.push_back(titem->getUUID()); | ||
3407 | } | ||
3408 | } | ||
3409 | if (!mAdded.empty()) | ||
3410 | { | ||
3411 | done(); | ||
3412 | } | ||
3413 | } | ||
3414 | |||
3455 | LLInventoryTransactionObserver::LLInventoryTransactionObserver( | 3415 | LLInventoryTransactionObserver::LLInventoryTransactionObserver( |
3456 | const LLTransactionID& transaction_id) : | 3416 | const LLTransactionID& transaction_id) : |
3457 | mTransactionID(transaction_id) | 3417 | mTransactionID(transaction_id) |