Append the count of unread IMs to the IM session's name in the communicate button's flyout list

ShowUnreadIMsCount can be set false to turn this off
This commit is contained in:
Inusaito Sayori
2013-08-24 19:20:56 -04:00
parent a4802a4511
commit 0c40a38a45
3 changed files with 32 additions and 1 deletions

View File

@@ -962,6 +962,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowUnreadIMsCounts</key>
<map>
<key>Comment</key>
<string>Show the count of unread IMs in the communicate flyout list</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>StatusBarPositionBeforeParcel</key>
<map>
<key>Comment</key>

View File

@@ -389,8 +389,26 @@ void LLToolBar::updateCommunicateList()
LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)floater_handle_it->get();
if (im_floaterp)
{
std::string floater_title = im_floaterp->getNumUnreadMessages() > 0 ? "*" : "";
static LLCachedControl<bool> show_counts("ShowUnreadIMsCounts", true);
S32 count = im_floaterp->getNumUnreadMessages();
std::string floater_title;
if (count > 0) floater_title = "*";
floater_title.append(im_floaterp->getShortTitle());
if (show_counts && count > 0)
{
floater_title += " - ";
if (count > 1)
{
LLStringUtil::format_map_t args;
args["COUNT"] = llformat("%d", count);
floater_title += getString("IMs", args);
}
else
{
floater_title += getString("IM");
}
}
itemp = communicate_button->add(floater_title, im_floaterp->getSessionID(), ADD_TOP);
if (im_floaterp == frontmost_floater)
{

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel background_opaque="true" background_visible="true" bottom="0" can_close="true" can_minimize="false" can_resize="false" follows="left|right|bottom" height="28" name="toolbar" width="1024">
<string name="Redock Windows">Redock Windows</string>
<string name="IMs">[COUNT] IMs</string>
<string name="IM">1 IM</string>
<panel bottom="0" filename="panel_bg_toolbar.xml" height="28" left="0" width="1024"/>
<layout_stack name="toolbar_stack" follows="left|right|bottom|top" bottom="2" left="1" width="1022" height="26" min_width="200" orientation="horizontal" border_size="0">
<layout_panel name="panel1" height="2" width="2" auto_resize="false" user_resize="false">