diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloatersellland.cpp | 107 |
1 files changed, 58 insertions, 49 deletions
diff --git a/linden/indra/newview/llfloatersellland.cpp b/linden/indra/newview/llfloatersellland.cpp index 4d91770..92e070f 100644 --- a/linden/indra/newview/llfloatersellland.cpp +++ b/linden/indra/newview/llfloatersellland.cpp | |||
@@ -16,7 +16,8 @@ | |||
16 | * There are special exceptions to the terms and conditions of the GPL as | 16 | * There are special exceptions to the terms and conditions of the GPL as |
17 | * it is applied to this Source Code. View the full text of the exception | 17 | * it is applied to this Source Code. View the full text of the exception |
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 18 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
19 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 19 | * online at |
20 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
20 | * | 21 | * |
21 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
22 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -79,9 +80,9 @@ private: | |||
79 | static void doSelectAgent(void *userdata); | 80 | static void doSelectAgent(void *userdata); |
80 | static void doCancel(void *userdata); | 81 | static void doCancel(void *userdata); |
81 | static void doSellLand(void *userdata); | 82 | static void doSellLand(void *userdata); |
82 | static void onConfirmSale(S32 option, void *userdata); | 83 | bool onConfirmSale(const LLSD& notification, const LLSD& response); |
83 | static void doShowObjects(void *userdata); | 84 | static void doShowObjects(void *userdata); |
84 | static void callbackHighlightTransferable(S32 option, void* userdata); | 85 | static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response); |
85 | 86 | ||
86 | static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); | 87 | static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); |
87 | 88 | ||
@@ -443,15 +444,16 @@ void LLFloaterSellLandUI::doShowObjects(void *userdata) | |||
443 | 444 | ||
444 | send_parcel_select_objects(parcel->getLocalID(), RT_SELL); | 445 | send_parcel_select_objects(parcel->getLocalID(), RT_SELL); |
445 | 446 | ||
446 | LLNotifyBox::showXml("TransferObjectsHighlighted", | 447 | LLNotifications::instance().add("TransferObjectsHighlighted", |
447 | callbackHighlightTransferable, | 448 | LLSD(), LLSD(), |
448 | userdata); | 449 | &LLFloaterSellLandUI::callbackHighlightTransferable); |
449 | } | 450 | } |
450 | 451 | ||
451 | // static | 452 | // static |
452 | void LLFloaterSellLandUI::callbackHighlightTransferable(S32 option, void* userdata) | 453 | bool LLFloaterSellLandUI::callbackHighlightTransferable(const LLSD& notification, const LLSD& data) |
453 | { | 454 | { |
454 | LLSelectMgr::getInstance()->unhighlightAll(); | 455 | LLSelectMgr::getInstance()->unhighlightAll(); |
456 | return false; | ||
455 | } | 457 | } |
456 | 458 | ||
457 | // static | 459 | // static |
@@ -462,83 +464,89 @@ void LLFloaterSellLandUI::doSellLand(void *userdata) | |||
462 | LLParcel* parcel = self->mParcelSelection->getParcel(); | 464 | LLParcel* parcel = self->mParcelSelection->getParcel(); |
463 | 465 | ||
464 | // Do a confirmation | 466 | // Do a confirmation |
465 | if (!parcel->getForSale()) | 467 | S32 sale_price = self->childGetValue("price"); |
468 | S32 area = parcel->getArea(); | ||
469 | std::string authorizedBuyerName = "Anyone"; | ||
470 | bool sell_to_anyone = true; | ||
471 | if ("user" == self->childGetValue("sell_to").asString()) | ||
466 | { | 472 | { |
467 | S32 sale_price = self->childGetValue("price"); | 473 | authorizedBuyerName = self->childGetText("sell_to_agent"); |
468 | S32 area = parcel->getArea(); | 474 | sell_to_anyone = false; |
469 | std::string authorizedBuyerName = "Anyone"; | 475 | } |
470 | bool sell_to_anyone = true; | ||
471 | if ("user" == self->childGetValue("sell_to").asString()) | ||
472 | { | ||
473 | authorizedBuyerName = self->childGetText("sell_to_agent"); | ||
474 | sell_to_anyone = false; | ||
475 | } | ||
476 | 476 | ||
477 | // must sell to someone if indicating sale to anyone | 477 | // must sell to someone if indicating sale to anyone |
478 | if ((sale_price == 0) && sell_to_anyone) | 478 | if (!parcel->getForSale() |
479 | { | 479 | && (sale_price == 0) |
480 | gViewerWindow->alertXml("SalePriceRestriction"); | 480 | && sell_to_anyone) |
481 | return; | 481 | { |
482 | } | 482 | LLNotifications::instance().add("SalePriceRestriction"); |
483 | return; | ||
484 | } | ||
483 | 485 | ||
484 | LLStringUtil::format_map_t args; | 486 | LLSD args; |
485 | args["[LAND_SIZE]"] = llformat("%d",area); | 487 | args["LAND_SIZE"] = llformat("%d",area); |
486 | args["[SALE_PRICE]"] = llformat("%d",sale_price); | 488 | args["SALE_PRICE"] = llformat("%d",sale_price); |
487 | args["[NAME]"] = authorizedBuyerName; | 489 | args["NAME"] = authorizedBuyerName; |
488 | 490 | ||
489 | if (sell_to_anyone) | 491 | LLNotification::Params params("ConfirmLandSaleChange"); |
490 | { | 492 | params.substitutions(args) |
491 | gViewerWindow->alertXml("ConfirmLandSaleToAnyoneChange", args, onConfirmSale, self); | 493 | .functor(boost::bind(&LLFloaterSellLandUI::onConfirmSale, self, _1, _2)); |
492 | } | 494 | |
493 | else | 495 | if (sell_to_anyone) |
494 | { | 496 | { |
495 | gViewerWindow->alertXml("ConfirmLandSaleChange", args, onConfirmSale, self); | 497 | params.name("ConfirmLandSaleToAnyoneChange"); |
496 | } | 498 | } |
499 | |||
500 | if (parcel->getForSale()) | ||
501 | { | ||
502 | // parcel already for sale, so ignore this question | ||
503 | LLNotifications::instance().forceResponse(params, -1); | ||
497 | } | 504 | } |
498 | else | 505 | else |
499 | { | 506 | { |
500 | onConfirmSale(-1, self); | 507 | // ask away |
508 | LLNotifications::instance().add(params); | ||
501 | } | 509 | } |
510 | |||
502 | } | 511 | } |
503 | 512 | ||
504 | // static | 513 | bool LLFloaterSellLandUI::onConfirmSale(const LLSD& notification, const LLSD& response) |
505 | void LLFloaterSellLandUI::onConfirmSale(S32 option, void *userdata) | ||
506 | { | 514 | { |
515 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
507 | if (option != 0) | 516 | if (option != 0) |
508 | { | 517 | { |
509 | return; | 518 | return false; |
510 | } | 519 | } |
511 | LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata; | 520 | S32 sale_price = childGetValue("price"); |
512 | S32 sale_price = self->childGetValue("price"); | ||
513 | 521 | ||
514 | // Valid extracted data | 522 | // Valid extracted data |
515 | if (sale_price < 0) | 523 | if (sale_price < 0) |
516 | { | 524 | { |
517 | // TomY TODO: Throw an error | 525 | // TomY TODO: Throw an error |
518 | return; | 526 | return false; |
519 | } | 527 | } |
520 | 528 | ||
521 | LLParcel* parcel = self->mParcelSelection->getParcel(); | 529 | LLParcel* parcel = mParcelSelection->getParcel(); |
522 | if (!parcel) return; | 530 | if (!parcel) return false; |
523 | 531 | ||
524 | // can_agent_modify_parcel deprecated by GROUPS | 532 | // can_agent_modify_parcel deprecated by GROUPS |
525 | // if (!can_agent_modify_parcel(parcel)) | 533 | // if (!can_agent_modify_parcel(parcel)) |
526 | // { | 534 | // { |
527 | // self->close(); | 535 | // close(); |
528 | // return; | 536 | // return; |
529 | // } | 537 | // } |
530 | 538 | ||
531 | parcel->setParcelFlag(PF_FOR_SALE, TRUE); | 539 | parcel->setParcelFlag(PF_FOR_SALE, TRUE); |
532 | parcel->setSalePrice(sale_price); | 540 | parcel->setSalePrice(sale_price); |
533 | bool sell_with_objects = false; | 541 | bool sell_with_objects = false; |
534 | if ("yes" == self->childGetValue("sell_objects").asString()) | 542 | if ("yes" == childGetValue("sell_objects").asString()) |
535 | { | 543 | { |
536 | sell_with_objects = true; | 544 | sell_with_objects = true; |
537 | } | 545 | } |
538 | parcel->setSellWithObjects(sell_with_objects); | 546 | parcel->setSellWithObjects(sell_with_objects); |
539 | if ("user" == self->childGetValue("sell_to").asString()) | 547 | if ("user" == childGetValue("sell_to").asString()) |
540 | { | 548 | { |
541 | parcel->setAuthorizedBuyerID(self->mAuthorizedBuyer); | 549 | parcel->setAuthorizedBuyerID(mAuthorizedBuyer); |
542 | } | 550 | } |
543 | else | 551 | else |
544 | { | 552 | { |
@@ -548,5 +556,6 @@ void LLFloaterSellLandUI::onConfirmSale(S32 option, void *userdata) | |||
548 | // Send update to server | 556 | // Send update to server |
549 | LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); | 557 | LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel ); |
550 | 558 | ||
551 | self->close(); | 559 | close(); |
560 | return false; | ||
552 | } | 561 | } |