summaryrefslogtreecommitdiff
path: root/indra/newview/llfolderviewitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfolderviewitem.cpp')
-rw-r--r--indra/newview/llfolderviewitem.cpp102
1 files changed, 67 insertions, 35 deletions
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index f452ae25c3..13b721fa23 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -41,6 +41,7 @@
#include "llviewerwindow.h" // Argh, only for setCursor()
// linden library includes
+#include "llclipboard.h"
#include "llfocusmgr.h" // gFocusMgr
#include "lltrans.h"
@@ -248,40 +249,40 @@ void LLFolderViewItem::refresh()
mLabel = getListener()->getDisplayName();
LLFolderType::EType preferred_type = getListener()->getPreferredType();
- // *TODO: to be removed when database supports multi language. This is a
- // temporary attempt to display the inventory folder in the user locale.
- // mantipov: *NOTE: be sure this code is synchronized with LLFriendCardsManager::findChildFolderUUID
- // it uses the same way to find localized string
+ // *TODO: to be removed when database supports multi language. This is a
+ // temporary attempt to display the inventory folder in the user locale.
+ // mantipov: *NOTE: be sure this code is synchronized with LLFriendCardsManager::findChildFolderUUID
+ // it uses the same way to find localized string
- // HACK: EXT - 6028 ([HARD CODED]? Inventory > Library > "Accessories" folder)
- // Translation of Accessories folder in Library inventory folder
- bool accessories = false;
- if(mLabel == std::string("Accessories"))
- {
- //To ensure that Accessories folder is in Library we have to check its parent folder.
- //Due to parent LLFolderViewFloder is not set to this item yet we have to check its parent via Inventory Model
- LLInventoryCategory* cat = gInventory.getCategory(getListener()->getUUID());
- if(cat)
+ // HACK: EXT - 6028 ([HARD CODED]? Inventory > Library > "Accessories" folder)
+ // Translation of Accessories folder in Library inventory folder
+ bool accessories = false;
+ if(mLabel == std::string("Accessories"))
{
- const LLUUID& parent_folder_id = cat->getParentUUID();
- accessories = (parent_folder_id == gInventory.getLibraryRootFolderID());
+ //To ensure that Accessories folder is in Library we have to check its parent folder.
+ //Due to parent LLFolderViewFloder is not set to this item yet we have to check its parent via Inventory Model
+ LLInventoryCategory* cat = gInventory.getCategory(getListener()->getUUID());
+ if(cat)
+ {
+ const LLUUID& parent_folder_id = cat->getParentUUID();
+ accessories = (parent_folder_id == gInventory.getLibraryRootFolderID());
+ }
}
- }
- //"Accessories" inventory category has folder type FT_NONE. So, this folder
- //can not be detected as protected with LLFolderType::lookupIsProtectedType
- if (accessories || LLFolderType::lookupIsProtectedType(preferred_type))
- {
- LLTrans::findString(mLabel, "InvFolder " + mLabel);
- };
+ //"Accessories" inventory category has folder type FT_NONE. So, this folder
+ //can not be detected as protected with LLFolderType::lookupIsProtectedType
+ if (accessories || LLFolderType::lookupIsProtectedType(preferred_type))
+ {
+ LLTrans::findString(mLabel, "InvFolder " + mLabel);
+ };
- setToolTip(mLabel);
+ setToolTip(mLabel);
setIcon(getListener()->getIcon());
- if (mRoot->useLabelSuffix())
- {
+ if (mRoot->useLabelSuffix())
+ {
mLabelStyle = getListener()->getLabelStyle();
mLabelSuffix = getListener()->getLabelSuffix();
- }
+}
std::string searchable_label(mLabel);
searchable_label.append(mLabelSuffix);
@@ -1101,7 +1102,37 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
LLFastTimer t2(FTM_ARRANGE);
- mHasVisibleChildren = hasFilteredDescendants(filter_generation);
+ // evaluate mHasVisibleChildren
+ mHasVisibleChildren = false;
+ if (hasFilteredDescendants(filter_generation))
+ {
+ // We have to verify that there's at least one child that's not filtered out
+ bool found = false;
+ // Try the items first
+ for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit)
+ {
+ LLFolderViewItem* itemp = (*iit);
+ found = (itemp->getFiltered(filter_generation));
+ if (found)
+ break;
+ }
+ if (!found)
+ {
+ // If no item found, try the folders
+ for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit)
+ {
+ LLFolderViewFolder* folderp = (*fit);
+ found = ( folderp->getListener()
+ && (folderp->getFiltered(filter_generation)
+ || (folderp->getFilteredFolder(filter_generation)
+ && folderp->hasFilteredDescendants(filter_generation))));
+ if (found)
+ break;
+ }
+ }
+
+ mHasVisibleChildren = found;
+ }
// calculate height as a single item (without any children), and reshapes rectangle to match
LLFolderViewItem::arrange( width, height, filter_generation );
@@ -1251,7 +1282,7 @@ void LLFolderViewFolder::requestSort()
void LLFolderViewFolder::setCompletedFilterGeneration(S32 generation, BOOL recurse_up)
{
- mMostFilteredDescendantGeneration = llmin(mMostFilteredDescendantGeneration, generation);
+ //mMostFilteredDescendantGeneration = llmin(mMostFilteredDescendantGeneration, generation);
mCompletedFilterGeneration = generation;
// only aggregate up if we are a lower (older) value
if (recurse_up
@@ -1286,6 +1317,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
{
// go ahead and flag this folder as done
mLastFilterGeneration = filter_generation;
+ mStringMatchOffset = std::string::npos;
}
else // filter self only on first pass through
{
@@ -1466,7 +1498,7 @@ void LLFolderViewFolder::dirtyFilter()
BOOL LLFolderViewFolder::getFiltered()
{
return getFilteredFolder(getRoot()->getFilter()->getFirstSuccessGeneration())
- && LLFolderViewItem::getFiltered();
+ && LLFolderViewItem::getFiltered();
}
BOOL LLFolderViewFolder::getFiltered(S32 filter_generation)
@@ -2022,13 +2054,13 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
requestSort();
if (getRoot()->getSortFunction().isByDate())
{
- LLFolderViewFolder* parentp = getParentFolder();
+ LLFolderViewFolder* parentp = getParentFolder();
while(parentp)
- {
- // parent folder doesn't have a time stamp yet, so get it from us
- parentp->requestSort();
- parentp = parentp->getParentFolder();
- }
+ {
+ // parent folder doesn't have a time stamp yet, so get it from us
+ parentp->requestSort();
+ parentp = parentp->getParentFolder();
+ }
}
return TRUE;
}