From b23d7f174c738121d5be88ea1de1f3556b563818 Mon Sep 17 00:00:00 2001 From: Beeks Date: Tue, 26 Oct 2010 23:01:51 -0400 Subject: [PATCH] Forced to push completely broken Contact Groups because a comment was removed from ascentflowercontactgroups.cpp and was committed. Signed-off-by: Beeks --- indra/newview/ascentfloatercontactgroups.cpp | 109 +++++++++++++----- indra/newview/ascentfloatercontactgroups.h | 5 +- indra/newview/llfloaterfriends.cpp | 67 ++++++++--- indra/newview/llfloaterfriends.h | 2 + .../xui/en-us/floater_contact_groups.xml | 80 +++++-------- 5 files changed, 169 insertions(+), 94 deletions(-) diff --git a/indra/newview/ascentfloatercontactgroups.cpp b/indra/newview/ascentfloatercontactgroups.cpp index a5d5c67af..5793b6dd7 100644 --- a/indra/newview/ascentfloatercontactgroups.cpp +++ b/indra/newview/ascentfloatercontactgroups.cpp @@ -45,17 +45,16 @@ void ASFloaterContactGroups::show(LLDynamicArray ids) { if (!sInstance) sInstance = new ASFloaterContactGroups(); - mSelectedUUIDs = ids; sInstance->open(); sInstance->populateGroupList(); sInstance->populateFriendList(); - sInstance->childSetAction("Cancel", onBtnClose, sInstance); - sInstance->childSetAction("Save", onBtnSave, sInstance); - sInstance->childSetAction("Create", onBtnCreate, sInstance); - sInstance->childSetAction("Delete", onBtnDelete, sInstance); + sInstance->childSetAction("combo_group_add", onBtnAdd, sInstance); + sInstance->childSetAction("combo_group_remove", onBtnRemove, sInstance); + //sInstance->childSetAction("New", onBtnCreate, sInstance); + //sInstance->childSetAction("Delete", onBtnDelete, sInstance); } void ASFloaterContactGroups::onBtnDelete(void* userdata) @@ -73,7 +72,28 @@ void ASFloaterContactGroups::onBtnDelete(void* userdata) } } -void ASFloaterContactGroups::onBtnSave(void* userdata) +void ASFloaterContactGroups::onBtnAdd(void* userdata) +{ + ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata; + llinfos << "Button Add Begin" << llendl; + if(self) + { + LLComboBox* combo = self->getChild("buddy_group_combobox"); + if (combo->getCurrentIndex() == -1) //Entered text is a new group name, create a group first + { + std::string name = combo->getSimple(); + self->createContactGroup(name); + combo->selectByValue(name); + } + for (S32 i = (self->mSelectedUUIDs.count() - 1); i >= 0; --i) + { + //self->addContactMember(combo->getSimple(), self->mSelectedUUIDs.get(i)); + } + } +} + + +void ASFloaterContactGroups::onBtnRemove(void* userdata) { ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata; @@ -98,12 +118,6 @@ void ASFloaterContactGroups::onBtnSave(void* userdata) } } -void ASFloaterContactGroups::onBtnClose(void* userdata) -{ - ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata; - if(self) self->close(); -} - void ASFloaterContactGroups::onBtnCreate(void* userdata) { ASFloaterContactGroups* self = (ASFloaterContactGroups*)userdata; @@ -112,12 +126,12 @@ void ASFloaterContactGroups::onBtnCreate(void* userdata) LLLineEditor* editor = self->getChild("add_group_lineedit"); if (editor) { - LLScrollListCtrl* scroller = self->getChild("friend_scroll_list"); + /*LLScrollListCtrl* scroller = self->getChild("friend_scroll_list"); if(scroller != NULL) { self->createContactGroup(editor->getValue().asString()); self->populateGroupList(); - } + }*/ } else { @@ -139,17 +153,58 @@ ASFloaterContactGroups::~ASFloaterContactGroups() void ASFloaterContactGroups::populateFriendList() { - LLScrollListCtrl* scroller = getChild("friend_scroll_list"); + /*LLScrollListCtrl* scroller = getChild("friend_scroll_list"); if(scroller != NULL) { - } + }*/ } void ASFloaterContactGroups::addContactMember(std::string contact_grp, LLUUID to_add) { - ASFloaterContactGroups::mContactGroupData[contact_grp].append(to_add.asString()); - gSavedPerAccountSettings.setLLSD("AscentContactGroups", ASFloaterContactGroups::mContactGroupData); + BOOL is_new = true; + S32 entrycount = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][contact_grp].size(); + for(S32 i = 0; i < entrycount; i++) + { + if (ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][contact_grp][i].asString() == to_add.asString()) + { + is_new = false; + break; + } + } + if (is_new) + { + ASFloaterContactGroups::mContactGroupData[contact_grp].append(to_add.asString()); + gSavedPerAccountSettings.setLLSD("AscentContactGroups", ASFloaterContactGroups::mContactGroupData); + } + populateActiveGroupList(to_add); +} + +void ASFloaterContactGroups::populateActiveGroupList(LLUUID user_key) +{ + LLScrollListCtrl* scroller = getChild("group_scroll_list"); + if(scroller != NULL) + { + llinfos << "Cleaning and rebuilding group list" << llendl; + scroller->deleteAllItems(); + + S32 count = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"].size(); + for (S32 index = 0; index < count; index++) + { + llinfos << "Entries for " << ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString() << llendl; + S32 entrycount = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].size(); + for(S32 i = 0; i < entrycount; i++) + { + llinfos << "Subentries for " << ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index][i].asString() << llendl; + if (ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index][i].asString() == user_key.asString()) + { + + scroller->addSimpleElement(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM); + break; + } + } + } + } } void ASFloaterContactGroups::deleteContactGroup(std::string contact_grp) @@ -167,21 +222,21 @@ void ASFloaterContactGroups::createContactGroup(std::string contact_grp) void ASFloaterContactGroups::populateGroupList() { ASFloaterContactGroups::mContactGroupData = gSavedPerAccountSettings.getLLSD("AscentContactGroups"); - LLScrollListCtrl* scroller = getChild("group_scroll_list"); - if(scroller != NULL) + LLComboBox* combo = getChild("buddy_group_combobox"); + if(combo != NULL) { - scroller->deleteAllItems(); + combo->removeall(); S32 count = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"].size(); S32 index; for (index = 0; index < count; index++) { - scroller->addSimpleElement(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM); + std::string group = ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(); + if (group != "") + { + llinfos << "Adding " << group << llendl; + combo->add(ASFloaterContactGroups::mContactGroupData["ASC_MASTER_GROUP_LIST"][index].asString(), ADD_BOTTOM); + } } } - else - { - LLChat msg("Null Scroller"); - LLFloaterChat::addChat(msg); - } } \ No newline at end of file diff --git a/indra/newview/ascentfloatercontactgroups.h b/indra/newview/ascentfloatercontactgroups.h index 1e9e280ab..ed9fa44f1 100644 --- a/indra/newview/ascentfloatercontactgroups.h +++ b/indra/newview/ascentfloatercontactgroups.h @@ -32,14 +32,15 @@ public: static void show(LLDynamicArray ids); void populateGroupList(); + void populateActiveGroupList(LLUUID to_add); void populateFriendList(); void addContactMember(std::string contact_grp, LLUUID to_add); void createContactGroup(std::string contact_grp); void deleteContactGroup(std::string contact_grp); // Buttons - static void onBtnClose(void* userdata); - static void onBtnSave(void* userdata); + static void onBtnAdd(void* userdata); + static void onBtnRemove(void* userdata); static void onBtnCreate(void* userdata); static void onBtnDelete(void* userdata); diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 275e48d17..21014021a 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -385,13 +385,14 @@ BOOL LLPanelFriends::postBuild() childSetAction("im_btn", onClickIM, this); childSetAction("assign_btn", onClickAssign, this); + childSetAction("expand_collapse_btn", onClickExpand, this); childSetAction("profile_btn", onClickProfile, this); childSetAction("offer_teleport_btn", onClickOfferTeleport, this); childSetAction("pay_btn", onClickPay, this); childSetAction("add_btn", onClickAddFriend, this); childSetAction("remove_btn", onClickRemove, this); - childSetAction("export_btn", onClickExport, this); - childSetAction("import_btn", onClickImport, this); + //childSetAction("export_btn", onClickExport, this); Making Dummy View -HgB + //childSetAction("import_btn", onClickImport, this); Making Dummy View -HgB setDefaultBtn("im_btn"); @@ -402,6 +403,8 @@ BOOL LLPanelFriends::postBuild() mFriendsList->sortByColumn(std::string("friend_name"), TRUE); mFriendsList->sortByColumn(std::string("icon_online_status"), FALSE); + updateColumns(this); + return TRUE; } @@ -551,7 +554,7 @@ void LLPanelFriends::refreshRightsChangeList() bool can_offer_teleport = num_selected >= 1; bool selected_friends_online = true; - LLTextBox* processing_label = getChild("process_rights_label"); + /*LLTextBox* processing_label = getChild("process_rights_label"); if(!mAllowRightsChange) { @@ -566,7 +569,7 @@ void LLPanelFriends::refreshRightsChangeList() else if(processing_label) { processing_label->setVisible(false); - } + } Making Dummy View -HgB */ const LLRelationship* friend_status = NULL; for(LLDynamicArray::iterator itr = friends.begin(); itr != friends.end(); ++itr) { @@ -602,7 +605,7 @@ void LLPanelFriends::refreshRightsChangeList() // to be consistent with context menus in inventory and because otherwise // offline friends would be silently dropped from the session childSetEnabled("im_btn", selected_friends_online || num_selected == 1); - childSetEnabled("assign_btn", TRUE); + childSetEnabled("assign_btn", num_selected == 1); childSetEnabled("offer_teleport_btn", can_offer_teleport); } } @@ -727,29 +730,20 @@ void LLPanelFriends::refreshUI() single_selected = TRUE; if(num_selected > 1) { - childSetText("friend_name_label", getString("Multiple")); multiple_selected = TRUE; } - else - { - childSetText("friend_name_label", mFriendsList->getFirstSelected()->getColumn(LIST_FRIEND_NAME)->getValue().asString() + "..."); - } - } - else - { - childSetText("friend_name_label", LLStringUtil::null); } //Options that can only be performed with one friend selected childSetEnabled("profile_btn", single_selected && !multiple_selected); childSetEnabled("pay_btn", single_selected && !multiple_selected); + childSetEnabled("assign_btn", single_selected && !multiple_selected); //Options that can be performed with up to MAX_FRIEND_SELECT friends selected //(single_selected will always be true in this situations) childSetEnabled("remove_btn", single_selected); childSetEnabled("im_btn", single_selected); - childSetEnabled("assign_btn", single_selected); - childSetEnabled("friend_rights", single_selected); + //childSetEnabled("friend_rights", single_selected); Making Dummy View -HgB refreshRightsChangeList(); } @@ -814,6 +808,47 @@ void LLPanelFriends::onClickAssign(void* user_data) } } +// static +void LLPanelFriends::onClickExpand(void* user_data) +{ + BOOL collapsed = gSavedSettings.getBOOL("ContactListCollapsed"); + gSavedSettings.setBOOL("ContactListCollapsed", !collapsed); + updateColumns(user_data); +} + +void LLPanelFriends::updateColumns(void* user_data) +{ + LLPanelFriends* panelp = (LLPanelFriends*)user_data; + if (panelp) + { + LLButton* expand_button = panelp->getChild("expand_collapse_btn"); + LLScrollListCtrl* list = panelp->getChild("friend_list"); + //llinfos << "Refreshing UI" << llendl; + S32 width = 22; + std::string button = ">"; + if (gSavedSettings.getBOOL("ContactListCollapsed")) + { + width = 0; + button = "<"; + } + expand_button->setLabel(button); + LLScrollListColumn* column = list->getColumn(5); + list->updateStaticColumnWidth(column, width); + column->setWidth(width); + column = list->getColumn(6); + list->updateStaticColumnWidth(column, width); + column->setWidth(width); + column = list->getColumn(7); + list->updateStaticColumnWidth(column, width); + column->setWidth(width); + list->updateLayout(); + if (!gSavedSettings.getBOOL("ContactListCollapsed")) + { + panelp->updateFriends(LLFriendObserver::ADD); + } + } +} + void LLPanelFriends::onClickIM(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 9383e0610..20c996d23 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -138,6 +138,8 @@ private: static void onContactSearchKeystroke(LLLineEditor* caller, void* user_data); static void onClickIM(void* user_data); static void onClickAssign(void* user_data); + static void onClickExpand(void* user_data); + static void updateColumns(void* user_data); static void onClickProfile(void* user_data); static void onClickAddFriend(void* user_data); static void onClickRemove(void* user_data); diff --git a/indra/newview/skins/default/xui/en-us/floater_contact_groups.xml b/indra/newview/skins/default/xui/en-us/floater_contact_groups.xml index e5a2d4420..771a5906c 100644 --- a/indra/newview/skins/default/xui/en-us/floater_contact_groups.xml +++ b/indra/newview/skins/default/xui/en-us/floater_contact_groups.xml @@ -4,53 +4,35 @@ - - - - - Create a new group or select an existing one: - - -