FIRE-19340: Add filter to search inventory items by transferable permission

Based off work by Nicky Perian from Kokua, this version comes without quirks of
using an extra debug setting and uses the already existing inventory filter
mechanism in place. This means the same rules apply (basically only the filter
on the "Recent" panel get restored at login.

Also fixed some bugs on the way regarding worn items filter (had no impact so
far) and re-enabled updateItemcountText() as it prevented the inventory status
text being properly updated on filter changes.
master
Ansariel 2016-05-25 16:22:22 +02:00
parent 73cf8744a8
commit f0d309b68f
10 changed files with 125 additions and 43 deletions

View File

@ -403,6 +403,19 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent
}
}
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_TRANSFERABLE
// Pass if this item is transferable
if (filterTypes & FILTERTYPE_TRANSFERABLE)
{
if ((listener->getPermissionMask() & PERM_TRANSFER) == 0)
{
return FALSE;
}
}
// </FS:Ansariel>
// <FS>
////////////////////////////////////////////////////////////////////////////////
// FILTERTYPE_WORN
@ -1055,13 +1068,35 @@ void LLInventoryFilter::setFindAllLinksMode(const std::string &search_name, cons
}
// <FS>
void LLInventoryFilter::setFilterWorn(BOOL sl)
void LLInventoryFilter::setFilterWorn(BOOL worn)
{
setModified();
mFilterOps.mFilterTypes |= FILTERTYPE_WORN;
if (worn)
{
mFilterOps.mFilterTypes |= FILTERTYPE_WORN;
}
else
{
mFilterOps.mFilterTypes &= ~FILTERTYPE_WORN;
}
}
// </FS>
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
void LLInventoryFilter::setFilterTransferable(BOOL transferable)
{
setModified();
if (transferable)
{
mFilterOps.mFilterTypes |= FILTERTYPE_TRANSFERABLE;
}
else
{
mFilterOps.mFilterTypes &= ~FILTERTYPE_TRANSFERABLE;
}
}
// </FS:Ansariel>
void LLInventoryFilter::markDefault()
{
mDefaultFilterOps = mFilterOps;
@ -1278,6 +1313,13 @@ const std::string& LLInventoryFilter::getFilterText()
mFilterText.erase(mFilterText.size() - 1, 1);
}
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
if (getFilterTransferable())
{
mFilterText += LLTrans::getString("Transfer Only");
}
// </FS:Ansariel>
if (isSinceLogoff())
{
mFilterText += LLTrans::getString("Since Logoff");
@ -1297,6 +1339,8 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe
setFilterSubString(other.getFilterSubString());
setDateRangeLastLogoff(other.isSinceLogoff());
setFilterWorn(other.getFilterWorn());
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
setFilterTransferable(other.getFilterTransferable());
return *this;
}
@ -1315,6 +1359,8 @@ void LLInventoryFilter::toParams(Params& params) const
params.filter_ops.date_search_direction = getDateSearchDirection();
params.filter_ops.show_folder_state = getShowFolderState();
params.filter_ops.permissions = getFilterPermissions();
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
params.filter_ops.transferable = getFilterTransferable();
params.substring = getFilterSubString();
params.since_logoff = isSinceLogoff();
}
@ -1369,6 +1415,12 @@ void LLInventoryFilter::fromParams(const Params& params)
{
setFilterPermissions(params.filter_ops.permissions);
}
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
if (params.filter_ops.transferable.isProvided())
{
setFilterTransferable(params.filter_ops.transferable);
}
// </FS:Ansariel>
// <FS:Ansariel> FIRE-8947: Don't restore filter string on relog
//if (params.substring.isProvided())
//{

View File

