diff options
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 39 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.h | 3 | ||||
-rw-r--r-- | indra/newview/llconversationmodel.h | 2 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.h | 3 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 3 |
6 files changed, 46 insertions, 17 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 2accec7a68..682da226bd 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -198,7 +198,7 @@ BOOL LLFolderViewItem::postBuild() // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset mLabel = vmi->getDisplayName(); - mIsFavorite = vmi->isFavorite(); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -312,7 +312,7 @@ void LLFolderViewItem::refresh() LLFolderViewModelItem& vmi = *getViewModelItem(); mLabel = vmi.getDisplayName(); - mIsFavorite = vmi.isFavorite(); + mIsFavorite = vmi.isFavorite() && !vmi.isItemInTrash(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -345,7 +345,7 @@ void LLFolderViewItem::refreshSuffix() mIconOpen = vmi->getIconOpen(); mIconOverlay = vmi->getIconOverlay(); - mIsFavorite = vmi->isFavorite(); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); if (mRoot->useLabelSuffix()) { @@ -1808,7 +1808,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) if (self->mFavoritesDirtyFlags == 0) { LL_WARNS() << "Called onIdleUpdateFavorites without dirty flags set" << LL_ENDL; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); return; } @@ -1816,20 +1816,26 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) { // do not display favorite-stars in trash self->mFavoritesDirtyFlags = 0; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); return; } - LLFolderViewFolder* root_folder = self->getRoot(); if (self->mFavoritesDirtyFlags == FAVORITE_ADDED) { if (!self->mHasFavorites) { // propagate up, exclude root LLFolderViewFolder* parent = self; - while (parent && !parent->hasFavorites() && root_folder != parent) + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) { parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } parent = parent->getParentFolder(); } } @@ -1838,7 +1844,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) { // full check LLFolderViewFolder* parent = self; - while (parent && root_folder != parent) + while (parent && !parent->getViewModelItem()->isAgentInventoryRoot()) { bool has_favorites = false; for (items_t::iterator iter = parent->mItems.begin(); @@ -1878,19 +1884,28 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) else { // propagate up, exclude root - while (parent && !parent->hasFavorites() && root_folder != parent) + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) { parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } parent = parent->getParentFolder(); } break; } + if (parent->mFavoritesDirtyFlags) + { + parent->mFavoritesDirtyFlags = 0; + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + } parent = parent->getParentFolder(); } } - - self->mFavoritesDirtyFlags = 0; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 152801ec69..b7afdb6aec 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -185,6 +185,9 @@ public: virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; + virtual bool isAgentInventory() const = 0; + virtual bool isAgentInventoryRoot() const = 0; + virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 3b70b9a568..478daadfda 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -80,6 +80,8 @@ public: virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } virtual bool isFavorite() const { return false; } + virtual bool isAgentInventory() const { return false; } + virtual bool isAgentInventoryRoot() const { return false; } virtual BOOL isItemRenameable() const { return TRUE; } virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; } virtual BOOL isItemMovable( void ) const { return FALSE; } diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 1649b2eed7..2459cc4f2c 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -47,7 +47,8 @@ public: virtual void showProperties(void) = 0; virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual. virtual bool isItemInOutfits() const { return false; } - virtual BOOL isAgentInventory() const { return FALSE; } + virtual bool isAgentInventory() const { return false; } + virtual bool isAgentInventoryRoot() const { return false; } virtual BOOL isUpToDate() const = 0; virtual void addChild(LLFolderViewModelItem* child); virtual bool hasChildren() const = 0; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5620523f24..1f91ef2772 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1335,7 +1335,7 @@ BOOL LLInvFVBridge::isLinkedObjectMissing() const return FALSE; } -BOOL LLInvFVBridge::isAgentInventory() const +bool LLInvFVBridge::isAgentInventory() const { const LLInventoryModel* model = getInventoryModel(); if(!model) return FALSE; @@ -1343,6 +1343,13 @@ BOOL LLInvFVBridge::isAgentInventory() const return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); } +bool LLInvFVBridge::isAgentInventoryRoot() const +{ + const LLInventoryModel* model = getInventoryModel(); + if(!model) return false; + return gInventory.getRootFolderID() == mUUID; +} + BOOL LLInvFVBridge::isCOFFolder() const { return LLAppearanceMgr::instance().getIsInCOF(mUUID); @@ -7868,7 +7875,7 @@ protected: BOOL isItemInTrash() const; // return true if the item is in agent inventory. if false, it // must be lost or in the inventory library. - BOOL isAgentInventory() const; + bool isAgentInventory() const; void wearOnAvatar(); }; @@ -7879,7 +7886,7 @@ BOOL LLWearableBridgeAction::isItemInTrash() const return mModel->isObjectDescendentOf(mUUID, trash_id); } -BOOL LLWearableBridgeAction::isAgentInventory() const +bool LLWearableBridgeAction::isAgentInventory() const { if(!mModel) return FALSE; if(gInventory.getRootFolderID() == mUUID) return TRUE; diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 39cd393fdd..5100da15cd 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -172,7 +172,8 @@ protected: BOOL isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash? BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory? - BOOL isAgentInventory() const; // false if lost or in the inventory library + bool isAgentInventory() const; // false if lost or in the inventory library + bool isAgentInventoryRoot() const; // true if worn by agent BOOL isCOFFolder() const; // true if COF or descendant of BOOL isInboxFolder() const; // true if COF or descendant of marketplace inbox |