Skip to content

Commit 80b714c

Browse files
committed
#3374 Fix item reparenting moving containing folder
1 parent d54b80b commit 80b714c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

indra/newview/llinventorypanel.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
688688
{
689689
LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem();
690690
LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent_vmi);
691-
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
692-
// Item has been moved.
693-
if (old_parent != new_parent)
691+
LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID());
692+
693+
if (old_parent != new_parent // Item has been moved.
694+
&& (new_parent != NULL || !isInRootContent(item_id, view_item)) // item is not or shouldn't be in root content
695+
)
694696
{
695697
if (new_parent != NULL)
696698
{
@@ -2268,6 +2270,7 @@ class LLInventoryFavoritesItemsPanel : public LLInventoryPanel
22682270
}
22692271

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

22722275
protected:
22732276
LLInventoryFavoritesItemsPanel(const Params&);
@@ -2303,6 +2306,17 @@ void LLInventoryFavoritesItemsPanel::removeItemID(const LLUUID& id)
23032306
LLInventoryPanel::removeItemID(id);
23042307
}
23052308

2309+
bool LLInventoryFavoritesItemsPanel::isInRootContent(const LLUUID& id, LLFolderViewItem* view_item)
2310+
{
2311+
if (!view_item->isFavorite())
2312+
{
2313+
return false;
2314+
}
2315+
2316+
std::set<LLUUID>::iterator found = mRootContentIDs.find(id);
2317+
return found != mRootContentIDs.end();
2318+
}
2319+
23062320
void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id)
23072321
{
23082322
F64 curent_time = LLTimer::getTotalSeconds();

indra/newview/llinventorypanel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ class LLInventoryPanel : public LLPanel
252252
static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id);
253253
void addItemID(const LLUUID& id, LLFolderViewItem* itemp);
254254
virtual void removeItemID(const LLUUID& id);
255+
virtual bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) { return false; }
255256
LLFolderViewItem* getItemByID(const LLUUID& id);
256257
LLFolderViewFolder* getFolderByID(const LLUUID& id);
257258
void setSelectionByID(const LLUUID& obj_id, bool take_keyboard_focus);

0 commit comments

Comments
 (0)