From 117e22047c5752352342d64e3fb7ce00a4eb8113 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:04 -0500 Subject: Second Life viewer sources 1.18.1.2 --- linden/indra/newview/llpanelavatar.cpp | 36 ++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'linden/indra/newview/llpanelavatar.cpp') diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp index 0180bb3..b79993f 100644 --- a/linden/indra/newview/llpanelavatar.cpp +++ b/linden/indra/newview/llpanelavatar.cpp @@ -91,6 +91,7 @@ BOOL LLPanelAvatar::sAllowFirstLife = FALSE; // RN: move these to lldbstrings.h static const S32 DB_USER_FAVORITES_STR_LEN = 254; +const char LOADING_MSG[] = "Loading..."; static const char IM_DISABLED_TOOLTIP[] = "Instant Message (IM).\nDisabled because you do not have their card."; static const char IM_ENABLED_TOOLTIP[] = "Instant Message (IM)"; static const S32 LEFT = HPAD; @@ -830,7 +831,7 @@ void LLPanelAvatarNotes::refresh() void LLPanelAvatarNotes::clearControls() { - childSetText("notes edit", "Loading..."); + childSetText("notes edit", LOADING_MSG); childSetEnabled("notes edit", false); } @@ -1271,6 +1272,8 @@ LLPanelAvatar::LLPanelAvatar( mAvatarID( LLUUID::null ), // mAvatarID is set with 'setAvatar' or 'setAvatarID' mHaveProperties(FALSE), mHaveStatistics(FALSE), + mHaveNotes(false), + mLastNotes(), mAllowEdit(allow_edit) { @@ -1415,6 +1418,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, setOnlineStatus(online_status); BOOL own_avatar = (mAvatarID == gAgent.getID() ); + BOOL avatar_is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL; mPanelSecondLife->enableControls(own_avatar && mAllowEdit); mPanelWeb->enableControls(own_avatar && mAllowEdit); @@ -1460,6 +1464,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, mPanelNotes->clearControls(); mPanelNotes->setDataRequested(false); + mHaveNotes = false; + mLastNotes.clear(); // Request just the first two pages of data. The picks, // classifieds, and notes will be requested when that panel @@ -1471,8 +1477,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, if (mAllowEdit) { // OK button disabled until properties data arrives - childSetVisible("OK",TRUE); - childSetEnabled("OK",TRUE); + childSetVisible("OK", true); + childSetEnabled("OK", false); childSetVisible("Cancel",TRUE); childSetEnabled("Cancel",TRUE); } @@ -1530,7 +1536,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name, childSetToolTip("Show on Map",childGetValue("ShowOnMapFriendOnline").asString()); } childSetVisible("Add Friend...", true); - childSetEnabled("Add Friend...", true); + childSetEnabled("Add Friend...", !avatar_is_friend); childSetVisible("Pay...",TRUE); childSetEnabled("Pay...",FALSE); } @@ -1604,12 +1610,12 @@ void LLPanelAvatar::resetGroupList() void LLPanelAvatar::onClickIM(void* userdata) { LLPanelAvatar* self = (LLPanelAvatar*) userdata; - gIMView->setFloaterOpen(TRUE); + gIMMgr->setFloaterOpen(TRUE); std::string name; LLNameEditor* nameedit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); if (nameedit) name = nameedit->getText(); - gIMView->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); + gIMMgr->addSession(name, IM_NOTHING_SPECIAL, self->mAvatarID); } @@ -1639,7 +1645,7 @@ void LLPanelAvatar::onClickAddFriend(void* userdata) LLNameEditor* name_edit = LLViewerUICtrlFactory::getNameEditorByName(self->mPanelSecondLife, "name"); if (name_edit) { - LLFloaterFriends::requestFriendshipDialog(self->getAvatarID(), + LLPanelFriends::requestFriendshipDialog(self->getAvatarID(), name_edit->getText()); } } @@ -1767,7 +1773,19 @@ void LLPanelAvatar::sendAvatarPropertiesRequest() void LLPanelAvatar::sendAvatarNotesUpdate() { std::string notes = mPanelNotes->childGetValue("notes edit").asString(); - + + if (!mHaveNotes + && (notes.empty() || notes == LOADING_MSG)) + { + // no notes from server and no user updates + return; + } + if (notes == mLastNotes) + { + // Avatar notes unchanged + return; + } + LLMessageSystem *msg = gMessageSystem; msg->newMessage("AvatarNotesUpdate"); @@ -2175,6 +2193,8 @@ void LLPanelAvatar::processAvatarNotesReply(LLMessageSystem *msg, void**) msg->getString("Data", "Notes", DB_USER_NOTE_SIZE, text); self->childSetValue("notes edit", text); self->childSetEnabled("notes edit", true); + self->mHaveNotes = true; + self->mLastNotes = text; } } -- cgit v1.1