diff options
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 41 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 73 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 6 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 6 |
6 files changed, 67 insertions, 110 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ae96963b2a..27e222237e 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1863,29 +1863,11 @@ void LLItemBridge::restoreToWorld() void LLItemBridge::gotoItem() { - LLInventoryObject *obj = getInventoryObject(); - if (obj && obj->getIsLinkType()) - { - const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); - if (gInventory.isObjectDescendentOf(obj->getLinkedUUID(), inbox_id)) - { - LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - if (sidepanel_inventory && sidepanel_inventory->getInboxPanel()) - { - sidepanel_inventory->getInboxPanel()->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO); - } - } - else - { - LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); - if (active_panel) - { - active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO); - active_panel->setFocus(TRUE); - } - } - - } + LLInventoryObject *obj = getInventoryObject(); + if (obj && obj->getIsLinkType()) + { + show_item_original(obj->getUUID()); + } } LLUIImagePtr LLItemBridge::getIcon() const @@ -7251,13 +7233,20 @@ void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string acti } LLItemBridge::performAction(model,action); } - void LLLinkFolderBridge::gotoItem() { LLItemBridge::gotoItem(); - LLInventoryPanel::getActiveInventoryPanel()->openFolderByID(getFolderID()); -} + const LLUUID &cat_uuid = getFolderID(); + if (!cat_uuid.isNull()) + { + LLFolderViewItem *base_folder = LLInventoryPanel::getActiveInventoryPanel()->getItemByID(cat_uuid); + if (base_folder) + { + base_folder->setOpen(TRUE); + } + } +} const LLUUID &LLLinkFolderBridge::getFolderID() const { if (LLViewerInventoryItem *link_item = getItem()) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 628363a47e..181bc48571 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -774,35 +774,45 @@ void show_item_profile(const LLUUID& item_uuid) void show_item_original(const LLUUID& item_uuid) { - LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); - if (!floater_inventory) - { - LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; - return; - } - - //sidetray inventory panel - LLSidepanelInventory *sidepanel_inventory = LLPanelMainInventory::newWindow()->LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - + LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); + if (!floater_inventory) + { + LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; + return; + } + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); + if (sidepanel_inventory) + { + LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); + if (main_inventory) + { + main_inventory->resetFilters(); + } + reset_inventory_filter(); - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(); - if (!active_panel) - { - //this may happen when there is no floatera and other panel is active in inventory tab + if (!LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("inventory")->isInVisibleChain()) + { + LLFloaterReg::toggleInstanceOrBringToFront("inventory"); + } - if (sidepanel_inventory) - { - sidepanel_inventory->showInventoryPanel(); - } - } - - active_panel = LLInventoryPanel::getActiveInventoryPanel(); - if (!active_panel) - { - return; - } - active_panel->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_YES); - active_panel->setFocus(TRUE); + const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); + if (gInventory.isObjectDescendentOf(gInventory.getLinkedItemID(item_uuid), inbox_id)) + { + if (sidepanel_inventory->getInboxPanel()) + { + sidepanel_inventory->openInbox(); + sidepanel_inventory->getInboxPanel()->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_YES); + } + } + else + { + sidepanel_inventory->selectAllItemsPanel(); + if (sidepanel_inventory->getActivePanel()) + { + sidepanel_inventory->getActivePanel()->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_YES); + } + } + } } @@ -2486,15 +2496,6 @@ 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 0246878ab6..1f5dfa6d5c 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -157,7 +157,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mViewsInitialized(false), mInvFVBridgeBuilder(NULL), mInventoryViewModel(p.name), - mGroupedItemBridge(new LLFolderViewGroupedItemBridge) + mGroupedItemBridge(new LLFolderViewGroupedItemBridge), + mFocusSelection(false) { mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER; @@ -339,7 +340,6 @@ void LLInventoryPanel::draw() { // Select the desired item (in case it wasn't loaded when the selection was requested) updateSelection(); - updateFolderState(); LLPanel::draw(); } @@ -1222,7 +1222,7 @@ void LLInventoryPanel::setSelectCallback(const boost::function<void (const std:: void LLInventoryPanel::clearSelection() { mSelectThisID.setNull(); - mOpenFolderID.setNull(); + mFocusSelection = false; } LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const @@ -1702,15 +1702,17 @@ LLFolderViewFolder* LLInventoryPanel::getFolderByID(const LLUUID& id) void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyboard_focus ) { LLFolderViewItem* itemp = getItemByID(obj_id); - if(itemp && itemp->getViewModelItem()) + if(itemp && itemp->getViewModelItem() && itemp->passedFilter()) { itemp->arrangeAndSet(TRUE, take_keyboard_focus); mSelectThisID.setNull(); + mFocusSelection = false; return; } else { // save the desired item to be selected later (if/when ready) + mFocusSelection = take_keyboard_focus; mSelectThisID = obj_id; } } @@ -1719,34 +1721,10 @@ void LLInventoryPanel::updateSelection() { if (mSelectThisID.notNull()) { - setSelectionByID(mSelectThisID, false); + setSelectionByID(mSelectThisID, mFocusSelection); } } -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 2bcc3f3c0b..447d24b959 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -244,9 +244,7 @@ public: 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; } @@ -262,11 +260,11 @@ protected: void openStartFolderOrMyInventory(); // open the first level of inventory void onItemsCompletion(); // called when selected items are complete - LLUUID mSelectThisID; - LLUUID mOpenFolderID; + LLUUID mSelectThisID; LLInventoryModel* mInventory; LLInventoryObserver* mInventoryObserver; LLInvPanelComplObserver* mCompletionObserver; + bool mFocusSelection; bool mAcceptsDragAndDrop; bool mAllowMultiSelect; bool mAllowDrag; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 813a5b3c20..4691ee3849 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -383,16 +383,15 @@ void LLPanelMainInventory::closeAllFolders() getPanel()->getRootFolder()->closeAllFolders(); } -LLFloaterSidePanelContainer* LLPanelMainInventory::newWindow() +void LLPanelMainInventory::newWindow() { static S32 instance_num = 0; instance_num = (instance_num + 1) % S32_MAX; if (!gAgentCamera.cameraMouselook()) { - return LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num)); + LLFloaterReg::showTypedInstance<LLFloaterSidePanelContainer>("inventory", LLSD(instance_num)); } - return NULL; } void LLPanelMainInventory::doCreate(const LLSD& userdata) @@ -1344,15 +1343,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) { return; } - 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"); - } - } + static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->performAction(getActivePanel()->getModel(), "goto"); } if (command_name == "find_links") diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 40f04da6e9..313e478bfe 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -46,7 +46,6 @@ class LLMenuButton; class LLMenuGL; class LLToggleableMenu; class LLFloater; -class LLFloaterSidePanelContainer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -91,10 +90,12 @@ public: void setFocusFilterEditor(); - static LLFloaterSidePanelContainer* newWindow(); + static void newWindow(); void toggleFindOptions(); + void resetFilters(); + protected: // // Misc functions @@ -119,7 +120,6 @@ protected: void doToSelected(const LLSD& userdata); void closeAllFolders(); void doCreate(const LLSD& userdata); - void resetFilters(); void setSortBy(const LLSD& userdata); void saveTexture(const LLSD& userdata); bool isSaveTextureEnabled(const LLSD& userdata); |