summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-02-10 18:05:07 -0800
committerMerov Linden <merov@lindenlab.com>2012-02-10 18:05:07 -0800
commitd245dad7ddbac36b013c70326ad25eb9247784f6 (patch)
tree2cce7b69f3778b21de7d14e4def746f8ad2bb328
parent2a4aa438f5798c34f1eef3ef75dc3289492138e1 (diff)
EXP-1863 : Fix the filtering of cut folders, also fix the move to trash of folders in double cut scenarios
-rw-r--r--indra/newview/llfolderview.cpp13
-rw-r--r--indra/newview/llinventoryfilter.cpp77
-rw-r--r--indra/newview/llinventoryfilter.h5
-rw-r--r--indra/newview/llinventorypanel.cpp3
4 files changed, 42 insertions, 56 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 51a5839b75..0abfa9db8e 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -1028,7 +1028,18 @@ void LLFolderView::removeCutItems()
++iter)
{
const LLUUID& item_id = (*iter);
- remove_item(&gInventory, item_id);
+ LLInventoryObject *obj = gInventory.getObject(item_id);
+ if (obj)
+ {
+ if (LLAssetType::AT_CATEGORY == obj->getType())
+ {
+ remove_category(&gInventory, item_id);
+ }
+ else
+ {
+ remove_item(&gInventory, item_id);
+ }
+ }
}
}
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 808b7619eb..f3d4667034 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -97,13 +97,16 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
}
mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
+ const LLFolderViewEventListener* listener = item->getListener();
const BOOL passed_filtertype = checkAgainstFilterType(item);
const BOOL passed_permissions = checkAgainstPermissions(item);
const BOOL passed_filterlink = checkAgainstFilterLinks(item);
+ const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE);
const BOOL passed = (passed_filtertype &&
passed_permissions &&
passed_filterlink &&
+ passed_clipboard &&
(mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
return passed;
@@ -115,8 +118,10 @@ bool LLInventoryFilter::check(const LLInventoryItem* item)
const bool passed_filtertype = checkAgainstFilterType(item);
const bool passed_permissions = checkAgainstPermissions(item);
+ const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID());
const bool passed = (passed_filtertype &&
passed_permissions &&
+ passed_clipboard &&
(mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
return passed;
@@ -145,7 +150,10 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder)
return false;
}
- return true;
+ // Always check against the clipboard
+ const BOOL passed_clipboard = checkAgainstClipboard(folder_id);
+
+ return passed_clipboard;
}
BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const
@@ -238,31 +246,6 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
}
}
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_CLIPBOARD
- // Pass if this item is not on the clipboard or is not a descendant of a folder
- // which is on the clipboard
- if (filterTypes & FILTERTYPE_CLIPBOARD)
- {
- if (LLClipboard::getInstance()->isCutMode())
- {
- LLUUID current_id = object_id;
- LLInventoryObject *current_object = gInventory.getObject(object_id);
- while (current_id.notNull())
- {
- if (LLClipboard::getInstance()->isOnClipboard(current_id))
- {
- return FALSE;
- }
- current_id = current_object->getParentUUID();
- if (current_id.notNull())
- {
- current_object = gInventory.getObject(current_id);
- }
- }
- }
- }
-
return TRUE;
}
@@ -323,31 +306,30 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons
return false;
}
- ////////////////////////////////////////////////////////////////////////////////
- // FILTERTYPE_CLIPBOARD
- // Pass if this item is not on the clipboard or is not a descendant of a folder
- // which is on the clipboard
- if (filterTypes & FILTERTYPE_CLIPBOARD)
+ return true;
+}
+
+// Items and folders that are on the clipboard or, recursively, in a folder which
+// is on the clipboard must be filtered out if the clipboard is in the "cut" mode.
+bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const
+{
+ if (LLClipboard::getInstance()->isCutMode())
{
- if (LLClipboard::getInstance()->isCutMode())
+ LLUUID current_id = object_id;
+ LLInventoryObject *current_object = gInventory.getObject(object_id);
+ while (current_id.notNull())
{
- LLUUID current_id = object_id;
- LLInventoryObject *current_object = gInventory.getObject(object_id);
- while (current_id.notNull())
+ if (LLClipboard::getInstance()->isOnClipboard(current_id))
{
- if (LLClipboard::getInstance()->isOnClipboard(current_id))
- {
- return false;
- }
- current_id = current_object->getParentUUID();
- if (current_id.notNull())
- {
- current_object = gInventory.getObject(current_id);
- }
+ return false;
+ }
+ current_id = current_object->getParentUUID();
+ if (current_id.notNull())
+ {
+ current_object = gInventory.getObject(current_id);
}
}
}
-
return true;
}
@@ -501,11 +483,6 @@ void LLInventoryFilter::setFilterEmptySystemFolders()
mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
}
-void LLInventoryFilter::setFilterClipboard()
-{
- mFilterOps.mFilterTypes |= FILTERTYPE_CLIPBOARD;
-}
-
void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
{
if (mFilterOps.mFilterUUID == LLUUID::null)
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index fb4f84b139..1ac90788b2 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -59,8 +59,7 @@ public:
FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it
FILTERTYPE_DATE = 0x1 << 3, // search by date range
FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type
- FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty
- FILTERTYPE_CLIPBOARD = 0x1 << 6 // pass if item is not on the clipboard
+ FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if empty
};
enum EFilterLink
@@ -92,7 +91,6 @@ public:
void setFilterUUID(const LLUUID &object_id);
void setFilterWearableTypes(U64 types);
void setFilterEmptySystemFolders();
- void setFilterClipboard();
void updateFilterTypes(U64 types, U64& current_types);
void setFilterSubString(const std::string& string);
@@ -125,6 +123,7 @@ public:
BOOL checkAgainstPermissions(const LLFolderViewItem* item) const;
bool checkAgainstPermissions(const LLInventoryItem* item) const;
BOOL checkAgainstFilterLinks(const LLFolderViewItem* item) const;
+ bool checkAgainstClipboard(const LLUUID& object_id) const;
std::string::size_type getStringMatchOffset() const;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 27f97ad26f..4508e7e083 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -248,8 +248,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
getFilter()->setFilterEmptySystemFolders();
}
- // hide items that are on the clipboard
- getFilter()->setFilterClipboard();
+ // keep track of the clipboard state so that we avoid filtering too much
mClipboardState = LLClipboard::getInstance()->getState();
// Initialize base class params.