void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { if (sl && !isSinceLogoff()) { setDateRange(mLastLogoff, time_max()); setModified(); } if (!sl && isSinceLogoff()) { setDateRange(0, time_max()); setModified(); } mFilterOps.mFilterTypes |= FILTERTYPE_DATE; }
void LLInventoryFilter::toLLSD(LLSD& data) const { data["filter_types"] = (LLSD::Integer)getFilterObjectTypes(); data["min_date"] = (LLSD::Integer)getMinDate(); data["max_date"] = (LLSD::Integer)getMaxDate(); data["hours_ago"] = (LLSD::Integer)getHoursAgo(); data["show_folder_state"] = (LLSD::Integer)getShowFolderState(); data["permissions"] = (LLSD::Integer)getFilterPermissions(); data["substring"] = (LLSD::String)getFilterSubString(); data["sort_order"] = (LLSD::Integer)getSortOrder(); data["since_logoff"] = (LLSD::Boolean)isSinceLogoff(); }
void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { if (sl && !isSinceLogoff()) { setDateRange(mLastLogoff, time_max()); setModified(); } if (!sl && isSinceLogoff()) { setDateRange(time_min(), time_max()); setModified(); } if (areDateLimitsSet()) { mFilterOps.mFilterTypes |= FILTERTYPE_DATE; } else { mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE; } }
void LLInventoryFilter::setHoursAgo(U32 hours) { if (mFilterOps.mHoursAgo != hours) { bool are_date_limits_valid = mFilterOps.mMinDate == time_min() && mFilterOps.mMaxDate == time_max(); bool is_increasing = hours > mFilterOps.mHoursAgo; bool is_decreasing = hours < mFilterOps.mHoursAgo; bool is_increasing_from_zero = is_increasing && !mFilterOps.mHoursAgo && !isSinceLogoff(); // *NOTE: need to cache last filter time, in case filter goes stale BOOL less_restrictive; BOOL more_restrictive; if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection) { less_restrictive = ((are_date_limits_valid && ((is_increasing && mFilterOps.mHoursAgo))) || !hours); more_restrictive = ((are_date_limits_valid && (!is_increasing && hours)) || is_increasing_from_zero); } else { less_restrictive = ((are_date_limits_valid && ((is_decreasing && mFilterOps.mHoursAgo))) || !hours); more_restrictive = ((are_date_limits_valid && (!is_decreasing && hours)) || is_increasing_from_zero); } mFilterOps.mHoursAgo = hours; mFilterOps.mMinDate = time_min(); mFilterOps.mMaxDate = time_max(); if (less_restrictive) { setModified(FILTER_LESS_RESTRICTIVE); } else if (more_restrictive) { setModified(FILTER_MORE_RESTRICTIVE); } else { setModified(FILTER_RESTART); } } if (areDateLimitsSet()) { mFilterOps.mFilterTypes |= FILTERTYPE_DATE; } else { mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE; } }
void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { static LLCachedControl<U32> s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0); if (sl && !isSinceLogoff()) { setDateRange(s_last_logoff(), time_max()); setModified(); } if (!sl && isSinceLogoff()) { setDateRange(time_min(), time_max()); setModified(); } if (areDateLimitsSet()) { mFilterOps.mFilterTypes |= FILTERTYPE_DATE; } else { mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE; } }
void LLInventoryFilter::toParams(Params& params) const { params.filter_ops.types = getFilterObjectTypes(); params.filter_ops.category_types = getFilterCategoryTypes(); if (getFilterObjectTypes() & FILTERTYPE_WEARABLE) { params.filter_ops.wearable_types = getFilterWearableTypes(); } params.filter_ops.date_range.min_date = getMinDate(); params.filter_ops.date_range.max_date = getMaxDate(); params.filter_ops.hours_ago = getHoursAgo(); params.filter_ops.date_search_direction = getDateSearchDirection(); params.filter_ops.show_folder_state = getShowFolderState(); params.filter_ops.permissions = getFilterPermissions(); params.substring = getFilterSubString(); params.since_logoff = isSinceLogoff(); }
const std::string& LLInventoryFilter::getFilterText() { if (!mNeedTextRebuild) { return mFilterText; } mNeedTextRebuild = FALSE; std::string filtered_types; std::string not_filtered_types; BOOL filtered_by_type = FALSE; BOOL filtered_by_all_types = TRUE; S32 num_filter_types = 0; mFilterText.clear(); if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) { //filtered_types += " Animations,"; filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Animations,"; not_filtered_types += LLTrans::getString("Animations"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD)) { //filtered_types += " Calling Cards,"; filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Calling Cards,"; not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE)) { //filtered_types += " Clothing,"; filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Clothing,"; not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE)) { //filtered_types += " Gestures,"; filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Gestures,"; not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK)) { //filtered_types += " Landmarks,"; filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Landmarks,"; not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD)) { //filtered_types += " Notecards,"; filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Notecards,"; not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT)) { //filtered_types += " Objects,"; filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Objects,"; not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LSL)) { //filtered_types += " Scripts,"; filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Scripts,"; not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND)) { //filtered_types += " Sounds,"; filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Sounds,"; not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE)) { //filtered_types += " Textures,"; filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Textures,"; not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT)) { //filtered_types += " Snapshots,"; filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { //not_filtered_types += " Snapshots,"; not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive() && filtered_by_type && !filtered_by_all_types) { mFilterText += " - "; if (num_filter_types < 5) { mFilterText += filtered_types; } else { //mFilterText += "No "; mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } // remove the ',' at the end mFilterText.erase(mFilterText.size() - 1, 1); } if (isSinceLogoff()) { //mFilterText += " - Since Logoff"; mFilterText += LLTrans::getString("Since Logoff"); } return mFilterText; }
bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const { if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); const LLUUID object_id = listener->getUUID(); const LLInventoryObject *object = gInventory.getObject(object_id); const U32 filterTypes = mFilterOps.mFilterTypes; //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_OBJECT // Pass if this item's type is of the correct filter type if (filterTypes & FILTERTYPE_OBJECT) { // If it has no type, pass it, unless it's a link. if (object_type == LLInventoryType::IT_NONE) { if (object && object->getIsLinkType()) { return FALSE; } } else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0)) { return FALSE; } } //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_UUID // Pass if this item is the target UUID or if it links to the target UUID if (filterTypes & FILTERTYPE_UUID) { if (!object) return FALSE; if (object->getLinkedUUID() != mFilterOps.mFilterUUID) return FALSE; } //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_DATE // Pass if this item is within the date range. if (filterTypes & FILTERTYPE_DATE) { const U16 HOURS_TO_SECONDS = 3600; time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS; if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest) { earliest = mFilterOps.mMinDate; } else if (!mFilterOps.mHoursAgo) { earliest = 0; } if (FILTERDATEDIRECTION_NEWER == mFilterOps.mDateSearchDirection || isSinceLogoff()) { if (listener->getCreationDate() < earliest || listener->getCreationDate() > mFilterOps.mMaxDate) return FALSE; } else { if (listener->getCreationDate() > earliest || listener->getCreationDate() > mFilterOps.mMaxDate) return FALSE; } } //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_WEARABLE // Pass if this item is a wearable of the appropriate type if (filterTypes & FILTERTYPE_WEARABLE) { LLWearableType::EType type = listener->getWearableType(); if ((0x1LL << type & mFilterOps.mFilterWearableTypes) == 0) { return FALSE; } } // <FS> //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_WORN // Pass if this item is worn (hiding COF and Outfits folders) if (filterTypes & FILTERTYPE_WORN) { if (!object) { return FALSE; } const LLUUID& cat_id = object->getParentUUID(); const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); return !LLAppearanceMgr::instance().getIsInCOF(object_id) // Not a link in COF && (!cat || cat->getPreferredType() != LLFolderType::FT_OUTFIT) // Not a link in an outfit folder && get_is_item_worn(object_id); } // </FS> //////////////////////////////////////////////////////////////////////////////// // FILTERTYPE_EMPTYFOLDERS // Pass if this item is a folder and is not a system folder that should be hidden if (filterTypes & FILTERTYPE_EMPTYFOLDERS) { if (object_type == LLInventoryType::IT_CATEGORY) { bool is_hidden_if_empty = LLViewerFolderType::lookupIsHiddenIfEmpty(listener->getPreferredType()); if (is_hidden_if_empty) { // Force the fetching of those folders so they are hidden if they really are empty... gInventory.fetchDescendentsOf(object_id); LLInventoryModel::cat_array_t* cat_array = NULL; LLInventoryModel::item_array_t* item_array = NULL; gInventory.getDirectDescendentsOf(object_id,cat_array,item_array); S32 descendents_actual = 0; if(cat_array && item_array) { descendents_actual = cat_array->size() + item_array->size(); } if (descendents_actual == 0) { return FALSE; } } } } return TRUE; }