diff options
author | Eugene Mutavchi <emutavchi@productengine.com> | 2009-12-07 13:13:11 +0200 |
---|---|---|
committer | Eugene Mutavchi <emutavchi@productengine.com> | 2009-12-07 13:13:11 +0200 |
commit | a0c82a20e3ef3316d2e2c15eecb5a6c2267eeaad (patch) | |
tree | cc09cf4e5667e16b5020bdb246a43dc312dc94cf /indra/newview/llfloateravatarpicker.cpp | |
parent | c6177836ecbe95f75d79f572303a879bf37b3226 (diff) |
Fixed normal bug EXT-3128 ("Ability to add friend" isn't disabled from "choose resident" ("+" btn) menu when resident is already a friend)
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llfloateravatarpicker.cpp')
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 07bb6f832b..6e3d5499a2 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -140,9 +140,14 @@ BOOL LLFloaterAvatarPicker::postBuild() return TRUE; } +void LLFloaterAvatarPicker::setOkBtnEnableCb(validate_callback_t cb) +{ + mOkButtonValidateSignal.connect(cb); +} + void LLFloaterAvatarPicker::onTabChanged() { - childSetEnabled("ok_btn", visibleItemsSelected()); + childSetEnabled("ok_btn", isSelectBtnEnabled()); } // Destroys the object @@ -175,6 +180,10 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata) { LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; + // If select btn not enabled then do not callback + if (!self || !self->isSelectBtnEnabled()) + return; + if(self->mCallback) { std::string acvtive_panel_name; @@ -244,7 +253,7 @@ void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata) LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; if (self) { - self->childSetEnabled("ok_btn", self->visibleItemsSelected()); + self->childSetEnabled("ok_btn", self->isSelectBtnEnabled()); } } @@ -477,3 +486,43 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) return LLFloater::handleKeyHere(key, mask); } + +bool LLFloaterAvatarPicker::isSelectBtnEnabled() +{ + bool ret_val = visibleItemsSelected(); + + if ( ret_val && mOkButtonValidateSignal.num_slots() ) + { + std::string acvtive_panel_name; + LLScrollListCtrl* list = NULL; + LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs"); + + if(active_panel) + { + acvtive_panel_name = active_panel->getName(); + } + + if(acvtive_panel_name == "SearchPanel") + { + list = getChild<LLScrollListCtrl>("SearchResults"); + } + else if(acvtive_panel_name == "NearMePanel") + { + list = getChild<LLScrollListCtrl>("NearMe"); + } + else if (acvtive_panel_name == "FriendsPanel") + { + list = getChild<LLScrollListCtrl>("Friends"); + } + + if(list) + { + std::vector<LLUUID> avatar_ids; + std::vector<std::string> avatar_names; + getSelectedAvatarData(list, avatar_names, avatar_ids); + return mOkButtonValidateSignal(avatar_ids); + } + } + + return ret_val; +} |