diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2011-06-29 15:24:05 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2011-06-29 15:24:05 -0700 |
commit | 8c6e6c305850f196e0eed7ebb4bf8aa528613fa4 (patch) | |
tree | 368787d731a91b93f10382956f1079ae13d20e76 /indra/newview | |
parent | e443dd3aab1c0bb017ffbf7a0b53edde3680f33b (diff) |
EXP-895 Selecting items in Marketplace Inbox does not change focus in inventory panel away from items selected in inventory panel
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 101 | ||||
-rw-r--r-- | indra/newview/llviewermessage.h | 2 |
3 files changed, 99 insertions, 14 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 58579bdf4f..6644eea219 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1798,6 +1798,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else { + if (gInventory.isObjectDescendentOf(inv_cat->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false))) + { + set_dad_inbox_object(inv_cat->getUUID()); + } // Reparent the folder and restamp children if it's moving // into trash. @@ -3176,6 +3180,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // (move the item, restamp if into trash) else { + // set up observer to select item once drag and drop from inbox is complete + if (gInventory.isObjectDescendentOf(inv_item->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false))) + { + set_dad_inbox_object(inv_item->getUUID()); + } + LLInvFVBridge::changeItemParent( model, (LLViewerInventoryItem*)inv_item, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index fa394e55b3..2ff540b625 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -694,7 +694,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) return false; } -static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel) +static void highlight_inventory_objects_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel) { if (NULL == inventory_panel) return; @@ -708,7 +708,7 @@ static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items, continue; } - LLInventoryItem* item = gInventory.getItem(item_id); + LLInventoryObject* item = gInventory.getObject(item_id); llassert(item); if (!item) { continue; @@ -787,7 +787,6 @@ class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetO public: LLViewerInventoryMoveFromWorldObserver() : LLInventoryAddItemByAssetObserver() - , mActivePanel(NULL) { } @@ -798,13 +797,16 @@ private: /*virtual */void onAssetAdded(const LLUUID& asset_id) { // Store active Inventory panel. - mActivePanel = LLInventoryPanel::getActiveInventoryPanel(); + if (LLInventoryPanel::getActiveInventoryPanel()) + { + mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle(); + } // Store selected items (without destination folder) mSelectedItems.clear(); - if (mActivePanel) + if (LLInventoryPanel::getActiveInventoryPanel()) { - mSelectedItems = mActivePanel->getRootFolder()->getSelectionList(); + mSelectedItems = LLInventoryPanel::getActiveInventoryPanel()->getRootFolder()->getSelectionList(); } mSelectedItems.erase(mMoveIntoFolderID); } @@ -815,12 +817,14 @@ private: */ void done() { + LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get()); + // if selection is not changed since watch started lets hightlight new items. - if (mActivePanel && !isSelectionChanged()) + if (active_panel && !isSelectionChanged()) { LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL; - mActivePanel->clearSelection(); - highlight_inventory_items_in_panel(mAddedItems, mActivePanel); + active_panel->clearSelection(); + highlight_inventory_objects_in_panel(mAddedItems, active_panel); } } @@ -828,16 +832,16 @@ private: * Returns true if selected inventory items were changed since moved inventory items were started to watch. */ bool isSelectionChanged() - { - const LLInventoryPanel * const current_active_panel = LLInventoryPanel::getActiveInventoryPanel(); + { + LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get()); - if (NULL == mActivePanel || current_active_panel != mActivePanel) + if (NULL == active_panel) { return true; } // get selected items (without destination folder) - selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList(); + selected_items_t selected_items = active_panel->getRootFolder()->getSelectionList(); selected_items.erase(mMoveIntoFolderID); // compare stored & current sets of selected items @@ -851,7 +855,7 @@ private: return different_items.size() > 0; } - LLInventoryPanel *mActivePanel; + LLHandle<LLPanel> mActivePanel; typedef std::set<LLUUID> selected_items_t; selected_items_t mSelectedItems; @@ -880,6 +884,75 @@ void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID()); } + +/** + * Class to observe moving of items and to select them in inventory. + * + * Used currently for dragging from inbox to regular inventory folders + */ + +class LLViewerInventoryMoveObserver : public LLInventoryObserver +{ +public: + + LLViewerInventoryMoveObserver(const LLUUID& object_id) + : LLInventoryObserver() + , mObjectID(object_id) + { + if (LLInventoryPanel::getActiveInventoryPanel()) + { + mActivePanel = LLInventoryPanel::getActiveInventoryPanel()->getHandle(); + } + } + + virtual ~LLViewerInventoryMoveObserver() {} + virtual void changed(U32 mask); + +private: + LLUUID mObjectID; + LLHandle<LLPanel> mActivePanel; + +}; + +void LLViewerInventoryMoveObserver::changed(U32 mask) +{ + LLInventoryPanel* active_panel = dynamic_cast<LLInventoryPanel*>(mActivePanel.get()); + + if (NULL == active_panel) + { + gInventory.removeObserver(this); + return; + } + + if((mask & (LLInventoryObserver::STRUCTURE)) != 0) + { + const std::set<LLUUID>& changed_items = gInventory.getChangedIDs(); + + std::set<LLUUID>::const_iterator id_it = changed_items.begin(); + std::set<LLUUID>::const_iterator id_end = changed_items.end(); + for (;id_it != id_end; ++id_it) + { + if ((*id_it) == mObjectID) + { + active_panel->clearSelection(); + std::vector<LLUUID> items; + items.push_back(mObjectID); + highlight_inventory_objects_in_panel(items, active_panel); + active_panel->getRootFolder()->scrollToShowSelection(); + + gInventory.removeObserver(this); + break; + } + } + } +} + +void set_dad_inbox_object(const LLUUID& object_id) +{ + LLViewerInventoryMoveObserver* move_observer = new LLViewerInventoryMoveObserver(object_id); + gInventory.addObserver(move_observer); +} + //unlike the FetchObserver for AgentOffer, we only make one //instance of the AddedObserver for TaskOffers //and it never dies. We do this because we don't know the UUID of diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index b4a9b8e677..9d09d9c01a 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -203,6 +203,8 @@ void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name) bool highlight_offered_object(const LLUUID& obj_id); void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid); +void set_dad_inbox_object(const LLUUID& object_id); + class LLOfferInfo : public LLNotificationResponderInterface { |