diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 75905d092740d4e838eb12e53a83b00e7d5f9f6f..c2f91ff7e01a365b7ea576d245933a66a0711421 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -84,8 +84,8 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues() declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32); declare("alpha_num", LLLineEditor::prevalidateAlphaNum); declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace); - declare("printable_not_pipe", LLLineEditor::prevalidatePrintableNotPipe); - declare("printable_no_space", LLLineEditor::prevalidatePrintableNoSpace); + declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe); + declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace); } LLLineEditor::Params::Params() @@ -2186,20 +2186,28 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str) return rv; } +// Used for most names of things stored on the server, due to old file-formats +// that used the pipe (|) for multiline text storage. Examples include +// inventory item names, parcel names, object names, etc. // static -BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str) +BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str) { BOOL rv = TRUE; S32 len = str.length(); if(len == 0) return rv; while(len--) { - if('|' == str[len]) + llwchar wc = str[len]; + if (wc < 0x20 + || wc > 0x7f + || wc == '|') { rv = FALSE; break; } - if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len]))) + if(!(wc == ' ' + || LLStringOps::isAlnum((char)wc) + || LLStringOps::isPunct((char)wc) ) ) { rv = FALSE; break; @@ -2209,15 +2217,19 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str) } +// Used for avatar names // static -BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str) +BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str) { BOOL rv = TRUE; S32 len = str.length(); if(len == 0) return rv; while(len--) { - if(LLStringOps::isSpace(str[len])) + llwchar wc = str[len]; + if (wc < 0x20 + || wc > 0x7f + || LLStringOps::isSpace(wc)) { rv = FALSE; break; @@ -2232,6 +2244,7 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str) return rv; } + // static BOOL LLLineEditor::prevalidateASCII(const LLWString &str) { diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index d3daa941cfe929d09ff6bbd228d17b17fb8089e4..4474963b1aff534468df87306f18ccb4f8dfd9dc 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -235,8 +235,8 @@ class LLLineEditor static BOOL prevalidateNonNegativeS32(const LLWString &str); static BOOL prevalidateAlphaNum(const LLWString &str ); static BOOL prevalidateAlphaNumSpace(const LLWString &str ); - static BOOL prevalidatePrintableNotPipe(const LLWString &str); - static BOOL prevalidatePrintableNoSpace(const LLWString &str); + static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str); + static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str); static BOOL prevalidateASCII(const LLWString &str); static BOOL postvalidateFloat(const std::string &str); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 886f5ec9249c58b9010c5f89b3375268d6a3ce2c..cd3432190b7f4ea43531f7e15e817f53788a3db0 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -415,7 +415,7 @@ LLPanelRegionTools::LLPanelRegionTools() BOOL LLPanelRegionTools::postBuild() { getChild<LLLineEditor>("region name")->setKeystrokeCallback(onChangeSimName, this); - childSetPrevalidate("region name", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("region name", &LLLineEditor::prevalidateASCIIPrintableNoPipe); childSetPrevalidate("estate", &LLLineEditor::prevalidatePositiveS32); childSetPrevalidate("parentestate", &LLLineEditor::prevalidatePositiveS32); childDisable("parentestate"); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 015a947d9179a730f4b993a650c256e9907bbd14..22d6098d5bc3706c5227f3551f71ef2288b1a095 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -347,13 +347,14 @@ BOOL LLPanelLandGeneral::postBuild() { mEditName = getChild<LLLineEditor>("Name"); mEditName->setCommitCallback(onCommitAny, this); - childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("Name", LLLineEditor::prevalidateASCIIPrintableNoPipe); mEditDesc = getChild<LLTextEditor>("Description"); mEditDesc->setCommitOnFocusLost(TRUE); mEditDesc->setCommitCallback(onCommitAny, this); - childSetPrevalidate("Description", LLLineEditor::prevalidatePrintableNotPipe); - + // No prevalidate function - historically the prevalidate function was broken, + // allowing residents to put in characters like U+2661 WHITE HEART SUIT, so + // preserve that ability. mTextSalePending = getChild<LLTextBox>("SalePending"); mTextOwnerLabel = getChild<LLTextBox>("Owner:"); diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index b7296518d460dddc3066068cb8171b8c7ea908c1..810761e034d4b4e694e21aed522cd841addffc97 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -111,7 +111,7 @@ BOOL LLFloaterNameDesc::postBuild() if (NameEditor) { NameEditor->setMaxTextLength(DB_INV_ITEM_NAME_STR_LEN); - NameEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + NameEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe); } y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f); @@ -123,7 +123,7 @@ BOOL LLFloaterNameDesc::postBuild() if (DescEditor) { DescEditor->setMaxTextLength(DB_INV_ITEM_DESC_STR_LEN); - DescEditor->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + DescEditor->setPrevalidate(&LLLineEditor::prevalidateASCIIPrintableNoPipe); } y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f); diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index e0d4a59d9d6f6050a904d5bf565206225a864696..ff9002787ce859df3a36e5ce54cefd15c770bfa1 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -130,9 +130,9 @@ BOOL LLFloaterProperties::postBuild() { // build the UI // item name & description - childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidateASCIIPrintableNoPipe); getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this)); - childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidateASCIIPrintableNoPipe); getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties:: onCommitDescription, this)); // Creator information getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this)); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 4192c6a586202736c6fb222f5ac9d7ad0d8a2e4a..955bc64e05dfe91f96ad171a73232e819d1ecbb1 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -220,7 +220,7 @@ LLFolderView::LLFolderView(const Params& p) params.font(getLabelFontForStyle(LLFontGL::NORMAL)); params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN); params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); - params.prevalidate_callback(&LLLineEditor::prevalidatePrintableNotPipe); + params.prevalidate_callback(&LLLineEditor::prevalidateASCIIPrintableNoPipe); params.commit_on_focus_lost(true); params.visible(false); mRenamer = LLUICtrlFactory::create<LLLineEditor> (params); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 1c2875bf467ee3314012f381a928054e5157353c..a1d54367c983910b595b521e01d07eb98bae4208 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -213,6 +213,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group) } mFounderName = panel_group->getChild<LLNameBox>("founder_name"); mGroupNameEditor = panel_group->getChild<LLLineEditor>("group_name_editor"); + mGroupNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII ); } // static diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index b3e14eb2fb8cb5f83291a8164e7776776a4d5157..78f3469f0e767585a9b150e34b09241b61b2b5d1 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -210,8 +210,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } #if !USE_VIEWER_AUTH - childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); - childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); + childSetPrevalidate("first_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace); + childSetPrevalidate("last_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace); childSetCommitCallback("password_edit", mungePassword, this); getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 1051326e72e9df716612db2c466fc21c85b51147..0dc010e2e746009e2ecc6baeb5b38952eb5898d0 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -80,9 +80,9 @@ LLPanelPermissions::LLPanelPermissions() : BOOL LLPanelPermissions::postBuild() { childSetCommitCallback("Object Name",LLPanelPermissions::onCommitName,this); - childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe); childSetCommitCallback("Object Description",LLPanelPermissions::onCommitDesc,this); - childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe); getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this)); diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 604faf8eb4b26ff08132a96008da0e81bc6425b3..92bd4dc62b11eba1e3ad289477eae69092b12838 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -79,7 +79,7 @@ BOOL LLPreviewAnim::postBuild() childSetAction("Anim audition btn",auditionAnim, this); childSetCommitCallback("desc", LLPreview::onText, this); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); return LLPreview::postBuild(); } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 7b3a20d1020edf7323f7760f4c74edbb377cf9ae..49a2a3723d214b688a116250373371028612b6f7 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -493,7 +493,7 @@ BOOL LLPreviewGesture::postBuild() { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); } return LLPreview::postBuild(); diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index ab9cfbf85064b7b0a3fda13e1db168f0f76c2e3b..ce81077d802fd492160a51bd7c3f1de59f13c200 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -96,7 +96,7 @@ BOOL LLPreviewNotecard::postBuild() childSetCommitCallback("desc", LLPreview::onText, this); if (item) childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); return LLPreview::postBuild(); } diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 2382befcfa7144435ad602aee25fd1b95e30589d..4e4711f8fbdd9729cc72a9ff6065b227d8b4ab6c 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -956,7 +956,7 @@ BOOL LLPreviewLSL::postBuild() childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); return LLPreview::postBuild(); } diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index 7659c50ed3153ecc7bc831f8c2b017b7b08e68dc..d7fd252fb67f26e2bb9b6dddb6e1a261e94f420b 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -75,7 +75,7 @@ BOOL LLPreviewSound::postBuild() button->setSoundFlags(LLView::SILENT); childSetCommitCallback("desc", LLPreview::onText, this); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); return LLPreview::postBuild(); } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 13d02b7dec021ae00f11fc8489b141707ebf2201..41cf402d6f4bc6b05b5e97bb887ae0907d4e85cd 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -152,7 +152,7 @@ BOOL LLPreviewTexture::postBuild() { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); - childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("desc", &LLLineEditor::prevalidateASCIIPrintableNoPipe); } } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index a3efea7b7e29588537dffa1eb1801b020b61312d..ff6e2d7363c05e005c24654b3af4b6eec2ced153 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -111,9 +111,9 @@ BOOL LLSidepanelItemInfo::postBuild() // build the UI // item name & description - childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidateASCIIPrintableNoPipe); //getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this)); - childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidateASCIIPrintableNoPipe); //getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this)); // Creator information diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 01c832d7d565c7b0db37b8eb29702b7161fffc44..4396cce545142f7646ca6bf0eb66e2fc2a0f73a3 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -100,8 +100,8 @@ BOOL LLSidepanelTaskInfo::postBuild() mBuyBtn = getChild<LLButton>("buy_btn"); mBuyBtn->setClickedCallback(boost::bind(&LLSidepanelTaskInfo::onBuyButtonClicked, this)); - childSetPrevalidate("Object Name",LLLineEditor::prevalidatePrintableNotPipe); - childSetPrevalidate("Object Description",LLLineEditor::prevalidatePrintableNotPipe); + childSetPrevalidate("Object Name",LLLineEditor::prevalidateASCIIPrintableNoPipe); + childSetPrevalidate("Object Description",LLLineEditor::prevalidateASCIIPrintableNoPipe); // getChild<LLUICtrl>("button set group")->setCommitCallback(boost::bind(&LLSidepanelTaskInfo::onClickGroup,this)); // childSetAction("button deed",LLSidepanelTaskInfo::onClickDeedToGroup,this); diff --git a/indra/newview/skins/default/xui/en/floater_test_line_editor.xml b/indra/newview/skins/default/xui/en/floater_test_line_editor.xml index e017d404c61a1b62f2bff133c1c3c1de4b3e9dd2..0531b52e5a04f77205acd9c259861642431a5aa0 100644 --- a/indra/newview/skins/default/xui/en/floater_test_line_editor.xml +++ b/indra/newview/skins/default/xui/en/floater_test_line_editor.xml @@ -18,7 +18,18 @@ Enabled line editor </line_editor> <line_editor - enabled="false" + height="20" + layout="topleft" + left_delta="0" + name="ascii_line_editor" + prevalidate_callback="ascii" + tool_tip="ascii line editor" + top_pad="10" + width="200"> + ASCII only line editor + </line_editor> + <line_editor + enabled="false" height="20" layout="topleft" left_delta="0" diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index b2f46bc433959005105f0372a73c4995c9748d82..944b4cda98ea5b12a09a9576effd3ea68d7bac77 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -809,11 +809,8 @@ Mixed Sale </panel.string> <text - type="string" - length="1" follows="left|top" height="10" - layout="topleft" left="10" name="Name:" top="0" @@ -823,7 +820,6 @@ <line_editor follows="left|top|right" height="19" - layout="topleft" left_pad="0" max_length="63" name="Object Name" @@ -831,11 +827,8 @@ top_delta="0" width="170" /> <text - type="string" - length="1" follows="left|top" height="10" - layout="topleft" left="10" name="Description:" top_pad="3" @@ -845,7 +838,6 @@ <line_editor follows="left|top|right" height="19" - layout="topleft" left_pad="0" max_length="127" name="Object Description"