diff --git a/indra/newview/llfloatermute.cpp b/indra/newview/llfloatermute.cpp index b4ea23ef4..cced63ab1 100644 --- a/indra/newview/llfloatermute.cpp +++ b/indra/newview/llfloatermute.cpp @@ -182,19 +182,12 @@ LLFloaterMute::LLFloaterMute(const LLSD& seed) : LLFloater(std::string("mute floater"), std::string("FloaterMuteRect3"), FLOATER_TITLE, RESIZE_YES, 220, 140, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mute.xml", NULL, FALSE); } -// LLMuteListObserver callback interface implementation. -/* virtual */ void LLFloaterMute::onChange() -{ - refreshMuteList(); -} - BOOL LLFloaterMute::postBuild() { - childSetCommitCallback("mutes", onSelectName, this); + childSetCommitCallback("mutes", boost::bind(&LLFloaterMute::updateButtons, this)); childSetAction("Mute resident...", onClickPick, this); childSetAction("Mute object by name...", onClickMuteByName, this); childSetAction("Unmute", onClickRemove, this); @@ -233,17 +226,11 @@ void LLFloaterMute::refreshMuteList() mMuteDict.clear(); std::vector mutes = LLMuteList::getInstance()->getMutes(); - std::vector::iterator it; - U32 count = 0; - for (it = mutes.begin(); it != mutes.end(); ++it) + for (std::vector::iterator it = mutes.begin(); it != mutes.end(); ++it) { std::string display_name = it->mName; LLNameListCtrl::NameItem element; - LLUUID entry_id; - if(it->mType == LLMute::GROUP || it->mType == LLMute::AGENT) - entry_id = it->mID; - else - entry_id.generate(boost::lexical_cast( count++ )); + LLUUID entry_id = it->mID; mMuteDict.insert(std::make_pair(entry_id,*it)); element.value = entry_id; element.name = display_name; @@ -299,24 +286,7 @@ void LLFloaterMute::selectMute(const LLUUID& mute_id) //----------------------------------------------------------------------------- void LLFloaterMute::updateButtons() { - if (mMuteList->getFirstSelected()) - { - childSetEnabled("Unmute", TRUE); - } - else - { - childSetEnabled("Unmute", FALSE); - } -} - -//----------------------------------------------------------------------------- -// onSelectName() -//----------------------------------------------------------------------------- -void LLFloaterMute::onSelectName(LLUICtrl *caller, void *data) -{ - LLFloaterMute *floater = (LLFloaterMute*)data; - - floater->updateButtons(); + getChildView("Unmute")->setEnabled(!!mMuteList->getFirstSelected()); } //----------------------------------------------------------------------------- @@ -328,11 +298,11 @@ void LLFloaterMute::onClickRemove(void *data) S32 last_selected = floater->mMuteList->getFirstSelectedIndex(); bool removed = false; - const std::vector items = floater->mMuteList->getAllSelected(); - for(std::vector::const_iterator it = items.begin(); it != items.end(); ++it) + uuid_vec_t items = floater->mMuteList->getSelectedIDs(); + for(uuid_vec_t::const_iterator it = items.begin(); it != items.end(); ++it) { - std::map::iterator mute_it = floater->mMuteDict.find((*it)->getUUID()); - if(mute_it != floater->mMuteDict.end() && LLMuteList::getInstance()->remove(mute_it->second)) + std::map::iterator mute_it = floater->mMuteDict.find(*it); + if (mute_it != floater->mMuteDict.end() && LLMuteList::getInstance()->remove(mute_it->second)) { floater->mMuteDict.erase(mute_it); removed = true; diff --git a/indra/newview/llfloatermute.h b/indra/newview/llfloatermute.h index 8abb6afdf..1a04ae198 100644 --- a/indra/newview/llfloatermute.h +++ b/indra/newview/llfloatermute.h @@ -63,13 +63,12 @@ public: void updateButtons(); // LLMuteListObserver callback interface implementation. - /* virtual */ void onChange(); + /* virtual */ void onChange() { refreshMuteList(); } private: // UI callbacks static void onClickRemove(void *data); static void onClickPick(void *data); - static void onSelectName(LLUICtrl* caller, void *data); void onPickUser(const uuid_vec_t& ids, const std::vector& names); static void onClickMuteByName(void*); static void callbackMuteByName(const std::string& text, void*);