summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfilter.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-07-31 23:46:13 -0700
committerMerov Linden <merov@lindenlab.com>2012-07-31 23:46:13 -0700
commite9a484f98d0376a5651d4f6eb5a692db4f77c800 (patch)
tree356e58f9630cdcdfab83ec96e9578ca5c5a25e65 /indra/newview/llinventoryfilter.cpp
parent8f7871911deba87e5ceed8f6f36c1cb2b429efe8 (diff)
CHUI-254 : Fix Inventory filter and item draw() to highlight matching substrings in inventory
Diffstat (limited to 'indra/newview/llinventoryfilter.cpp')
-rw-r--r--indra/newview/llinventoryfilter.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index b4be927b09..4f4030550f 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -95,9 +95,9 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
return passed_clipboard;
}
- std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : 0;
+ std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos;
- BOOL passed = string_offset != std::string::npos;
+ BOOL passed = (mFilterSubString.size() == 0 || string_offset != std::string::npos);
passed = passed && checkAgainstFilterType(listener);
passed = passed && checkAgainstPermissions(listener);
passed = passed && checkAgainstFilterLinks(listener);
@@ -108,7 +108,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item)
bool LLInventoryFilter::check(const LLInventoryItem* item)
{
- std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
+ std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
const bool passed_filtertype = checkAgainstFilterType(item);
const bool passed_permissions = checkAgainstPermissions(item);
@@ -116,7 +116,7 @@ bool LLInventoryFilter::check(const LLInventoryItem* item)
const bool passed = (passed_filtertype
&& passed_permissions
&& passed_clipboard
- && (mFilterSubString.size() == 0 || string_offset != std::string::npos));
+ && (mFilterSubString.size() == 0 || string_offset != std::string::npos));
return passed;
}
@@ -383,9 +383,10 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
return mFilterSubString;
}
-std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewItem* item) const
+std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const
{
- return mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
+ const LLFolderViewModelItemInventory* listener = static_cast<const LLFolderViewModelItemInventory*>(item);
+ return mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos;
}
bool LLInventoryFilter::isDefault() const
@@ -1004,6 +1005,11 @@ bool LLInventoryFilter::hasFilterString() const
return mFilterSubString.size() > 0;
}
+std::string::size_type LLInventoryFilter::getFilterStringSize() const
+{
+ return mFilterSubString.size();
+}
+
PermissionMask LLInventoryFilter::getFilterPermissions() const
{
return mFilterOps.mPermissions;