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.cpp304
1 files changed, 191 insertions, 113 deletions
diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp
index e87ac0c..16c0aa9 100644
--- a/linden/indra/newview/llfolderview.cpp
+++ b/linden/indra/newview/llfolderview.cpp
@@ -162,7 +162,6 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon,
162 mIcon(icon), 162 mIcon(icon),
163 mHasVisibleChildren(FALSE), 163 mHasVisibleChildren(FALSE),
164 mIndentation(0), 164 mIndentation(0),
165 mNumDescendantsSelected(0),
166 mFiltered(FALSE), 165 mFiltered(FALSE),
167 mLastFilterGeneration(-1), 166 mLastFilterGeneration(-1),
168 mStringMatchOffset(std::string::npos), 167 mStringMatchOffset(std::string::npos),
@@ -350,7 +349,8 @@ void LLFolderViewItem::refresh()
350 349
351 if (mSearchableLabel.compare(searchable_label) || 350 if (mSearchableLabel.compare(searchable_label) ||
352 mSearchableLabelCreator.compare(searchable_label_creator) || 351 mSearchableLabelCreator.compare(searchable_label_creator) ||
353 mSearchableLabelDesc.compare(searchable_label_creator)) 352 mSearchableLabelDesc.compare(searchable_label_desc) ||
353 mSearchableLabelAll.compare(searchable_label_all))
354 { 354 {
355 mSearchableLabel.assign(searchable_label); 355 mSearchableLabel.assign(searchable_label);
356 mSearchableLabelCreator.assign(searchable_label_creator); 356 mSearchableLabelCreator.assign(searchable_label_creator);
@@ -358,28 +358,10 @@ void LLFolderViewItem::refresh()
358 mSearchableLabelAll.assign(searchable_label_all); 358 mSearchableLabelAll.assign(searchable_label_all);
359 359
360 dirtyFilter(); 360 dirtyFilter();
361 //some part of label has changed, so overall width has potentially changed 361 // some part of label has changed, so overall width has potentially changed
362 if (mParentFolder) 362 if (mParentFolder)
363 mParentFolder->requestArrange(); 363 mParentFolder->requestArrange();
364 } 364 }
365
366 /*if(mSearchableLabelCreator.compare(searchable_label_creator))
367 {
368 mSearchableLabelCreator.assign(searchable_label_creator);
369
370 dirtyFilter();
371 if(mParentFolder)
372 mParentFolder->requestArrange();
373 }
374
375 if(mSearchableLabelDesc.compare(searchable_label_desc))
376 {
377 mSearchableLabelDesc.assign(searchable_label_desc);
378
379 dirtyFilter();
380 if(mParentFolder)
381 mParentFolder->requestArrange();
382 }*/
383 365
384 S32 label_width = sFont->getWidth(mLabel); 366 S32 label_width = sFont->getWidth(mLabel);
385 if( mLabelSuffix.size() ) 367 if( mLabelSuffix.size() )
@@ -517,26 +499,33 @@ void LLFolderViewItem::dirtyFilter()
517// together. 499// together.
518BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) 500BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus)
519{ 501{
520 if( selection == this ) 502 if (selection == this && !mIsSelected)
521 { 503 {
522 mIsSelected = TRUE; 504 selectItem();
523 if(mListener) 505 if(mListener)
524 { 506 {
525 mListener->selectItem(); 507 mListener->selectItem();
526 } 508 }
527 } 509 }
528 else 510 else if (mIsSelected) // Deselect everything else.
529 { 511 {
530 mIsSelected = FALSE; 512 deselectItem();
531 } 513 }
532 return mIsSelected; 514 return mIsSelected;
533} 515}
534 516
535BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) 517BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected)
536{ 518{
537 if(selection == this && mIsSelected != selected) 519 if (selection == this && mIsSelected != selected)
538 { 520 {
539 mIsSelected = selected; 521 if (mIsSelected)
522 {
523 deselectItem();
524 }
525 else
526 {
527 selectItem();
528 }
540 if(mListener) 529 if(mListener)
541 { 530 {
542 mListener->selectItem(); 531 mListener->selectItem();
@@ -546,22 +535,33 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte
546 return FALSE; 535 return FALSE;
547} 536}
548 537
549void LLFolderViewItem::recursiveDeselect(BOOL deselect_self) 538void LLFolderViewItem::deselectItem(void)
550{ 539{
551 if (mIsSelected && deselect_self) 540 llassert(mIsSelected);
552 {
553 mIsSelected = FALSE;
554 541
555 // update ancestors' count of selected descendents 542 mIsSelected = FALSE;
556 LLFolderViewFolder* parent_folder = getParentFolder(); 543
557 while(parent_folder) 544 // Update ancestors' count of selected descendents.
558 { 545 LLFolderViewFolder* parent_folder = getParentFolder();
559 parent_folder->mNumDescendantsSelected--; 546 if (parent_folder)
560 parent_folder = parent_folder->getParentFolder(); 547 {
561 } 548 parent_folder->recursiveIncrementNumDescendantsSelected(-1);
562 } 549 }
563} 550}
564 551
552void LLFolderViewItem::selectItem(void)
553{
554 llassert(!mIsSelected);
555
556 mIsSelected = TRUE;
557
558 // Update ancestors' count of selected descendents.
559 LLFolderViewFolder* parent_folder = getParentFolder();
560 if (parent_folder)
561 {
562 parent_folder->recursiveIncrementNumDescendantsSelected(1);
563 }
564}
565 565
566BOOL LLFolderViewItem::isMovable() 566BOOL LLFolderViewItem::isMovable()
567{ 567{
@@ -654,16 +654,20 @@ void LLFolderViewItem::rename(const std::string& new_name)
654 } 654 }
655} 655}
656 656
657const std::string& LLFolderViewItem::getSearchableLabel(U32 search_type = 0) const 657const std::string& LLFolderViewItem::getSearchableLabel() const
658{ 658{
659 if(search_type == 3) 659 U32 type = mRoot->getFilter()->getSearchType();
660 return mSearchableLabelAll; 660 switch(type)
661 else if(search_type == 2) 661 {
662 return mSearchableLabelDesc; 662 case 1:
663 else if(search_type == 1)
664 return mSearchableLabelCreator; 663 return mSearchableLabelCreator;
665 else 664 case 2:
665 return mSearchableLabelDesc;
666 case 3:
667 return mSearchableLabelAll;
668 default:
666 return mSearchableLabel; 669 return mSearchableLabel;
670 }
667} 671}
668 672
669const std::string& LLFolderViewItem::getName( void ) const 673const std::string& LLFolderViewItem::getName( void ) const
@@ -1022,9 +1026,16 @@ void LLFolderViewItem::draw()
1022 { 1026 {
1023 // don't draw backgrounds for zero-length strings 1027 // don't draw backgrounds for zero-length strings
1024 S32 filter_string_length = mRoot->getFilterSubString().size(); 1028 S32 filter_string_length = mRoot->getFilterSubString().size();
1025 if (filter_string_length > 0) 1029
1030 std::string combined_string = mLabel + mLabelSuffix;
1031
1032 //fix so that highlighting works properly again - rkeast
1033 std::string check = combined_string;
1034 LLStringUtil::toUpper(check);
1035
1036 if ((filter_string_length > 0) && (check.find(mRoot->getFilterSubString()) != -1))
1026 { 1037 {
1027 std::string combined_string = mLabel + mLabelSuffix; 1038// llinfos << "mLabel " << mLabel<< " mLabelSuffix " << mLabelSuffix << " mLabel " << mLabel << " mLabel " << mLabel << llendl;
1028 S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; 1039 S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1;
1029 S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; 1040 S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
1030 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); 1041 S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3);
@@ -1057,6 +1068,7 @@ LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr ic
1057 LLFolderView* root, 1068 LLFolderView* root,
1058 LLFolderViewEventListener* listener ): 1069 LLFolderViewEventListener* listener ):
1059 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time 1070 LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time
1071 mNumDescendantsSelected(0),
1060 mIsOpen(FALSE), 1072 mIsOpen(FALSE),
1061 mExpanderHighlighted(FALSE), 1073 mExpanderHighlighted(FALSE),
1062 mCurHeight(0.f), 1074 mCurHeight(0.f),
@@ -1423,6 +1435,21 @@ BOOL LLFolderViewFolder::hasFilteredDescendants()
1423 return mMostFilteredDescendantGeneration >= mRoot->getFilter()->getCurrentGeneration(); 1435 return mMostFilteredDescendantGeneration >= mRoot->getFilter()->getCurrentGeneration();
1424} 1436}
1425 1437
1438void LLFolderViewFolder::recursiveIncrementNumDescendantsSelected(S32 increment)
1439{
1440 LLFolderViewFolder* parent_folder = this;
1441 do
1442 {
1443 parent_folder->mNumDescendantsSelected += increment;
1444
1445 // Make sure we don't have negative values.
1446 llassert(parent_folder->mNumDescendantsSelected >= 0);
1447
1448 parent_folder = parent_folder->getParentFolder();
1449 }
1450 while(parent_folder);
1451}
1452
1426// Passes selection information on to children and record selection 1453// Passes selection information on to children and record selection
1427// information if necessary. 1454// information if necessary.
1428BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, 1455BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem,
@@ -1431,7 +1458,10 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
1431 BOOL rv = FALSE; 1458 BOOL rv = FALSE;
1432 if( selection == this ) 1459 if( selection == this )
1433 { 1460 {
1434 mIsSelected = TRUE; 1461 if (!isSelected())
1462 {
1463 selectItem();
1464 }
1435 if(mListener) 1465 if(mListener)
1436 { 1466 {
1437 mListener->selectItem(); 1467 mListener->selectItem();
@@ -1440,7 +1470,10 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
1440 } 1470 }
1441 else 1471 else
1442 { 1472 {
1443 mIsSelected = FALSE; 1473 if (isSelected())
1474 {
1475 deselectItem();
1476 }
1444 rv = FALSE; 1477 rv = FALSE;
1445 } 1478 }
1446 BOOL child_selected = FALSE; 1479 BOOL child_selected = FALSE;
@@ -1453,7 +1486,6 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
1453 { 1486 {
1454 rv = TRUE; 1487 rv = TRUE;
1455 child_selected = TRUE; 1488 child_selected = TRUE;
1456 mNumDescendantsSelected++;
1457 } 1489 }
1458 } 1490 }
1459 for (items_t::iterator iter = mItems.begin(); 1491 for (items_t::iterator iter = mItems.begin();
@@ -1464,7 +1496,6 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
1464 { 1496 {
1465 rv = TRUE; 1497 rv = TRUE;
1466 child_selected = TRUE; 1498 child_selected = TRUE;
1467 mNumDescendantsSelected++;
1468 } 1499 }
1469 } 1500 }
1470 if(openitem && child_selected) 1501 if(openitem && child_selected)
@@ -1474,37 +1505,39 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem
1474 return rv; 1505 return rv;
1475} 1506}
1476 1507
1477// This method is used to change the selection of an item. If 1508// This method is used to change the selection of an item.
1478// selection is 'this', then note selection as true. Returns TRUE 1509// Recursively traverse all children; if 'selection' is 'this' then change
1479// if this or a child is now selected. 1510// the select status if necessary.
1480BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, 1511// Returns TRUE if the selection state of this folder, or of a child, was changed.
1481 BOOL selected) 1512BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected)
1482{ 1513{
1483 BOOL rv = FALSE; 1514 BOOL rv = FALSE;
1484 if(selection == this) 1515 if(selection == this)
1485 { 1516 {
1486 mIsSelected = selected; 1517 if (isSelected() != selected)
1518 {
1519 rv = TRUE;
1520 if (selected)
1521 {
1522 selectItem();
1523 }
1524 else
1525 {
1526 deselectItem();
1527 }
1528 }
1487 if(mListener && selected) 1529 if(mListener && selected)
1488 { 1530 {
1489 mListener->selectItem(); 1531 mListener->selectItem();
1490 } 1532 }
1491 rv = TRUE;
1492 } 1533 }
1493 1534
1494 for (folders_t::iterator iter = mFolders.begin(); 1535 for (folders_t::iterator iter = mFolders.begin();
1495 iter != mFolders.end();) 1536 iter != mFolders.end();)
1496 { 1537 {
1497 folders_t::iterator fit = iter++; 1538 folders_t::iterator fit = iter++;
1498 if((*fit)->changeSelection(selection, selected)) 1539 if ((*fit)->changeSelection(selection, selected))
1499 { 1540 {
1500 if (selected)
1501 {
1502 mNumDescendantsSelected++;
1503 }
1504 else
1505 {
1506 mNumDescendantsSelected--;
1507 }
1508 rv = TRUE; 1541 rv = TRUE;
1509 } 1542 }
1510 } 1543 }
@@ -1512,33 +1545,22 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection,
1512 iter != mItems.end();) 1545 iter != mItems.end();)
1513 { 1546 {
1514 items_t::iterator iit = iter++; 1547 items_t::iterator iit = iter++;
1515 if((*iit)->changeSelection(selection, selected)) 1548 if ((*iit)->changeSelection(selection, selected))
1516 { 1549 {
1517 if (selected)
1518 {
1519 mNumDescendantsSelected++;
1520 }
1521 else
1522 {
1523 mNumDescendantsSelected--;
1524 }
1525 rv = TRUE; 1550 rv = TRUE;
1526 } 1551 }
1527 } 1552 }
1528 return rv; 1553 return rv;
1529} 1554}
1530 1555
1531S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& selected_items) 1556void LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& selected_items)
1532{ 1557{
1533 S32 num_selected = 0;
1534
1535 // pass on to child folders first 1558 // pass on to child folders first
1536 for (folders_t::iterator iter = mFolders.begin(); 1559 for (folders_t::iterator iter = mFolders.begin();
1537 iter != mFolders.end();) 1560 iter != mFolders.end();)
1538 { 1561 {
1539 folders_t::iterator fit = iter++; 1562 folders_t::iterator fit = iter++;
1540 num_selected += (*fit)->extendSelection(selection, last_selected, selected_items); 1563 (*fit)->extendSelection(selection, last_selected, selected_items);
1541 mNumDescendantsSelected += num_selected;
1542 } 1564 }
1543 1565
1544 // handle selection of our immediate children... 1566 // handle selection of our immediate children...
@@ -1631,8 +1653,6 @@ S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderVie
1631 if (item->changeSelection(item, TRUE)) 1653 if (item->changeSelection(item, TRUE))
1632 { 1654 {
1633 selected_items.put(item); 1655 selected_items.put(item);
1634 mNumDescendantsSelected++;
1635 num_selected++;
1636 } 1656 }
1637 } 1657 }
1638 } 1658 }
@@ -1642,30 +1662,15 @@ S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderVie
1642 if (selection->changeSelection(selection, TRUE)) 1662 if (selection->changeSelection(selection, TRUE))
1643 { 1663 {
1644 selected_items.put(selection); 1664 selected_items.put(selection);
1645 mNumDescendantsSelected++;
1646 num_selected++;
1647 } 1665 }
1648 } 1666 }
1649
1650 return num_selected;
1651} 1667}
1652 1668
1653void LLFolderViewFolder::recursiveDeselect(BOOL deselect_self) 1669void LLFolderViewFolder::recursiveDeselect(BOOL deselect_self)
1654{ 1670{
1655 // make sure we don't have negative values 1671 if (isSelected() && deselect_self)
1656 llassert(mNumDescendantsSelected >= 0);
1657
1658 if (mIsSelected && deselect_self)
1659 { 1672 {
1660 mIsSelected = FALSE; 1673 deselectItem();
1661
1662 // update ancestors' count of selected descendents
1663 LLFolderViewFolder* parent_folder = getParentFolder();
1664 while(parent_folder)
1665 {
1666 parent_folder->mNumDescendantsSelected--;
1667 parent_folder = parent_folder->getParentFolder();
1668 }
1669 } 1674 }
1670 1675
1671 if (0 == mNumDescendantsSelected) 1676 if (0 == mNumDescendantsSelected)
@@ -1673,14 +1678,19 @@ void LLFolderViewFolder::recursiveDeselect(BOOL deselect_self)
1673 return; 1678 return;
1674 } 1679 }
1675 1680
1681 // Deselect all items in this folder.
1676 for (items_t::iterator iter = mItems.begin(); 1682 for (items_t::iterator iter = mItems.begin();
1677 iter != mItems.end();) 1683 iter != mItems.end();)
1678 { 1684 {
1679 items_t::iterator iit = iter++; 1685 items_t::iterator iit = iter++;
1680 LLFolderViewItem* item = (*iit); 1686 LLFolderViewItem* item = (*iit);
1681 item->recursiveDeselect(TRUE); 1687 if (item->isSelected())
1688 {
1689 item->deselectItem();
1690 }
1682 } 1691 }
1683 1692
1693 // Recursively deselect all folders in this folder.
1684 for (folders_t::iterator iter = mFolders.begin(); 1694 for (folders_t::iterator iter = mFolders.begin();
1685 iter != mFolders.end();) 1695 iter != mFolders.end();)
1686 { 1696 {
@@ -1740,7 +1750,10 @@ void LLFolderViewFolder::removeView(LLFolderViewItem* item)
1740 return; 1750 return;
1741 } 1751 }
1742 // deselect without traversing hierarchy 1752 // deselect without traversing hierarchy
1743 item->recursiveDeselect(TRUE); 1753 if (item->isSelected())
1754 {
1755 item->deselectItem();
1756 }
1744 getRoot()->removeFromSelectionList(item); 1757 getRoot()->removeFromSelectionList(item);
1745 extractItem(item); 1758 extractItem(item);
1746 delete item; 1759 delete item;
@@ -1756,16 +1769,24 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item )
1756 // This is an evil downcast. However, it's only doing 1769 // This is an evil downcast. However, it's only doing
1757 // pointer comparison to find if (which it should be ) the 1770 // pointer comparison to find if (which it should be ) the
1758 // item is in the container, so it's pretty safe. 1771 // item is in the container, so it's pretty safe.
1759 LLFolderViewFolder* f = reinterpret_cast<LLFolderViewFolder*>(item); 1772 LLFolderViewFolder* f = static_cast<LLFolderViewFolder*>(item);
1760 folders_t::iterator ft; 1773 folders_t::iterator ft;
1761 ft = std::find(mFolders.begin(), mFolders.end(), f); 1774 ft = std::find(mFolders.begin(), mFolders.end(), f);
1762 if(ft != mFolders.end()) 1775 if(ft != mFolders.end())
1763 { 1776 {
1777 if ((*ft)->numSelected())
1778 {
1779 recursiveIncrementNumDescendantsSelected(-(*ft)->numSelected());
1780 }
1764 mFolders.erase(ft); 1781 mFolders.erase(ft);
1765 } 1782 }
1766 } 1783 }
1767 else 1784 else
1768 { 1785 {
1786 if ((*it)->isSelected())
1787 {
1788 recursiveIncrementNumDescendantsSelected(-1);
1789 }
1769 mItems.erase(it); 1790 mItems.erase(it);
1770 } 1791 }
1771 //item has been removed, need to update filter 1792 //item has been removed, need to update filter
@@ -1944,6 +1965,10 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item)
1944 item, 1965 item,
1945 mSortFunction); 1966 mSortFunction);
1946 mItems.insert(it,item); 1967 mItems.insert(it,item);
1968 if (item->isSelected())
1969 {
1970 recursiveIncrementNumDescendantsSelected(1);
1971 }
1947 item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); 1972 item->setRect(LLRect(0, 0, getRect().getWidth(), 0));
1948 item->setVisible(FALSE); 1973 item->setVisible(FALSE);
1949 addChild( item ); 1974 addChild( item );
@@ -1961,6 +1986,10 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
1961 folder, 1986 folder,
1962 mSortFunction); 1987 mSortFunction);
1963 mFolders.insert(it,folder); 1988 mFolders.insert(it,folder);
1989 if (folder->numSelected())
1990 {
1991 recursiveIncrementNumDescendantsSelected(folder->numSelected());
1992 }
1964 folder->setOrigin(0, 0); 1993 folder->setOrigin(0, 0);
1965 folder->reshape(getRect().getWidth(), 0); 1994 folder->reshape(getRect().getWidth(), 0);
1966 folder->setVisible(FALSE); 1995 folder->setVisible(FALSE);
@@ -2731,6 +2760,10 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder)
2731 { 2760 {
2732 mFolders.insert(mFolders.begin(), folder); 2761 mFolders.insert(mFolders.begin(), folder);
2733 } 2762 }
2763 if (folder->numSelected())
2764 {
2765 recursiveIncrementNumDescendantsSelected(folder->numSelected());
2766 }
2734 folder->setOrigin(0, 0); 2767 folder->setOrigin(0, 0);
2735 folder->reshape(getRect().getWidth(), 0); 2768 folder->reshape(getRect().getWidth(), 0);
2736 folder->setVisible(FALSE); 2769 folder->setVisible(FALSE);
@@ -3012,29 +3045,24 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected)
3012 return rv; 3045 return rv;
3013} 3046}
3014 3047
3015S32 LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items) 3048void LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items)
3016{ 3049{
3017 S32 rv = 0;
3018
3019 // now store resulting selection 3050 // now store resulting selection
3020 if (mAllowMultiSelect) 3051 if (mAllowMultiSelect)
3021 { 3052 {
3022 LLFolderViewItem *cur_selection = getCurSelectedItem(); 3053 LLFolderViewItem *cur_selection = getCurSelectedItem();
3023 rv = LLFolderViewFolder::extendSelection(selection, cur_selection, items); 3054 LLFolderViewFolder::extendSelection(selection, cur_selection, items);
3024 for (S32 i = 0; i < items.count(); i++) 3055 for (S32 i = 0; i < items.count(); i++)
3025 { 3056 {
3026 addToSelectionList(items[i]); 3057 addToSelectionList(items[i]);
3027 rv++;
3028 } 3058 }
3029 } 3059 }
3030 else 3060 else
3031 { 3061 {
3032 setSelection(selection, FALSE, FALSE); 3062 setSelection(selection, FALSE, FALSE);
3033 rv++;
3034 } 3063 }
3035 3064
3036 mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; 3065 mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS;
3037 return rv;
3038} 3066}
3039 3067
3040void LLFolderView::sanitizeSelection() 3068void LLFolderView::sanitizeSelection()
@@ -4554,6 +4582,8 @@ LLInventoryFilter::LLInventoryFilter(const std::string& name) :
4554 mModified(FALSE), 4582 mModified(FALSE),
4555 mNeedTextRebuild(TRUE) 4583 mNeedTextRebuild(TRUE)
4556{ 4584{
4585 //fix to get rid of gSavedSettings use - rkeast
4586 mSearchType = 0;
4557 mFilterOps.mFilterTypes = LLInventoryType::NIT_ALL; 4587 mFilterOps.mFilterTypes = LLInventoryType::NIT_ALL;
4558 mFilterOps.mMinDate = time_min(); 4588 mFilterOps.mMinDate = time_min();
4559 mFilterOps.mMaxDate = time_max(); 4589 mFilterOps.mMaxDate = time_max();
@@ -4599,14 +4629,49 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item)
4599 LLFolderViewEventListener* listener = item->getListener(); 4629 LLFolderViewEventListener* listener = item->getListener();
4600 const LLUUID& item_id = listener->getUUID(); 4630 const LLUUID& item_id = listener->getUUID();
4601 4631
4602 U32 search_type = gSavedSettings.getU32("InventorySearchType"); 4632 //When searching for all labels, we need to explode the filter string
4603 mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel(search_type).find(mFilterSubString) : std::string::npos; 4633 //Into an array, and then compare each string to the label seperately
4604 BOOL passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) 4634 //Otherwise the filter substring needs to be
4635 //formatted in the same order as the label - rkeast
4636
4637 BOOL passed;
4638 //Added ability to toggle this type of searching for all labels cause it's convienient - RKeast
4639 if(mSearchType == 3)
4640 {
4641 std::istringstream i(mFilterSubString);
4642 std::string blah;
4643
4644 LLDynamicArray<std::string> search_array;
4645
4646 while(i >> blah)
4647 {
4648 search_array.put(blah);
4649 }
4650
4651 BOOL subStringMatch = true;
4652 for(int i = 0; i < search_array.getLength(); i++)
4653 {
4654 mSubStringMatchOffset = (search_array.get(i)).size() ? item->getSearchableLabel().find(search_array.get(i)) : std::string::npos;
4655 subStringMatch = subStringMatch && ((search_array.get(i)).size() == 0 || mSubStringMatchOffset != std::string::npos);
4656 }
4657
4658 passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE)
4659 && (subStringMatch)
4660 && (mFilterWorn == false || gAgent.isWearingItem(item_id) ||
4661 (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id)))
4662 && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions)
4663 && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate);
4664 }
4665 else
4666 {
4667 mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
4668 passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE)
4605 && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) 4669 && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos)
4606 && (mFilterWorn == false || gAgent.isWearingItem(item_id) || 4670 && (mFilterWorn == false || gAgent.isWearingItem(item_id) ||
4607 (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id))) 4671 (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id)))
4608 && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) 4672 && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions)
4609 && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); 4673 && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate);
4674 }
4610 return passed; 4675 return passed;
4611} 4676}
4612 4677
@@ -4655,6 +4720,19 @@ BOOL LLInventoryFilter::isModifiedAndClear()
4655 return ret; 4720 return ret;
4656} 4721}
4657 4722
4723
4724//fix to get rid of gSavedSettings use - rkeast
4725void LLInventoryFilter::setSearchType(U32 type)
4726{
4727 mSearchType = type;
4728}
4729
4730//fix to get rid of gSavedSettings use - rkeast
4731U32 LLInventoryFilter::getSearchType()
4732{
4733 return mSearchType;
4734}
4735
4658void LLInventoryFilter::setFilterTypes(U32 types) 4736void LLInventoryFilter::setFilterTypes(U32 types)
4659{ 4737{
4660 if (mFilterOps.mFilterTypes != types) 4738 if (mFilterOps.mFilterTypes != types)