From 8f4c4db90fdafc86efb64318e611d00aae662ab1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Sat, 23 Nov 2013 09:37:09 -0500 Subject: SH-4611 FIX - use an observer to scroll after category rename completes --- indra/newview/llinventorybridge.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'indra/newview/llinventorybridge.cpp') 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 -- cgit v1.2.3