summaryrefslogtreecommitdiff
path: root/indra/newview/llfolderviewmodelinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfolderviewmodelinventory.cpp')
-rwxr-xr-xindra/newview/llfolderviewmodelinventory.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 3271a40ea0..e9f80b795a 100755
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llfolderviewmodelinventory.h"
#include "llinventorymodelbackgroundfetch.h"
+#include "llinventoryfunctions.h"
#include "llinventorypanel.h"
#include "lltooldraganddrop.h"
#include "llfavoritesbar.h"
@@ -108,6 +109,29 @@ bool LLFolderViewModelInventory::contentsReady()
return !LLInventoryModelBackgroundFetch::instance().folderFetchActive();
}
+bool LLFolderViewModelInventory::isFolderComplete(LLFolderViewFolder* folder)
+{
+ LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
+ LLUUID cat_id = modelp->getUUID();
+ if (cat_id.isNull())
+ {
+ return false;
+ }
+ LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+ if (cat)
+ {
+ // don't need to check version - descendents_server == -1 if we have no data
+ S32 descendents_server = cat->getDescendentCount();
+ S32 descendents_actual = cat->getViewerDescendentCount();
+ if (descendents_server == descendents_actual
+ || (descendents_actual > 0 && descendents_server == -1)) // content was loaded in previous session
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
void LLFolderViewModelItemInventory::requestSort()
{
LLFolderViewModelItemCommon::requestSort();
@@ -277,7 +301,7 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a,
// We sort by name if we aren't sorting by date
// OR if these are folders and we are sorting folders by name.
- bool by_name = (!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM)));
+ bool by_name = ((!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))) && !mFoldersByWeight);
if (a->getSortGroup() != b->getSortGroup())
{
@@ -309,6 +333,31 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a,
return (compare < 0);
}
}
+ else if (mFoldersByWeight)
+ {
+ S32 weight_a = compute_stock_count(a->getUUID());
+ S32 weight_b = compute_stock_count(b->getUUID());
+ if (weight_a == weight_b)
+ {
+ // Equal weight -> use alphabetical order
+ return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0);
+ }
+ else if (weight_a == COMPUTE_STOCK_INFINITE)
+ {
+ // No stock -> move a at the end of the list
+ return false;
+ }
+ else if (weight_b == COMPUTE_STOCK_INFINITE)
+ {
+ // No stock -> move b at the end of the list
+ return true;
+ }
+ else
+ {
+ // Lighter is first (sorted in increasing order of weight)
+ return (weight_a < weight_b);
+ }
+ }
else
{
time_t first_create = a->getCreationDate();