Contacts Floater: Added listing and action to buttons on groups tab

meow-7.2.2
Kadah 2011-01-23 23:50:32 -08:00
parent 2da4bf3051
commit 1e44163bf4
4 changed files with 129 additions and 38 deletions

View File

@ -41,6 +41,8 @@
#include "llcallingcard.h" // for LLAvatarTracker
#include "llfloateravatarpicker.h"
#include "llfriendcard.h"
#include "llgroupactions.h"
#include "llgrouplist.h"
#include "llsidetray.h"
static const std::string FRIENDS_TAB_NAME = "friends_panel";
@ -87,7 +89,8 @@ static const LLAvatarItemStatusComparator STATUS_COMPARATOR;
FSFloaterContacts::FSFloaterContacts(const LLSD& seed)
: LLFloater(seed),
mTabContainer(NULL),
mFriendList(NULL)
mFriendList(NULL),
mGroupList(NULL)
{
}
@ -118,6 +121,23 @@ BOOL FSFloaterContacts::postBuild()
mFriendsTab->childSetAction("remove_btn", boost::bind(&FSFloaterContacts::onDeleteFriendButtonClicked, this));
mFriendsTab->childSetAction("add_btn", boost::bind(&FSFloaterContacts::onAddFriendWizButtonClicked, this));
mGroupsTab = getChild<LLPanel>(GROUP_TAB_NAME);
mGroupList = mGroupsTab->getChild<LLGroupList>("group_list");
mGroupList->setNoItemsMsg(getString("no_groups_msg"));
mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg"));
mGroupList->setDoubleClickCallback(boost::bind(&FSFloaterContacts::onGroupChatButtonClicked, this));
// mGroupList->setCommitCallback(boost::bind(&FSFloaterContacts::updateButtons, this));
mGroupList->setReturnCallback(boost::bind(&FSFloaterContacts::onGroupChatButtonClicked, this));
mGroupsTab->childSetAction("chat_btn", boost::bind(&FSFloaterContacts::onGroupChatButtonClicked, this));
mGroupsTab->childSetAction("info_btn", boost::bind(&FSFloaterContacts::onGroupInfoButtonClicked, this));
mGroupsTab->childSetAction("activate_btn", boost::bind(&FSFloaterContacts::onGroupActivateButtonClicked, this));
mGroupsTab->childSetAction("leave_btn", boost::bind(&FSFloaterContacts::onGroupLeaveButtonClicked, this));
mGroupsTab->childSetAction("create_btn", boost::bind(&FSFloaterContacts::onGroupCreateButtonClicked, this));
mGroupsTab->childSetAction("search_btn", boost::bind(&FSFloaterContacts::onGroupSearchButtonClicked, this));
return TRUE;
}
@ -134,6 +154,27 @@ void FSFloaterContacts::onOpen(const LLSD& key)
}
//
// Friend actions
//
void FSFloaterContacts::onAvatarListDoubleClicked(LLUICtrl* ctrl)
{
LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
if(!item)
{
return;
}
LLUUID clicked_id = item->getAvatarId();
#if 0 // SJB: Useful for testing, but not currently functional or to spec
LLAvatarActions::showProfile(clicked_id);
#else // spec says open IM window
LLAvatarActions::startIM(clicked_id);
#endif
}
void FSFloaterContacts::onImButtonClicked()
{
uuid_vec_t selected_uuids;
@ -166,7 +207,8 @@ void FSFloaterContacts::onTeleportButtonClicked()
void FSFloaterContacts::onPayButtonClicked()
{
LLUUID id = getCurrentItemID();
LLAvatarActions::pay(id);
if (id.notNull())
LLAvatarActions::pay(id);
}
void FSFloaterContacts::onDeleteFriendButtonClicked()
@ -213,6 +255,45 @@ void FSFloaterContacts::onAddFriendWizButtonClicked()
}
}
//
// Group actions
//
void FSFloaterContacts::onGroupChatButtonClicked()
{
LLUUID group_id = getCurrentItemID();
if (group_id.notNull())
LLGroupActions::startIM(group_id);
}
void FSFloaterContacts::onGroupInfoButtonClicked()
{
LLGroupActions::show(getCurrentItemID());
}
void FSFloaterContacts::onGroupActivateButtonClicked()
{
LLGroupActions::activate(mGroupList->getSelectedUUID());
}
void FSFloaterContacts::onGroupLeaveButtonClicked()
{
LLUUID group_id = getCurrentItemID();
if (group_id.notNull())
LLGroupActions::leave(group_id);
}
void FSFloaterContacts::onGroupCreateButtonClicked()
{
LLGroupActions::createGroup();
}
void FSFloaterContacts::onGroupSearchButtonClicked()
{
LLGroupActions::search();
}
std::string FSFloaterContacts::getActiveTabName() const
{
@ -226,8 +307,8 @@ LLUUID FSFloaterContacts::getCurrentItemID() const
if (cur_tab == FRIENDS_TAB_NAME)
return mFriendList->getSelectedUUID();
// if (cur_tab == GROUP_TAB_NAME)
// return mGroupList->getSelectedUUID();
if (cur_tab == GROUP_TAB_NAME)
return mGroupList->getSelectedUUID();
llassert(0 && "unknown tab selected");
return LLUUID::null;
@ -239,29 +320,13 @@ void FSFloaterContacts::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
if (cur_tab == FRIENDS_TAB_NAME)
mFriendList->getSelectedUUIDs(selected_uuids);
// else if (cur_tab == GROUP_TAB_NAME)
// mGroupList->getSelectedUUIDs(selected_uuids);
else if (cur_tab == GROUP_TAB_NAME)
mGroupList->getSelectedUUIDs(selected_uuids);
else
llassert(0 && "unknown tab selected");
}
void FSFloaterContacts::onAvatarListDoubleClicked(LLUICtrl* ctrl)
{
LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
if(!item)
{
return;
}
LLUUID clicked_id = item->getAvatarId();
#if 0 // SJB: Useful for testing, but not currently functional or to spec
LLAvatarActions::showProfile(clicked_id);
#else // spec says open IM window
LLAvatarActions::startIM(clicked_id);
#endif
}
// static

