summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventoryfunctions.cpp22
-rw-r--r--indra/newview/llinventoryobserver.h1
-rw-r--r--indra/newview/llinventorypanel.cpp35
3 files changed, 56 insertions, 2 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index b95d75a782..135dfa3519 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2344,6 +2344,21 @@ void ungroup_folder_items(const LLUUID& folder_id)
gInventory.notifyObservers();
}
+class LLUpdateFavorite : public LLInventoryCallback
+{
+public:
+ LLUpdateFavorite(const LLUUID& inv_item_id)
+ : mInvItemID(inv_item_id)
+ {}
+ /* virtual */ void fire(const LLUUID& inv_item_id) override
+ {
+ gInventory.addChangedMask(LLInventoryObserver::UPDATE_FAVORITE, mInvItemID);
+ gInventory.notifyObservers();
+ }
+private:
+ LLUUID mInvItemID;
+};
+
void set_favorite(const LLUUID& obj_id, bool favorite)
{
LLInventoryObject* obj = gInventory.getObject(obj_id);
@@ -2351,15 +2366,18 @@ void set_favorite(const LLUUID& obj_id, bool favorite)
{
LLSD updates;
updates["favorite"] = LLSD().with("toggled", favorite);
+
+ LLPointer<LLInventoryCallback> cb = new LLUpdateFavorite(obj_id);
+
LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj);
if (view_folder)
{
- update_inventory_category(obj_id, updates, NULL);
+ update_inventory_category(obj_id, updates, cb);
}
LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj);
if (view_item)
{
- update_inventory_item(obj_id, updates, NULL);
+ update_inventory_item(obj_id, updates, cb);
}
}
}
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index bec08d2cdf..6cd630bcd2 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -60,6 +60,7 @@ public:
CREATE = 512, // With ADD, item has just been created.
// unfortunately a particular message is still associated with some unique semantics.
UPDATE_CREATE = 1024, // With ADD, item added via UpdateCreateInventoryItem
+ UPDATE_FAVORITE = 2048, // With ADD, item added via UpdateCreateInventoryItem
ALL = 0xffffffff
};
LLInventoryObserver();
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index ab04a8589a..4aace2f96e 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -620,6 +620,19 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
}
}
+ if (mask & LLInventoryObserver::UPDATE_FAVORITE)
+ {
+ if (view_item)
+ {
+ // TODO:: move to idle
+ LLFolderViewFolder* parent = view_item->getParentFolder();
+ if (parent)
+ {
+ parent->updateHasFavorites(view_item->isFavorite());
+ }
+ }
+ }
+
// We don't typically care which of these masks the item is actually flagged with, since the masks
// may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
// Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
@@ -648,6 +661,16 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
setSelection(item_id, FALSE);
}
updateFolderLabel(model_item->getParentUUID());
+ if (model_item->getIsFavorite())
+ {
+ // TODO:: move to idle
+ LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
+ if (new_parent)
+ {
+ new_parent->updateHasFavorites(true);
+ }
+ }
+
}
//////////////////////////////
@@ -694,6 +717,13 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
updateFolderLabel(viewmodel_folder->getUUID());
}
old_parent->getViewModelItem()->dirtyDescendantsFilter();
+
+ if (view_item->isFavorite())
+ {
+ // TODO:: move to idle
+ old_parent->updateHasFavorites(false); // favorite was removed
+ new_parent->updateHasFavorites(true); // favorite was added
+ }
}
}
}
@@ -715,6 +745,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
{
updateFolderLabel(viewmodel_folder->getUUID());
}
+ if (view_item->isFavorite())
+ {
+ // TODO:: move to idle
+ parent->updateHasFavorites(false); // favorite was removed
+ }
}
}
}