summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llpanelprofile.cpp81
-rw-r--r--indra/newview/llpanelprofile.h8
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_notes.xml24
3 files changed, 103 insertions, 10 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 82515c8d4a..49b18874f3 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -1237,10 +1237,24 @@ void LLPanelProfileFirstLife::updateButtons()
LLPanelProfileNotes::LLPanelProfileNotes()
: LLPanelProfileTab()
+, mAvatarNameCacheConnection()
{
}
+LLPanelProfileNotes::~LLPanelProfileNotes()
+{
+ if (getAvatarId().notNull())
+ {
+ LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
+ }
+
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
+}
+
void LLPanelProfileNotes::updateData()
{
LLUUID avatar_id = getAvatarId();
@@ -1257,6 +1271,7 @@ BOOL LLPanelProfileNotes::postBuild()
mMapRights = getChild<LLCheckBoxCtrl>("map_check");
mEditObjectRights = getChild<LLCheckBoxCtrl>("objects_check");
mNotesEditor = getChild<LLTextEditor>("notes_edit");
+ mCharacterLimitWarning = getChild<LLTextBox>("character_limit_warning");
mEditObjectRights->setCommitCallback(boost::bind(&LLPanelProfileNotes::onCommitRights, this));
@@ -1272,6 +1287,8 @@ void LLPanelProfileNotes::onOpen(const LLSD& key)
resetData();
fillRightsData();
+
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileNotes::onAvatarNameCache, this, _1, _2));
}
void LLPanelProfileNotes::apply()
@@ -1379,6 +1396,27 @@ void LLPanelProfileNotes::applyRights()
LLAvatarPropertiesProcessor::getInstance()->sendFriendRights(getAvatarId(), rights);
}
+void LLPanelProfileNotes::updateWarning()
+{
+ mCharacterLimitWarning->setText(std::string());
+
+ std::string str = getString("header_symbol_limit");
+ mCharacterLimitWarning->appendText(str, false, LLStyle::Params().color(LLColor4::yellow));
+ mCharacterLimitWarning->appendText(" ", false, LLStyle::Params());
+
+ LLStringUtil::format_map_t args;
+ if (!mURLWebProfile.empty())
+ {
+ args["[PROFILE_URL]"] = mURLWebProfile;
+ }
+ else
+ {
+ args["[PROFILE_URL]"] = getProfileURL(getAvatarId().asString());
+ }
+ str = getString("body_symbol_limit", args);
+ mCharacterLimitWarning->appendText(str, false, LLStyle::Params());
+}
+
void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type)
{
if (APT_NOTES == type)
@@ -1390,6 +1428,16 @@ void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType typ
mNotesEditor->setEnabled(TRUE);
updateButtons();
+ if (avatar_notes->notes.size() > 1000)
+ {
+ mCharacterLimitWarning->setVisible(TRUE);
+ updateWarning();
+ }
+ else
+ {
+ mCharacterLimitWarning->setVisible(FALSE);
+ }
+
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
}
}
@@ -1402,6 +1450,9 @@ void LLPanelProfileNotes::resetData()
mOnlineStatus->setValue(FALSE);
mMapRights->setValue(FALSE);
mEditObjectRights->setValue(FALSE);
+ mCharacterLimitWarning->setVisible(FALSE);
+
+ mURLWebProfile.clear();
}
void LLPanelProfileNotes::enableCheckboxes(bool enable)
@@ -1411,14 +1462,6 @@ void LLPanelProfileNotes::enableCheckboxes(bool enable)
mEditObjectRights->setEnabled(enable);
}
-LLPanelProfileNotes::~LLPanelProfileNotes()
-{
- if (getAvatarId().notNull())
- {
- LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
- }
-}
-
// virtual, called by LLAvatarTracker
void LLPanelProfileNotes::changed(U32 mask)
{
@@ -1439,6 +1482,28 @@ void LLPanelProfileNotes::setAvatarId(const LLUUID& avatar_id)
}
}
+void LLPanelProfileNotes::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
+{
+ mAvatarNameCacheConnection.disconnect();
+
+ std::string username = av_name.getAccountName();
+ if (username.empty())
+ {
+ username = LLCacheName::buildUsername(av_name.getDisplayName());
+ }
+ else
+ {
+ LLStringUtil::replaceChar(username, ' ', '.');
+ }
+
+ mURLWebProfile = getProfileURL(username, false);
+
+ if (mCharacterLimitWarning->getVisible())
+ {
+ updateWarning();
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
// LLPanelProfile
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index de25b92470..a42021af88 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -361,6 +361,8 @@ public:
*/
virtual void apply();
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+
protected:
/**
* Fills rights data for friends.
@@ -374,11 +376,17 @@ protected:
void enableCheckboxes(bool enable);
void applyRights();
+ void updateWarning();
LLCheckBoxCtrl* mOnlineStatus;
LLCheckBoxCtrl* mMapRights;
LLCheckBoxCtrl* mEditObjectRights;
LLTextEditor* mNotesEditor;
+ LLTextBox* mCharacterLimitWarning;
+
+ std::string mURLWebProfile;
+
+ boost::signals2::connection mAvatarNameCacheConnection;
};
diff --git a/indra/newview/skins/default/xui/en/panel_profile_notes.xml b/indra/newview/skins/default/xui/en/panel_profile_notes.xml
index 0bafaac361..179fa0136c 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_notes.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_notes.xml
@@ -9,6 +9,14 @@
follows="all"
layout="topleft"
>
+ <!--these strings will be combined into one with different styles-->
+ <string name="header_symbol_limit">
+Warning: Your notes contain more than 1000 characters.
+ </string>
+ <string name="body_symbol_limit">
+Only first 1000 characters are shown here. If you edit your notes and click OK, the extra characters will be lost. To preserve the extra characters, you must edit it [[PROFILE_URL] on the web]
+ </string>
+
<loading_indicator
name="progress_indicator"
top="3"
@@ -36,16 +44,27 @@
top_pad="4"
left="6"
right="-6"
- height="335"
+ height="311"
follows="all"
layout="topleft"
max_length="1000"
word_wrap="true"
/>
<text
+ layout="topleft"
+ follows="left|bottom|right"
+ top_pad="2"
+ left="6"
+ right="-6"
+ height ="28"
+ name="character_limit_warning"
+ word_wrap="true">
+ Placeholder: Your notes contain more than 1000 characters. Only first 1000 characters are shown here. If you edit your notes and click OK, the extra characters will be lost. To preserve the extra characters, you must edit it [https://my.secondlife.com/settings/profile on the web]
+ </text>
+ <text
name="status_message2"
value="Allow this avatar to:"
- top_pad="8"
+ top_pad="11"
left="6"
right="-6"
height="16"
@@ -57,6 +76,7 @@
name="status_check"
label="See when I am online"
enabled="false"
+ top_pad="0"
left="10"
height="16"
width="293"