summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2014-03-14 21:15:18 +0200
committerandreykproductengine <akleshchev@productengine.com>2014-03-14 21:15:18 +0200
commitabf5d5b36083d4f1d94674e456750838ae683157 (patch)
treec4e75451674e8890234620a3aafe05fea959e6ed
parentd9a3eb063271abeec6b437730328fe4a6b1b81f2 (diff)
MAINT-3426 FIXED Searching inventory for "online" no longer returns online friends calling cards in search results.
-rwxr-xr-xindra/newview/llinventorybridge.cpp42
-rwxr-xr-xindra/newview/llinventorybridge.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 44943d8722..101b16b027 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4708,6 +4708,10 @@ public:
virtual void changed(U32 mask)
{
mBridgep->refreshFolderViewItem();
+ if (mask & LLFriendObserver::ONLINE)
+ {
+ mBridgep->checkSearchBySuffixChanges();
+ }
}
protected:
LLCallingCardBridge* mBridgep;
@@ -4742,6 +4746,44 @@ void LLCallingCardBridge::refreshFolderViewItem()
}
}
+void LLCallingCardBridge::checkSearchBySuffixChanges()
+{
+ if (!mDisplayName.empty())
+ {
+ // changes in mDisplayName are processed by rename function and here it will be always same
+ // suffixes are also of fixed length, and we are processing change of one at a time,
+ // so it should be safe to use length (note: mSearchableName is capitalized)
+ S32 old_length = mSearchableName.length();
+ S32 new_length = mDisplayName.length() + getLabelSuffix().length();
+ if (old_length == new_length)
+ {
+ return;
+ }
+ mSearchableName.assign(mDisplayName);
+ mSearchableName.append(getLabelSuffix());
+ LLStringUtil::toUpper(mSearchableName);
+ if (new_length<old_length)
+ {
+ LLInventoryFilter* filter = getInventoryFilter();
+ if (filter && mPassedFilter && mSearchableName.find(filter->getFilterSubString()) == std::string::npos)
+ {
+ // string no longer contains substring
+ // we either have to update all parents manually or restart filter.
+ // dirtyFilter will not work here due to obsolete descendants' generations
+ getInventoryFilter()->setModified(LLFolderViewFilter::FILTER_MORE_RESTRICTIVE);
+ }
+ }
+ else
+ {
+ if (getInventoryFilter())
+ {
+ // mSearchableName became longer, we gained additional suffix and need to repeat filter check.
+ dirtyFilter();
+ }
+ }
+ }
+}
+
// virtual
void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string action)
{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index bc875e8f37..b29235260b 100755
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -419,6 +419,7 @@ public:
void* cargo_data,
std::string& tooltip_msg);
void refreshFolderViewItem();
+ void checkSearchBySuffixChanges();
protected:
LLCallingCardObserver* mObserver;
};