summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmarketplaceinbox.cpp
diff options
context:
space:
mode:
authorLeslie Linden <none@none>2011-06-14 16:35:15 -0700
committerLeslie Linden <none@none>2011-06-14 16:35:15 -0700
commit142c2fc29c9645df1bff924d6a61c09f04713a7b (patch)
treeb4a578097f712518c4a805013596bc9dc2efa729 /indra/newview/llpanelmarketplaceinbox.cpp
parent3eeb14ee0abb5720e010d94eba52db09fa32237e (diff)
EXP-896 FIX -- Inbox not opened by default when new items are received
EXP-894 FIX -- When scrolling to the bottom of the inbox, the last item is c... EXP-856 FIX -- Inbox item count reflected as badge on inventory button * Inbox auto-expands when "fresh" items are reported * Logic for "fresh" item determination is still in progress but works for purchases while logged in * Badges now only displayed when the inventory side panel is collapsed or when inventory not visible Reviewed by Leyla
Diffstat (limited to 'indra/newview/llpanelmarketplaceinbox.cpp')
-rw-r--r--indra/newview/llpanelmarketplaceinbox.cpp65
1 files changed, 57 insertions, 8 deletions
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index a6d6308dc2..0fe2560fbf 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -34,9 +34,14 @@
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
+const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
+{
+ return LLUICtrlFactory::getDefaultParams<LLPanelMarketplaceInbox>();
+}
+
// protected
-LLPanelMarketplaceInbox::LLPanelMarketplaceInbox()
- : LLPanel()
+LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p)
+ : LLPanel(p)
, mInventoryPanel(NULL)
{
}
@@ -69,7 +74,31 @@ BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dr
return TRUE;
}
-U32 LLPanelMarketplaceInbox::getItemCount() const
+U32 LLPanelMarketplaceInbox::getFreshItemCount() const
+{
+ U32 fresh_item_count = 0;
+
+ LLFolderView * root_folder = mInventoryPanel->getRootFolder();
+
+ const LLFolderViewFolder * inbox_folder = *(root_folder->getFoldersBegin());
+
+ LLFolderViewFolder::folders_t::const_iterator folders_it = inbox_folder->getFoldersBegin();
+ LLFolderViewFolder::folders_t::const_iterator folders_end = inbox_folder->getFoldersEnd();
+
+ for (; folders_it != folders_end; ++folders_it)
+ {
+ const LLFolderViewFolder * folder = *folders_it;
+
+ if (folder->getCreationDate() > 1500)
+ {
+ fresh_item_count++;
+ }
+ }
+
+ return fresh_item_count;
+}
+
+U32 LLPanelMarketplaceInbox::getTotalItemCount() const
{
LLInventoryModel* model = mInventoryPanel->getModel();
@@ -96,11 +125,16 @@ U32 LLPanelMarketplaceInbox::getItemCount() const
std::string LLPanelMarketplaceInbox::getBadgeString() const
{
std::string item_count_str("");
- U32 item_count = getItemCount();
- if (item_count)
+ // If side panel collapsed or expanded and not inventory
+ if (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))
{
- item_count_str = llformat("%d", item_count);
+ U32 item_count = getFreshItemCount();
+
+ if (item_count)
+ {
+ item_count_str = llformat("%d", item_count);
+ }
}
return item_count_str;
@@ -108,17 +142,32 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const
void LLPanelMarketplaceInbox::draw()
{
- std::string item_count_str = getBadgeString();
+ U32 item_count = getTotalItemCount();
+
+ LLView * fresh_new_count_view = getChildView("inbox_fresh_new_count");
- if (item_count_str.length() > 0)
+ if (item_count > 0)
{
+ std::string item_count_str = llformat("%d", item_count);
+
LLStringUtil::format_map_t args;
args["[NUM]"] = item_count_str;
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelWithArg", args));
+
+ // set green text to fresh item count
+ U32 fresh_item_count = getFreshItemCount();
+ fresh_new_count_view->setVisible((fresh_item_count > 0));
+
+ if (fresh_item_count > 0)
+ {
+ getChild<LLUICtrl>("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count));
+ }
}
else
{
getChild<LLButton>("inbox_btn")->setLabel(getString("InboxLabelNoArg"));
+
+ fresh_new_count_view->setVisible(FALSE);
}
LLPanel::draw();