summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r--indra/newview/llpanelavatar.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 146be0df7f..2c27808f03 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -38,6 +38,7 @@
#include "llavatarconstants.h" // AVATAR_ONLINE
#include "llcallingcard.h"
#include "llcombobox.h"
+#include "lldateutil.h" // ageFromDate()
#include "llimview.h"
#include "lltexteditor.h"
#include "lltexturectrl.h"
@@ -358,7 +359,7 @@ void LLPanelAvatarProfile::onOpen(const LLSD& key)
{
LLPanelProfileTab::onOpen(key);
- mGroups.erase();
+ mGroups.clear();
//Disable "Add Friend" button for friends.
childSetEnabled("add_friend", !LLAvatarActions::isFriend(getAvatarId()));
@@ -390,7 +391,7 @@ void LLPanelAvatarProfile::resetControls()
void LLPanelAvatarProfile::resetData()
{
- mGroups.erase();
+ mGroups.clear();
childSetValue("2nd_life_pic",LLUUID::null);
childSetValue("real_world_pic",LLUUID::null);
childSetValue("online_status",LLStringUtil::null);
@@ -442,23 +443,29 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g
// Group properties may arrive in two callbacks, we need to save them across
// different calls. We can't do that in textbox as textbox may change the text.
- std::string groups = mGroups;
LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin();
const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end();
- if(groups.empty() && it_end != it)
- {
- groups = (*it).group_name;
- ++it;
- }
for(; it_end != it; ++it)
{
LLAvatarGroups::LLGroupData group_data = *it;
- groups += ", ";
- groups += group_data.group_name;
+
+ // Check if there is no duplicates for this group
+ if (std::find(mGroups.begin(), mGroups.end(), group_data.group_name) == mGroups.end())
+ mGroups.push_back(group_data.group_name);
+ }
+
+ // Creating string, containing group list
+ std::string groups = "";
+ for (group_list_t::const_iterator it = mGroups.begin(); it != mGroups.end(); ++it)
+ {
+ if (it != mGroups.begin())
+ groups += ", ";
+
+ groups += *it;
}
- mGroups = groups;
- childSetValue("sl_groups",mGroups);
+
+ childSetValue("sl_groups", groups);
}
void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
@@ -466,8 +473,11 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
//remove avatar id from cache to get fresh info
LLAvatarIconIDCache::getInstance()->remove(avatar_data->avatar_id);
-
- childSetValue("register_date", avatar_data->born_on );
+ LLStringUtil::format_map_t args;
+ args["[REG_DATE]"] = avatar_data->born_on;
+ args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
+ std::string register_date = getString("RegisterDateFormat", args);
+ childSetValue("register_date", register_date );
childSetValue("sl_description_edit", avatar_data->about_text);
childSetValue("fl_description_edit",avatar_data->fl_about_text);
childSetValue("2nd_life_pic", avatar_data->image_id);