summaryrefslogtreecommitdiff
path: root/indra/newview/llfloateropenobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloateropenobject.cpp')
-rw-r--r--indra/newview/llfloateropenobject.cpp102
1 files changed, 42 insertions, 60 deletions
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index f4984df6d9..aa82dc34b7 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -43,11 +43,12 @@
#include "llbutton.h"
#include "lltextbox.h"
-#include "llagent.h" // for agent id
#include "llalertdialog.h"
-#include "llinventoryview.h"
+#include "llinventorybridge.h"
+#include "llfloaterinventory.h"
#include "llinventorymodel.h"
#include "llpanelinventory.h"
+#include "llfloaterreg.h"
#include "llselectmgr.h"
#include "lluiconstants.h"
#include "llviewerobject.h"
@@ -55,27 +56,44 @@
#include "llviewerwindow.h"
-LLFloaterOpenObject* LLFloaterOpenObject::sInstance = NULL;
-
-LLFloaterOpenObject::LLFloaterOpenObject()
-: LLFloater(std::string("object_contents")),
+LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key)
+: LLFloater(key),
mPanelInventory(NULL),
mDirty(TRUE)
{
- LLCallbackMap::map_t factory_map;
- factory_map["object_contents"] = LLCallbackMap(createPanelInventory, this);
- LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml",&factory_map);
-
- childSetAction("copy_to_inventory_button", onClickMoveToInventory, this);
- childSetAction("copy_and_wear_button", onClickMoveAndWear, this);
- childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this
+// LLUICtrlFactory::getInstance()->buildFloater(this,"floater_openobject.xml");
+ mCommitCallbackRegistrar.add("OpenObject.MoveToInventory", boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this));
+ mCommitCallbackRegistrar.add("OpenObject.MoveAndWear", boost::bind(&LLFloaterOpenObject::onClickMoveAndWear, this));
}
LLFloaterOpenObject::~LLFloaterOpenObject()
{
- sInstance = NULL;
+// sInstance = NULL;
+}
+// virtual
+BOOL LLFloaterOpenObject::postBuild()
+{
+ childSetTextArg("object_name", "[DESC]", std::string("Object") ); // *Note: probably do not want to translate this
+ mPanelInventory = getChild<LLPanelInventory>("object_contents");
+ return TRUE;
}
+void LLFloaterOpenObject::onOpen(const LLSD& key)
+{
+ LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection();
+ if (object_selection->getRootObjectCount() != 1)
+ {
+ LLNotifications::instance().add("UnableToViewContentsMoreThanOne");
+ closeFloater();
+ return;
+ }
+ if(!(object_selection->getPrimaryObject()))
+ {
+ closeFloater();
+ return;
+ }
+ mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
+}
void LLFloaterOpenObject::refresh()
{
mPanelInventory->refresh();
@@ -96,7 +114,6 @@ void LLFloaterOpenObject::refresh()
}
childSetTextArg("object_name", "[DESC]", name);
-
childSetEnabled("copy_to_inventory_button", enabled);
childSetEnabled("copy_and_wear_button", enabled);
@@ -112,34 +129,11 @@ void LLFloaterOpenObject::draw()
LLFloater::draw();
}
-// static
void LLFloaterOpenObject::dirty()
{
- if (sInstance) sInstance->mDirty = TRUE;
+ mDirty = TRUE;
}
-// static
-void LLFloaterOpenObject::show()
-{
- LLObjectSelectionHandle object_selection = LLSelectMgr::getInstance()->getSelection();
- if (object_selection->getRootObjectCount() != 1)
- {
- LLNotifications::instance().add("UnableToViewContentsMoreThanOne");
- return;
- }
-
- // Create a new instance only if needed
- if (!sInstance)
- {
- sInstance = new LLFloaterOpenObject();
- sInstance->center();
- }
-
- sInstance->open(); /* Flawfinder: ignore */
- sInstance->setFocus(TRUE);
-
- sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
-}
void LLFloaterOpenObject::moveToInventory(bool wear)
@@ -167,7 +161,7 @@ void LLFloaterOpenObject::moveToInventory(bool wear)
}
else
{
- parent_category_id = gAgent.getInventoryRootID();
+ parent_category_id = gInventory.getRootFolderID();
}
LLUUID category_id = gInventory.createNewCategory(parent_category_id,
LLAssetType::AT_NONE,
@@ -198,8 +192,8 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
if (result == 0)
{
- LLInventoryView::showAgentInventory();
- LLInventoryView* view = LLInventoryView::getActiveInventory();
+ LLFloaterInventory::showAgentInventory();
+ LLFloaterInventory* view = LLFloaterInventory::getActiveInventory();
if (view)
{
view->getPanel()->setSelection(cat->mCatID, TAKE_FOCUS_NO);
@@ -209,27 +203,15 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
delete cat;
}
-
-// static
-void LLFloaterOpenObject::onClickMoveToInventory(void* data)
+void LLFloaterOpenObject::onClickMoveToInventory()
{
- LLFloaterOpenObject* self = (LLFloaterOpenObject*)data;
- self->moveToInventory(false);
- self->close();
+ moveToInventory(false);
+ closeFloater();
}
-// static
-void LLFloaterOpenObject::onClickMoveAndWear(void* data)
+void LLFloaterOpenObject::onClickMoveAndWear()
{
- LLFloaterOpenObject* self = (LLFloaterOpenObject*)data;
- self->moveToInventory(true);
- self->close();
+ moveToInventory(true);
+ closeFloater();
}
-//static
-void* LLFloaterOpenObject::createPanelInventory(void* data)
-{
- LLFloaterOpenObject* floater = (LLFloaterOpenObject*)data;
- floater->mPanelInventory = new LLPanelInventory(std::string("Object Contents"), LLRect());
- return floater->mPanelInventory;
-}