diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-11-23 09:37:09 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-11-23 09:37:09 -0500 |
commit | 8f4c4db90fdafc86efb64318e611d00aae662ab1 (patch) | |
tree | b5e051cc330d359e437ba985ffcdbe29a1f4a2a7 | |
parent | 0384d579726e61b4239880df9fddb502afe65f5a (diff) |
SH-4611 FIX - use an observer to scroll after category rename completes
-rwxr-xr-x | indra/llui/llfolderview.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 37 | ||||
-rwxr-xr-x | indra/newview/llinventoryobserver.cpp | 21 | ||||
-rwxr-xr-x | indra/newview/llinventoryobserver.h | 18 |
4 files changed, 78 insertions, 1 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index f32a52e6c6..ff5c2d0849 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -701,8 +701,9 @@ void LLFolderView::finishRenamingItem( void ) closeRenamer(); + // This is moved to an inventory observer in llinventorybridge.cpp, to handle updating after operation completed in AISv3 (SH-4611). // List is re-sorted alphabetically, so scroll to make sure the selected item is visible. - scrollToShowSelection(); + //scrollToShowSelection(); } void LLFolderView::closeRenamer( void ) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 3877f9f040..74837bac37 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2984,8 +2984,45 @@ std::string LLFolderBridge::getLabelSuffix() const : LLStringUtil::null; } +class ScrollOnRenameObserver: public LLInventoryObserver +{ +public: + LLFolderView *mView; + LLUUID mUUID; + + ScrollOnRenameObserver(const LLUUID& uuid, LLFolderView *view): + mUUID(uuid), + mView(view) + { + } + void changed(U32 mask) + { + if (mask & LLInventoryObserver::LABEL) + { + // TODO - check for whether this is the item we're waiting for a rename of + const uuid_set_t& changed_item_ids = gInventory.getChangedIDs(); + for (uuid_set_t::const_iterator it = changed_item_ids.begin(); it != changed_item_ids.end(); ++it) + { + const LLUUID& id = *it; + if (id == mUUID) + { + mView->scrollToShowSelection(); + + gInventory.removeObserver(this); + delete this; + return; + } + } + } + } +}; + BOOL LLFolderBridge::renameItem(const std::string& new_name) { + + LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot); + gInventory.addObserver(observer); + rename_category(getInventoryModel(), mUUID, new_name); // return FALSE because we either notified observers (& therefore diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 011686bfdd..ae59b44184 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -701,3 +701,24 @@ LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData( { mItemNameHash.finalize(); } + +void LLScrollOnRenameObserver::changed(U32 mask) +{ + if (mask & LLInventoryObserver::LABEL) + { + // TODO - check for whether this is the item we're waiting for a rename of + const uuid_set_t& changed_item_ids = gInventory.getChangedIDs(); + for (uuid_set_t::const_iterator it = changed_item_ids.begin(); it != changed_item_ids.end(); ++it) + { + const LLUUID& id = *it; + if (id == mUUID) + { + mView->scrollToShowSelection(); + + gInventory.removeObserver(this); + delete this; + return; + } + } + } +} diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index dd30513844..2436930ef6 100755 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -287,4 +287,22 @@ protected: category_map_t mCategoryMap; }; +class LLFolderView; + +// Force a FolderView to scroll after an item in the corresponding view has been renamed. +class LLScrollOnRenameObserver: public LLInventoryObserver +{ +public: + LLFolderView *mView; + LLUUID mUUID; + + LLScrollOnRenameObserver(const LLUUID& uuid, LLFolderView *view): + mUUID(uuid), + mView(view) + { + } + /* virtual */ void changed(U32 mask); +}; + + #endif // LL_LLINVENTORYOBSERVERS_H |