Skip to content

#3374 LLFolderViewFolder::updateHasFavorites #3381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions indra/newview/llinventorypanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve

if (get_is_favorite(model_item))
{
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID());
if (new_parent)
{
new_parent->updateHasFavorites(true);
Expand All @@ -688,9 +688,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
{
LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem();
LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent_vmi);
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
// Item has been moved.
if (old_parent != new_parent)
LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID());

if (old_parent != new_parent // Item has been moved.
&& (new_parent != NULL || !isInRootContent(item_id, view_item)) // item is not or shouldn't be in root content
)
{
if (new_parent != NULL)
{
Expand Down Expand Up @@ -728,8 +730,14 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve

if (view_item->isFavorite())
{
old_parent->updateHasFavorites(false); // favorite was removed
new_parent->updateHasFavorites(true); // favorite was added
if (old_parent)
{
old_parent->updateHasFavorites(false); // favorite was removed
}
if (new_parent)
{
new_parent->updateHasFavorites(true); // favorite was added
}
}
}
}
Expand Down Expand Up @@ -2262,6 +2270,7 @@ class LLInventoryFavoritesItemsPanel : public LLInventoryPanel
}

void removeItemID(const LLUUID& id) override;
bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) override;

protected:
LLInventoryFavoritesItemsPanel(const Params&);
Expand Down Expand Up @@ -2297,6 +2306,17 @@ void LLInventoryFavoritesItemsPanel::removeItemID(const LLUUID& id)
LLInventoryPanel::removeItemID(id);
}

bool LLInventoryFavoritesItemsPanel::isInRootContent(const LLUUID& id, LLFolderViewItem* view_item)
{
if (!view_item->isFavorite())
{
return false;
}

std::set<LLUUID>::iterator found = mRootContentIDs.find(id);
return found != mRootContentIDs.end();
}

void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id)
{
F64 curent_time = LLTimer::getTotalSeconds();
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llinventorypanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class LLInventoryPanel : public LLPanel
static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id);
void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
virtual void removeItemID(const LLUUID& id);
virtual bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) { return false; }
LLFolderViewItem* getItemByID(const LLUUID& id);
LLFolderViewFolder* getFolderByID(const LLUUID& id);
void setSelectionByID(const LLUUID& obj_id, bool take_keyboard_focus);
Expand Down
Loading