Merov Linden avatar Merov Linden committed abb5de7

EXP-756 : Move the folder resort to first draw and do it only once

Comments (0)

Files changed (2)

indra/newview/llpanelmaininventory.cpp

 		mActivePanel->getFilter()->markDefault();
 		mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
 		mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2));
+		mResortActivePanel = true;
 	}
 	LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items");
 	if (recent_items_panel)
 	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;
 }
 
 	{
 		mFilterEditor->setText(mFilterSubString);
 	}	
+	if (mActivePanel && mResortActivePanel)
+	{
+		// EXP-756: Force resorting of the list the first time we draw the list: 
+		// In the case of date sorting, we don't have enough information at initialization time
+		// to correctly sort the folders. Later manual resort doesn't do anything as the order value is 
+		// set correctly. The workaround is to reset the order to alphabetical (or anything) then to the correct order.
+		U32 order = mActivePanel->getSortOrder();
+		mActivePanel->setSortOrder(LLInventoryFilter::SO_NAME);
+		mActivePanel->setSortOrder(order);
+		mResortActivePanel = false;
+	}
 	LLPanel::draw();
 	updateItemcountText();
 }

indra/newview/llpanelmaininventory.h

 	LLTabContainer*				mFilterTabs;
 	LLHandle<LLFloater>			mFinderHandle;
 	LLInventoryPanel*			mActivePanel;
+	bool						mResortActivePanel;
 	LLSaveFolderState*			mSavedFolderState;
 	std::string					mFilterText;
 	std::string					mFilterSubString;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.