diff options
| -rwxr-xr-x | indra/newview/llinventoryfilter.cpp | 39 | ||||
| -rwxr-xr-x | indra/newview/llinventoryfilter.h | 4 | ||||
| -rwxr-xr-x | indra/newview/llpanelmaininventory.cpp | 8 | 
3 files changed, 40 insertions, 11 deletions
| diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index dc8b15a5bf..9f6a042e41 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -68,7 +68,8 @@ LLInventoryFilter::LLInventoryFilter(const Params& p)  :	mName(p.name),  	mFilterModified(FILTER_NONE),  	mEmptyLookupMessage("InventoryNoMatchingItems"), -    mFilterOps(p.filter_ops), +	mFilterOps(p.filter_ops), +	mBackupFilterOps(mFilterOps),  	mFilterSubString(p.substring),  	mCurrentGeneration(0),  	mFirstRequiredGeneration(0), @@ -546,6 +547,21 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)  			setModified(FILTER_RESTART);  		} +		// Cancel out filter links once the search string is modified +		if (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS) +		{ +			if (mBackupFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS) +			{ +				// we started viewer/floater in 'only links' mode +				mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS; +			} +			else +			{ +				mFilterOps = mBackupFilterOps; +				setModified(FILTER_RESTART); +			} +		} +  		// Cancel out UUID once the search string is modified  		if (mFilterOps.mFilterTypes == FILTERTYPE_UUID)  		{ @@ -553,11 +569,6 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)  			mFilterOps.mFilterUUID == LLUUID::null;  			setModified(FILTER_RESTART);  		} - -		// Cancel out filter links once the search string is modified -		{ -			mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS; -		}  	}  } @@ -748,6 +759,22 @@ void LLInventoryFilter::setShowFolderState(EFolderShow state)  	}  } +void LLInventoryFilter::setFindAllLinksMode(const std::string &search_name, const LLUUID& search_id) +{ +	// Save a copy of settings so that we will be able to restore it later +	// but make sure we are not searching for links already +	if(mFilterOps.mFilterLinks != FILTERLINK_ONLY_LINKS) +	{ +		mBackupFilterOps = mFilterOps; +	} +	 +	// set search options +	setFilterSubString(search_name); +	setFilterUUID(search_id); +	setShowFolderState(SHOW_NON_EMPTY_FOLDERS); +	setFilterLinks(FILTERLINK_ONLY_LINKS); +} +  void LLInventoryFilter::markDefault()  {  	mDefaultFilterOps = mFilterOps; diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 5e18ad4d20..6e35c48c7b 100755 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -193,6 +193,9 @@ public:  	void 				setFilterLinks(U64 filter_link);  	U64					getFilterLinks() const; +	// 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); +  	// +-------------------------------------------------------------------+  	// + Execution And Results  	// +-------------------------------------------------------------------+ @@ -267,6 +270,7 @@ private:  	FilterOps				mFilterOps;  	FilterOps				mDefaultFilterOps; +	FilterOps				mBackupFilterOps; // for backup purposes when leaving 'search link' mode  	std::string				mFilterSubString;  	std::string				mFilterSubStringOrig; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index eb037577be..5b5378838d 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1134,14 +1134,12 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)  		const LLUUID& item_id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID();  		const std::string &item_name = current_item->getViewModelItem()->getName();  		mFilterSubString = item_name; +  		LLInventoryFilter &filter = mActivePanel->getFilter(); -		filter.setFilterSubString(item_name); -		mFilterEditor->setText(item_name); +		filter.setFindAllLinksMode(item_name, item_id); +		mFilterEditor->setText(item_name);  		mFilterEditor->setFocus(TRUE); -		filter.setFilterUUID(item_id); -		filter.setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); -		filter.setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS);  	}  } | 