View File

@ -35,6 +35,7 @@
class LLAvatarList;
class LLAvatarName;
class LLGroupList;
class LLPanel;
class LLTabContainer;
@ -52,6 +53,8 @@ public:
LLPanel* mFriendsTab;
LLAvatarList* mFriendList;
LLPanel* mGroupsTab;
LLGroupList* mGroupList;
private:
std::string getActiveTabName() const;
@ -64,6 +67,7 @@ private:
// misc callbacks
static void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names);
// friend buttons
void onViewProfileButtonClicked();
void onImButtonClicked();
void onTeleportButtonClicked();
@ -71,6 +75,14 @@ private:
void onDeleteFriendButtonClicked();
void onAddFriendWizButtonClicked();
// group buttons
void onGroupChatButtonClicked();
void onGroupInfoButtonClicked();
void onGroupActivateButtonClicked();
void onGroupLeaveButtonClicked();
void onGroupCreateButtonClicked();
void onGroupSearchButtonClicked();
LLTabContainer* mTabContainer;
};

View File

@ -15,6 +15,12 @@
<string
name="no_friends"
value="No friends" />
<string
name="no_filtered_groups_msg"
value="Didn't find what you're looking for? Try [secondlife:///app/search/groups/[SEARCH_TERM] Search]." />
<string
name="no_groups_msg"
value="Looking for Groups to join? Try [secondlife:///app/search/groups Search]." />
<tab_container
follows="all"
height="390"

View File

@ -6,7 +6,15 @@
mouse_opaque="true"
name="groups"
width="350">
<scroll_list
<group_list
allow_select="true"
bottom="10"
follows="left|top|right|bottom"
left="10"
name="group_list"
top="-10"
width="240" />
<!--<scroll_list
background_visible="true"
bottom="45"
column_padding="5"
@ -22,8 +30,8 @@
top="-10"
width="240">
<scroll_list.column label="" name="name" width="248" />
</scroll_list>
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
</scroll_list>-->
<!--<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom="22" drop_shadow_visible="true" enabled="true" follows="left|bottom"
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="12"
mouse_opaque="false" name="groupdesc" v_pad="0" width="248">
@ -34,7 +42,7 @@
font="SansSerifSmall" h_pad="0" halign="left" height="16" left="12"
mouse_opaque="false" name="groupcount" v_pad="0" width="248">
You belong to [COUNT] groups (of [MAX] maximum).
</text>
</text>-->
<button
top="-10"
@ -42,7 +50,7 @@
height="22"
label="IM/Call"
right="-10"
name="IM"
name="chat_btn"
tool_tip="Open Instant Message session"
width="80" />
<button
@ -50,49 +58,49 @@
follows="top|right"
height="22"
label="Info"
name="Info"
name="info_btn"
width="80" />
<button
<!--<button
bottom_delta="-25"
follows="top|right"
height="22"
label="Titles..."
name="Titles..."
width="80" />
name="titles_btn"
width="80" />-->
<button
bottom_delta="-25"
follows="top|right"
height="22"
label="Activate"
name="Activate"
name="activate_btn"
width="80" />
<button
bottom_delta="-25"
follows="top|right"
height="22"
label="Leave"
name="Leave"
name="leave_btn"
width="80" />
<button
bottom_delta="-35"
follows="top|right"
height="22"
label="Create..."
name="Create"
name="create_btn"
width="80" />
<button
bottom_delta="-25"
follows="top|right"
height="22"
label="Search..."
name="Search..."
name="search_btn"
width="80" />
<button
<!--<button
bottom_delta="-25"
follows="top|right"
font="SansSerif"
height="22"
label="Invite..."
name="Invite..."
width="80" />
name="invite_btn"
width="80" />-->
</panel>