summaryrefslogtreecommitdiff
path: root/indra/llui/llfolderviewitem.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-27 05:01:36 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-04-27 05:01:36 +0300
commita0c4d81080fbc4b5326e6b598e5df27e01631d48 (patch)
treef45337506aa72b301280a89aaca031b6de0a2888 /indra/llui/llfolderviewitem.cpp
parentcea6eeeede9f687ca195cc9b9e778fd6784afbe2 (diff)
viewer#1300 'Star' favorites in inventory #2
Diffstat (limited to 'indra/llui/llfolderviewitem.cpp')
-rw-r--r--indra/llui/llfolderviewitem.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 84146e5829..be703a1e9a 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -1783,6 +1783,64 @@ BOOL LLFolderViewFolder::isMovable()
return TRUE;
}
+void LLFolderViewFolder::updateHasFavorites(bool new_childs_value)
+{
+ if (mHasFavorites != new_childs_value)
+ {
+ if (new_childs_value)
+ {
+ mHasFavorites = new_childs_value;
+ // propagate up to root
+ LLFolderViewFolder* parent = getParentFolder();
+ while (parent && !parent->hasFavorites())
+ {
+ parent->setHasFavorites(true);
+ parent = parent->getParentFolder();
+ }
+ }
+ else
+ {
+ LLFolderViewFolder* parent = this;
+ while (parent)
+ {
+ bool has_favorites = false;
+ for (items_t::iterator iter = parent->mItems.begin();
+ iter != parent->mItems.end();)
+ {
+ items_t::iterator iit = iter++;
+ if ((*iit)->isFavorite())
+ {
+ has_favorites = true;
+ break;
+ }
+ }
+
+ for (folders_t::iterator iter = parent->mFolders.begin();
+ iter != parent->mFolders.end() && !has_favorites;)
+ {
+ folders_t::iterator fit = iter++;
+ if ((*fit)->isFavorite() || (*fit)->hasFavorites())
+ {
+ has_favorites = true;
+ break;
+ }
+ }
+
+ if (!has_favorites)
+ {
+ parent->mHasFavorites = false;
+ parent->setHasFavorites(false);
+ }
+ else
+ {
+ break;
+ }
+ parent = parent->getParentFolder();
+ }
+ }
+ }
+}
+
BOOL LLFolderViewFolder::isRemovable()
{