SL-13826 Show result of "Find original" and "Show original" in Main Inventory floater and reset the filters to guarantee success

meow-7.2.2
Mnikolenko Productengine 2020-12-10 17:43:21 +02:00
parent d1789103c2
commit 6ec194154b
6 changed files with 67 additions and 110 deletions

View File

@ -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())

View File

@ -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;
}
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();
//sidetray inventory panel
LLSidepanelInventory *sidepanel_inventory = LLPanelMainInventory::newWindow()->LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
if (!LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>("inventory")->isInVisibleChain())
{
LLFloaterReg::toggleInstanceOrBringToFront("inventory");
}
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 (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)
{

View File

@ -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()))

View File

@ -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;

View File

@ -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")

View File

@ -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);