@ -59,6 +59,7 @@ public:
FILTERTYPE_MARKETPLACE_LISTING_FOLDER = 0x1 << 9, // pass iff folder is a listing folder
FILTERTYPE_NO_MARKETPLACE_ITEMS = 0x1 << 10, // pass iff folder is not under the marketplace
FILTERTYPE_WORN = 0x1 << 11, // <FS> search by wearable type
FILTERTYPE_TRANSFERABLE = 0x1 << 12 // <FS:Ansariel> FIRE-19340: search inventory by transferable permission
};
enum EFilterDateDirection
@ -122,6 +123,7 @@ public:
Optional<U32> date_search_direction;
Optional<EFolderShow> show_folder_state;
Optional<PermissionMask> permissions;
Optional<bool> transferable; // <FS:Ansariel> FIRE-19340: search inventory by transferable permission
Params()
: types("filter_types", FILTERTYPE_OBJECT),
@ -134,7 +136,8 @@ public:
hours_ago("hours_ago", 0),
date_search_direction("date_search_direction", FILTERDATEDIRECTION_NEWER),
show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS),
permissions("permissions", PERM_NONE)
permissions("permissions", PERM_NONE),
transferable("transferable", false) // <FS:Ansariel> FIRE-19340: search inventory by transferable permission
{}
};
@ -227,8 +230,15 @@ public:
// sets params for Link-only search and backs up search settings for future restoration
void setFindAllLinksMode(const std::string &search_name, const LLUUID& search_id);
void setFilterWorn(BOOL sl);
// <FS>
void setFilterWorn(BOOL worn);
BOOL getFilterWorn() const { return mFilterOps.mFilterTypes & FILTERTYPE_WORN; }
// </FS>
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
void setFilterTransferable(BOOL transferable);
BOOL getFilterTransferable() const { return mFilterOps.mFilterTypes & FILTERTYPE_TRANSFERABLE; }
// </FS:Ansariel>
// +-------------------------------------------------------------------+
// + Execution And Results

View File

@ -406,7 +406,7 @@ void LLInventoryPanel::setFilterSubString(const std::string& string)
getFilter().setFilterSubString(string);
}
// ## Zi: Extended Inventory Search
// <FS:Zi> Extended Inventory Search
void LLInventoryPanel::setFilterSubStringTarget(const std::string& target)
{
getFilter().setFilterSubStringTarget(target);
@ -416,7 +416,7 @@ LLInventoryFilter::EFilterSubstringTarget LLInventoryPanel::getFilterSubStringTa
{
return getFilter().getFilterSubStringTarget();
}
// ## Zi: Extended Inventory Search
// </FS:Zi> Extended Inventory Search
const std::string LLInventoryPanel::getFilterSubString()
{
@ -461,12 +461,26 @@ void LLInventoryPanel::setFilterLinks(U64 filter_links)
getFilter().setFilterLinks(filter_links);
}
// ## Zi: Filter Links Menu
// <FS:Zi> Filter Links Menu
U64 LLInventoryPanel::getFilterLinks()
{
return getFilter().getFilterLinks();
}
// ## Zi: Filter Links Menu
// </FS:Zi> Filter Links Menu
// <FS>
void LLInventoryPanel::setWorn(BOOL worn)
{
getFilter().setFilterWorn(worn);
}
// </FS>
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
void LLInventoryPanel::setTransferable(BOOL transferable)
{
getFilter().setFilterTransferable(transferable);
}
// </FS:Ansariel>
void LLInventoryPanel::setShowFolderState(LLInventoryFilter::EFolderShow show)
{
@ -1692,11 +1706,6 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params)
mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER;
}
void LLInventoryPanel::setWorn(BOOL sl)
{
getFilter().setFilterWorn(sl);
}
/************************************************************************/
/* Worn Inventory Panel related class */
/************************************************************************/

View File

@ -179,16 +179,18 @@ public:
void setFilterWearableTypes(U64 filter);
void setFilterSubString(const std::string& string);
const std::string getFilterSubString();
// ## Zi: Extended Inventory Search
// <FS:Zi> Extended Inventory Search
void setFilterSubStringTarget(const std::string& target);
LLInventoryFilter::EFilterSubstringTarget getFilterSubStringTarget() const;
// ## Zi: Extended Inventory Search
// </FS:Zi> Extended Inventory Search
void setSinceLogoff(BOOL sl);
void setHoursAgo(U32 hours);
void setDateSearchDirection(U32 direction);
BOOL getSinceLogoff();
void setFilterLinks(U64 filter_links);
U64 getFilterLinks(); // ## Zi: Filter Links Menu
U64 getFilterLinks(); // <FS:Zi> Filter Links Menu
void setWorn(BOOL worn); // <FS>
void setTransferable(BOOL transferable); // <FS:Ansariel> FIRE-19340: search inventory by transferable permission
void setShowFolderState(LLInventoryFilter::EFolderShow show);
LLInventoryFilter::EFolderShow getShowFolderState();
@ -317,9 +319,6 @@ protected:
private:
bool mBuildDefaultHierarchy; // default inventory hierarchy should be created in postBuild()
bool mViewsInitialized; // Views have been generated
public:
void setWorn(BOOL sl);
};
#endif // LL_LLINVENTORYPANEL_H

