diff --git a/indra/newview/lffloaterinvpanel.cpp b/indra/newview/lffloaterinvpanel.cpp index 2578c90a2..b09885890 100644 --- a/indra/newview/lffloaterinvpanel.cpp +++ b/indra/newview/lffloaterinvpanel.cpp @@ -26,19 +26,19 @@ #include "lluictrlfactory.h" -LFFloaterInvPanel::LFFloaterInvPanel(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name) -: LLInstanceTracker(cat_id) +LFFloaterInvPanel::LFFloaterInvPanel(const LLSD& cat, const std::string& name, LLInventoryModel* model) +: LLInstanceTracker(cat) { mCommitCallbackRegistrar.add("InvPanel.Search", boost::bind(&LLInventoryPanel::setFilterSubString, boost::ref(mPanel), _2)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inv_panel.xml"); LLPanel* panel = getChild("placeholder_panel"); - mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, LLSD().with("id", cat_id), panel->getRect(), model, true); + mPanel = new LLInventoryPanel("inv_panel", LLInventoryPanel::DEFAULT_SORT_ORDER, cat, panel->getRect(), model ? model : &gInventory, true); mPanel->postBuild(); mPanel->setFollows(FOLLOWS_ALL); mPanel->setEnabled(true); addChild(mPanel); removeChild(panel); - setTitle(name); + setTitle(name.empty() ? mPanel->getRootFolder()->getLabel() : name); } LFFloaterInvPanel::~LFFloaterInvPanel() @@ -47,10 +47,10 @@ LFFloaterInvPanel::~LFFloaterInvPanel() } // static -void LFFloaterInvPanel::show(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name) +void LFFloaterInvPanel::show(const LLSD& cat, const std::string& name, LLInventoryModel* model) { - LFFloaterInvPanel* floater = LFFloaterInvPanel::getInstance(cat_id); - if (!floater) floater = new LFFloaterInvPanel(cat_id, model, name); + LFFloaterInvPanel* floater = LFFloaterInvPanel::getInstance(cat); + if (!floater) floater = new LFFloaterInvPanel(cat, name, model); floater->open(); } @@ -63,10 +63,10 @@ void LFFloaterInvPanel::closeAll() { cache.push_back(&*i); } - // Now close all panels, without using instance_iter iterators. - for (std::vector::iterator i = cache.begin(); i != cache.end(); ++i) + // Now close all, without using instance_iter iterators. + for (auto& floater : cache) { - (*i)->close(); + floater->close(); } } diff --git a/indra/newview/lffloaterinvpanel.h b/indra/newview/lffloaterinvpanel.h index 3c9104db1..51dac3369 100644 --- a/indra/newview/lffloaterinvpanel.h +++ b/indra/newview/lffloaterinvpanel.h @@ -23,15 +23,16 @@ #include "llfloater.h" #include "llinstancetracker.h" +#include "llsdutil.h" -class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker +class LFFloaterInvPanel : public LLFloater, public LLInstanceTracker { - LFFloaterInvPanel(const LLUUID& cat_id, class LLInventoryModel* model, const std::string& name); + LFFloaterInvPanel(const LLSD& cat, const std::string& name = LLStringUtil::null, class LLInventoryModel* model = nullptr); ~LFFloaterInvPanel(); public: - static void show(const LLUUID& cat_id, LLInventoryModel* model, const std::string& name); // Show the floater for cat_id (create with other params if necessary) + static void show(const LLSD& cat, const std::string& name = LLStringUtil::null, LLInventoryModel* model = nullptr); // Show the floater for cat (create with other params if necessary) static void closeAll(); // Called when not allowed to have inventory open /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5326a64d3..2f527e134 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2961,7 +2961,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLInventoryModel* model = getInventoryModel(); LLViewerInventoryCategory* cat = getCategory(); if (!model || !cat) return; - LFFloaterInvPanel::show(mUUID, model, cat->getName()); + LFFloaterInvPanel::show(LLSD().with("id", mUUID), cat->getName(), model); return; } else if ("paste" == action)