diff options
author | andreykproductengine <akleshchev@productengine.com> | 2014-08-18 16:06:20 +0300 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2014-08-18 16:06:20 +0300 |
commit | 55fa4b1c37ced0a3f0b38cb17bd6da5dfbc0b69c (patch) | |
tree | f75e342e257d05c4b0f68a3f0e8bc9a356411282 /indra/newview | |
parent | 3fda7e8c3f6566c7619eb3b0018142b56041bd6e (diff) |
MAINT-4334 FIXED Request confirmation from the user when paying another avatar to ensure that the destination avatar and L$ amount is correct and intended before the money is sent
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterpay.cpp | 75 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/floater_pay.xml | 187 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/floater_pay_object.xml | 194 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 13 |
4 files changed, 303 insertions, 166 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()) diff --git a/indra/newview/skins/default/xui/en/floater_pay.xml b/indra/newview/skins/default/xui/en/floater_pay.xml index 41a7134b1d..9d91f801a6 100755 --- a/indra/newview/skins/default/xui/en/floater_pay.xml +++ b/indra/newview/skins/default/xui/en/floater_pay.xml @@ -2,12 +2,12 @@ <floater legacy_header_height="18" can_minimize="false" - height="200" + height="186" layout="topleft" name="Give Money" help_topic="give_money" save_rect="true" - width="250"> + width="261"> <string name="payee_group"> Pay Group @@ -21,88 +21,129 @@ type="string" length="1" follows="left|top" - font="SansSerifSmall" height="16" layout="topleft" left="10" - name="payee_name" - top="25" - use_ellipses="true" - width="230"> - Test Name That Is Extremely Long To Check Clipping + top="24" + name="paying_text" + width="180"> + You are paying: </text> - <button - height="23" - label="L$1" - label_selected="L$1" - layout="topleft" - left="35" - name="fastpay 1" - top_pad="8" - width="80" /> - <button - height="23" - label="L$5" - label_selected="L$5" - layout="topleft" - left_pad="15" - name="fastpay 5" - width="80" /> - <button - height="23" - label="L$10" - label_selected="L$10" - layout="topleft" - left="35" - name="fastpay 10" - top_pad="8" - width="80" /> - <button - height="23" - label="L$20" - label_selected="L$20" - layout="topleft" - left_pad="15" - name="fastpay 20" - width="80" /> <text type="string" length="1" follows="left|top" - height="18" + font="SansSerifSmall" + height="16" layout="topleft" - left="35" - name="amount text" - top_pad="8" + left="10" + top_pad="5" + name="payee_name" + use_ellipses="true" width="180"> - Or, choose amount: + Test Name That Is Extremely Long To Check Clipping </text> - <line_editor - border_style="line" - follows="left|top|right" - height="19" - top_pad="0" - layout="topleft" - left="130" - max_length_bytes="9" - name="amount" - width="80" /> - <button - enabled="false" - height="23" - label="Pay" - label_selected="Pay" - layout="topleft" - left="20" - name="pay btn" - top_pad="15" - width="100" /> - <button - height="23" - label="Cancel" - label_selected="Cancel" + <panel + border_thickness="0" + height="104" + label="Search" layout="topleft" + left="0" + top_pad="10" + help_topic="avatarpicker" + name="PatternsPanel" + width="120"> + <button + height="23" + label="Pay L$ 1" + label_selected="Pay L$ 1" + layout="topleft" + left="10" + top="0" + name="fastpay 1" + width="110" /> + <button + height="23" + label="Pay L$ 5" + label_selected="Pay L$ 5" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 5" + width="110" /> + <button + height="23" + label="Pay L$ 10" + label_selected="Pay L$ 10" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 10" + width="110" /> + <button + height="23" + label="Pay L$ 20" + label_selected="Pay L$ 20" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 20" + width="110" /> + </panel> + <view_border + bevel_style="in" + width="1" + height="104" left_pad="10" - name="cancel btn" - width="100" /> + layout="topleft" /> + <panel + border_thickness="0" + height="104" + label="Search" + layout="topleft" + left_pad="0" + name="InputPanel" + width="120"> + <text + type="string" + length="1" + follows="left|top" + height="18" + layout="topleft" + left="10" + top="0" + name="amount text" + width="110"> + Other amount: + </text> + <line_editor + border_style="line" + follows="left|top|right" + height="19" + layout="topleft" + left="10" + top_pad="0" + max_length_bytes="9" + name="amount" + width="90" /> + <button + enabled="false" + height="23" + label="Pay" + label_selected="Pay" + layout="topleft" + left="10" + top_pad="17" + name="pay btn" + width="110" /> + <button + height="23" + label="Cancel" + label_selected="Cancel" + layout="topleft" + left="10" + top_pad="4" + name="cancel btn" + width="110" /> + </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_pay_object.xml b/indra/newview/skins/default/xui/en/floater_pay_object.xml index d3a35c2051..f1e27b918e 100755 --- a/indra/newview/skins/default/xui/en/floater_pay_object.xml +++ b/indra/newview/skins/default/xui/en/floater_pay_object.xml @@ -2,12 +2,12 @@ <floater legacy_header_height="18" can_minimize="false" - height="225" + height="228" layout="topleft" name="Give Money" help_topic="give_money" save_rect="true" - width="250"> + width="261"> <string name="payee_group"> Pay Group @@ -16,12 +16,25 @@ name="payee_resident"> Pay Resident </string> + <text + type="string" + length="1" follows="left|top" height="16" layout="topleft" left="10" - top_pad="24" + top="24" + name="paying_text" + width="180"> + You are paying: + </text> + <text + follows="left|top" + height="16" + layout="topleft" + left="10" + top_pad="5" name="payee_name" use_ellipses="true" width="225"> @@ -40,7 +53,7 @@ width="180"> Via object: </text> - <icon + <icon height="16" width="16" image_name="Inv_Object" @@ -64,78 +77,107 @@ width="188"> My awesome object with a really damn long name </text> - <button - height="23" - label="L$1" - label_selected="L$1" - layout="topleft" - left="25" - name="fastpay 1" - top_pad="8" - width="80" /> - <button - height="23" - label="L$5" - label_selected="L$5" - layout="topleft" - left_pad="15" - name="fastpay 5" - width="80" /> - <button - height="23" - label="L$10" - label_selected="L$10" - layout="topleft" - left="25" - name="fastpay 10" - top_pad="8" - width="80" /> - <button - height="23" - label="L$20" - label_selected="L$20" + <panel + border_thickness="0" + height="104" + label="Search" layout="topleft" - left_pad="15" - name="fastpay 20" - width="80" /> - <text - type="string" - length="1" - follows="left|top" - height="14" - layout="topleft" - left="25" - name="amount text" - top_pad="8" - width="180"> - Or, choose amount: - </text> - <line_editor - border_style="line" - follows="left|top|right" - height="21" - top_pad="0" - layout="topleft" - left="120" - max_length_bytes="9" - name="amount" - width="80" /> - <button - enabled="false" - height="23" - label="Pay" - label_selected="Pay" - layout="topleft" - left="10" - name="pay btn" - top_pad="5" - width="100" /> - <button - height="23" - label="Cancel" - label_selected="Cancel" + left="0" + top_pad="10" + help_topic="avatarpicker" + name="PatternsPanel" + width="120"> + <button + height="23" + label="Pay L$ 1" + label_selected="Pay L$ 1" + layout="topleft" + left="10" + top="0" + name="fastpay 1" + width="110" /> + <button + height="23" + label="Pay L$ 5" + label_selected="Pay L$ 5" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 5" + width="110" /> + <button + height="23" + label="Pay L$ 10" + label_selected="Pay L$ 10" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 10" + width="110" /> + <button + height="23" + label="Pay L$ 20" + label_selected="Pay L$ 20" + layout="topleft" + left="10" + top_pad="4" + name="fastpay 20" + width="110" /> + </panel> + <view_border + bevel_style="in" + width="1" + height="104" + left_pad="10" + layout="topleft" /> + <panel + border_thickness="0" + height="104" + label="Search" layout="topleft" - left_pad="5" - name="cancel btn" - width="100" /> + left_pad="0" + name="InputPanel" + width="120"> + <text + type="string" + length="1" + follows="left|top" + height="18" + layout="topleft" + left="10" + top="0" + name="amount text" + width="180"> + Other amount: + </text> + <line_editor + border_style="line" + follows="left|top|right" + height="19" + layout="topleft" + left="10" + top_pad="0" + max_length_bytes="9" + name="amount" + width="90" /> + <button + enabled="false" + height="23" + label="Pay" + label_selected="Pay" + layout="topleft" + left="10" + top_pad="17" + name="pay btn" + width="110" /> + <button + height="23" + label="Cancel" + label_selected="Cancel" + layout="topleft" + left="10" + top_pad="4" + name="cancel btn" + width="110" /> + </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d606893fc7..55e421ebe0 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5175,6 +5175,19 @@ Warning: The 'Pay object' click action has been set, but it will only <notification icon="alertmodal.tga" + name="PayConfirmation" + type="alertmodal"> + Confirm that you want to pay L$[AMOUNT] to [TARGET]. + <tag>confirm</tag> + <usetemplate + ignoretext="Confirm before paying" + name="okcancelignore" + notext="Cancel" + yestext="Pay"/> + </notification> + + <notification + icon="alertmodal.tga" name="OpenObjectCannotCopy" type="alertmodal"> There are no items in this object that you are allowed to copy. |