View File

@ -889,9 +889,7 @@ void LLPanelMainInventory::draw()
mResortActivePanel = false;
}
LLPanel::draw();
/// <FS:CR> This really doesn't need updated every frame. changed() handles
/// it whenever inventory changes.
//updateItemcountText();
updateItemcountText();
}
void LLPanelMainInventory::updateItemcountText()
@ -941,12 +939,12 @@ void LLPanelMainInventory::onFocusReceived()
void LLPanelMainInventory::setFilterTextFromFilter()
{
//mFilterText = mActivePanel->getFilter().getFilterText();
// ## Zi: Filter dropdown
// <FS:Zi> Filter dropdown
// this method gets called by the filter subwindow (once every frame), so we update our combo box here
LLInventoryFilter &filter = mActivePanel->getFilter();
updateFilterDropdown(&filter);
mFilterText = filter.getFilterText();
// ## Zi: Filter dropdown
// </FS:Zi> Filter dropdown
}
void LLPanelMainInventory::toggleFindOptions()
@ -1116,6 +1114,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
getChild<LLUICtrl>("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND));
getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
getChild<LLUICtrl>("check_transferable")->setValue(mFilter->getFilterTransferable()); // <FS:Ansariel> FIRE-19340: search inventory by transferable permission
getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
mSpinSinceHours->set((F32)(hours % 24));
@ -1236,6 +1235,8 @@ void LLFloaterInventoryFinder::draw()
mPanelMainInventory->getPanel()->setHoursAgo(hours);
mPanelMainInventory->getPanel()->setSinceLogoff(getCheckSinceLogoff());
// <FS:Ansariel> FIRE-19340: search inventory by transferable permission
mPanelMainInventory->getPanel()->setTransferable(getChild<LLUICtrl>("check_transferable")->getValue().asBoolean());
mPanelMainInventory->setFilterTextFromFilter();
mPanelMainInventory->getPanel()->setDateSearchDirection(getDateSearchDirection());
@ -1303,7 +1304,7 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
self->getChild<LLUICtrl>("check_snapshot")->setValue(FALSE);
}
// ## Zi: Inventory Collapse and Expand Buttons
// <FS:Zi> Inventory Collapse and Expand Buttons
void LLPanelMainInventory::onCollapseButtonClicked()
{
// mFilterEditor->clear();
@ -1315,7 +1316,7 @@ void LLPanelMainInventory::onExpandButtonClicked()
{
getPanel()->openAllFolders();
}
// ## Zi: Inventory Collapse and Expand Buttons
// </FS:Zi> Inventory Collapse and Expand Buttons
//////////////////////////////////////////////////////////////////////////////////
// List Commands //

View File

@ -45,7 +45,7 @@ class LLMenuButton;
class LLMenuGL;
class LLToggleableMenu;
class LLFloater;
class LLComboBox; // ## Zi: Filter dropdown
class LLComboBox; // <FS:Zi> Filter dropdown
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPanelMainInventory
@ -87,10 +87,10 @@ public:
void setFocusFilterEditor();
// ## Zi: Filter dropdown
// <FS:Zi> Filter dropdown
void onFilterTypeSelected(const std::string& filter_type_name);
void updateFilterDropdown(const LLInventoryFilter* filter);
// ## Zi: Filter dropdown
// </FS:Zi> Filter dropdown
// <FS:Ansariel> FIRE-12808: Don't save filters during settings restore
static bool sSaveFilters;
@ -123,19 +123,19 @@ protected:
void doCreate(const LLSD& userdata);
void resetFilters();
// ## Zi: Sort By menu handlers
// <FS:Zi> Sort By menu handlers
void setSortBy(const LLSD& userdata);
BOOL isSortByChecked(const LLSD& userdata);
// ## Zi: Sort By menu handlers
// </FS:Zi> Sort By menu handlers
void saveTexture(const LLSD& userdata);
bool isSaveTextureEnabled(const LLSD& userdata);
void updateItemcountText();
// ## Zi: Inventory Collapse and Expand Buttons
// <FS:Zi> Inventory Collapse and Expand Buttons
void onCollapseButtonClicked();
void onExpandButtonClicked();
// ## Zi: Inventory Collapse and Expand Buttons
// </FS:Zi> Inventory Collapse and Expand Buttons
void onFocusReceived();
private:
@ -154,11 +154,11 @@ private:
std::string mItemCountString;
LLTextBox* mItemcountText;
// ## Zi: Filter dropdown
// <FS:Zi> Filter dropdown
LLComboBox* mFilterComboBox;
std::map<std::string,U64> mFilterMap; // contains name-to-number mapping for dropdown filter types
U64 mFilterMask; // contains the cumulated bit filter for all dropdown filter types
// ## Zi: Filter dropdown
// </FS:Zi> Filter dropdown
//////////////////////////////////////////////////////////////////////////////////
// List Commands //
@ -173,16 +173,16 @@ protected:
BOOL isActionChecked(const LLSD& userdata);
void onCustomAction(const LLSD& command_name);
// ## Zi: Filter Links Menu
// <FS:Zi> Filter Links Menu
BOOL isFilterLinksChecked(const LLSD& userdata);
void onFilterLinksChecked(const LLSD& userdata);
// ## Zi: Filter Links Menu
// </FS:Zi> Filter Links Menu
// ## Zi: Extended Inventory Search
// <FS:Zi> Extended Inventory Search
BOOL isSearchTargetChecked(const LLSD& userdata);
void onSearchTargetChecked(const LLSD& userdata);
LLInventoryFilter::EFilterSubstringTarget getSearchTarget() const;
// ## Zi: Extended Inventory Search
// </FS:Zi> Extended Inventory Search
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
/**
@ -195,10 +195,10 @@ private:
LLMenuGL* mMenuAdd;
LLMenuButton* mGearMenuButton;
// ## Zi: Inventory Collapse and Expand Buttons
// <FS:Zi> Inventory Collapse and Expand Buttons
LLButton* mCollapseBtn;
LLButton* mExpandBtn;
// ## Zi: Inventory Collapse and Expand Buttons
// </FS:Zi> Inventory Collapse and Expand Buttons
bool mNeedUploadCost;
// List Commands //

View File

@ -14,6 +14,7 @@
<check_box label="Fotos" name="check_snapshot"/>
<button label="Alle" label_selected="Alle" name="All"/>
<button label="Keine" label_selected="Keine" name="None"/>
<check_box label="Nur Transferierbar" name="check_transferable"/>
<check_box label="Ordner immer anz." name="check_show_empty"/>
<check_box label="Seit Abmeldung" name="check_since_logoff"/>
<text name="- OR -">

View File

@ -1791,6 +1791,7 @@ Warten Sie kurz und versuchen Sie dann noch einmal, sich anzumelden.
<string name="Snapshots" value=" Fotos,"/>
<string name="No Filters" value="Keine"/>
<string name="Since Logoff" value=" - Seit Abmeldung"/>
<string name="Transfer Only" value=" - Nur Transfer"/>
<string name="InvFolder My Inventory">
Inventar
</string>

View File

@ -2,7 +2,7 @@
<floater
legacy_header_height="18"
can_minimize="false"
height="470"
height="486"
layout="topleft"
name="Inventory Finder"
help_topic="inventory_finder"
@ -229,13 +229,21 @@
left="8"
name="None"
width="100" />
<check_box
height="16"
label="Transfer only"
layout="topleft"
left="8"
name="check_transferable"
top_pad="6"
width="144" />
<check_box
height="16"
label="Always show folders"
layout="topleft"
left="8"
name="check_show_empty"
top_pad="6"
top_pad="0"
width="144" />
<check_box
height="16"

View File

@ -831,6 +831,7 @@ This feature is currently in Beta. Please add your name to this [http://goo.gl/f
<string name="Snapshots" value=" Snapshots," />
<string name="No Filters" value="No " />
<string name="Since Logoff" value=" - Since Logoff" />
<string name="Transfer Only" value=" - Transfer only" />
<!-- inventory folder -->
<string name="InvFolder My Inventory">Inventory</string>