Skip to content
Snippets Groups Projects
Commit dab6788c authored by Paul ProductEngine's avatar Paul ProductEngine
Browse files

CHUI-157 FIXED (Implement menu bar for conversation floater)

- Added View Nearby chat history option
- Also replaced menu item "Add Friend / Remove" with two separate menus: Add Friend and Remove Friend. So if user is a Friend the Remove Friend option would be shown there. If the user is not a friend, the Add Friend option would be shown.
parent ab37263a
No related branches found
No related tags found
No related merge requests found
...@@ -241,15 +241,18 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata) ...@@ -241,15 +241,18 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
{ {
LLAvatarActions::offerTeleport(selected_id); LLAvatarActions::offerTeleport(selected_id);
} }
else if("add_rem_friend" == command_name) else if("add_friend" == command_name)
{ {
if (LLAvatarActions::isFriend(selected_id)) if (!LLAvatarActions::isFriend(selected_id))
{ {
LLAvatarActions::removeFriendDialog(selected_id); LLAvatarActions::requestFriendshipDialog(selected_id);
} }
else }
else if("remove_friend" == command_name)
{
if (LLAvatarActions::isFriend(selected_id))
{ {
LLAvatarActions::requestFriendshipDialog(selected_id); LLAvatarActions::removeFriendDialog(selected_id);
} }
} }
else if ("invite_to_group" == command_name) else if ("invite_to_group" == command_name)
...@@ -336,6 +339,10 @@ bool LLConversationLogList::isActionChecked(const LLSD& userdata) ...@@ -336,6 +339,10 @@ bool LLConversationLogList::isActionChecked(const LLSD& userdata)
{ {
return is_p2p && LLAvatarActions::isFriend(selected_id); return is_p2p && LLAvatarActions::isFriend(selected_id);
} }
else if ("is_not_friend" == command_name)
{
return is_p2p && !LLAvatarActions::isFriend(selected_id);
}
return false; return false;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "llconversationloglist.h" #include "llconversationloglist.h"
#include "llfiltereditor.h" #include "llfiltereditor.h"
#include "llfloaterconversationlog.h" #include "llfloaterconversationlog.h"
#include "llfloaterreg.h"
#include "llmenubutton.h" #include "llmenubutton.h"
LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key) LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key)
...@@ -97,6 +98,10 @@ void LLFloaterConversationLog::onCustomAction (const LLSD& userdata) ...@@ -97,6 +98,10 @@ void LLFloaterConversationLog::onCustomAction (const LLSD& userdata)
{ {
mConversationLogList->toggleSortFriendsOnTop(); mConversationLogList->toggleSortFriendsOnTop();
} }
else if ("view_nearby_chat_history" == command_name)
{
LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
}
} }
bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata) bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "llfloaterconversationpreview.h" #include "llfloaterconversationpreview.h"
#include "llimview.h" #include "llimview.h"
#include "lllineeditor.h" #include "lllineeditor.h"
#include "lltrans.h"
LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id) LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id)
: LLFloater(session_id), : LLFloater(session_id),
...@@ -44,20 +45,28 @@ BOOL LLFloaterConversationPreview::postBuild() ...@@ -44,20 +45,28 @@ BOOL LLFloaterConversationPreview::postBuild()
getChild<LLUICtrl>("more_history")->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this)); getChild<LLUICtrl>("more_history")->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this));
const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID); const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID);
if (conv) std::string name;
{ std::string file;
std::string name = conv->getConversationName();
LLStringUtil::format_map_t args;
args["[NAME]"] = name;
std::string title = getString("Title", args);
setTitle(title);
getChild<LLLineEditor>("description")->setValue(name); if (mSessionID != LLUUID::null && conv)
{
name = conv->getConversationName();
file = conv->getHistoryFileName();
}
else
{
name = LLTrans::getString("NearbyChatTitle");
file = "chat";
} }
std::string file = conv->getHistoryFileName(); LLStringUtil::format_map_t args;
LLLogChat::loadChatHistory(file, mMessages, true); args["[NAME]"] = name;
std::string title = getString("Title", args);
setTitle(title);
getChild<LLLineEditor>("description")->setValue(name);
LLLogChat::loadChatHistory(file, mMessages, true);
mCurrentPage = mMessages.size() / mPageSize; mCurrentPage = mMessages.size() / mPageSize;
return LLFloater::postBuild(); return LLFloater::postBuild();
...@@ -68,7 +77,7 @@ void LLFloaterConversationPreview::draw() ...@@ -68,7 +77,7 @@ void LLFloaterConversationPreview::draw()
LLFloater::draw(); LLFloater::draw();
} }
void LLFloaterConversationPreview::onOpen(const LLSD& session_id) void LLFloaterConversationPreview::onOpen(const LLSD& key)
{ {
showHistory(); showHistory();
} }
...@@ -88,13 +97,8 @@ void LLFloaterConversationPreview::showHistory() ...@@ -88,13 +97,8 @@ void LLFloaterConversationPreview::showHistory()
int delta = 0; int delta = 0;
if (mCurrentPage) if (mCurrentPage)
{ {
// stinson 08/28/2012 : This operation could be simplified using integer math with the mod (%) operator. int remainder = mMessages.size() % mPageSize;
// e.g. The following code should give the same output. delta = (remainder == 0) ? 0 : (mPageSize - remainder);
// int remainder = mMessages.size() % mPageSize;
// delta = (remainder == 0) ? 0 : (mPageSize - remainder);
// Though without examining further, the remainder might be a more appropriate value.
double num_of_pages = static_cast<double>(mMessages.size()) / static_cast<double>(mPageSize);
delta = static_cast<int>((ceil(num_of_pages) - num_of_pages) * static_cast<double>(mPageSize));
} }
std::advance(iter, (mCurrentPage * mPageSize) - delta); std::advance(iter, (mCurrentPage * mPageSize) - delta);
......
...@@ -39,7 +39,7 @@ class LLFloaterConversationPreview : public LLFloater ...@@ -39,7 +39,7 @@ class LLFloaterConversationPreview : public LLFloater
virtual BOOL postBuild(); virtual BOOL postBuild();
virtual void draw(); virtual void draw();
virtual void onOpen(const LLSD& session_id); virtual void onOpen(const LLSD& key);
private: private:
void onMoreHistoryBtnClick(); void onMoreHistoryBtnClick();
......
...@@ -57,20 +57,28 @@ ...@@ -57,20 +57,28 @@
parameter="can_offer_teleport"/> parameter="can_offer_teleport"/>
</menu_item_call> </menu_item_call>
<menu_item_separator /> <menu_item_separator />
<menu_item_check <menu_item_call
label="Add friend/Remove friend" label="Add Friend"
layout="topleft" layout="topleft"
name="Friend_add_remove"> name="add_friend">
<menu_item_check.on_click <on_click
function="Calllog.Action" function="Calllog.Action"
parameter="add_rem_friend" /> parameter="add_friend"/>
<menu_item_check.on_check <on_visible
function="Calllog.Check"
parameter="is_not_friend" />
</menu_item_call>
<menu_item_call
label="Remove Friend"
layout="topleft"
name="remove_friend">
<on_click
function="Calllog.Action"
parameter="remove_friend"/>
<on_visible
function="Calllog.Check" function="Calllog.Check"
parameter="is_friend" /> parameter="is_friend" />
<menu_item_check.on_enable </menu_item_call>
function="Calllog.Enable"
parameter="add_rem_friend" />
</menu_item_check>
<menu_item_call <menu_item_call
label="Invite to group..." label="Invite to group..."
layout="topleft" layout="topleft"
......
...@@ -34,4 +34,12 @@ ...@@ -34,4 +34,12 @@
function="CallLog.Check" function="CallLog.Check"
parameter="sort_friends_on_top" /> parameter="sort_friends_on_top" />
</menu_item_check> </menu_item_check>
<menu_item_separator />
<menu_item_call
label="View Nearby chat history..."
name="view_nearby_chat_history">
<on_click
function="CallLog.Action"
parameter="view_nearby_chat_history" />
</menu_item_call>
</toggleable_menu> </toggleable_menu>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment