diff options
Diffstat (limited to 'linden/indra/newview/llpanelpermissions.cpp')
-rw-r--r-- | linden/indra/newview/llpanelpermissions.cpp | 122 |
1 files changed, 70 insertions, 52 deletions
diff --git a/linden/indra/newview/llpanelpermissions.cpp b/linden/indra/newview/llpanelpermissions.cpp index 0cfef5c..3d5723e 100644 --- a/linden/indra/newview/llpanelpermissions.cpp +++ b/linden/indra/newview/llpanelpermissions.cpp | |||
@@ -1,7 +1,11 @@ | |||
1 | /** | 1 | /** |
2 | * @file llpanelpermissions.cpp | 2 | * @file llpanelpermissions.cpp |
3 | * @brief LLPanelPermissions class implementation | 3 | * @brief LLPanelPermissions class implementation |
4 | * This class represents the panel in the build view for | ||
5 | * viewing/editing object names, owners, permissions, etc. | ||
4 | * | 6 | * |
7 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
8 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 9 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 10 | * |
7 | * Second Life Viewer Source Code | 11 | * Second Life Viewer Source Code |
@@ -24,15 +28,9 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
31 | * $/LicenseInfo$ | ||
27 | */ | 32 | */ |
28 | 33 | ||
29 | //***************************************************************************** | ||
30 | // | ||
31 | // This class represents the panel in the build view for | ||
32 | // viewing/editing object names, owners, permissions, etc. | ||
33 | // | ||
34 | //***************************************************************************** | ||
35 | |||
36 | #include "llviewerprecompiledheaders.h" | 34 | #include "llviewerprecompiledheaders.h" |
37 | 35 | ||
38 | #include "llpanelpermissions.h" | 36 | #include "llpanelpermissions.h" |
@@ -71,8 +69,13 @@ | |||
71 | ///---------------------------------------------------------------------------- | 69 | ///---------------------------------------------------------------------------- |
72 | 70 | ||
73 | // Default constructor | 71 | // Default constructor |
72 | LLPanelPermissions::LLPanelPermissions(const std::string& title) : | ||
73 | LLPanel(title) | ||
74 | { | ||
75 | setMouseOpaque(FALSE); | ||
76 | } | ||
74 | 77 | ||
75 | BOOL LLPanelPermissions::postBuild() | 78 | BOOL LLPanelPermissions::postBuild() |
76 | { | 79 | { |
77 | this->childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); | 80 | this->childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); |
78 | this->childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); | 81 | this->childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); |
@@ -104,25 +107,23 @@ BOOL LLPanelPermissions::postBuild() | |||
104 | this->childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); | 107 | this->childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); |
105 | this->childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); | 108 | this->childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); |
106 | this->childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); | 109 | this->childSetCommitCallback("clickaction",LLPanelPermissions::onCommitClickAction,this); |
107 | 110 | this->childSetCommitCallback("search_check",LLPanelPermissions::onCommitIncludeInSearch,this); | |
108 | LLTextBox* LabelGroupNameRectProxy = gUICtrlFactory->getTextBoxByName(this,"Group Name Proxy"); | 111 | |
109 | if(LabelGroupNameRectProxy ) | 112 | LLTextBox* group_rect_proxy = gUICtrlFactory->getTextBoxByName(this,"Group Name Proxy"); |
113 | if(group_rect_proxy ) | ||
110 | { | 114 | { |
111 | mLabelGroupName = new LLNameBox("Group Name",LabelGroupNameRectProxy->getRect()); | 115 | mLabelGroupName = new LLNameBox("Group Name", group_rect_proxy->getRect()); |
112 | addChild(mLabelGroupName); | 116 | addChild(mLabelGroupName); |
113 | }else | 117 | } |
118 | else | ||
119 | { | ||
114 | mLabelGroupName = NULL; | 120 | mLabelGroupName = NULL; |
121 | } | ||
115 | 122 | ||
116 | return TRUE; | 123 | return TRUE; |
117 | } | 124 | } |
118 | 125 | ||
119 | LLPanelPermissions::LLPanelPermissions(const std::string& title) : | ||
120 | LLPanel(title) | ||
121 | { | ||
122 | setMouseOpaque(FALSE); | ||
123 | } | ||
124 | 126 | ||
125 | // Destroys the object | ||
126 | LLPanelPermissions::~LLPanelPermissions() | 127 | LLPanelPermissions::~LLPanelPermissions() |
127 | { | 128 | { |
128 | // base class will take care of everything | 129 | // base class will take care of everything |
@@ -131,7 +132,6 @@ LLPanelPermissions::~LLPanelPermissions() | |||
131 | 132 | ||
132 | void LLPanelPermissions::refresh() | 133 | void LLPanelPermissions::refresh() |
133 | { | 134 | { |
134 | |||
135 | LLButton* BtnDeedToGroup = gUICtrlFactory->getButtonByName(this,"button deed"); | 135 | LLButton* BtnDeedToGroup = gUICtrlFactory->getButtonByName(this,"button deed"); |
136 | if(BtnDeedToGroup) | 136 | if(BtnDeedToGroup) |
137 | { | 137 | { |
@@ -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",""); | 168 | childSetText("perm_modify",LLString::null); |
169 | 169 | ||
170 | childSetEnabled("Creator:",false); | 170 | childSetEnabled("Creator:",false); |
171 | childSetText("Creator Name",""); | 171 | childSetText("Creator Name",LLString::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",""); | 176 | childSetText("Owner Name",LLString::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",""); | 181 | childSetText("Group Name",LLString::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",""); | 185 | childSetText("Object Name",LLString::null); |
186 | childSetEnabled("Object Name",false); | 186 | childSetEnabled("Object Name",false); |
187 | childSetEnabled("Name:",false); | 187 | childSetEnabled("Name:",false); |
188 | childSetText("Group Name",""); | 188 | childSetText("Group Name",LLString::null); |
189 | childSetEnabled("Group Name",false); | 189 | childSetEnabled("Group Name",false); |
190 | childSetEnabled("Description:",false); | 190 | childSetEnabled("Description:",false); |
191 | childSetText("Object Description",""); | 191 | childSetText("Object Description",LLString::null); |
192 | childSetEnabled("Object Description",false); | 192 | childSetEnabled("Object Description",false); |
193 | 193 | ||
194 | childSetText("prim info",""); | 194 | childSetText("prim info",LLString::null); |
195 | childSetEnabled("prim info",false); | 195 | childSetEnabled("prim info",false); |
196 | 196 | ||
197 | childSetEnabled("Permissions:",false); | 197 | childSetEnabled("Permissions:",false); |
@@ -217,6 +217,10 @@ void LLPanelPermissions::refresh() | |||
217 | //checkbox for sale | 217 | //checkbox for sale |
218 | childSetValue("checkbox for sale",FALSE); | 218 | childSetValue("checkbox for sale",FALSE); |
219 | childSetEnabled("checkbox for sale",false); | 219 | childSetEnabled("checkbox for sale",false); |
220 | |||
221 | //checkbox include in search | ||
222 | childSetValue("search_check", FALSE); | ||
223 | childSetEnabled("search_check", false); | ||
220 | 224 | ||
221 | LLRadioGroup* RadioSaleType = gUICtrlFactory->getRadioGroupByName(this,"sale type"); | 225 | LLRadioGroup* RadioSaleType = gUICtrlFactory->getRadioGroupByName(this,"sale type"); |
222 | if(RadioSaleType) | 226 | if(RadioSaleType) |
@@ -226,7 +230,7 @@ void LLPanelPermissions::refresh() | |||
226 | } | 230 | } |
227 | 231 | ||
228 | childSetEnabled("Price: L$",false); | 232 | childSetEnabled("Price: L$",false); |
229 | childSetText("EdCost",false); | 233 | childSetText("EdCost",LLString::null); |
230 | childSetEnabled("EdCost",false); | 234 | childSetEnabled("EdCost",false); |
231 | 235 | ||
232 | childSetEnabled("label click action",false); | 236 | childSetEnabled("label click action",false); |
@@ -417,7 +421,7 @@ void LLPanelPermissions::refresh() | |||
417 | if(!owners_identical) | 421 | if(!owners_identical) |
418 | { | 422 | { |
419 | childSetEnabled("Price: L$",false); | 423 | childSetEnabled("Price: L$",false); |
420 | childSetText("EdCost",""); | 424 | childSetText("EdCost",LLString::null); |
421 | childSetEnabled("EdCost",false); | 425 | childSetEnabled("EdCost",false); |
422 | } | 426 | } |
423 | else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) | 427 | else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) |
@@ -449,7 +453,7 @@ void LLPanelPermissions::refresh() | |||
449 | { | 453 | { |
450 | // ...public object | 454 | // ...public object |
451 | childSetEnabled("Price: L$",false); | 455 | childSetEnabled("Price: L$",false); |
452 | childSetText("EdCost",""); | 456 | childSetText("EdCost",LLString::null); |
453 | childSetEnabled("EdCost",false); | 457 | childSetEnabled("EdCost",false); |
454 | } | 458 | } |
455 | 459 | ||
@@ -497,36 +501,35 @@ void LLPanelPermissions::refresh() | |||
497 | 501 | ||
498 | if( gSavedSettings.getBOOL("DebugPermissions") ) | 502 | if( gSavedSettings.getBOOL("DebugPermissions") ) |
499 | { | 503 | { |
500 | char perm_string[10]; /*Flawfinder: ignore*/ | 504 | std::string perm_string; |
501 | if (valid_base_perms) | 505 | if (valid_base_perms) |
502 | { | 506 | { |
503 | 507 | perm_string = "B: "; | |
504 | strcpy(perm_string, "B: "); /*Flawfinder: ignore*/ | 508 | perm_string += mask_to_string(base_mask_on); |
505 | mask_to_string(base_mask_on, perm_string+3); | ||
506 | childSetText("B:",perm_string); | 509 | childSetText("B:",perm_string); |
507 | childSetVisible("B:",true); | 510 | childSetVisible("B:",true); |
508 | 511 | ||
509 | strcpy(perm_string, "O: "); /*Flawfinder: ignore*/ | 512 | perm_string = "O: "; |
510 | mask_to_string(owner_mask_on, perm_string+3); | 513 | perm_string += mask_to_string(owner_mask_on); |
511 | childSetText("O:",perm_string); | 514 | childSetText("O:",perm_string); |
512 | childSetVisible("O:",true); | 515 | childSetVisible("O:",true); |
513 | 516 | ||
514 | strcpy(perm_string, "G: "); /*Flawfinder: ignore*/ | 517 | perm_string = "G: "; |
515 | mask_to_string(group_mask_on, perm_string+3); | 518 | perm_string += mask_to_string(group_mask_on); |
516 | childSetText("G:",perm_string); | 519 | childSetText("G:",perm_string); |
517 | childSetVisible("G:",true); | 520 | childSetVisible("G:",true); |
518 | 521 | ||
519 | strcpy(perm_string, "E: "); /*Flawfinder: ignore*/ | 522 | perm_string = "E: "; |
520 | mask_to_string(everyone_mask_on, perm_string+3); | 523 | perm_string += mask_to_string(everyone_mask_on); |
521 | childSetText("E:",perm_string); | 524 | childSetText("E:",perm_string); |
522 | childSetVisible("E:",true); | 525 | childSetVisible("E:",true); |
523 | 526 | ||
524 | strcpy(perm_string, "N: "); /*Flawfinder: ignore*/ | 527 | perm_string = "N: "; |
525 | mask_to_string(next_owner_mask_on, perm_string+3); | 528 | perm_string += mask_to_string(next_owner_mask_on); |
526 | childSetText("N:",perm_string); | 529 | childSetText("N:",perm_string); |
527 | childSetVisible("N:",true); | 530 | childSetVisible("N:",true); |
528 | } | 531 | } |
529 | strcpy(perm_string, "F: "); /*Flawfinder: ignore*/ | 532 | perm_string = "F: "; |
530 | U32 flag_mask = 0x0; | 533 | U32 flag_mask = 0x0; |
531 | if (objectp->permMove()) | 534 | if (objectp->permMove()) |
532 | flag_mask |= PERM_MOVE; | 535 | flag_mask |= PERM_MOVE; |
@@ -536,7 +539,7 @@ void LLPanelPermissions::refresh() | |||
536 | flag_mask |= PERM_COPY; | 539 | flag_mask |= PERM_COPY; |
537 | if (objectp->permTransfer()) | 540 | if (objectp->permTransfer()) |
538 | flag_mask |= PERM_TRANSFER; | 541 | flag_mask |= PERM_TRANSFER; |
539 | mask_to_string(flag_mask, perm_string+3); | 542 | perm_string += mask_to_string(flag_mask); |
540 | childSetText("F:",perm_string); | 543 | childSetText("F:",perm_string); |
541 | childSetVisible("F:",true); | 544 | childSetVisible("F:",true); |
542 | } | 545 | } |
@@ -568,9 +571,8 @@ void LLPanelPermissions::refresh() | |||
568 | 571 | ||
569 | if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) | 572 | if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) |
570 | { | 573 | { |
571 | // XUI:translate | ||
572 | // ...must select root to choose permissions | 574 | // ...must select root to choose permissions |
573 | childSetValue("perm_modify", "Must select entire object to set permissions."); | 575 | childSetValue("perm_modify", childGetText("text modify warning")); |
574 | } | 576 | } |
575 | 577 | ||
576 | if (has_change_perm_ability) | 578 | if (has_change_perm_ability) |
@@ -613,7 +615,7 @@ void LLPanelPermissions::refresh() | |||
613 | { | 615 | { |
614 | childSetValue("checkbox share with group",TRUE); | 616 | childSetValue("checkbox share with group",TRUE); |
615 | childSetTentative("checkbox share with group",FALSE); | 617 | childSetTentative("checkbox share with group",FALSE); |
616 | childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned); | 618 | childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); |
617 | } | 619 | } |
618 | else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) | 620 | else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) |
619 | { | 621 | { |
@@ -625,7 +627,7 @@ void LLPanelPermissions::refresh() | |||
625 | { | 627 | { |
626 | childSetValue("checkbox share with group",TRUE); | 628 | childSetValue("checkbox share with group",TRUE); |
627 | childSetTentative("checkbox share with group",true); | 629 | childSetTentative("checkbox share with group",true); |
628 | childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned); | 630 | childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); |
629 | } | 631 | } |
630 | } | 632 | } |
631 | 633 | ||
@@ -750,8 +752,15 @@ void LLPanelPermissions::refresh() | |||
750 | childSetTentative("checkbox for sale",false); | 752 | childSetTentative("checkbox for sale",false); |
751 | } | 753 | } |
752 | 754 | ||
753 | // Click action (touch, sit, buy) | 755 | // Check search status of objects |
754 | BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); | 756 | BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ); |
757 | bool include_in_search; | ||
758 | bool all_include_in_search = gSelectMgr->selectionGetIncludeInSearch(&include_in_search); | ||
759 | childSetEnabled("search_check", is_perm_modify && all_volume); | ||
760 | childSetValue("search_check", include_in_search); | ||
761 | childSetTentative("search_check", ! all_include_in_search); | ||
762 | |||
763 | // Click action (touch, sit, buy) | ||
755 | U8 click_action = 0; | 764 | U8 click_action = 0; |
756 | if (gSelectMgr->selectionGetClickAction(&click_action)) | 765 | if (gSelectMgr->selectionGetClickAction(&click_action)) |
757 | { | 766 | { |
@@ -1016,9 +1025,8 @@ void LLPanelPermissions::setAllSaleInfo() | |||
1016 | } | 1025 | } |
1017 | } | 1026 | } |
1018 | 1027 | ||
1019 | class LLSelectionPayable : public LLSelectedObjectFunctor | 1028 | struct LLSelectionPayable : public LLSelectedObjectFunctor |
1020 | { | 1029 | { |
1021 | public: | ||
1022 | virtual bool apply(LLViewerObject* obj) | 1030 | virtual bool apply(LLViewerObject* obj) |
1023 | { | 1031 | { |
1024 | // can pay if you or your parent has money() event in script | 1032 | // can pay if you or your parent has money() event in script |
@@ -1064,3 +1072,13 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*) | |||
1064 | } | 1072 | } |
1065 | gSelectMgr->selectionSetClickAction(click_action); | 1073 | gSelectMgr->selectionSetClickAction(click_action); |
1066 | } | 1074 | } |
1075 | |||
1076 | // static | ||
1077 | void LLPanelPermissions::onCommitIncludeInSearch(LLUICtrl* ctrl, void*) | ||
1078 | { | ||
1079 | LLCheckBoxCtrl* box = (LLCheckBoxCtrl*)ctrl; | ||
1080 | llassert(box); | ||
1081 | |||
1082 | gSelectMgr->selectionSetIncludeInSearch(box->get()); | ||
1083 | } | ||
1084 | |||