aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfolderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfolderview.cpp')
-rw-r--r--linden/indra/newview/llfolderview.cpp86
1 files changed, 37 insertions, 49 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp
index b543e31..4833c12 100644
--- a/linden/indra/newview/llfolderview.cpp
+++ b/linden/indra/newview/llfolderview.cpp
@@ -349,10 +349,10 @@ void LLFolderViewItem::arrangeFromRoot()
349// UI. If open is TRUE, then folders are opened up along the way to 349// UI. If open is TRUE, then folders are opened up along the way to
350// the selection. 350// the selection.
351void LLFolderViewItem::setSelectionFromRoot(LLFolderViewItem* selection, 351void LLFolderViewItem::setSelectionFromRoot(LLFolderViewItem* selection,
352 BOOL open, /* Flawfinder: ignore */ 352 BOOL openitem,
353 BOOL take_keyboard_focus) 353 BOOL take_keyboard_focus)
354{ 354{
355 getRoot()->setSelection(selection, open, take_keyboard_focus); /* Flawfinder: ignore */ 355 getRoot()->setSelection(selection, openitem, take_keyboard_focus);
356} 356}
357 357
358// helper function to change the selection from the root. 358// helper function to change the selection from the root.
@@ -368,7 +368,7 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
368 getRoot()->extendSelection(selection, NULL, selected_items); 368 getRoot()->extendSelection(selection, NULL, selected_items);
369} 369}
370 370
371EInventorySortGroup LLFolderViewItem::getSortGroup() 371EInventorySortGroup LLFolderViewItem::getSortGroup() const
372{ 372{
373 return SG_ITEM; 373 return SG_ITEM;
374} 374}
@@ -442,7 +442,7 @@ void LLFolderViewItem::dirtyFilter()
442// means 'deselect' for a leaf item. Do this optimization after 442// means 'deselect' for a leaf item. Do this optimization after
443// multiple selection is implemented to make sure it all plays nice 443// multiple selection is implemented to make sure it all plays nice
444// together. 444// together.
445BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL open, BOOL take_keyboard_focus) 445BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus)
446{ 446{
447 if( selection == this ) 447 if( selection == this )
448 { 448 {
@@ -548,7 +548,7 @@ void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags)
548 } 548 }
549} 549}
550 550
551void LLFolderViewItem::open( void ) /* Flawfinder: ignore */ 551void LLFolderViewItem::openItem( void )
552{ 552{
553 if( mListener ) 553 if( mListener )
554 { 554 {
@@ -989,9 +989,6 @@ LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon,
989 mMostFilteredDescendantGeneration(-1) 989 mMostFilteredDescendantGeneration(-1)
990{ 990{
991 mType = "(folder)"; 991 mType = "(folder)";
992
993 //mItems.setInsertBefore( &sort_item_name );
994 //mFolders.setInsertBefore( &folder_insert_before );
995} 992}
996 993
997// Destroys the object 994// Destroys the object
@@ -1000,10 +997,6 @@ LLFolderViewFolder::~LLFolderViewFolder( void )
1000 // The LLView base class takes care of object destruction. make sure that we 997 // The LLView base class takes care of object destruction. make sure that we
1001 // don't have mouse or keyboard focus 998 // don't have mouse or keyboard focus
1002 gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() 999 gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
1003
1004 //mItems.reset();
1005 //mItems.removeAllNodes();
1006 //mFolders.removeAllNodes();
1007} 1000}
1008 1001
1009// addToFolder() returns TRUE if it succeeds. FALSE otherwise 1002// addToFolder() returns TRUE if it succeeds. FALSE otherwise
@@ -1048,9 +1041,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
1048 // Add sizes of children 1041 // Add sizes of children
1049 S32 parent_item_height = getRect().getHeight(); 1042 S32 parent_item_height = getRect().getHeight();
1050 1043
1051 folders_t::iterator fit = mFolders.begin(); 1044 for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit)
1052 folders_t::iterator fend = mFolders.end();
1053 for(; fit < fend; ++fit)
1054 { 1045 {
1055 LLFolderViewFolder* folderp = (*fit); 1046 LLFolderViewFolder* folderp = (*fit);
1056 if (getRoot()->getDebugFilters()) 1047 if (getRoot()->getDebugFilters())
@@ -1076,9 +1067,8 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
1076 folderp->setOrigin( 0, child_top - folderp->getRect().getHeight() ); 1067 folderp->setOrigin( 0, child_top - folderp->getRect().getHeight() );
1077 } 1068 }
1078 } 1069 }
1079 items_t::iterator iit = mItems.begin(); 1070 for(items_t::iterator iit = mItems.begin();
1080 items_t::iterator iend = mItems.end(); 1071 iit != mItems.end(); ++iit)
1081 for(;iit < iend; ++iit)
1082 { 1072 {
1083 LLFolderViewItem* itemp = (*iit); 1073 LLFolderViewItem* itemp = (*iit);
1084 if (getRoot()->getDebugFilters()) 1074 if (getRoot()->getDebugFilters())
@@ -1354,7 +1344,7 @@ BOOL LLFolderViewFolder::hasFilteredDescendants()
1354 1344
1355// Passes selection information on to children and record selection 1345// Passes selection information on to children and record selection
1356// information if necessary. 1346// information if necessary.
1357BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */ 1347BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem,
1358 BOOL take_keyboard_focus) 1348 BOOL take_keyboard_focus)
1359{ 1349{
1360 BOOL rv = FALSE; 1350 BOOL rv = FALSE;
@@ -1378,7 +1368,7 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /
1378 iter != mFolders.end();) 1368 iter != mFolders.end();)
1379 { 1369 {
1380 folders_t::iterator fit = iter++; 1370 folders_t::iterator fit = iter++;
1381 if((*fit)->setSelection(selection, open, take_keyboard_focus)) /* Flawfinder: ignore */ 1371 if((*fit)->setSelection(selection, openitem, take_keyboard_focus))
1382 { 1372 {
1383 rv = TRUE; 1373 rv = TRUE;
1384 child_selected = TRUE; 1374 child_selected = TRUE;
@@ -1389,14 +1379,14 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /
1389 iter != mItems.end();) 1379 iter != mItems.end();)
1390 { 1380 {
1391 items_t::iterator iit = iter++; 1381 items_t::iterator iit = iter++;
1392 if((*iit)->setSelection(selection, open, take_keyboard_focus)) /* Flawfinder: ignore */ 1382 if((*iit)->setSelection(selection, openitem, take_keyboard_focus))
1393 { 1383 {
1394 rv = TRUE; 1384 rv = TRUE;
1395 child_selected = TRUE; 1385 child_selected = TRUE;
1396 mNumDescendantsSelected++; 1386 mNumDescendantsSelected++;
1397 } 1387 }
1398 } 1388 }
1399 if(open && child_selected) /* Flawfinder: ignore */ 1389 if(openitem && child_selected)
1400 { 1390 {
1401 setOpenArrangeRecursively(TRUE); 1391 setOpenArrangeRecursively(TRUE);
1402 } 1392 }
@@ -1636,11 +1626,9 @@ void LLFolderViewFolder::destroyView()
1636 while (!mFolders.empty()) 1626 while (!mFolders.empty())
1637 { 1627 {
1638 LLFolderViewFolder *folderp = mFolders.back(); 1628 LLFolderViewFolder *folderp = mFolders.back();
1639 folderp->destroyView(); 1629 folderp->destroyView(); // removes entry from mFolders
1640 } 1630 }
1641 1631
1642 mFolders.clear();
1643
1644 deleteAllChildren(); 1632 deleteAllChildren();
1645 1633
1646 if (mParentFolder) 1634 if (mParentFolder)
@@ -1711,11 +1699,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item )
1711// This is only called for renaming an object because it won't work for date 1699// This is only called for renaming an object because it won't work for date
1712void LLFolderViewFolder::resort(LLFolderViewItem* item) 1700void LLFolderViewFolder::resort(LLFolderViewItem* item)
1713{ 1701{
1714 std::sort(mItems.begin(), mItems.end(), mSortFunction); 1702 mItems.sort(mSortFunction);
1715 std::sort(mFolders.begin(), mFolders.end(), mSortFunction); 1703 mFolders.sort(mSortFunction);
1716} 1704}
1717 1705
1718bool LLFolderViewFolder::isTrash() 1706bool LLFolderViewFolder::isTrash() const
1719{ 1707{
1720 if (mAmTrash == LLFolderViewFolder::UNKNOWN) 1708 if (mAmTrash == LLFolderViewFolder::UNKNOWN)
1721 { 1709 {
@@ -1740,8 +1728,8 @@ void LLFolderViewFolder::sortBy(U32 order)
1740 (*fit)->sortBy(order); 1728 (*fit)->sortBy(order);
1741 } 1729 }
1742 1730
1743 std::sort(mFolders.begin(), mFolders.end(), mSortFunction); 1731 mFolders.sort(mSortFunction);
1744 std::sort(mItems.begin(), mItems.end(), mSortFunction); 1732 mItems.sort(mSortFunction);
1745 1733
1746 if (order & LLInventoryFilter::SO_DATE) 1734 if (order & LLInventoryFilter::SO_DATE)
1747 { 1735 {
@@ -1776,12 +1764,12 @@ void LLFolderViewFolder::setItemSortOrder(U32 ordering)
1776 (*fit)->setItemSortOrder(ordering); 1764 (*fit)->setItemSortOrder(ordering);
1777 } 1765 }
1778 1766
1779 std::sort(mFolders.begin(), mFolders.end(), mSortFunction); 1767 mFolders.sort(mSortFunction);
1780 std::sort(mItems.begin(), mItems.end(), mSortFunction); 1768 mItems.sort(mSortFunction);
1781 } 1769 }
1782} 1770}
1783 1771
1784EInventorySortGroup LLFolderViewFolder::getSortGroup() 1772EInventorySortGroup LLFolderViewFolder::getSortGroup() const
1785{ 1773{
1786 if (isTrash()) 1774 if (isTrash())
1787 { 1775 {
@@ -1928,16 +1916,16 @@ void LLFolderViewFolder::toggleOpen()
1928} 1916}
1929 1917
1930// Force a folder open or closed 1918// Force a folder open or closed
1931void LLFolderViewFolder::setOpen(BOOL open) /* Flawfinder: ignore */ 1919void LLFolderViewFolder::setOpen(BOOL openitem)
1932{ 1920{
1933 setOpenArrangeRecursively(open); /* Flawfinder: ignore */ 1921 setOpenArrangeRecursively(openitem);
1934} 1922}
1935 1923
1936void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recurse) /* Flawfinder: ignore */ 1924void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
1937{ 1925{
1938 BOOL was_open = mIsOpen; 1926 BOOL was_open = mIsOpen;
1939 mIsOpen = open; /* Flawfinder: ignore */ 1927 mIsOpen = openitem;
1940 if(!was_open && open) /* Flawfinder: ignore */ 1928 if(!was_open && openitem)
1941 { 1929 {
1942 if(mListener) 1930 if(mListener)
1943 { 1931 {
@@ -1951,12 +1939,12 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recur
1951 iter != mFolders.end();) 1939 iter != mFolders.end();)
1952 { 1940 {
1953 folders_t::iterator fit = iter++; 1941 folders_t::iterator fit = iter++;
1954 (*fit)->setOpenArrangeRecursively(open, RECURSE_DOWN); /* Flawfinder: ignore */ 1942 (*fit)->setOpenArrangeRecursively(openitem, RECURSE_DOWN); /* Flawfinder: ignore */
1955 } 1943 }
1956 } 1944 }
1957 if (mParentFolder && (recurse == RECURSE_UP || recurse == RECURSE_UP_DOWN)) 1945 if (mParentFolder && (recurse == RECURSE_UP || recurse == RECURSE_UP_DOWN))
1958 { 1946 {
1959 mParentFolder->setOpenArrangeRecursively(open, RECURSE_UP); /* Flawfinder: ignore */ 1947 mParentFolder->setOpenArrangeRecursively(openitem, RECURSE_UP);
1960 } 1948 }
1961 1949
1962 if (was_open != mIsOpen) 1950 if (was_open != mIsOpen)
@@ -1989,7 +1977,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
1989 return TRUE; 1977 return TRUE;
1990} 1978}
1991 1979
1992void LLFolderViewFolder::open( void ) /* Flawfinder: ignore */ 1980void LLFolderViewFolder::openItem( void )
1993{ 1981{
1994 toggleOpen(); 1982 toggleOpen();
1995} 1983}
@@ -2687,10 +2675,10 @@ void LLFolderView::openFolder(const LLString& foldername)
2687 } 2675 }
2688} 2676}
2689 2677
2690void LLFolderView::setOpenArrangeRecursively(BOOL open, ERecurseType recurse) /* Flawfinder: ignore */ 2678void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
2691{ 2679{
2692 // call base class to do proper recursion 2680 // call base class to do proper recursion
2693 LLFolderViewFolder::setOpenArrangeRecursively(open, recurse); /* Flawfinder: ignore */ 2681 LLFolderViewFolder::setOpenArrangeRecursively(openitem, recurse);
2694 // make sure root folder is always open 2682 // make sure root folder is always open
2695 mIsOpen = TRUE; 2683 mIsOpen = TRUE;
2696} 2684}
@@ -2866,7 +2854,7 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
2866 2854
2867 2855
2868// Record the selected item and pass it down the hierachy. 2856// Record the selected item and pass it down the hierachy.
2869BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */ 2857BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
2870 BOOL take_keyboard_focus) 2858 BOOL take_keyboard_focus)
2871{ 2859{
2872 if( selection == this ) 2860 if( selection == this )
@@ -2888,8 +2876,8 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flaw
2888 addToSelectionList(selection); 2876 addToSelectionList(selection);
2889 } 2877 }
2890 2878
2891 BOOL rv = LLFolderViewFolder::setSelection(selection, open, take_keyboard_focus); 2879 BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus);
2892 if(open && selection) 2880 if(openitem && selection)
2893 { 2881 {
2894 selection->getParentFolder()->requestArrange(); 2882 selection->getParentFolder()->requestArrange();
2895 } 2883 }
@@ -3349,7 +3337,7 @@ void LLFolderView::openSelectedItems( void )
3349 { 3337 {
3350 if (mSelectedItems.size() == 1) 3338 if (mSelectedItems.size() == 1)
3351 { 3339 {
3352 mSelectedItems.front()->open(); /* Flawfinder: ignore */ 3340 mSelectedItems.front()->openItem();
3353 } 3341 }
3354 else 3342 else
3355 { 3343 {
@@ -3371,7 +3359,7 @@ void LLFolderView::openSelectedItems( void )
3371 LLFloater::setFloaterHost(multi_propertiesp); 3359 LLFloater::setFloaterHost(multi_propertiesp);
3372 else 3360 else
3373 LLFloater::setFloaterHost(multi_previewp); 3361 LLFloater::setFloaterHost(multi_previewp);
3374 (*item_it)->open(); 3362 (*item_it)->openItem();
3375 } 3363 }
3376 3364
3377 LLFloater::setFloaterHost(NULL); 3365 LLFloater::setFloaterHost(NULL);
@@ -4358,7 +4346,7 @@ bool LLInventorySort::updateSort(U32 order)
4358 return false; 4346 return false;
4359} 4347}
4360 4348
4361bool LLInventorySort::operator()(LLFolderViewItem* a, LLFolderViewItem* b) 4349bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolderViewItem* const& b)
4362{ 4350{
4363 // We sort by name if we aren't sorting by date 4351 // We sort by name if we aren't sorting by date
4364 // OR if these are folders and we are sorting folders by name. 4352 // OR if these are folders and we are sorting folders by name.