diff options
Diffstat (limited to 'linden/indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | linden/indra/newview/llpanelpermissions.cpp | 203 |
1 files changed, 129 insertions, 74 deletions
diff --git a/linden/indra/newview/llpanelpermissions.cpp b/linden/indra/newview/llpanelpermissions.cpp index 0d50f38..4867980 100644 --- a/linden/indra/newview/llpanelpermissions.cpp +++ b/linden/indra/newview/llpanelpermissions.cpp | |||
@@ -98,8 +98,8 @@ BOOL LLPanelPermissions::postBuild() | |||
98 | 98 | ||
99 | this->childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); | 99 | this->childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); |
100 | 100 | ||
101 | this->childSetCommitCallback("EdCost",LLPanelPermissions::onCommitSaleInfo,this); | 101 | this->childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); |
102 | this->childSetPrevalidate("EdCost",LLLineEditor::prevalidateNonNegativeS32); | 102 | this->childSetPrevalidate("Edit Cost",LLLineEditor::prevalidateNonNegativeS32); |
103 | 103 | ||
104 | this->childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); | 104 | this->childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); |
105 | 105 | ||
@@ -135,7 +135,7 @@ void LLPanelPermissions::refresh() | |||
135 | LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); | 135 | LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); |
136 | if(BtnDeedToGroup) | 136 | if(BtnDeedToGroup) |
137 | { | 137 | { |
138 | LLString deedText; | 138 | std::string deedText; |
139 | if (gSavedSettings.getWarning("DeedObject")) | 139 | if (gSavedSettings.getWarning("DeedObject")) |
140 | { | 140 | { |
141 | deedText = getString("text deed continued"); | 141 | deedText = getString("text deed continued"); |
@@ -165,33 +165,33 @@ void LLPanelPermissions::refresh() | |||
165 | { | 165 | { |
166 | // ...nothing selected | 166 | // ...nothing selected |
167 | childSetEnabled("perm_modify",false); | 167 | childSetEnabled("perm_modify",false); |
168 | childSetText("perm_modify",LLString::null); | 168 | childSetText("perm_modify",LLStringUtil::null); |
169 | 169 | ||
170 | childSetEnabled("Creator:",false); | 170 | childSetEnabled("Creator:",false); |
171 | childSetText("Creator Name",LLString::null); | 171 | childSetText("Creator Name",LLStringUtil::null); |
172 | childSetEnabled("Creator Name",false); | 172 | childSetEnabled("Creator Name",false); |
173 | childSetEnabled("button creator profile",false); | 173 | childSetEnabled("button creator profile",false); |
174 | 174 | ||
175 | childSetEnabled("Owner:",false); | 175 | childSetEnabled("Owner:",false); |
176 | childSetText("Owner Name",LLString::null); | 176 | childSetText("Owner Name",LLStringUtil::null); |
177 | childSetEnabled("Owner Name",false); | 177 | childSetEnabled("Owner Name",false); |
178 | childSetEnabled("button owner profile",false); | 178 | childSetEnabled("button owner profile",false); |
179 | 179 | ||
180 | childSetEnabled("Group:",false); | 180 | childSetEnabled("Group:",false); |
181 | childSetText("Group Name",LLString::null); | 181 | childSetText("Group Name",LLStringUtil::null); |
182 | childSetEnabled("Group Name",false); | 182 | childSetEnabled("Group Name",false); |
183 | childSetEnabled("button set group",false); | 183 | childSetEnabled("button set group",false); |
184 | 184 | ||
185 | childSetText("Object Name",LLString::null); | 185 | childSetText("Object Name",LLStringUtil::null); |
186 | childSetEnabled("Object Name",false); | 186 | childSetEnabled("Object Name",false); |
187 | childSetEnabled("Name:",false); | 187 | childSetEnabled("Name:",false); |
188 | childSetText("Group Name",LLString::null); | 188 | childSetText("Group Name",LLStringUtil::null); |
189 | childSetEnabled("Group Name",false); | 189 | childSetEnabled("Group Name",false); |
190 | childSetEnabled("Description:",false); | 190 | childSetEnabled("Description:",false); |
191 | childSetText("Object Description",LLString::null); | 191 | childSetText("Object Description",LLStringUtil::null); |
192 | childSetEnabled("Object Description",false); | 192 | childSetEnabled("Object Description",false); |
193 | 193 | ||
194 | childSetText("prim info",LLString::null); | 194 | childSetText("prim info",LLStringUtil::null); |
195 | childSetEnabled("prim info",false); | 195 | childSetEnabled("prim info",false); |
196 | 196 | ||
197 | childSetEnabled("Permissions:",false); | 197 | childSetEnabled("Permissions:",false); |
@@ -229,9 +229,10 @@ void LLPanelPermissions::refresh() | |||
229 | RadioSaleType->setEnabled(FALSE); | 229 | RadioSaleType->setEnabled(FALSE); |
230 | } | 230 | } |
231 | 231 | ||
232 | childSetEnabled("Price: L$",false); | 232 | childSetEnabled("Cost",false); |
233 | childSetText("EdCost",LLString::null); | 233 | childSetText("Cost",getString("Cost Default")); |
234 | childSetEnabled("EdCost",false); | 234 | childSetText("Edit Cost",LLStringUtil::null); |
235 | childSetEnabled("Edit Cost",false); | ||
235 | 236 | ||
236 | childSetEnabled("label click action",false); | 237 | childSetEnabled("label click action",false); |
237 | LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); | 238 | LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); |
@@ -259,7 +260,7 @@ void LLPanelPermissions::refresh() | |||
259 | || LLSelectMgr::getInstance()->selectGetModify(); | 260 | || LLSelectMgr::getInstance()->selectGetModify(); |
260 | const LLView* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); | 261 | const LLView* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); |
261 | S32 string_index = 0; | 262 | S32 string_index = 0; |
262 | LLString MODIFY_INFO_STRINGS[] = | 263 | std::string MODIFY_INFO_STRINGS[] = |
263 | { | 264 | { |
264 | getString("text modify info 1"), | 265 | getString("text modify info 1"), |
265 | getString("text modify info 2"), | 266 | getString("text modify info 2"), |
@@ -282,7 +283,7 @@ void LLPanelPermissions::refresh() | |||
282 | // Update creator text field | 283 | // Update creator text field |
283 | childSetEnabled("Creator:",true); | 284 | childSetEnabled("Creator:",true); |
284 | BOOL creators_identical; | 285 | BOOL creators_identical; |
285 | LLString creator_name; | 286 | std::string creator_name; |
286 | creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, | 287 | creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, |
287 | creator_name); | 288 | creator_name); |
288 | 289 | ||
@@ -294,7 +295,7 @@ void LLPanelPermissions::refresh() | |||
294 | childSetEnabled("Owner:",true); | 295 | childSetEnabled("Owner:",true); |
295 | 296 | ||
296 | BOOL owners_identical; | 297 | BOOL owners_identical; |
297 | LLString owner_name; | 298 | std::string owner_name; |
298 | owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); | 299 | owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); |
299 | 300 | ||
300 | // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; | 301 | // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; |
@@ -308,7 +309,7 @@ void LLPanelPermissions::refresh() | |||
308 | else | 309 | else |
309 | { | 310 | { |
310 | // Display last owner if public | 311 | // Display last owner if public |
311 | LLString last_owner_name; | 312 | std::string last_owner_name; |
312 | LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); | 313 | LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); |
313 | 314 | ||
314 | // It should never happen that the last owner is null and the owner | 315 | // It should never happen that the last owner is null and the owner |
@@ -327,7 +328,7 @@ void LLPanelPermissions::refresh() | |||
327 | 328 | ||
328 | // update group text field | 329 | // update group text field |
329 | childSetEnabled("Group:",true); | 330 | childSetEnabled("Group:",true); |
330 | childSetText("Group Name",LLString::null); | 331 | childSetText("Group Name",LLStringUtil::null); |
331 | LLUUID group_id; | 332 | LLUUID group_id; |
332 | BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); | 333 | BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); |
333 | if (groups_identical) | 334 | if (groups_identical) |
@@ -343,7 +344,7 @@ void LLPanelPermissions::refresh() | |||
343 | if(mLabelGroupName) | 344 | if(mLabelGroupName) |
344 | { | 345 | { |
345 | mLabelGroupName->setNameID(LLUUID::null, TRUE); | 346 | mLabelGroupName->setNameID(LLUUID::null, TRUE); |
346 | mLabelGroupName->refresh(LLUUID::null, "", "", TRUE); | 347 | mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, LLStringUtil::null, TRUE); |
347 | mLabelGroupName->setEnabled(FALSE); | 348 | mLabelGroupName->setEnabled(FALSE); |
348 | } | 349 | } |
349 | } | 350 | } |
@@ -392,16 +393,14 @@ void LLPanelPermissions::refresh() | |||
392 | S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); | 393 | S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); |
393 | S32 obj_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); | 394 | S32 obj_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); |
394 | 395 | ||
395 | LLString object_info_string; | 396 | std::string object_info_string; |
396 | if (1 == obj_count) | 397 | if (1 == obj_count) |
397 | { | 398 | { |
398 | object_info_string.assign("1 Object, "); | 399 | object_info_string.assign("1 Object, "); |
399 | } | 400 | } |
400 | else | 401 | else |
401 | { | 402 | { |
402 | char buffer[MAX_STRING]; /*Flawfinder: ignore*/ | 403 | object_info_string = llformat( "%d Objects, ", obj_count); |
403 | snprintf(buffer, MAX_STRING, "%d Objects, ", obj_count); /* Flawfinder: ignore */ | ||
404 | object_info_string.assign(buffer); | ||
405 | } | 404 | } |
406 | if (1 == prim_count) | 405 | if (1 == prim_count) |
407 | { | 406 | { |
@@ -409,63 +408,99 @@ void LLPanelPermissions::refresh() | |||
409 | } | 408 | } |
410 | else | 409 | else |
411 | { | 410 | { |
412 | char buffer[MAX_STRING]; /*Flawfinder: ignore*/ | 411 | std::string buffer; |
413 | snprintf(buffer, MAX_STRING, "%d Primitives", prim_count); /* Flawfinder: ignore */ | 412 | buffer = llformat( "%d Primitives", prim_count); |
414 | object_info_string.append(buffer); | 413 | object_info_string.append(buffer); |
415 | } | 414 | } |
416 | childSetText("prim info",object_info_string); | 415 | childSetText("prim info",object_info_string); |
417 | childSetEnabled("prim info",true); | 416 | childSetEnabled("prim info",true); |
418 | 417 | ||
419 | S32 price; | 418 | S32 total_sale_price = 0; |
420 | BOOL is_for_sale = LLSelectMgr::getInstance()->selectIsForSale(price); | 419 | S32 individual_sale_price = 0; |
421 | if (!is_for_sale) | 420 | BOOL is_for_sale_mixed = FALSE; |
422 | { | 421 | BOOL is_sale_price_mixed = FALSE; |
423 | price = DEFAULT_PRICE; | 422 | U32 num_for_sale = FALSE; |
424 | } | 423 | LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, |
425 | 424 | is_for_sale_mixed, | |
426 | BOOL self_owned = (gAgent.getID() == mOwnerID); | 425 | is_sale_price_mixed, |
427 | BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; | 426 | total_sale_price, |
428 | BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); | 427 | individual_sale_price); |
429 | BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); | 428 | |
430 | BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); | 429 | const BOOL self_owned = (gAgent.getID() == mOwnerID); |
430 | const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; | ||
431 | const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); | ||
432 | const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); | ||
433 | const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); | ||
431 | 434 | ||
432 | if(!owners_identical) | 435 | if(!owners_identical) |
433 | { | 436 | { |
434 | childSetEnabled("Price: L$",false); | 437 | childSetEnabled("Cost",false); |
435 | childSetText("EdCost",LLString::null); | 438 | childSetText("Edit Cost",LLStringUtil::null); |
436 | childSetEnabled("EdCost",false); | 439 | childSetEnabled("Edit Cost",false); |
437 | } | 440 | } |
441 | // You own these objects. | ||
438 | else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) | 442 | else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) |
439 | { | 443 | { |
440 | LLLineEditor* EditPrice = getChild<LLLineEditor>("EdCost"); | 444 | // If there are multiple items for sale then set text to PRICE PER UNIT. |
441 | if(keyboard_focus_view != EditPrice) | 445 | if (num_for_sale > 1) |
442 | { | 446 | { |
443 | childSetText("EdCost",llformat("%d",price)); | 447 | childSetText("Cost",getString("Cost Per Unit")); |
444 | } | 448 | } |
445 | if(is_for_sale && is_one_object && can_transfer) | 449 | else |
446 | { | 450 | { |
447 | childSetEnabled("Price: L$",true); | 451 | childSetText("Cost",getString("Cost Default")); |
448 | childSetEnabled("EdCost",true); | ||
449 | } | 452 | } |
450 | else | 453 | |
454 | LLLineEditor *editPrice = getChild<LLLineEditor>("Edit Cost"); | ||
455 | if(keyboard_focus_view != editPrice) | ||
451 | { | 456 | { |
452 | childSetEnabled("Price: L$",false); | 457 | // If the sale price is mixed then set the cost to MIXED, otherwise |
453 | childSetEnabled("EdCost",false); | 458 | // set to the actual cost. |
459 | if (num_for_sale > 0 && is_for_sale_mixed) | ||
460 | { | ||
461 | childSetText("Edit Cost",getString("Sale Mixed")); | ||
462 | } | ||
463 | else if (num_for_sale > 0 && is_sale_price_mixed) | ||
464 | { | ||
465 | childSetText("Edit Cost",getString("Cost Mixed")); | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | childSetText("Edit Cost",llformat("%d",individual_sale_price)); | ||
470 | } | ||
454 | } | 471 | } |
472 | // The edit fields are only enabled if you can sell this object | ||
473 | // and the sale price is not mixed. | ||
474 | bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; | ||
475 | childSetEnabled("Cost",enable_edit); | ||
476 | childSetEnabled("Edit Cost",enable_edit); | ||
455 | } | 477 | } |
478 | // Someone, not you, owns these objects. | ||
456 | else if(!public_owned) | 479 | else if(!public_owned) |
457 | { | 480 | { |
458 | // ...someone, not you, owns it | 481 | childSetEnabled("Cost",false); |
459 | childSetEnabled("Price: L$",false); | 482 | childSetEnabled("Edit Cost",false); |
460 | childSetText("EdCost",llformat("%d",price)); | 483 | |
461 | childSetEnabled("EdCost",false); | 484 | // Don't show a price if none of the items are for sale. |
485 | if (num_for_sale) | ||
486 | childSetText("Edit Cost",llformat("%d",total_sale_price)); | ||
487 | else | ||
488 | childSetText("Edit Cost",LLStringUtil::null); | ||
489 | |||
490 | // If multiple items are for sale, set text to TOTAL PRICE. | ||
491 | if (num_for_sale > 1) | ||
492 | childSetText("Cost",getString("Cost Total")); | ||
493 | else | ||
494 | childSetText("Cost",getString("Cost Default")); | ||
462 | } | 495 | } |
496 | // This is a public object. | ||
463 | else | 497 | else |
464 | { | 498 | { |
465 | // ...public object | 499 | childSetEnabled("Cost",false); |
466 | childSetEnabled("Price: L$",false); | 500 | childSetText("Cost",getString("Cost Default")); |
467 | childSetText("EdCost",LLString::null); | 501 | |
468 | childSetEnabled("EdCost",false); | 502 | childSetText("Edit Cost",LLStringUtil::null); |
503 | childSetEnabled("Edit Cost",false); | ||
469 | } | 504 | } |
470 | 505 | ||
471 | // Enable and disable the permissions checkboxes | 506 | // Enable and disable the permissions checkboxes |
@@ -601,8 +636,11 @@ void LLPanelPermissions::refresh() | |||
601 | 636 | ||
602 | if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) | 637 | if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) |
603 | { | 638 | { |
604 | childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && is_for_sale)); | 639 | childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); |
605 | childSetEnabled("sale type",is_for_sale && can_transfer); | 640 | // Set the checkbox to tentative if the prices of each object selected |
641 | // are not the same. | ||
642 | childSetTentative("checkbox for sale", is_for_sale_mixed); | ||
643 | childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); | ||
606 | 644 | ||
607 | childSetEnabled("Next owner can:", TRUE); | 645 | childSetEnabled("Next owner can:", TRUE); |
608 | childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); | 646 | childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); |
@@ -744,21 +782,23 @@ void LLPanelPermissions::refresh() | |||
744 | if (valid_sale_info) | 782 | if (valid_sale_info) |
745 | { | 783 | { |
746 | RadioSaleType->setSelectedIndex((S32)sale_type - 1); | 784 | RadioSaleType->setSelectedIndex((S32)sale_type - 1); |
785 | RadioSaleType->setTentative(FALSE); // unfortunately this doesn't do anything at the moment. | ||
747 | } | 786 | } |
748 | else | 787 | else |
749 | { | 788 | { |
750 | // default option is sell copy, determined to be safest | 789 | // default option is sell copy, determined to be safest |
751 | RadioSaleType->setSelectedIndex((S32)LLSaleInfo::FS_COPY - 1); | 790 | RadioSaleType->setSelectedIndex((S32)LLSaleInfo::FS_COPY - 1); |
791 | RadioSaleType->setTentative(TRUE); // unfortunately this doesn't do anything at the moment. | ||
752 | } | 792 | } |
753 | } | 793 | } |
754 | 794 | ||
755 | childSetValue("checkbox for sale", is_for_sale); | 795 | childSetValue("checkbox for sale", num_for_sale != 0); |
756 | 796 | ||
757 | // HACK: There are some old objects in world that are set for sale, | 797 | // HACK: There are some old objects in world that are set for sale, |
758 | // but are no-transfer. We need to let users turn for-sale off, but only | 798 | // but are no-transfer. We need to let users turn for-sale off, but only |
759 | // if for-sale is set. | 799 | // if for-sale is set. |
760 | bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); | 800 | bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); |
761 | if (is_for_sale && has_change_sale_ability && cannot_actually_sell) | 801 | if (num_for_sale && has_change_sale_ability && cannot_actually_sell) |
762 | { | 802 | { |
763 | childSetEnabled("checkbox for sale", true); | 803 | childSetEnabled("checkbox for sale", true); |
764 | } | 804 | } |
@@ -829,7 +869,7 @@ void LLPanelPermissions::onClickGroup(void* data) | |||
829 | { | 869 | { |
830 | LLPanelPermissions* panelp = (LLPanelPermissions*)data; | 870 | LLPanelPermissions* panelp = (LLPanelPermissions*)data; |
831 | LLUUID owner_id; | 871 | LLUUID owner_id; |
832 | LLString name; | 872 | std::string name; |
833 | BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); | 873 | BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); |
834 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); | 874 | LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); |
835 | 875 | ||
@@ -982,9 +1022,10 @@ void LLPanelPermissions::setAllSaleInfo() | |||
982 | llinfos << "LLPanelPermissions::setAllSaleInfo()" << llendl; | 1022 | llinfos << "LLPanelPermissions::setAllSaleInfo()" << llendl; |
983 | LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT; | 1023 | LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT; |
984 | 1024 | ||
985 | LLCheckBoxCtrl* mCheckPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale"); | 1025 | LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale"); |
986 | 1026 | ||
987 | if(mCheckPurchase && mCheckPurchase->get()) | 1027 | // Set the sale type if the object(s) are for sale. |
1028 | if(checkPurchase && checkPurchase->get()) | ||
988 | { | 1029 | { |
989 | LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); | 1030 | LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); |
990 | if(RadioSaleType) | 1031 | if(RadioSaleType) |
@@ -1006,23 +1047,37 @@ void LLPanelPermissions::setAllSaleInfo() | |||
1006 | } | 1047 | } |
1007 | } | 1048 | } |
1008 | } | 1049 | } |
1009 | LLLineEditor* mEditPrice = getChild<LLLineEditor>("EdCost"); | ||
1010 | 1050 | ||
1011 | S32 price = -1; | 1051 | S32 price = -1; |
1012 | if(mEditPrice) | 1052 | |
1053 | LLLineEditor *editPrice = getChild<LLLineEditor>("Edit Cost"); | ||
1054 | if (editPrice) | ||
1013 | { | 1055 | { |
1014 | price = atoi(mEditPrice->getText().c_str()); | 1056 | // Don't extract the price if it's labeled as MIXED or is empty. |
1057 | const std::string& editPriceString = editPrice->getText(); | ||
1058 | if (editPriceString != getString("Cost Mixed") && | ||
1059 | !editPriceString.empty()) | ||
1060 | { | ||
1061 | price = atoi(editPriceString.c_str()); | ||
1062 | } | ||
1063 | else | ||
1064 | { | ||
1065 | price = DEFAULT_PRICE; | ||
1066 | } | ||
1015 | } | 1067 | } |
1016 | // Invalid data - turn off the sale | 1068 | // If somehow an invalid price, turn the sale off. |
1017 | if (price < 0) | 1069 | if (price < 0) |
1018 | { | ||
1019 | sale_type = LLSaleInfo::FS_NOT; | 1070 | sale_type = LLSaleInfo::FS_NOT; |
1020 | price = 0; | ||
1021 | } | ||
1022 | 1071 | ||
1072 | // Force the sale price of not-for-sale items to DEFAULT_PRICE. | ||
1073 | if (sale_type == LLSaleInfo::FS_NOT) | ||
1074 | { | ||
1075 | price = DEFAULT_PRICE; | ||
1076 | } | ||
1077 | // Pack up the sale info and send the update. | ||
1023 | LLSaleInfo sale_info(sale_type, price); | 1078 | LLSaleInfo sale_info(sale_type, price); |
1024 | LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); | 1079 | LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); |
1025 | 1080 | ||
1026 | // If turned off for-sale, make sure click-action buy is turned | 1081 | // If turned off for-sale, make sure click-action buy is turned |
1027 | // off as well | 1082 | // off as well |
1028 | if (sale_type == LLSaleInfo::FS_NOT) | 1083 | if (sale_type == LLSaleInfo::FS_NOT) |