summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpay.cpp
diff options
context:
space:
mode:
authormaksymsproductengine <maksymsproductengine@lindenlab.com>2014-12-19 23:20:47 +0200
committermaksymsproductengine <maksymsproductengine@lindenlab.com>2014-12-19 23:20:47 +0200
commit027899963cb8443e7880b4d4aa6c429d16db488b (patch)
treec57a93342fbe6f8e032198e85478705976f3f986 /indra/newview/llfloaterpay.cpp
parente21f8284fdd9cd86e2822b233775e9a3d77917d5 (diff)
parent4ec9bce3c2a715f53938e4568c95b7a2bdfc9e16 (diff)
merge with 3.7.23-release
Diffstat (limited to 'indra/newview/llfloaterpay.cpp')
-rwxr-xr-xindra/newview/llfloaterpay.cpp75
1 files changed, 58 insertions, 17 deletions
diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp
index f0c010b545..a4d13ce1d5 100755
--- a/indra/newview/llfloaterpay.cpp
+++ b/indra/newview/llfloaterpay.cpp
@@ -40,8 +40,10 @@
#include "lltextbox.h"
#include "lllineeditor.h"
#include "llmutelist.h"
+#include "llnotificationsutil.h"
#include "llfloaterreporter.h"
#include "llslurl.h"
+#include "llstatusbar.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
@@ -90,6 +92,9 @@ public:
static void payDirectly(money_callback callback,
const LLUUID& target_id,
bool is_group);
+ static bool payConfirmationCallback(const LLSD& notification,
+ const LLSD& response,
+ LLGiveMoneyInfo* info);
private:
static void onCancel(void* data);
@@ -111,14 +116,12 @@ protected:
LLGiveMoneyInfo* mQuickPayInfo[MAX_PAY_BUTTONS];
LLSafeHandle<LLObjectSelection> mObjectSelection;
-
- static S32 sLastAmount;
};
-S32 LLFloaterPay::sLastAmount = 0;
const S32 MAX_AMOUNT_LENGTH = 10;
const S32 FASTPAY_BUTTON_WIDTH = 80;
+const S32 PAY_AMOUNT_NOTIFICATION = 200;
LLFloaterPay::LLFloaterPay(const LLSD& key)
: LLFloater(key),
@@ -188,17 +191,9 @@ BOOL LLFloaterPay::postBuild()
getChildView("amount text")->setVisible(FALSE);
-
- std::string last_amount;
- if(sLastAmount > 0)
- {
- last_amount = llformat("%d", sLastAmount);
- }
-
getChildView("amount")->setVisible(FALSE);
getChild<LLLineEditor>("amount")->setKeystrokeCallback(&LLFloaterPay::onKeystroke, this);
- getChild<LLUICtrl>("amount")->setValue(last_amount);
getChild<LLLineEditor>("amount")->setPrevalidate(LLTextValidate::validateNonNegativeS32);
info = new LLGiveMoneyInfo(this, 0);
@@ -207,7 +202,7 @@ BOOL LLFloaterPay::postBuild()
childSetAction("pay btn",&LLFloaterPay::onGive,info);
setDefaultBtn("pay btn");
getChildView("pay btn")->setVisible(FALSE);
- getChildView("pay btn")->setEnabled((sLastAmount > 0));
+ getChildView("pay btn")->setEnabled(FALSE);
childSetAction("cancel btn",&LLFloaterPay::onCancel,this);
@@ -419,7 +414,24 @@ void LLFloaterPay::payDirectly(money_callback callback,
floater->finishPayUI(target_id, is_group);
}
-
+
+bool LLFloaterPay::payConfirmationCallback(const LLSD& notification, const LLSD& response, LLGiveMoneyInfo* info)
+{
+ if (!info || !info->mFloater)
+ {
+ return false;
+ }
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option == 0)
+ {
+ info->mFloater->give(info->mAmount);
+ info->mFloater->closeFloater();
+ }
+
+ return false;
+}
+
void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group)
{
std::string slurl;
@@ -470,10 +482,40 @@ void LLFloaterPay::onKeystroke(LLLineEditor*, void* data)
void LLFloaterPay::onGive(void* data)
{
LLGiveMoneyInfo* info = reinterpret_cast<LLGiveMoneyInfo*>(data);
- if(info && info->mFloater)
+ LLFloaterPay* floater = info->mFloater;
+ if(info && floater)
{
- info->mFloater->give(info->mAmount);
- info->mFloater->closeFloater();
+ S32 amount = info->mAmount;
+ if(amount == 0)
+ {
+ amount = atoi(floater->getChild<LLUICtrl>("amount")->getValue().asString().c_str());
+ }
+ if (amount > PAY_AMOUNT_NOTIFICATION && gStatusBar && gStatusBar->getBalance() > amount)
+ {
+ LLUUID payee_id;
+ BOOL is_group;
+ if (floater->mObjectSelection.notNull())
+ {
+ LLSelectNode* node = floater->mObjectSelection->getFirstRootNode();
+ node->mPermissions->getOwnership(payee_id, is_group);
+ }
+ else
+ {
+ is_group = floater->mTargetIsGroup;
+ payee_id = floater->mTargetUUID;
+ }
+
+ LLSD args;
+ args["TARGET"] = LLSLURL( is_group ? "group" : "agent", payee_id, "completename").getSLURLString();
+ args["AMOUNT"] = amount;
+
+ LLNotificationsUtil::add("PayConfirmation", args, LLSD(), boost::bind(&LLFloaterPay::payConfirmationCallback, _1, _2, info));
+ }
+ else
+ {
+ floater->give(amount);
+ floater->closeFloater();
+ }
}
}
@@ -487,7 +529,6 @@ void LLFloaterPay::give(S32 amount)
{
amount = atoi(getChild<LLUICtrl>("amount")->getValue().asString().c_str());
}
- sLastAmount = amount;
// Try to pay an object.
if (mObjectSelection.notNull())