summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/settings_per_account.xml4
-rw-r--r--indra/newview/llfolderviewitem.cpp62
-rw-r--r--indra/newview/llfolderviewitem.h4
-rw-r--r--indra/newview/llinventorypanel.cpp5
-rw-r--r--indra/newview/llinventorypanel.h2
-rw-r--r--indra/newview/llpanelmarketplaceinbox.cpp6
-rw-r--r--indra/newview/llpanelmarketplaceinboxinventory.cpp44
-rw-r--r--indra/newview/llpanelmarketplaceinboxinventory.h8
-rw-r--r--indra/newview/llpanelmarketplaceoutboxinventory.cpp5
-rw-r--r--indra/newview/llpanelmarketplaceoutboxinventory.h2
-rw-r--r--indra/newview/llsidepanelinventory.cpp4
11 files changed, 71 insertions, 75 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 49f8a11e3e..c7140283f1 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -33,10 +33,10 @@
<key>Value</key>
<string />
</map>
- <key>LastInventoryInboxExpansion</key>
+ <key>LastInventoryInboxActivity</key>
<map>
<key>Comment</key>
- <string>The last time the received items inbox was expanded for view.</string>
+ <string>The last time the received items inbox was poked by the user.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 72e2294196..00bc63326b 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -2057,23 +2057,42 @@ BOOL LLFolderViewFolder::isRemovable()
BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
{
mItems.push_back(item);
+
if (item->isSelected())
{
recursiveIncrementNumDescendantsSelected(1);
}
+
item->setRect(LLRect(0, 0, getRect().getWidth(), 0));
item->setVisible(FALSE);
- addChild( item );
+
+ addChild(item);
+
item->dirtyFilter();
+
+ // Update the folder creation date if the child is newer than our current date
+ setCreationDate(llmax<time_t>(mCreationDate, item->getCreationDate()));
+
+ // Handle sorting
requestArrange();
requestSort();
+
+ // Traverse parent folders and update creation date and resort, if necessary
LLFolderViewFolder* parentp = getParentFolder();
- while (parentp && parentp->mSortFunction.isByDate())
+ while (parentp)
{
- // parent folder doesn't have a time stamp yet, so get it from us
- parentp->requestSort();
+ // Update the folder creation date if the child is newer than our current date
+ parentp->setCreationDate(llmax<time_t>(parentp->mCreationDate, item->getCreationDate()));
+
+ if (parentp->mSortFunction.isByDate())
+ {
+ // parent folder doesn't have a time stamp yet, so get it from us
+ parentp->requestSort();
+ }
+
parentp = parentp->getParentFolder();
}
+
return TRUE;
}
@@ -2437,41 +2456,6 @@ void LLFolderViewFolder::draw()
time_t LLFolderViewFolder::getCreationDate() const
{
- // folders have no creation date try to create one from an item somewhere in our folder hierarchy
- if (!mCreationDate)
- {
- for (items_t::const_iterator iit = mItems.begin();
- iit != mItems.end(); ++iit)
- {
- LLFolderViewItem* itemp = (*iit);
-
- const time_t item_creation_date = itemp->getCreationDate();
-
- if (item_creation_date)
- {
- setCreationDate(item_creation_date);
- break;
- }
- }
-
- if (!mCreationDate)
- {
- for (folders_t::const_iterator fit = mFolders.begin();
- fit != mFolders.end(); ++fit)
- {
- LLFolderViewFolder* folderp = (*fit);
-
- const time_t folder_creation_date = folderp->getCreationDate();
-
- if (folder_creation_date)
- {
- setCreationDate(folder_creation_date);
- break;
- }
- }
- }
- }
-
return llmax<time_t>(mCreationDate, mSubtreeCreationDate);
}
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index ce936b4991..676eaf825d 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -136,7 +136,7 @@ protected:
std::string mSearchableLabel;
S32 mLabelWidth;
bool mLabelWidthDirty;
- mutable time_t mCreationDate;
+ time_t mCreationDate;
LLFolderViewFolder* mParentFolder;
LLFolderViewEventListener* mListener;
BOOL mIsCurSelection;
@@ -174,7 +174,7 @@ protected:
static LLFontGL* getLabelFontForStyle(U8 style);
- virtual void setCreationDate(time_t creation_date_utc) const { mCreationDate = creation_date_utc; }
+ virtual void setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; }
public:
BOOL postBuild();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 5f033cf517..173e5c6ae6 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -234,7 +234,6 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
{
setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER));
}
- mFolderRoot->setSortOrder(getFilter()->getSortOrder());
// hide inbox
getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX));
@@ -347,6 +346,10 @@ U32 LLInventoryPanel::getSortOrder() const
return mFolderRoot->getSortOrder();
}
+void LLInventoryPanel::requestSort()
+{
+ mFolderRoot->requestSort();
+}
void LLInventoryPanel::setSinceLogoff(BOOL sl)
{
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 7676bbb6d7..cfb84bf4b7 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -208,6 +208,8 @@ public:
void setSortOrder(U32 order);
U32 getSortOrder() const;
+ void requestSort();
+
private:
std::string mSortOrderSetting;
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 9f17c34dfb..8d0712a328 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -95,8 +95,10 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel()
LLRect inventory_placeholder_rect = inbox_inventory_placeholder->getRect();
mInventoryPanel->setShape(inventory_placeholder_rect);
- // Set the sort order newest to oldest, and a selection change callback
+ // Set the sort order newest to oldest
mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE);
+
+ // Set selection callback for proper update of inventory status buttons
mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this));
// Set up the note to display when the inbox is empty
@@ -113,6 +115,8 @@ void LLPanelMarketplaceInbox::onFocusReceived()
LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel<LLSidepanelInventory>("sidepanel_inventory");
sidepanel_inventory->clearSelections(true, false, true);
+
+ gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
}
BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index e5b0db92f3..47f34434db 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -37,6 +37,8 @@
#include "llviewerfoldertype.h"
+#define DEBUGGING_FRESHNESS 0
+
//
// statics
//
@@ -188,49 +190,57 @@ void LLInboxFolderViewFolder::draw()
LLFolderViewFolder::draw();
}
-BOOL LLInboxFolderViewFolder::addToFolder(LLFolderViewFolder* folder, LLFolderView* root)
-{
- BOOL retval = LLFolderViewFolder::addToFolder(folder, root);
-
- // Only mark top-level inbox folders as fresh
- mFresh = (mParentFolder == mRoot);
-
- return retval;
-}
-
-void LLInboxFolderViewFolder::updateFlag() const
+void LLInboxFolderViewFolder::computeFreshness()
{
- const std::string& last_expansion = gSavedPerAccountSettings.getString("LastInventoryInboxExpansion");
+ const std::string& last_expansion = gSavedPerAccountSettings.getString("LastInventoryInboxActivity");
if (!last_expansion.empty())
{
LLDate saved_freshness_date = LLDate(last_expansion);
mFresh = (mCreationDate > saved_freshness_date.secondsSinceEpoch());
+
+#if DEBUGGING_FRESHNESS
+ if (mFresh)
+ {
+ llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << saved_freshness_date.secondsSinceEpoch() << llendl;
+ }
+#endif
+ }
+ else
+ {
+ mFresh = true;
}
}
+void LLInboxFolderViewFolder::deFreshify()
+{
+ mFresh = false;
+
+ gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
+}
+
void LLInboxFolderViewFolder::selectItem()
{
LLFolderViewFolder::selectItem();
- mFresh = false;
+ deFreshify();
}
void LLInboxFolderViewFolder::toggleOpen()
{
LLFolderViewFolder::toggleOpen();
- mFresh = false;
+ deFreshify();
}
-void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) const
+void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc)
{
mCreationDate = creation_date_utc;
- if (mFresh)
+ if (mParentFolder == mRoot)
{
- updateFlag();
+ computeFreshness();
}
}
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.h b/indra/newview/llpanelmarketplaceinboxinventory.h
index 06706539a0..089facf80c 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.h
+++ b/indra/newview/llpanelmarketplaceinboxinventory.h
@@ -75,18 +75,18 @@ public:
void draw();
- BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
+ void computeFreshness();
+ void deFreshify();
- void updateFlag() const;
void selectItem();
void toggleOpen();
bool isFresh() const { return mFresh; }
protected:
- void setCreationDate(time_t creation_date_utc) const;
+ void setCreationDate(time_t creation_date_utc);
- mutable bool mFresh;
+ bool mFresh;
};
diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.cpp b/indra/newview/llpanelmarketplaceoutboxinventory.cpp
index 14b6ee9e0a..ed1206aec8 100644
--- a/indra/newview/llpanelmarketplaceoutboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceoutboxinventory.cpp
@@ -259,11 +259,6 @@ void LLOutboxFolderViewFolder::setError(S32 errorCode)
}
}
-void LLOutboxFolderViewFolder::setCreationDate(time_t creation_date_utc) const
-{
- mCreationDate = creation_date_utc;
-}
-
//
// LLOutboxFolderViewItem Implementation
//
diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.h b/indra/newview/llpanelmarketplaceoutboxinventory.h
index ec55b7eb2e..346680a79d 100644
--- a/indra/newview/llpanelmarketplaceoutboxinventory.h
+++ b/indra/newview/llpanelmarketplaceoutboxinventory.h
@@ -77,8 +77,6 @@ public:
bool hasError() const { return (mError != 0); }
protected:
- void setCreationDate(time_t creation_date_utc) const;
-
S32 mError;
};
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 522de30467..858639215c 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -539,7 +539,7 @@ void LLSidepanelInventory::onToggleInboxBtn()
if (inbox_expanded && inboxPanel->isInVisibleChain())
{
- gSavedPerAccountSettings.setString("LastInventoryInboxExpansion", LLDate::now().asString());
+ gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
}
}
@@ -568,7 +568,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
#else
if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState())
{
- gSavedPerAccountSettings.setString("LastInventoryInboxExpansion", LLDate::now().asString());
+ gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
}
#endif