summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index b540e9c5bb..a935ede186 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -187,6 +187,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2));
+ mEnableCallbackRegistrar.add("Inventory.FileUploadLocation.Check", boost::bind(&LLInventoryPanel::isUploadLocationSelected, this, _2));
mCommitCallbackRegistrar.add("Inventory.OpenNewFolderWindow", boost::bind(&LLInventoryPanel::openSingleViewInventory, this, LLUUID()));
}
@@ -770,6 +771,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
// Remove the item's UI.
LLFolderViewFolder* parent = view_item->getParentFolder();
removeItemID(viewmodel_item->getUUID());
+ bool was_favorite = view_item->isFavorite();
view_item->destroyView();
if(parent)
{
@@ -783,7 +785,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
updateFolderLabel(viewmodel_folder->getUUID());
}
}
- if (view_item->isFavorite())
+ if (was_favorite)
{
parent->updateHasFavorites(false); // favorite was removed
}
@@ -1831,6 +1833,13 @@ void LLInventoryPanel::fileUploadLocation(const LLSD& userdata)
LLInventoryAction::fileUploadLocation(dest, param);
}
+bool LLInventoryPanel::isUploadLocationSelected(const LLSD& userdata)
+{
+ const std::string param = userdata.asString();
+ const LLUUID dest = LLFolderBridge::sSelf.get()->getUUID();
+ return LLInventoryAction::isFileUploadLocation(dest, param);
+}
+
void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id)
{
LLPanelMainInventory::newFolderWindow(folder_id.isNull() ? LLFolderBridge::sSelf.get()->getUUID() : folder_id);
@@ -2298,6 +2307,7 @@ public:
void removeItemID(const LLUUID& id) override;
bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) override;
+ bool hasPredecessorsInRootContent(const LLInventoryObject* model_item) const;
protected:
LLInventoryFavoritesItemsPanel(const Params&);
@@ -2344,6 +2354,24 @@ bool LLInventoryFavoritesItemsPanel::isInRootContent(const LLUUID& id, LLFolderV
return found != mRootContentIDs.end();
}
+bool LLInventoryFavoritesItemsPanel::hasPredecessorsInRootContent(const LLInventoryObject* obj) const
+{
+ LLUUID parent_id = obj->getParentUUID();
+ while (parent_id.notNull())
+ {
+ if (mRootContentIDs.contains(parent_id))
+ {
+ return true;
+ }
+ LLViewerInventoryCategory* cat = mInventory->getCategory(parent_id);
+ if (cat)
+ {
+ parent_id = cat->getParentUUID();
+ }
+ }
+ return false;
+}
+
void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id)
{
F64 curent_time = LLTimer::getTotalSeconds();
@@ -2433,6 +2461,7 @@ bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLIn
{
removeItemID(viewmodel_item->getUUID());
}
+ bool was_favorite = view_item->isFavorite();
view_item->destroyView();
if (parent)
{
@@ -2442,7 +2471,7 @@ bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLIn
{
updateFolderLabel(viewmodel_folder->getUUID());
}
- if (view_item->isFavorite())
+ if (was_favorite)
{
parent->updateHasFavorites(false); // favorite was removed
}
@@ -2495,7 +2524,8 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con
}
LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID());
- if (!folder_view_item)
+ if (!folder_view_item
+ && !hasPredecessorsInRootContent(model_item))
{
const LLUUID& parent_id = cat->getParentUUID();
mRootContentIDs.emplace(cat->getUUID());
@@ -2507,7 +2537,9 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con
else
{
// New favorite item
- if (model_item->getIsFavorite() && typedViewsFilter(id, model_item))
+ if (model_item->getIsFavorite()
+ && typedViewsFilter(id, model_item)
+ && !hasPredecessorsInRootContent(model_item))
{
const LLUUID& parent_id = model_item->getParentUUID();
mRootContentIDs.emplace(id);