Commits

Merov Linden committed 173a27d

EXP-756 : Fix inventory folder ordering on launch

  • Participants
  • Parent commits c475a9f

Comments (0)

Files changed (5)

indra/newview/llfolderview.cpp

 	return FALSE;
 }
 
-void LLFolderView::checkTreeResortForModelChanged()
-{
-	if (mSortOrder & LLInventoryFilter::SO_DATE && !(mSortOrder & LLInventoryFilter::SO_FOLDERS_BY_NAME))
-	{
-		// This is the case where something got added or removed.  If we are date sorting
-		// everything including folders, then we need to rebuild the whole tree.
-		// Just set to something not SO_DATE to force the folder most resent date resort.
-		mSortOrder = mSortOrder & ~LLInventoryFilter::SO_DATE;
-		setSortOrder(mSortOrder | LLInventoryFilter::SO_DATE);
-	}
-}
-
 static LLFastTimer::DeclareTimer FTM_SORT("Sort Inventory");
 
 void LLFolderView::setSortOrder(U32 order)

indra/newview/llfolderview.h

 	// FolderViews default to sort by name.  This will change that,
 	// and resort the items if necessary.
 	void setSortOrder(U32 order);
-	void checkTreeResortForModelChanged();
 	void setFilterPermMask(PermissionMask filter_perm_mask);
 	void setAllowMultiSelect(BOOL allow) { mAllowMultiSelect = allow; }
 	

indra/newview/llfolderviewitem.cpp

 		return;
 	}
 
-	// Propegate this change to sub folders
+	// Propagate this change to sub folders
 	for (folders_t::iterator iter = mFolders.begin();
 		iter != mFolders.end();)
 	{

indra/newview/llinventoryfilter.h

 		FILTERLINK_ONLY_LINKS		// only show links
 	};
 
-	// REFACTOR: Change this to an enum.
-	static const U32 SO_DATE = 1;
-	static const U32 SO_FOLDERS_BY_NAME = 2;
-	static const U32 SO_SYSTEM_FOLDERS_TO_TOP = 4;
+	enum ESortOrderType
+	{
+		SO_NAME = 0,						// Sort inventory by name
+		SO_DATE = 0x1,						// Sort inventory by date
+		SO_FOLDERS_BY_NAME = 0x1 << 1,		// Force folder sort by name
+		SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2	// Force system folders to be on top
+	};
 
 	LLInventoryFilter(const std::string& name);
 	virtual ~LLInventoryFilter();

indra/newview/llpanelmaininventory.cpp

 	mMenuAdd->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", upload_cost);
 	mMenuAdd->getChild<LLMenuItemGL>("Bulk Upload")->setLabelArg("[COST]", upload_cost);
 
+	// EXP-756: Force resorting of the list: in the case of date sorting, one didn't have enough information at
+	// the beginning to correctly sort the folders. Later resort didn't do anything as the order value was 
+	// set correctly. The workaround is to reset the order to alphabetical (or anything) then to the correct order.
+	if (mActivePanel)
+	{
+		U32 order = mActivePanel->getSortOrder();
+		mActivePanel->setSortOrder(LLInventoryFilter::SO_NAME);
+		mActivePanel->setSortOrder(order);
+	}
+
 	return TRUE;
 }