summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterbuycontents.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterbuycontents.cpp')
-rw-r--r--indra/newview/llfloaterbuycontents.cpp66
1 files changed, 32 insertions, 34 deletions
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 9bde3b1dac..a7388d21a3 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -3,31 +3,25 @@
* @author James Cook
* @brief LLFloaterBuyContents class implementation
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,6 +41,7 @@
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h" // for gInventory
+#include "llfirstuse.h"
#include "llfloaterreg.h"
#include "llfloaterinventory.h" // for LLInventoryIcon::getIcon
#include "llnotificationsutil.h"
@@ -60,7 +55,6 @@
LLFloaterBuyContents::LLFloaterBuyContents(const LLSD& key)
: LLFloater(key)
{
-// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml");
}
BOOL LLFloaterBuyContents::postBuild()
@@ -69,9 +63,9 @@ BOOL LLFloaterBuyContents::postBuild()
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this));
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this));
- childDisable("item_list");
- childDisable("buy_btn");
- childDisable("wear_check");
+ getChildView("item_list")->setEnabled(FALSE);
+ getChildView("buy_btn")->setEnabled(FALSE);
+ getChildView("wear_check")->setEnabled(FALSE);
setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
@@ -129,9 +123,9 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
gCacheName->getGroupName(owner_id, owner_name);
}
- floater->childSetTextArg("contains_text", "[NAME]", node->mName);
- floater->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
- floater->childSetTextArg("buy_text", "[NAME]", owner_name);
+ floater->getChild<LLUICtrl>("contains_text")->setTextArg("[NAME]", node->mName);
+ floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
+ floater->getChild<LLUICtrl>("buy_text")->setTextArg("[NAME]", owner_name);
// Must do this after the floater is created, because
// sometimes the inventory is already there and
@@ -169,7 +163,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
}
// default to turning off the buy button.
- childDisable("buy_btn");
+ getChildView("buy_btn")->setEnabled(FALSE);
LLUUID owner_id;
BOOL is_group_owned;
@@ -210,7 +204,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
// There will be at least one item shown in the display, so go
// ahead and enable the buy button.
- childEnable("buy_btn");
+ getChildView("buy_btn")->setEnabled(TRUE);
// Create the line in the list
LLSD row;
@@ -256,8 +250,8 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
if (wearable_count > 0)
{
- childEnable("wear_check");
- childSetValue("wear_check", LLSD(false) );
+ getChildView("wear_check")->setEnabled(TRUE);
+ getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
}
removeVOInventoryListener();
@@ -268,7 +262,7 @@ void LLFloaterBuyContents::onClickBuy()
{
// Make sure this wasn't selected through other mechanisms
// (ie, being the default button and pressing enter.
- if(!childIsEnabled("buy_btn"))
+ if(!getChildView("buy_btn")->getEnabled())
{
// We shouldn't be enabled. Just close.
closeFloater();
@@ -276,7 +270,7 @@ void LLFloaterBuyContents::onClickBuy()
}
// We may want to wear this item
- if (childGetValue("wear_check"))
+ if (getChild<LLUICtrl>("wear_check")->getValue())
{
LLInventoryState::sWearNewClothing = TRUE;
}
@@ -290,6 +284,10 @@ void LLFloaterBuyContents::onClickBuy()
// it doesn't match region info then sale is canceled.
LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo);
+ // NOTE: do this here instead of on receipt of object, since contents are transfered
+ // via a generic BulkUpdateInventory message with no way of distinguishing it from
+ // other inventory operations
+ LLFirstUse::newInventory();
closeFloater();
}