From 8ae1ec8b3765d829250a4372270c0dac47c2dd7e Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 30 Aug 2010 05:05:43 -0700 Subject: Fixed #455: inventory found items vanish after a certain amount of time. Also fixed several inventory search bugs by updating desc. etc. searches to the latest Emerald version --- linden/indra/newview/app_settings/settings.xml | 22 +- linden/indra/newview/llfolderview.cpp | 304 +++++++++++++-------- linden/indra/newview/llfolderview.h | 75 +++-- linden/indra/newview/llinventoryactions.cpp | 18 +- linden/indra/newview/llinventoryview.cpp | 40 ++- linden/indra/newview/llinventoryview.h | 5 + .../skins/default/xui/en-us/floater_inventory.xml | 2 +- 7 files changed, 300 insertions(+), 166 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index acdb0a6..76f549d 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -288,17 +288,6 @@ Value http://support.secondlife.com - InventorySearchType - - Comment - Controls what type of inventory search we perform. - Persist - 0 - Type - U32 - Value - 0 - IgnoreSimulatorCameraConstraints Comment @@ -932,6 +921,17 @@ Value 1 + WornItemsSortOrder + + Comment + Specifies sort key for worn inventory items (+0 = name, +1 = date, +2 = folders always by name, +4 = system folders to top) + Persist + 1 + Type + U32 + Value + 7 + DefaultGrid Comment diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index e87ac0c..16c0aa9 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp @@ -162,7 +162,6 @@ LLFolderViewItem::LLFolderViewItem( const std::string& name, LLUIImagePtr icon, mIcon(icon), mHasVisibleChildren(FALSE), mIndentation(0), - mNumDescendantsSelected(0), mFiltered(FALSE), mLastFilterGeneration(-1), mStringMatchOffset(std::string::npos), @@ -350,7 +349,8 @@ void LLFolderViewItem::refresh() if (mSearchableLabel.compare(searchable_label) || mSearchableLabelCreator.compare(searchable_label_creator) || - mSearchableLabelDesc.compare(searchable_label_creator)) + mSearchableLabelDesc.compare(searchable_label_desc) || + mSearchableLabelAll.compare(searchable_label_all)) { mSearchableLabel.assign(searchable_label); mSearchableLabelCreator.assign(searchable_label_creator); @@ -358,28 +358,10 @@ void LLFolderViewItem::refresh() mSearchableLabelAll.assign(searchable_label_all); dirtyFilter(); - //some part of label has changed, so overall width has potentially changed + // some part of label has changed, so overall width has potentially changed if (mParentFolder) mParentFolder->requestArrange(); } - - /*if(mSearchableLabelCreator.compare(searchable_label_creator)) - { - mSearchableLabelCreator.assign(searchable_label_creator); - - dirtyFilter(); - if(mParentFolder) - mParentFolder->requestArrange(); - } - - if(mSearchableLabelDesc.compare(searchable_label_desc)) - { - mSearchableLabelDesc.assign(searchable_label_desc); - - dirtyFilter(); - if(mParentFolder) - mParentFolder->requestArrange(); - }*/ S32 label_width = sFont->getWidth(mLabel); if( mLabelSuffix.size() ) @@ -517,26 +499,33 @@ void LLFolderViewItem::dirtyFilter() // together. BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) { - if( selection == this ) + if (selection == this && !mIsSelected) { - mIsSelected = TRUE; + selectItem(); if(mListener) { mListener->selectItem(); } } - else + else if (mIsSelected) // Deselect everything else. { - mIsSelected = FALSE; + deselectItem(); } return mIsSelected; } BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) { - if(selection == this && mIsSelected != selected) + if (selection == this && mIsSelected != selected) { - mIsSelected = selected; + if (mIsSelected) + { + deselectItem(); + } + else + { + selectItem(); + } if(mListener) { mListener->selectItem(); @@ -546,22 +535,33 @@ BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selecte return FALSE; } -void LLFolderViewItem::recursiveDeselect(BOOL deselect_self) +void LLFolderViewItem::deselectItem(void) { - if (mIsSelected && deselect_self) - { - mIsSelected = FALSE; + llassert(mIsSelected); - // update ancestors' count of selected descendents - LLFolderViewFolder* parent_folder = getParentFolder(); - while(parent_folder) - { - parent_folder->mNumDescendantsSelected--; - parent_folder = parent_folder->getParentFolder(); - } + mIsSelected = FALSE; + + // Update ancestors' count of selected descendents. + LLFolderViewFolder* parent_folder = getParentFolder(); + if (parent_folder) + { + parent_folder->recursiveIncrementNumDescendantsSelected(-1); } } +void LLFolderViewItem::selectItem(void) +{ + llassert(!mIsSelected); + + mIsSelected = TRUE; + + // Update ancestors' count of selected descendents. + LLFolderViewFolder* parent_folder = getParentFolder(); + if (parent_folder) + { + parent_folder->recursiveIncrementNumDescendantsSelected(1); + } +} BOOL LLFolderViewItem::isMovable() { @@ -654,16 +654,20 @@ void LLFolderViewItem::rename(const std::string& new_name) } } -const std::string& LLFolderViewItem::getSearchableLabel(U32 search_type = 0) const +const std::string& LLFolderViewItem::getSearchableLabel() const { - if(search_type == 3) - return mSearchableLabelAll; - else if(search_type == 2) - return mSearchableLabelDesc; - else if(search_type == 1) + U32 type = mRoot->getFilter()->getSearchType(); + switch(type) + { + case 1: return mSearchableLabelCreator; - else + case 2: + return mSearchableLabelDesc; + case 3: + return mSearchableLabelAll; + default: return mSearchableLabel; + } } const std::string& LLFolderViewItem::getName( void ) const @@ -1022,9 +1026,16 @@ void LLFolderViewItem::draw() { // don't draw backgrounds for zero-length strings S32 filter_string_length = mRoot->getFilterSubString().size(); - if (filter_string_length > 0) + + std::string combined_string = mLabel + mLabelSuffix; + + //fix so that highlighting works properly again - rkeast + std::string check = combined_string; + LLStringUtil::toUpper(check); + + if ((filter_string_length > 0) && (check.find(mRoot->getFilterSubString()) != -1)) { - std::string combined_string = mLabel + mLabelSuffix; +// llinfos << "mLabel " << mLabel<< " mLabelSuffix " << mLabelSuffix << " mLabel " << mLabel << " mLabel " << mLabel << llendl; S32 left = llround(text_left) + sFont->getWidth(combined_string, 0, mStringMatchOffset) - 1; S32 right = left + sFont->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; S32 bottom = llfloor(getRect().getHeight() - sFont->getLineHeight() - 3); @@ -1057,6 +1068,7 @@ LLFolderViewFolder::LLFolderViewFolder( const std::string& name, LLUIImagePtr ic LLFolderView* root, LLFolderViewEventListener* listener ): LLFolderViewItem( name, icon, 0, root, listener ), // 0 = no create time + mNumDescendantsSelected(0), mIsOpen(FALSE), mExpanderHighlighted(FALSE), mCurHeight(0.f), @@ -1423,6 +1435,21 @@ BOOL LLFolderViewFolder::hasFilteredDescendants() return mMostFilteredDescendantGeneration >= mRoot->getFilter()->getCurrentGeneration(); } +void LLFolderViewFolder::recursiveIncrementNumDescendantsSelected(S32 increment) +{ + LLFolderViewFolder* parent_folder = this; + do + { + parent_folder->mNumDescendantsSelected += increment; + + // Make sure we don't have negative values. + llassert(parent_folder->mNumDescendantsSelected >= 0); + + parent_folder = parent_folder->getParentFolder(); + } + while(parent_folder); +} + // Passes selection information on to children and record selection // information if necessary. BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, @@ -1431,7 +1458,10 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem BOOL rv = FALSE; if( selection == this ) { - mIsSelected = TRUE; + if (!isSelected()) + { + selectItem(); + } if(mListener) { mListener->selectItem(); @@ -1440,7 +1470,10 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem } else { - mIsSelected = FALSE; + if (isSelected()) + { + deselectItem(); + } rv = FALSE; } BOOL child_selected = FALSE; @@ -1453,7 +1486,6 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem { rv = TRUE; child_selected = TRUE; - mNumDescendantsSelected++; } } for (items_t::iterator iter = mItems.begin(); @@ -1464,7 +1496,6 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem { rv = TRUE; child_selected = TRUE; - mNumDescendantsSelected++; } } if(openitem && child_selected) @@ -1474,37 +1505,39 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem return rv; } -// This method is used to change the selection of an item. If -// selection is 'this', then note selection as true. Returns TRUE -// if this or a child is now selected. -BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, - BOOL selected) +// This method is used to change the selection of an item. +// Recursively traverse all children; if 'selection' is 'this' then change +// the select status if necessary. +// Returns TRUE if the selection state of this folder, or of a child, was changed. +BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected) { BOOL rv = FALSE; if(selection == this) { - mIsSelected = selected; + if (isSelected() != selected) + { + rv = TRUE; + if (selected) + { + selectItem(); + } + else + { + deselectItem(); + } + } if(mListener && selected) { mListener->selectItem(); } - rv = TRUE; } for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) { folders_t::iterator fit = iter++; - if((*fit)->changeSelection(selection, selected)) + if ((*fit)->changeSelection(selection, selected)) { - if (selected) - { - mNumDescendantsSelected++; - } - else - { - mNumDescendantsSelected--; - } rv = TRUE; } } @@ -1512,33 +1545,22 @@ BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, iter != mItems.end();) { items_t::iterator iit = iter++; - if((*iit)->changeSelection(selection, selected)) + if ((*iit)->changeSelection(selection, selected)) { - if (selected) - { - mNumDescendantsSelected++; - } - else - { - mNumDescendantsSelected--; - } rv = TRUE; } } return rv; } -S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& selected_items) +void LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& selected_items) { - S32 num_selected = 0; - // pass on to child folders first for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) { folders_t::iterator fit = iter++; - num_selected += (*fit)->extendSelection(selection, last_selected, selected_items); - mNumDescendantsSelected += num_selected; + (*fit)->extendSelection(selection, last_selected, selected_items); } // handle selection of our immediate children... @@ -1631,8 +1653,6 @@ S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderVie if (item->changeSelection(item, TRUE)) { selected_items.put(item); - mNumDescendantsSelected++; - num_selected++; } } } @@ -1642,30 +1662,15 @@ S32 LLFolderViewFolder::extendSelection(LLFolderViewItem* selection, LLFolderVie if (selection->changeSelection(selection, TRUE)) { selected_items.put(selection); - mNumDescendantsSelected++; - num_selected++; } } - - return num_selected; } void LLFolderViewFolder::recursiveDeselect(BOOL deselect_self) { - // make sure we don't have negative values - llassert(mNumDescendantsSelected >= 0); - - if (mIsSelected && deselect_self) + if (isSelected() && deselect_self) { - mIsSelected = FALSE; - - // update ancestors' count of selected descendents - LLFolderViewFolder* parent_folder = getParentFolder(); - while(parent_folder) - { - parent_folder->mNumDescendantsSelected--; - parent_folder = parent_folder->getParentFolder(); - } + deselectItem(); } if (0 == mNumDescendantsSelected) @@ -1673,14 +1678,19 @@ void LLFolderViewFolder::recursiveDeselect(BOOL deselect_self) return; } + // Deselect all items in this folder. for (items_t::iterator iter = mItems.begin(); iter != mItems.end();) { items_t::iterator iit = iter++; LLFolderViewItem* item = (*iit); - item->recursiveDeselect(TRUE); + if (item->isSelected()) + { + item->deselectItem(); + } } + // Recursively deselect all folders in this folder. for (folders_t::iterator iter = mFolders.begin(); iter != mFolders.end();) { @@ -1740,7 +1750,10 @@ void LLFolderViewFolder::removeView(LLFolderViewItem* item) return; } // deselect without traversing hierarchy - item->recursiveDeselect(TRUE); + if (item->isSelected()) + { + item->deselectItem(); + } getRoot()->removeFromSelectionList(item); extractItem(item); delete item; @@ -1756,16 +1769,24 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) // This is an evil downcast. However, it's only doing // pointer comparison to find if (which it should be ) the // item is in the container, so it's pretty safe. - LLFolderViewFolder* f = reinterpret_cast(item); + LLFolderViewFolder* f = static_cast(item); folders_t::iterator ft; ft = std::find(mFolders.begin(), mFolders.end(), f); if(ft != mFolders.end()) { + if ((*ft)->numSelected()) + { + recursiveIncrementNumDescendantsSelected(-(*ft)->numSelected()); + } mFolders.erase(ft); } } else { + if ((*it)->isSelected()) + { + recursiveIncrementNumDescendantsSelected(-1); + } mItems.erase(it); } //item has been removed, need to update filter @@ -1944,6 +1965,10 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) item, mSortFunction); mItems.insert(it,item); + if (item->isSelected()) + { + recursiveIncrementNumDescendantsSelected(1); + } item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); item->setVisible(FALSE); addChild( item ); @@ -1961,6 +1986,10 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) folder, mSortFunction); mFolders.insert(it,folder); + if (folder->numSelected()) + { + recursiveIncrementNumDescendantsSelected(folder->numSelected()); + } folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); @@ -2731,6 +2760,10 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) { mFolders.insert(mFolders.begin(), folder); } + if (folder->numSelected()) + { + recursiveIncrementNumDescendantsSelected(folder->numSelected()); + } folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); @@ -3012,29 +3045,24 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) return rv; } -S32 LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items) +void LLFolderView::extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items) { - S32 rv = 0; - // now store resulting selection if (mAllowMultiSelect) { LLFolderViewItem *cur_selection = getCurSelectedItem(); - rv = LLFolderViewFolder::extendSelection(selection, cur_selection, items); + LLFolderViewFolder::extendSelection(selection, cur_selection, items); for (S32 i = 0; i < items.count(); i++) { addToSelectionList(items[i]); - rv++; } } else { setSelection(selection, FALSE, FALSE); - rv++; } mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; - return rv; } void LLFolderView::sanitizeSelection() @@ -4554,6 +4582,8 @@ LLInventoryFilter::LLInventoryFilter(const std::string& name) : mModified(FALSE), mNeedTextRebuild(TRUE) { + //fix to get rid of gSavedSettings use - rkeast + mSearchType = 0; mFilterOps.mFilterTypes = LLInventoryType::NIT_ALL; mFilterOps.mMinDate = time_min(); mFilterOps.mMaxDate = time_max(); @@ -4599,14 +4629,49 @@ BOOL LLInventoryFilter::check(LLFolderViewItem* item) LLFolderViewEventListener* listener = item->getListener(); const LLUUID& item_id = listener->getUUID(); - U32 search_type = gSavedSettings.getU32("InventorySearchType"); - mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel(search_type).find(mFilterSubString) : std::string::npos; - BOOL passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) + //When searching for all labels, we need to explode the filter string + //Into an array, and then compare each string to the label seperately + //Otherwise the filter substring needs to be + //formatted in the same order as the label - rkeast + + BOOL passed; + //Added ability to toggle this type of searching for all labels cause it's convienient - RKeast + if(mSearchType == 3) + { + std::istringstream i(mFilterSubString); + std::string blah; + + LLDynamicArray search_array; + + while(i >> blah) + { + search_array.put(blah); + } + + BOOL subStringMatch = true; + for(int i = 0; i < search_array.getLength(); i++) + { + mSubStringMatchOffset = (search_array.get(i)).size() ? item->getSearchableLabel().find(search_array.get(i)) : std::string::npos; + subStringMatch = subStringMatch && ((search_array.get(i)).size() == 0 || mSubStringMatchOffset != std::string::npos); + } + + passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) + && (subStringMatch) + && (mFilterWorn == false || gAgent.isWearingItem(item_id) || + (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id))) + && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) + && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); + } + else + { + mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; + passed = (listener->getNInventoryType() & mFilterOps.mFilterTypes || listener->getNInventoryType() == LLInventoryType::NIT_NONE) && (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos) && (mFilterWorn == false || gAgent.isWearingItem(item_id) || (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isWearingAttachment(item_id))) && ((listener->getPermissionMask() & mFilterOps.mPermissions) == mFilterOps.mPermissions) && (listener->getCreationDate() >= earliest && listener->getCreationDate() <= mFilterOps.mMaxDate); + } return passed; } @@ -4655,6 +4720,19 @@ BOOL LLInventoryFilter::isModifiedAndClear() return ret; } + +//fix to get rid of gSavedSettings use - rkeast +void LLInventoryFilter::setSearchType(U32 type) +{ + mSearchType = type; +} + +//fix to get rid of gSavedSettings use - rkeast +U32 LLInventoryFilter::getSearchType() +{ + return mSearchType; +} + void LLInventoryFilter::setFilterTypes(U32 types) { if (mFilterOps.mFilterTypes != types) diff --git a/linden/indra/newview/llfolderview.h b/linden/indra/newview/llfolderview.h index 5e6902d..9fad72e 100644 --- a/linden/indra/newview/llfolderview.h +++ b/linden/indra/newview/llfolderview.h @@ -168,6 +168,10 @@ public: class LLInventoryFilter { public: + //fix to get rid of gSavedSettings use - rkeast + void setSearchType(U32 type); + U32 getSearchType(); + typedef enum e_folder_show { SHOW_ALL_FOLDERS, @@ -248,6 +252,9 @@ public: void fromLLSD(LLSD& data); protected: + //fix to get rid of gSavedSettings use - rkeast + U32 mSearchType; + struct filter_ops { U32 mFilterTypes; @@ -322,9 +329,12 @@ class LLFolderView; class LLFolderViewItem : public LLUICtrl { -protected: friend class LLFolderViewEventListener; +private: + BOOL mIsSelected; + +protected: static const LLFontGL* sFont; static const LLFontGL* sSmallFont; static LLColor4 sFgColor; @@ -354,7 +364,6 @@ protected: U32 mCreationDate; LLFolderViewFolder* mParentFolder; LLFolderViewEventListener* mListener; - BOOL mIsSelected; BOOL mIsCurSelection; BOOL mSelectPending; LLFontGL::StyleFlags mLabelStyle; @@ -363,7 +372,6 @@ protected: std::string mStatusText; BOOL mHasVisibleChildren; S32 mIndentation; - S32 mNumDescendantsSelected; BOOL mFiltered; S32 mLastFilterGeneration; std::string::size_type mStringMatchOffset; @@ -424,22 +432,23 @@ public: virtual void dirtyFilter(); - // If the selection is 'this' then note that otherwise - // ignore. Returns TRUE if this object was affected. If open is - // TRUE, then folders are opened up along the way to the - // selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus); + // If 'selection' is 'this' then note that otherwise ignore. + // Returns TRUE if this item ends up being selected. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); - // This method is used to toggle the selection of an item. If - // selection is 'this', then note selection, and return TRUE. + // This method is used to set the selection state of an item. + // If 'selection' is 'this' then note selection. + // Returns TRUE if the selection state of this item was changed. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); // this method is used to group select items - virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items){ return FALSE; } + virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items) { } - // this method is used to group select items - virtual void recursiveDeselect(BOOL deselect_self); + // this method is used to deselect this element + void deselectItem(); + + // this method is used to select this element + void selectItem(); // gets multiple-element selection virtual BOOL getSelectionList(std::set &selection){return TRUE;} @@ -453,9 +462,7 @@ public: // destroys this item recursively virtual void destroyView(); - S32 getNumSelectedDescendants() { return mNumDescendantsSelected; } - - BOOL isSelected() { return mIsSelected; } + BOOL isSelected() const { return mIsSelected; } void setIsCurSelection(BOOL select) { mIsCurSelection = select; } @@ -475,7 +482,7 @@ public: // viewed. This method will ask the viewed object itself. const std::string& getName( void ) const; - const std::string& getSearchableLabel( U32 search_type ) const; + const std::string& getSearchableLabel() const; // This method returns the label displayed on the view. This // method was primarily added to allow sorting on the folder @@ -563,6 +570,13 @@ public: UNKNOWN, TRASH, NOT_TRASH } ETrash; +private: + S32 mNumDescendantsSelected; + +public: // Accessed needed by LLFolderViewItem + void recursiveIncrementNumDescendantsSelected(S32 increment); + S32 numSelected(void) const { return mNumDescendantsSelected + (isSelected() ? 1 : 0); } + protected: typedef std::list items_t; typedef std::list folders_t; @@ -624,20 +638,22 @@ public: virtual void dirtyFilter(); // Passes selection information on to children and record - // selection information if necessary. Returns TRUE if this object - // (or a child) was affected. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus); - - // This method is used to change the selection of an item. If - // selection is 'this', then note selection as true. Returns TRUE - // if this or a child is now selected. + // selection information if necessary. + // Returns TRUE if this object (or a child) ends up being selected. + // If 'openitem' is TRUE then folders are opened up along the way to the selection. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + + // This method is used to change the selection of an item. + // Recursively traverse all children; if 'selection' is 'this' then change + // the select status if necessary. + // Returns TRUE if the selection state of this folder, or of a child, was changed. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); // this method is used to group select items - virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items); + virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items); - virtual void recursiveDeselect(BOOL deselect_self); + // Deselect this folder and all folder/items it contains recursively. + void recursiveDeselect(BOOL deselect_self); // Returns true is this object and all of its children can be removed. virtual BOOL isRemovable(); @@ -724,6 +740,7 @@ public: time_t getCreationDate() const; bool isTrash() const; + S32 getNumSelectedDescendants(void) const { return mNumDescendantsSelected; } }; @@ -797,7 +814,7 @@ public: // children, and keeps track of selected objects. virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items); + virtual void extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray& items); virtual BOOL getSelectionList(std::set &selection); diff --git a/linden/indra/newview/llinventoryactions.cpp b/linden/indra/newview/llinventoryactions.cpp index 319b5b2..f3277ad 100644 --- a/linden/indra/newview/llinventoryactions.cpp +++ b/linden/indra/newview/llinventoryactions.cpp @@ -486,7 +486,7 @@ class LLDoCreateFloater : public inventory_listener_t } }; -//Handles the search type buttons +//Handles the search type buttons - RKeast class SetSearchType : public inventory_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -494,8 +494,10 @@ class SetSearchType : public inventory_listener_t std::string search_type = userdata.asString(); if(search_type == "name") { - gSavedSettings.setU32("InventorySearchType", 0); + mPtr->getActivePanel()->setSearchType(0); + gSavedPerAccountSettings.setU32("InventorySearchType",0); + mPtr->getControl("Inventory.SearchByName")->setValue(TRUE); mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); mPtr->getControl("Inventory.SearchByDesc")->setValue(FALSE); @@ -503,7 +505,9 @@ class SetSearchType : public inventory_listener_t } else if(search_type == "creator") { - gSavedSettings.setU32("InventorySearchType", 1); + mPtr->getActivePanel()->setSearchType(1); + + gSavedPerAccountSettings.setU32("InventorySearchType",1); mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); mPtr->getControl("Inventory.SearchByCreator")->setValue(TRUE); @@ -512,7 +516,9 @@ class SetSearchType : public inventory_listener_t } else if(search_type == "desc") { - gSavedSettings.setU32("InventorySearchType", 2); + mPtr->getActivePanel()->setSearchType(2); + + gSavedPerAccountSettings.setU32("InventorySearchType",2); mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); @@ -521,7 +527,9 @@ class SetSearchType : public inventory_listener_t } else if(search_type == "all") { - gSavedSettings.setU32("InventorySearchType", 3); + mPtr->getActivePanel()->setSearchType(3); + + gSavedPerAccountSettings.setU32("InventorySearchType",3); mPtr->getControl("Inventory.SearchByName")->setValue(FALSE); mPtr->getControl("Inventory.SearchByCreator")->setValue(FALSE); diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index a001d65..71d8194 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -486,7 +486,8 @@ LLInventoryView::LLInventoryView(const std::string& name, LLInventoryModel* inventory) : LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, - MINIMIZE_NO, CLOSE_YES) + MINIMIZE_NO, CLOSE_YES), + mActivePanel(NULL) //LLHandle mFinderHandle takes care of its own initialization { init(inventory); @@ -497,7 +498,8 @@ LLInventoryView::LLInventoryView(const std::string& name, LLInventoryModel* inventory) : LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, - MINIMIZE_NO, CLOSE_YES) + MINIMIZE_NO, CLOSE_YES), + mActivePanel(NULL) //LLHandle mFinderHandle takes care of its own initialization { init(inventory); @@ -522,8 +524,8 @@ void LLInventoryView::init(LLInventoryModel* inventory) addBoolControl("Inventory.FoldersAlwaysByName", sort_folders_by_name ); addBoolControl("Inventory.SystemFoldersToTop", sort_system_folders_to_top ); - //Search Controls - U32 search_type = gSavedSettings.getU32("InventorySearchType"); + //Search Controls - RKeast + U32 search_type = gSavedPerAccountSettings.getU32("InventorySearchType"); BOOL search_by_name = (search_type == 0); addBoolControl("Inventory.SearchByName", search_by_name); @@ -544,6 +546,10 @@ void LLInventoryView::init(LLInventoryModel* inventory) if (mActivePanel) { // "All Items" is the previous only view, so it gets the InventorySortOrder + + //Fix for gSavedSettings use - rkeast + mActivePanel->getFilter()->setSearchType(search_type); + mActivePanel->setSortOrder(gSavedSettings.getU32("InventorySortOrder")); mActivePanel->getFilter()->markDefault(); mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); @@ -580,7 +586,7 @@ void LLInventoryView::init(LLInventoryModel* inventory) file.close(); // Load the persistent "Recent Items" settings. - // Note that the "All Items" settings do not persist. + // Note that the "All Items" and "Worn Items" settings do not persist per-account. if(recent_items_panel) { if(savedFilterState.has(recent_items_panel->getFilter()->getName())) @@ -590,8 +596,7 @@ void LLInventoryView::init(LLInventoryModel* inventory) recent_items_panel->getFilter()->fromLLSD(recent_items); } } - - } + } //Initialize item count - rkeast mItemCount = gSavedPerAccountSettings.getS32("InventoryPreviousCount"); @@ -1044,9 +1049,16 @@ void LLInventoryView::onClearSearch(void* user_data) LLInventoryView* self = (LLInventoryView*)user_data; if(!self) return; + LLFloater *finder = self->getFinder(); if (self->mActivePanel) { self->mActivePanel->setFilterSubString(LLStringUtil::null); + self->mActivePanel->setFilterTypes(LLInventoryType::NIT_ALL); + } + + if (finder) + { + LLInventoryViewFinder::selectAllTypes(finder); } // re-open folders that were initially open @@ -1737,6 +1749,7 @@ LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, const std::string LLInventoryPanel::DEFAULT_SORT_ORDER = std::string("InventorySortOrder"); const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("RecentItemsSortOrder"); +const std::string LLInventoryPanel::WORNITEMS_SORT_ORDER = std::string("WornItemsSortOrder"); const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string(""); LLInventoryPanel::LLInventoryPanel(const std::string& name, @@ -1867,6 +1880,19 @@ void LLInventoryPanel::draw() LLPanel::draw(); } + +//fix to get rid of gSavedSettings use - rkeast +void LLInventoryPanel::setSearchType(U32 type) +{ + mFolders->getFilter()->setSearchType(type); +} + +//fix to get rid of gSavedSettings use - rkeast +U32 LLInventoryPanel::getSearchType() +{ + return mFolders->getFilter()->getSearchType(); +} + void LLInventoryPanel::setFilterTypes(U32 filter_types) { mFolders->getFilter()->setFilterTypes(filter_types); diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index e098ac7..3ec1e73 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -70,6 +70,7 @@ class LLInventoryPanel : public LLPanel public: static const std::string DEFAULT_SORT_ORDER; static const std::string RECENTITEMS_SORT_ORDER; + static const std::string WORNITEMS_SORT_ORDER; static const std::string INHERIT_SORT_ORDER; LLInventoryPanel(const std::string& name, @@ -96,6 +97,10 @@ public: EAcceptance* accept, std::string& tooltip_msg); + //fix to get rid of gSavedSettings use - rkeast + void setSearchType(U32 type); + U32 getSearchType(); + // Call this method to set the selection. void openAllFolders(); void closeAllFolders(); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml index f1a6626..3ab7c7b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_inventory.xml @@ -64,7 +64,7 @@ + sort_order="WornItemsSortOrder" width="461" />