diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 03123689c5c911d3777d8c38afa1565f728f3eb0..67d65547b6692df00e57bc9fa4262feaaf0c2f2c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1881,6 +1881,7 @@ void LLItemBridge::gotoItem() if (active_panel) { active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO); + active_panel->setFocus(TRUE); } } @@ -7229,24 +7230,13 @@ void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string acti } LLItemBridge::performAction(model,action); } + void LLLinkFolderBridge::gotoItem() { - const LLUUID &cat_uuid = getFolderID(); - if (!cat_uuid.isNull()) - { - LLFolderViewItem *base_folder = mInventoryPanel.get()->getItemByID(cat_uuid); - if (base_folder) - { - if (LLInventoryModel* model = getInventoryModel()) - { - model->fetchDescendentsOf(cat_uuid); - } - base_folder->setOpen(TRUE); - mRoot->setSelection(base_folder,TRUE); - mRoot->scrollToShowSelection(); - } - } + LLItemBridge::gotoItem(); + LLInventoryPanel::getActiveInventoryPanel()->openFolderByID(getFolderID()); } + const LLUUID &LLLinkFolderBridge::getFolderID() const { if (LLViewerInventoryItem *link_item = getItem()) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 646d92b9e15e34241f3abfbb574248bc89644444..9eb84ed25990a880119023f9b550a237ee969937 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -737,9 +737,8 @@ void show_item_original(const LLUUID& item_uuid) } //sidetray inventory panel - LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + LLSidepanelInventory *sidepanel_inventory = LLPanelMainInventory::newWindow()->LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - bool do_reset_inventory_filter = !floater_inventory->isInVisibleChain(); LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (!active_panel) @@ -758,11 +757,7 @@ void show_item_original(const LLUUID& item_uuid) return; } active_panel->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_YES); - - if(do_reset_inventory_filter) - { - reset_inventory_filter(); - } + active_panel->setFocus(TRUE); } @@ -2446,6 +2441,15 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } else { + if (action == "goto") + { + LLSidepanelInventory *sidepanel_inventory = LLPanelMainInventory::newWindow()->LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + if (sidepanel_inventory && sidepanel_inventory->getMainInventoryPanel()) + { + model = sidepanel_inventory->getMainInventoryPanel()->getActivePanel()->getModel(); + } + } + std::set<LLFolderViewItem*>::iterator set_iter; for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c65998cf907394254fdc2f3517588977590aa3e6..740c27ae8b62f3c9f8d315bcdfceed4b17bfa821 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -339,6 +339,7 @@ void LLInventoryPanel::draw() { // Select the desired item (in case it wasn't loaded when the selection was requested) updateSelection(); + updateFolderState(); LLPanel::draw(); } @@ -1146,6 +1147,7 @@ void LLInventoryPanel::setSelectCallback(const boost::function<void (const std:: void LLInventoryPanel::clearSelection() { mSelectThisID.setNull(); + mOpenFolderID.setNull(); } LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const @@ -1646,6 +1648,30 @@ void LLInventoryPanel::updateSelection() } } +void LLInventoryPanel::openFolderByID( const LLUUID& folder_id) +{ + LLFolderViewItem* itemp = getItemByID(folder_id); + if(itemp && itemp->getViewModelItem()) + { + itemp->setOpen(TRUE); + mOpenFolderID.setNull(); + return; + } + else + { + // save the desired folder to be open later (if/when ready) + mOpenFolderID = folder_id; + } +} + +void LLInventoryPanel::updateFolderState() +{ + if (mOpenFolderID.notNull()) + { + openFolderByID(mOpenFolderID); + } +} + void LLInventoryPanel::doToSelected(const LLSD& userdata) { if (("purge" == userdata.asString())) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 7cb52dc1f30a5aa7c44c9def1c9e8dad810631fe..e51281b4b30cb97c8c73aee21245ee32b6c178aa 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -244,7 +244,9 @@ class LLInventoryPanel : public LLPanel LLFolderViewItem* getItemByID(const LLUUID& id); LLFolderViewFolder* getFolderByID(const LLUUID& id); void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); + void openFolderByID(const LLUUID& folder_id); void updateSelection(); + void updateFolderState(); void setSuppressOpenItemAction(bool supress_open_item) { mSuppressOpenItemAction = supress_open_item; } @@ -260,7 +262,8 @@ class LLInventoryPanel : public LLPanel void openStartFolderOrMyInventory(); // open the first level of inventory void onItemsCompletion(); // called when selected items are complete - LLUUID mSelectThisID; + LLUUID mSelectThisID; + LLUUID mOpenFolderID; LLInventoryModel* mInventory; LLInventoryObserver* mInventoryObserver; LLInvPanelComplObserver* mCompletionObserver; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 4691ee3849fcca3f77e63a154b3b32937fc8387b..813a5b3c20d234c3ddf9b9b4e08eab1db920da6a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -383,15 +383,16 @@ void LLPanelMainInventory::closeAllFolders() getPanel()->getRootFolder()->closeAllFolders(); } -void LLPanelMainInventory::newWindow() +LLFloaterSidePanelContainer* LLPanelMainInventory::newWindow() { static S32 instance_num = 0; instance_num = (instance_num + 1) % S32_MAX; if (!gAgentCamera.cameraMouselook()) { - LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num)); + return LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num)); } + return NULL; } void LLPanelMainInventory::doCreate(const LLSD& userdata) @@ -1343,7 +1344,15 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) { return; } - static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(getActivePanel()->getModel(), "goto"); + LLSidepanelInventory *sidepanel_inventory = newWindow()->LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + if (sidepanel_inventory) + { + LLPanelMainInventory* new_inventory = sidepanel_inventory->getMainInventoryPanel(); + if (new_inventory) + { + static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(new_inventory->getActivePanel()->getModel(), "goto"); + } + } } if (command_name == "find_links") diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 903b33bdbf702685e1f20b78a789a9a798ae2277..40f04da6e95c147511ed196763a22a4994910c15 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -46,6 +46,7 @@ class LLMenuButton; class LLMenuGL; class LLToggleableMenu; class LLFloater; +class LLFloaterSidePanelContainer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -90,7 +91,7 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver void setFocusFilterEditor(); - static void newWindow(); + static LLFloaterSidePanelContainer* newWindow(); void toggleFindOptions();