diff --git a/indra/newview/fsfloaterprofile.cpp b/indra/newview/fsfloaterprofile.cpp index 4df46811f6..df1866af8c 100644 --- a/indra/newview/fsfloaterprofile.cpp +++ b/indra/newview/fsfloaterprofile.cpp @@ -100,10 +100,10 @@ void FSFloaterProfile::onOKBtn() { FSPanelProfile* panel_profile = findChild(PANEL_PROFILE); FSPanelProfileWeb* panel_web = findChild(PANEL_WEB); - // FSPanelProfileInterests* panel_interests = findChild(PANEL_INTERESTS); + FSPanelProfileInterests* panel_interests = findChild(PANEL_INTERESTS); FSPanelProfilePicks* panel_picks = findChild(PANEL_PICKS); FSPanelProfileFirstLife* panel_firstlife = findChild(PANEL_FIRSTLIFE); - // FSPanelAvatarNotes* panel_notes = findChild(PANEL_NOTES); + FSPanelAvatarNotes* panel_notes = findChild(PANEL_NOTES); //KC - Avatar data is spread over 3 different panels // collect data from the last 2 and give to the first to save @@ -113,9 +113,9 @@ void FSFloaterProfile::onOKBtn() panel_web->apply(&data); panel_profile->apply(&data); - // panel_interests->apply(); + panel_interests->apply(); panel_picks->apply(); - // panel_notes->apply(); + panel_notes->apply(); } closeFloater(); diff --git a/indra/newview/fspanelprofile.cpp b/indra/newview/fspanelprofile.cpp index 342ef083cf..ec8a46facd 100644 --- a/indra/newview/fspanelprofile.cpp +++ b/indra/newview/fspanelprofile.cpp @@ -182,6 +182,10 @@ BOOL FSPanelProfile::postBuild() enable.add("Profile.EnableUnblock", boost::bind(&FSPanelProfile::enableUnblock, this)); LLGroupList* group_list = getChild("group_list"); + if (getAvatarId() == gAgent.getID()) + { + group_list->enableForAgent(); + } group_list->setDoubleClickCallback(boost::bind(&FSPanelProfile::openGroupProfile, this)); group_list->setReturnCallback(boost::bind(&FSPanelProfile::openGroupProfile, this)); @@ -209,11 +213,6 @@ void FSPanelProfile::onOpen(const LLSD& key) getChild("block")->setVisible( false ); getChild("unblock")->setVisible( false ); getChild("overflow_btn")->setVisible( false ); - - getChild("show_in_search_checkbox")->setVisible( true ); - getChild("show_in_search_checkbox")->setEnabled( true ); - getChild("sl_description_edit")->setEnabled( true ); - getChild("2nd_life_pic")->setEnabled( true ); } else { @@ -226,7 +225,7 @@ void FSPanelProfile::onOpen(const LLSD& key) void FSPanelProfile::apply(LLAvatarData* data) { - if (getAvatarId() == gAgent.getID()) + if (getIsLoaded() && (getAvatarId() == gAgent.getID())) { data->image_id = getChild("2nd_life_pic")->getImageAssetID(); data->about_text = getChild("sl_description_edit")->getValue().asString(); @@ -241,7 +240,10 @@ void FSPanelProfile::updateData() if (getAvatarId().notNull()) { LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(getAvatarId()); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarGroupsRequest(getAvatarId()); + if (getAvatarId() != gAgent.getID()) + { + LLAvatarPropertiesProcessor::getInstance()->sendAvatarGroupsRequest(getAvatarId()); + } } } @@ -253,6 +255,7 @@ void FSPanelProfile::processProperties(void* data, EAvatarProcessorType type) if(avatar_data && getAvatarId() == avatar_data->avatar_id) { processProfileProperties(avatar_data); + enableControls(); } } else if(APT_GROUPS == type) @@ -657,6 +660,19 @@ void FSPanelProfile::processOnlineStatus(bool online) mStatusText->setValue(status); } +void FSPanelProfile::enableControls() +{ + FSPanelProfileTab::enableControls(); + + if (getAvatarId() == gAgent.getID()) + { + getChild("show_in_search_checkbox")->setVisible( true ); + getChild("show_in_search_checkbox")->setEnabled( true ); + getChild("sl_description_edit")->setEnabled( true ); + getChild("2nd_life_pic")->setEnabled( true ); + } +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -671,6 +687,11 @@ FSPanelProfileWeb::~FSPanelProfileWeb() { } +void FSPanelProfileWeb::onOpen(const LLSD& key) +{ + FSPanelProfileTab::onOpen(key); +} + BOOL FSPanelProfileWeb::postBuild() { getChild("load")->setCommitCallback(boost::bind(&FSPanelProfileWeb::onCommitLoad, this, _1)); @@ -681,6 +702,8 @@ BOOL FSPanelProfileWeb::postBuild() mWebBrowser = getChild("profile_html"); mWebBrowser->addObserver(this); + getChild("url_edit")->setEnabled( FALSE ); + return TRUE; } @@ -694,6 +717,7 @@ void FSPanelProfileWeb::processProperties(void* data, EAvatarProcessorType type) mURLHome = avatar_data->profile_url; getChild("url_edit")->setValue(mURLHome); childSetEnabled("load", mURLHome.length() > 0); + enableControls(); } } } @@ -828,6 +852,16 @@ void FSPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e } } +void FSPanelProfileWeb::enableControls() +{ + FSPanelProfileTab::enableControls(); + + if (getAvatarId() == gAgent.getID()) + { + getChild("url_edit")->setEnabled( TRUE ); + } +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -844,6 +878,11 @@ FSPanelProfileInterests::~FSPanelProfileInterests() { } +void FSPanelProfileInterests::onOpen(const LLSD& key) +{ + FSPanelProfileTab::onOpen(key); +} + BOOL FSPanelProfileInterests::postBuild() { for (S32 i=0; i < WANT_CHECKS; ++i) @@ -858,6 +897,12 @@ BOOL FSPanelProfileInterests::postBuild() mSkillChecks[i] = getChild(check_name); } + //FS:KC - Due to a bug with LLLineEditor, it cannot be disabled from XUI + // It won't properly enable from code if it is. + getChild("want_to_edit")->setEnabled( FALSE ); + getChild("skills_edit")->setEnabled( FALSE ); + getChild("languages_edit")->setEnabled( FALSE ); + return TRUE; } @@ -869,9 +914,9 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType const FSInterestsData* interests_data = static_cast(data); if (interests_data && getAvatarId() == interests_data->avatar_id) { - for (S32 i=0; i < WANT_CHECKS; ++i) + for (S32 i=0; i < WANT_CHECKS; i++) { - if (interests_data->want_to_mask & 1<want_to_mask & (1<setValue(TRUE); } @@ -881,9 +926,9 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType } } - for (S32 i=0; i < SKILL_CHECKS; ++i) + for (S32 i=0; i < SKILL_CHECKS; i++) { - if (interests_data->skills_mask & 1<skills_mask & (1<setValue(TRUE); } @@ -896,10 +941,66 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType childSetText("want_to_edit", interests_data->want_to_text); childSetText("skills_edit", interests_data->skills_text); childSetText("languages_edit", interests_data->languages_text); + + enableControls(); } } } +void FSPanelProfileInterests::apply() +{ + if (getIsLoaded() && (getAvatarId() == gAgent.getID())) + { + FSInterestsData interests_data = FSInterestsData(); + + interests_data.want_to_mask = 0; + for (S32 i=0; i < WANT_CHECKS; i++) + { + if (mWantChecks[i]->getValue().asBoolean()) + { + interests_data.want_to_mask |= (1<getValue().asBoolean()) + { + interests_data.skills_mask |= (1<("want_to_edit")->getValue().asString(); + interests_data.skills_text = getChild("skills_edit")->getValue().asString(); + interests_data.languages_text = getChild("languages_edit")->getValue().asString(); + + LLAvatarPropertiesProcessor::getInstance()->sendInterestsInfoUpdate(&interests_data); + } + +} + +void FSPanelProfileInterests::enableControls() +{ + FSPanelProfileTab::enableControls(); + + if (getAvatarId() == gAgent.getID()) + { + getChild("want_to_edit")->setEnabled( TRUE ); + getChild("skills_edit")->setEnabled( TRUE ); + getChild("languages_edit")->setEnabled( TRUE ); + + for (S32 i=0; i < WANT_CHECKS; ++i) + { + mWantChecks[i]->setEnabled( TRUE ); + } + + for (S32 i=0; i < SKILL_CHECKS; ++i) + { + mSkillChecks[i]->setEnabled( TRUE ); + } + } +} ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -1093,7 +1194,7 @@ void FSPanelPick::onClickTeleport() void FSPanelPick::enableSaveButton(bool enable) { - // getChildView("save_changes_btn")->setEnabled(enable); + getChildView("save_changes_btn")->setEnabled(enable); getChild("save_changes_btn")->setVisible(enable); } @@ -1284,6 +1385,15 @@ void FSPanelProfilePicks::onOpen(const LLSD& key) { FSPanelProfileTab::onOpen(key); + if (getAvatarId() == gAgent.getID()) + { + getChild("new_btn")->setVisible( true ); + getChild("new_btn")->setEnabled( true ); + + getChild("delete_btn")->setVisible( true ); + getChild("delete_btn")->setEnabled( true ); + } + updateData(); } @@ -1451,6 +1561,11 @@ FSPanelProfileFirstLife::~FSPanelProfileFirstLife() { } +void FSPanelProfileFirstLife::onOpen(const LLSD& key) +{ + FSPanelProfileTab::onOpen(key); +} + void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type) { if(APT_PROPERTIES == type) @@ -1460,6 +1575,7 @@ void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType { getChild("fl_description_edit")->setValue(avatar_data->fl_about_text); getChild("real_world_pic")->setValue(avatar_data->fl_image_id); + enableControls(); } } } @@ -1470,6 +1586,17 @@ void FSPanelProfileFirstLife::apply(LLAvatarData* data) data->fl_about_text = getChild("fl_description_edit")->getValue().asString(); } +void FSPanelProfileFirstLife::enableControls() +{ + FSPanelProfileTab::enableControls(); + + if (getAvatarId() == gAgent.getID()) + { + getChild("fl_description_edit")->setEnabled( true ); + getChild("real_world_pic")->setEnabled( true ); + } +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -1508,6 +1635,15 @@ void FSPanelAvatarNotes::onOpen(const LLSD& key) updateData(); } +void FSPanelAvatarNotes::apply() +{ + if (getIsLoaded()) + { + //likely overkill + onCommitNotes(); + } +} + void FSPanelAvatarNotes::fillRightsData() { getChild("status_check")->setValue(FALSE); @@ -1618,6 +1754,7 @@ void FSPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type { getChild("notes_edit")->setValue(avatar_notes->notes); getChildView("notes edit")->setEnabled(true); + enableControls(); LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } @@ -1659,6 +1796,4 @@ void FSPanelAvatarNotes::setAvatarId(const LLUUID& id) } } - - // eof diff --git a/indra/newview/fspanelprofile.h b/indra/newview/fspanelprofile.h index c68961b420..8e2e08bc1c 100644 --- a/indra/newview/fspanelprofile.h +++ b/indra/newview/fspanelprofile.h @@ -79,9 +79,14 @@ protected: virtual void onMapButtonClick(); + virtual void enableControls() { mLoaded = TRUE; } + + bool getIsLoaded() { return mLoaded; } + private: - LLUUID mAvatarId; + LLUUID mAvatarId; + BOOL mLoaded; }; @@ -206,6 +211,8 @@ protected: void updateOnlineStatus(); void processOnlineStatus(bool online); + virtual void enableControls(); + private: typedef std::map group_map_t; group_map_t mGroups; @@ -228,6 +235,8 @@ public: FSPanelProfileWeb(); /*virtual*/ ~FSPanelProfileWeb(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ BOOL postBuild(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); @@ -247,6 +256,8 @@ public: void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + virtual void enableControls(); + protected: void onCommitLoad(LLUICtrl* ctrl); void onCommitWebProfile(LLUICtrl* ctrl); @@ -270,11 +281,19 @@ public: FSPanelProfileInterests(); /*virtual*/ ~FSPanelProfileInterests(); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ BOOL postBuild(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + /** + * Saves changes. + */ + virtual void apply(); + protected: + virtual void enableControls(); private: LLCheckBoxCtrl *mWantChecks[8]; @@ -307,6 +326,9 @@ public: /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + /** + * Saves changes. + */ virtual void apply(); //This stuff we got from LLRemoteParcelObserver, in the last one we intentionally do nothing @@ -429,6 +451,9 @@ public: /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + /** + * Saves changes. + */ virtual void apply(); protected: @@ -456,7 +481,9 @@ class FSPanelProfileFirstLife { public: FSPanelProfileFirstLife(); - /*virtual*/ ~FSPanelProfileFirstLife();; + /*virtual*/ ~FSPanelProfileFirstLife(); + + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); @@ -464,6 +491,9 @@ public: * Saves changes. */ void apply(LLAvatarData* data); + +protected: + virtual void enableControls(); }; /** @@ -492,6 +522,11 @@ public: /*virtual*/ void updateData(); + /** + * Saves changes. + */ + virtual void apply(); + protected: /** * Fills rights data for friends. diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 2b7a0dc08c..2884ac00f9 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -669,3 +669,28 @@ void LLAvatarPropertiesProcessor::removePendingRequest(const LLUUID& avatar_id, timestamp_map_t::key_type key = std::make_pair(avatar_id, type); mRequestTimestamps.erase(key); } + +// +void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const FSInterestsData* interests_data) +{ + if(!interests_data) + { + return; + } + + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_AvatarInterestsUpdate); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() ); + msg->nextBlockFast( _PREHASH_PropertiesData); + msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); + msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); + msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask); + msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text); + msg->addString( _PREHASH_LanguagesText, interests_data->languages_text); + + gAgent.sendReliableMessage(); +} +// diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index e64c667183..321a3d07c0 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -232,6 +232,10 @@ public: void sendClassifiedDelete(const LLUUID& classified_id); +// + void sendInterestsInfoUpdate(const FSInterestsData* interests_data); +// + // Returns translated, human readable string for account type, such // as "Resident" or "Linden Employee". Used for profiles, inspectors. static std::string accountType(const LLAvatarData* avatar_data); diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 4541128c5c..8a2554504e 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -79,30 +79,16 @@ LLGroupList::LLGroupList(const Params& p) mForAgent(p.for_agent) , mDirty(true) // to force initial update { - // Listen for agent group changes. - if (mForAgent) gAgent.addListener(this, "new group"); - mShowIcons = mForAgent && gSavedSettings.getBOOL("GroupListShowIcons"); setCommitOnSelectionChange(true); // Set default sort order. setComparator(&GROUP_COMPARATOR); - - - if (mForAgent) + + if (mForAgent) { - // Set up context menu. - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; - - registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2)); - enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2)); - - LLMenuGL* context_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_people_groups.xml", - gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(context_menu) - mContextMenuHandle = context_menu->getHandle(); - } + enableForAgent(); + } } LLGroupList::~LLGroupList() @@ -111,6 +97,26 @@ LLGroupList::~LLGroupList() if (mContextMenuHandle.get()) mContextMenuHandle.get()->die(); } +void LLGroupList::enableForAgent() +{ + mForAgent = true; + + // Listen for agent group changes. + gAgent.addListener(this, "new group"); + + // Set up context menu. + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + + registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2)); + enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2)); + + LLMenuGL* context_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_people_groups.xml", + gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if(context_menu) + mContextMenuHandle = context_menu->getHandle(); +} + // virtual void LLGroupList::draw() { diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h index bd9606c907..692ae98a0f 100644 --- a/indra/newview/llgrouplist.h +++ b/indra/newview/llgrouplist.h @@ -54,6 +54,8 @@ public: LLGroupList(const Params& p); virtual ~LLGroupList(); + void enableForAgent(); + virtual void draw(); // from LLView /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView diff --git a/indra/newview/skins/default/xui/en/floater_profile_view.xml b/indra/newview/skins/default/xui/en/floater_profile_view.xml index ded54196ad..2af531747d 100644 --- a/indra/newview/skins/default/xui/en/floater_profile_view.xml +++ b/indra/newview/skins/default/xui/en/floater_profile_view.xml @@ -81,7 +81,7 @@ bottom_delta="0" left="10" height="20" - width="100" + width="90" layout="topleft" follows="left|bottom" name="ok_btn" @@ -93,7 +93,7 @@ bottom_delta="0" right="-10" height="20" - width="100" + width="90" layout="topleft" follows="right|bottom" name="cancel_btn" diff --git a/indra/newview/skins/default/xui/en/panel_profile_interests.xml b/indra/newview/skins/default/xui/en/panel_profile_interests.xml index 24050f9f68..d1e123293c 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_interests.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_interests.xml @@ -105,7 +105,6 @@ follows="left|top" name="want_to_edit" is_unicode="false" - enabled="false" max_length="254" /> + diff --git a/indra/newview/skins/default/xui/en/panel_profile_picks.xml b/indra/newview/skins/default/xui/en/panel_profile_picks.xml index 9875e5c385..24b63a760e 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_picks.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_picks.xml @@ -34,7 +34,9 @@ layout="topleft" follows="left|top" name="new_btn" - label="New..." /> + label="New..." + visible="false" + enabled="false" />