diff options
-rwxr-xr-x | indra/llui/llfolderview.cpp | 27 | ||||
-rwxr-xr-x | indra/llui/llfolderview.h | 7 | ||||
-rwxr-xr-x | indra/llui/llfolderviewmodel.cpp | 8 | ||||
-rwxr-xr-x | indra/newview/llfloateroutbox.cpp | 68 | ||||
-rwxr-xr-x | indra/newview/llfolderviewmodelinventory.cpp | 20 | ||||
-rwxr-xr-x | indra/newview/llinventoryobserver.cpp | 6 | ||||
-rwxr-xr-x | indra/newview/llinventorypanel.cpp | 188 | ||||
-rwxr-xr-x | indra/newview/llinventorypanel.h | 11 | ||||
-rwxr-xr-x | indra/newview/llpanelmarketplaceinboxinventory.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llplacesinventorypanel.cpp | 12 |
10 files changed, 162 insertions, 189 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 4d1c2a38d0..225bf21b0a 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -167,16 +167,16 @@ LLFolderView::LLFolderView(const Params& p) mMinWidth(0), mDragAndDropThisFrame(FALSE), mCallbackRegistrar(NULL), - mParentPanel(p.parent_panel), mUseEllipses(p.use_ellipses), mDraggingOverItem(NULL), mStatusTextBox(NULL), mShowItemLinkOverlays(p.show_item_link_overlays), mViewModel(p.view_model) { + LLPanel* panel = p.parent_panel; + mParentPanel = panel->getHandle(); mViewModel->setFolderView(this); mRoot = this; - llinfos << "Merov : create folder view, this = " << this << ", name = " << (std::string(p.name)) << ", model = " << getFolderViewModel() << llendl; LLRect rect = p.rect; LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); @@ -244,7 +244,6 @@ LLFolderView::LLFolderView(const Params& p) // Destroys the object LLFolderView::~LLFolderView( void ) { - llinfos << "Merov : delete folder view (start), this = " << this << ", model = " << getFolderViewModel() << llendl; closeRenamer(); // The release focus call can potentially call the @@ -268,7 +267,6 @@ LLFolderView::~LLFolderView( void ) mViewModel->setFolderView(NULL); mViewModel = NULL; - llinfos << "Merov : delete folder view (end), this = " << this << ", model = " << getFolderViewModel() << llendl; } BOOL LLFolderView::canFocusChildren() const @@ -329,7 +327,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) { // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); - filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); // Note: we filter the model, not the view getViewModelItem()->filter(filter); @@ -423,7 +421,7 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, if( selection && take_keyboard_focus) { - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); } // clear selection down here because change of keyboard focus can potentially @@ -761,7 +759,7 @@ void LLFolderView::removeSelectedItems() if (item_to_delete->remove()) { // change selection on successful delete - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); } } arrangeAll(); @@ -771,7 +769,7 @@ void LLFolderView::removeSelectedItems() LLDynamicArray<LLFolderViewModelItem*> listeners; LLFolderViewModelItem* listener; - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); for(S32 i = 0; i < count; ++i) { @@ -951,7 +949,7 @@ void LLFolderView::cut() } // Update the selection - setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus()); + setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); } mSearchString.clear(); } @@ -1293,7 +1291,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) } BOOL handled = FALSE; - if (mParentPanel->hasFocus()) + if (mParentPanel.get()->hasFocus()) { // SL-51858: Key presses are not being passed to the Popup menu. // A proper fix is non-trivial so instead just close the menu. @@ -1327,7 +1325,7 @@ BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) mKeyboardSelection = FALSE; mSearchString.clear(); - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); LLEditMenuHandler::gEditMenuHandler = this; @@ -1410,7 +1408,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) { // all user operations move keyboard focus to inventory // this way, we know when to stop auto-updating a search - mParentPanel->setFocus(TRUE); + mParentPanel.get()->setFocus(TRUE); BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); @@ -1608,7 +1606,6 @@ void LLFolderView::update() { return; } - //llinfos << "Merov : update, this = " << this << ", model = " << getFolderViewModel() << llendl; if (getFolderViewModel()->getFilter().isModified() && getFolderViewModel()->getFilter().isNotDefault()) { @@ -1655,8 +1652,8 @@ void LLFolderView::update() BOOL filter_finished = getViewModelItem()->passedFilter() && mViewModel->contentsReady(); if (filter_finished - || gFocusMgr.childHasKeyboardFocus(mParentPanel) - || gFocusMgr.childHasMouseCapture(mParentPanel)) + || gFocusMgr.childHasKeyboardFocus(mParentPanel.get()) + || gFocusMgr.childHasMouseCapture(mParentPanel.get())) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process mNeedsAutoSelect = FALSE; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 11fccdace4..5b83049e5c 100755 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -229,7 +229,7 @@ public: void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } - LLPanel* getParentPanel() { return mParentPanel; } + LLPanel* getParentPanel() { return mParentPanel.get(); } // DEBUG only void dumpSelectionInformation(); @@ -238,6 +238,9 @@ public: bool useLabelSuffix() { return mUseLabelSuffix; } void updateMenu(); + // Note: We may eventually have to move that method up the hierarchy to LLFolderViewItem. + LLHandle<LLFolderView> getHandle() const { return getDerivedHandle<LLFolderView>(); } + private: void updateMenuOptions(LLMenuGL* menu); void updateRenamerPosition(); @@ -295,7 +298,7 @@ protected: S32 mMinWidth; BOOL mDragAndDropThisFrame; - LLPanel* mParentPanel; + LLHandle<LLPanel> mParentPanel; LLFolderViewModelInterface* mViewModel; diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 48ca8156f2..3363dc5316 100755 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -36,10 +36,6 @@ bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) std::string LLFolderViewModelCommon::getStatusText() { - if (!mFolderView) - { - llinfos << "Merov : Trying LLFolderViewModelCommon::getStatusText() on a NULL mFolderView!!!" << llendl; - } if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter().getCurrentGeneration()) { return LLTrans::getString("Searching"); @@ -52,10 +48,6 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - if (!mFolderView) - { - llinfos << "Merov : Trying LLFolderViewModelCommon::filter() on a NULL mFolderView!!!" << llendl; - } getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index f8de91715c..fa628f2a08 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -165,34 +165,13 @@ BOOL LLFloaterOutbox::postBuild() void LLFloaterOutbox::cleanOutbox() { - /* - // Create a new category creation observer - if (mCategoryAddedObserver == NULL) - { - mCategoryAddedObserver = new LLOutboxAddedObserver(this); - gInventory.addObserver(mCategoryAddedObserver); - } - llassert(mCategoryAddedObserver); - - // Delete the observer for outbox modifications - if (mCategoriesObserver) - { - gInventory.removeObserver(mCategoriesObserver); - delete mCategoriesObserver; - mCategoriesObserver = NULL; - } - llassert(!mCategoriesObserver); - */ - - // Clear the outbox data - mOutboxId.setNull(); - mOutboxItemCount = 0; - // Note: we cannot delete the mOutboxInventoryPanel as that point // as this is called through callback observers of the panel itself. - // Doing so crashes rapidly. + // Doing so would crash rapidly. - llinfos << "Merov : cleanOutbox!" << llendl; + // Invalidate the outbox data + mOutboxId.setNull(); + mOutboxItemCount = 0; } void LLFloaterOutbox::onClose(bool app_quitting) @@ -261,11 +240,10 @@ void LLFloaterOutbox::setupOutbox() } if (outbox_id == mOutboxId) { - llinfos << "Merov : setupOutbox, we already have an outbox set = " << mOutboxId.asString() << llendl; + llwarns << "Inventory warning: Merchant outbox already set" << llendl; return; } mOutboxId = outbox_id; - llinfos << "Merov : setupOutbox!!!, mOutboxId = " << mOutboxId.asString() << llendl; // No longer need to observe new category creation if (mCategoryAddedObserver && gInventory.containsObserver(mCategoryAddedObserver)) @@ -288,26 +266,23 @@ void LLFloaterOutbox::setupOutbox() llassert(mCategoriesObserver); // Set up the outbox inventory view - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + LLInventoryPanel* inventory_panel = mOutboxInventoryPanel.get(); + if (inventory_panel) { - delete panel; + delete inventory_panel; } - LLInventoryPanel* inventory_panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); + inventory_panel = LLUICtrlFactory::createFromFile<LLInventoryPanel>("panel_outbox_inventory.xml", mInventoryPlaceholder->getParent(), LLInventoryPanel::child_registry_t::instance()); mOutboxInventoryPanel = inventory_panel->getInventoryPanelHandle(); llassert(mOutboxInventoryPanel.get() != NULL); // Reshape the inventory to the proper size - panel = mOutboxInventoryPanel.get(); LLRect inventory_placeholder_rect = mInventoryPlaceholder->getRect(); - panel->setShape(inventory_placeholder_rect); + inventory_panel->setShape(inventory_placeholder_rect); // Set the sort order newest to oldest - panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); - panel->getFilter().markDefault(); + inventory_panel->getFolderViewModel()->setSorter(LLInventoryFilter::SO_FOLDERS_BY_NAME); + inventory_panel->getFilter().markDefault(); - llinfos << "Merov : setupOutbox!!!, viewModel = " << panel->getFolderViewModel() << llendl; - // Get the content of the outbox fetchOutboxContents(); } @@ -390,14 +365,6 @@ void LLFloaterOutbox::updateView() { updateFolderCount(); LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << ", viewModel = " << panel->getFolderViewModel() << llendl; - } - else - { - llinfos << "Merov : LLFloaterOutbox::updateView(), panel = " << panel << llendl; - } if (mOutboxItemCount > 0) { @@ -538,10 +505,9 @@ void LLFloaterOutbox::onMouseLeave(S32 x, S32 y, MASK mask) void LLFloaterOutbox::onImportButtonClicked() { - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - if (panel) + if (mOutboxInventoryPanel.get()) { - panel->clearSelection(); + mOutboxInventoryPanel.get()->clearSelection(); } mImportBusy = LLMarketplaceInventoryImporter::instance().triggerImport(); @@ -549,18 +515,14 @@ void LLFloaterOutbox::onImportButtonClicked() void LLFloaterOutbox::onOutboxChanged() { - //llassert(!mOutboxId.isNull()); - LLInventoryPanel* panel = mOutboxInventoryPanel.get(); - llinfos << "Merov : onOutboxChanged!!!, panel = " << panel << ", view model = " << (panel ? panel->getFolderViewModel() : NULL) << llendl; LLViewerInventoryCategory* category = gInventory.getCategory(mOutboxId); - if (category) + if (mOutboxId.notNull() && category) { fetchOutboxContents(); updateView(); } else { - llinfos << "Merov : onOutboxChanged!!!, the category disappeared!" << llendl; cleanOutbox(); } } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index c28657dbcd..aac3a41b9e 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -232,16 +232,16 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) return continue_filtering; } -LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() -{ - return &mInventoryViewModel; -} - - -const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const -{ - return &mInventoryViewModel; -} +//LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() +//{ +// return &mInventoryViewModel; +//} +// +// +//const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const +//{ +// return &mInventoryViewModel; +//} bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const { diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index bfe9ee6198..2be1d7a757 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -690,8 +690,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask) if (!mCategoryMap.size()) return; - llinfos << "Merov : Categories Observer changed, map size = " << mCategoryMap.size() << ", mask = " << mask << llendl; - for (category_map_t::iterator iter = mCategoryMap.begin(); iter != mCategoryMap.end(); ++iter) @@ -702,7 +700,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); if (!category) { - llinfos << "Merov : Categories Observer disappeared, cat_id = " << cat_id << llendl; + llwarns << "Category : Category id = " << cat_id << " disappeared" << llendl; cat_data.mCallback(); continue; } @@ -757,8 +755,6 @@ void LLInventoryCategoriesObserver::changed(U32 mask) cat_changed = true; } } - - llinfos << "Merov : Categories Observer changed, cat_id = " << cat_id << ", changed = " << cat_changed << llendl; // If anything has changed above, fire the callback. if (cat_changed) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 63cedb6aa8..81ee7ac07e 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -137,7 +137,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : LLPanel(p), mInventoryObserver(NULL), mCompletionObserver(NULL), - mFolderRoot(NULL), mScroller(NULL), mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), @@ -196,6 +195,32 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) return LLUICtrlFactory::create<LLFolderView>(p); } +void LLInventoryPanel::clearFolderRoot() +{ + gIdleCallbacks.deleteFunction(idle, this); + gIdleCallbacks.deleteFunction(onIdle, this); + + if (mInventoryObserver) + { + mInventory->removeObserver(mInventoryObserver); + delete mInventoryObserver; + mInventoryObserver = NULL; + } + if (mCompletionObserver) + { + mInventory->removeObserver(mCompletionObserver); + delete mCompletionObserver; + mCompletionObserver = NULL; + } + + if (mScroller) + { + removeChild(mScroller); + delete mScroller; + mScroller = NULL; + } +} + void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { // save off copy of params @@ -203,23 +228,23 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) // Clear up the root view // Note: This needs to be done *before* we build the new folder view LLUUID root_id = getRootFolderID(); - if (mFolderRoot) + if (mFolderRoot.get()) { removeItemID(root_id); - mFolderRoot->destroyView(); - mFolderRoot = NULL; + mFolderRoot.get()->destroyView(); } mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves { // Determine the root folder in case specified, and // build the views starting with that folder. - mFolderRoot = createFolderRoot(root_id); + LLFolderView* folder_view = createFolderRoot(root_id); + mFolderRoot = folder_view->getHandle(); - addItemID(root_id, mFolderRoot); + addItemID(root_id, mFolderRoot.get()); } mCommitCallbackRegistrar.popScope(); - mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar); // Scroller LLRect scroller_view_rect = getRect(); @@ -228,10 +253,10 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) scroller_params.rect(scroller_view_rect); mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params); addChild(mScroller); - mScroller->addChild(mFolderRoot); - mFolderRoot->setScrollContainer(mScroller); - mFolderRoot->setFollowsAll(); - mFolderRoot->addChild(mFolderRoot->mStatusTextBox); + mScroller->addChild(mFolderRoot.get()); + mFolderRoot.get()->setScrollContainer(mScroller); + mFolderRoot.get()->setFollowsAll(); + mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); // Set up the callbacks from the inventory we're viewing, and then build everything. mInventoryObserver = new LLInventoryPanelObserver(this); @@ -280,23 +305,13 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) LLInventoryPanel::~LLInventoryPanel() { - gIdleCallbacks.deleteFunction(idle, this); - U32 sort_order = getFolderViewModel()->getSorter().getSortOrder(); - if (mSortOrderSetting != INHERIT_SORT_ORDER) - { - gSavedSettings.setU32(mSortOrderSetting, sort_order); - } - - gIdleCallbacks.deleteFunction(onIdle, this); - - // LLView destructor will take care of the sub-views. - mInventory->removeObserver(mInventoryObserver); - mInventory->removeObserver(mCompletionObserver); - delete mInventoryObserver; - delete mCompletionObserver; - - mScroller = NULL; + if (mSortOrderSetting != INHERIT_SORT_ORDER) + { + gSavedSettings.setU32(mSortOrderSetting, sort_order); + } + + clearFolderRoot(); } void LLInventoryPanel::draw() @@ -363,9 +378,9 @@ void LLInventoryPanel::setSortOrder(U32 order) if (order != getFolderViewModel()->getSorter().getSortOrder()) { getFolderViewModel()->setSorter(sorter); - mFolderRoot->arrangeAll(); + mFolderRoot.get()->arrangeAll(); // try to keep selection onscreen, even if it wasn't to start with - mFolderRoot->scrollToShowSelection(); + mFolderRoot.get()->scrollToShowSelection(); } } @@ -508,7 +523,7 @@ void LLInventoryPanel::modelChanged(U32 mask) // Add the UI element for this item. buildNewViews(item_id); // Select any newly created object that has the auto rename at top of folder root set. - if(mFolderRoot->getRoot()->needsAutoRename()) + if(mFolderRoot.get()->getRoot()->needsAutoRename()) { setSelection(item_id, FALSE); } @@ -559,17 +574,11 @@ void LLInventoryPanel::modelChanged(U32 mask) } } -LLFolderView* LLInventoryPanel::getRootFolder() -{ - return mFolderRoot; -} - LLUUID LLInventoryPanel::getRootFolderID() { - if (mFolderRoot && mFolderRoot->getViewModelItem()) + if (mFolderRoot.get() && mFolderRoot.get()->getViewModelItem()) { - return static_cast<LLFolderViewModelItemInventory*>(mFolderRoot->getViewModelItem())->getUUID(); - + return static_cast<LLFolderViewModelItemInventory*>(mFolderRoot.get()->getViewModelItem())->getUUID(); } else { @@ -590,7 +599,9 @@ LLUUID LLInventoryPanel::getRootFolderID() } else if (preferred_type != LLFolderType::FT_NONE) { - llinfos << "Merov : getRootFolderID, name = " << mParams.start_folder.name() << ", type = " << mParams.start_folder.type << llendl; + LLStringExplicit label(mParams.start_folder.name()); + setLabel(label); + root_id = gInventory.findCategoryUUIDForType(preferred_type, false); if (root_id.isNull()) { @@ -650,24 +661,33 @@ void LLInventoryPanel::idle(void* user_data) } - panel->mFolderRoot->update(); - // while dragging, update selection rendering to reflect single/multi drag status - if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) - { - EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); - if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) - { - panel->mFolderRoot->setShowSingleSelection(TRUE); - } - else - { - panel->mFolderRoot->setShowSingleSelection(FALSE); - } -} - else - { - panel->mFolderRoot->setShowSingleSelection(FALSE); - } + // Take into account the fact that the root folder might be invalidated + if (panel->mFolderRoot.get()) + { + panel->mFolderRoot.get()->update(); + // while dragging, update selection rendering to reflect single/multi drag status + if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) + { + EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); + if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) + { + panel->mFolderRoot.get()->setShowSingleSelection(TRUE); + } + else + { + panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + } + } + else + { + panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + } + } + else + { + llwarns << "Inventory : Deleted folder root detected on panel" << llendl; + panel->clearFolderRoot(); + } } @@ -718,7 +738,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br LLFolderViewFolder::Params params(mParams.folder); params.name = bridge->getDisplayName(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.tool_tip = params.name; @@ -734,7 +754,7 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge params.name = bridge->getDisplayName(); params.creation_date = bridge->getCreationDate(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; @@ -775,7 +795,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) LLInventoryType::IT_CATEGORY, this, &mInventoryViewModel, - mFolderRoot, + mFolderRoot.get(), objectp->getUUID()); if (new_listener) { @@ -791,7 +811,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) item->getInventoryType(), this, &mInventoryViewModel, - mFolderRoot, + mFolderRoot.get(), item->getUUID(), item->getFlags()); @@ -848,7 +868,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) void LLInventoryPanel::openStartFolderOrMyInventory() { // Find My Inventory folder and open it up by name - for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child)) + for (LLView *child = mFolderRoot.get()->getFirstChild(); child; child = mFolderRoot.get()->findNextSibling(child)) { LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child); if (fchild @@ -863,12 +883,12 @@ void LLInventoryPanel::openStartFolderOrMyInventory() void LLInventoryPanel::onItemsCompletion() { - if (mFolderRoot) mFolderRoot->updateMenu(); + if (mFolderRoot.get()) mFolderRoot.get()->updateMenu(); } void LLInventoryPanel::openSelected() { - LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem(); + LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem(); if(!folder_item) return; LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); if(!bridge) return; @@ -877,7 +897,7 @@ void LLInventoryPanel::openSelected() void LLInventoryPanel::unSelectAll() { - mFolderRoot->setSelection(NULL, FALSE, FALSE); + mFolderRoot.get()->setSelection(NULL, FALSE, FALSE); } @@ -915,14 +935,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // If folder view is empty the (x, y) point won't be in its rect // so the handler must be called explicitly. // but only if was not handled before. See EXT-6746. - if (!handled && !mFolderRoot->hasVisibleChildren()) + if (!handled && !mFolderRoot.get()->hasVisibleChildren()) { - handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + handled = mFolderRoot.get()->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } if (handled) { - mFolderRoot->setDragAndDropThisFrame(); + mFolderRoot.get()->setDragAndDropThisFrame(); } } @@ -932,7 +952,7 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, void LLInventoryPanel::onFocusLost() { // inventory no longer handles cut/copy/paste/delete - if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot) + if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot.get()) { LLEditMenuHandler::gEditMenuHandler = NULL; } @@ -943,7 +963,7 @@ void LLInventoryPanel::onFocusLost() void LLInventoryPanel::onFocusReceived() { // inventory now handles cut/copy/paste/delete - LLEditMenuHandler::gEditMenuHandler = mFolderRoot; + LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get(); LLPanel::onFocusReceived(); } @@ -954,7 +974,7 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) if (acceptsBadge()) { - badge_added = badge->addToView(mFolderRoot); + badge_added = badge->addToView(mFolderRoot.get()); } return badge_added; @@ -962,8 +982,8 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) void LLInventoryPanel::openAllFolders() { - mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); - mFolderRoot->arrangeAll(); + mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + mFolderRoot.get()->arrangeAll(); } void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) @@ -979,9 +999,9 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb) { - if (mFolderRoot) + if (mFolderRoot.get()) { - mFolderRoot->setSelectCallback(cb); + mFolderRoot.get()->setSelectCallback(cb); } } @@ -1005,7 +1025,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it } } - LLFolderView* fv = getRootFolder(); + LLFolderView* fv = mFolderRoot.get(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { fv->setNeedsAutoRename(FALSE); @@ -1024,7 +1044,7 @@ void LLInventoryPanel::doCreate(const LLSD& userdata) bool LLInventoryPanel::beginIMSession() { - std::set<LLFolderViewItem*> selected_items = mFolderRoot->getSelectionList(); + std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList(); std::string name; @@ -1118,7 +1138,7 @@ bool LLInventoryPanel::beginIMSession() bool LLInventoryPanel::attachObject(const LLSD& userdata) { // Copy selected item UUIDs to a vector. - std::set<LLFolderViewItem*> selected_items = mFolderRoot->getSelectionList(); + std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList(); uuid_vec_t items; for (std::set<LLFolderViewItem*>::const_iterator set_iter = selected_items.begin(); set_iter != selected_items.end(); @@ -1145,7 +1165,7 @@ BOOL LLInventoryPanel::getSinceLogoff() void LLInventoryPanel::dumpSelectionInformation(void* user_data) { LLInventoryPanel* iv = (LLInventoryPanel*)user_data; - iv->mFolderRoot->dumpSelectionInformation(); + iv->mFolderRoot.get()->dumpSelectionInformation(); } BOOL is_inventorysp_active() @@ -1347,7 +1367,7 @@ void LLInventoryPanel::updateSelection() void LLInventoryPanel::doToSelected(const LLSD& userdata) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, userdata.asString()); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), userdata.asString()); return; } @@ -1361,7 +1381,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) // Open selected items if enter key hit on the inventory panel if (mask == MASK_NONE) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open"); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open"); handled = TRUE; } break; @@ -1371,7 +1391,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) // Note: on Mac laptop keyboards, backspace and delete are one and the same if (isSelectionRemovable() && (mask == MASK_NONE)) { - LLInventoryAction::doToSelected(mInventory, mFolderRoot, "delete"); + LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete"); handled = TRUE; } break; @@ -1382,9 +1402,9 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) bool LLInventoryPanel::isSelectionRemovable() { bool can_delete = false; - if (mFolderRoot) + if (mFolderRoot.get()) { - std::set<LLFolderViewItem*> selection_set = mFolderRoot->getSelectionList(); + std::set<LLFolderViewItem*> selection_set = mFolderRoot.get()->getSelectionList(); if (!selection_set.empty()) { can_delete = true; diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 00a90325ad..c0ce513694 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -181,7 +181,7 @@ public: LLInventoryFilter::EFolderShow getShowFolderState(); // This method is called when something has changed about the inventory. void modelChanged(U32 mask); - LLFolderView* getRootFolder(); + LLFolderView* getRootFolder() { return mFolderRoot.get(); } LLUUID getRootFolderID(); LLScrollContainer* getScrollableContainer() { return mScroller; } @@ -217,8 +217,11 @@ public: void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); void updateSelection(); - LLFolderViewModelInventory* getFolderViewModel(); - const LLFolderViewModelInventory* getFolderViewModel() const; + LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; } + const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; } + + // Clean up stuff when the folder root gets deleted + void clearFolderRoot(); protected: void openStartFolderOrMyInventory(); // open the first level of inventory @@ -233,7 +236,7 @@ protected: bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons bool mShowEmptyMessage; - LLFolderView* mFolderRoot; + LLHandle<LLFolderView> mFolderRoot; LLScrollContainer* mScroller; LLFolderViewModelInventory mInventoryViewModel; diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index adfb2dee86..da938712d7 100755 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -69,7 +69,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge LLInboxFolderViewFolder::Params params; params.name = bridge->getDisplayName(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.tool_tip = params.name; params.font_color = item_color; @@ -86,7 +86,7 @@ LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * b params.name = bridge->getDisplayName(); params.creation_date = bridge->getCreationDate(); - params.root = mFolderRoot; + params.root = mFolderRoot.get(); params.listener = bridge; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 4c2213c198..5eadd65884 100755 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -91,17 +91,17 @@ LLFolderView * LLPlacesInventoryPanel::createFolderRoot(LLUUID root_id ) void LLPlacesInventoryPanel::saveFolderState() { mSavedFolderState->setApply(FALSE); - mFolderRoot->applyFunctorRecursively(*mSavedFolderState); + mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); } // re-open folders which state was saved void LLPlacesInventoryPanel::restoreFolderState() { mSavedFolderState->setApply(TRUE); - mFolderRoot->applyFunctorRecursively(*mSavedFolderState); + mFolderRoot.get()->applyFunctorRecursively(*mSavedFolderState); LLOpenFoldersWithSelection opener; - mFolderRoot->applyFunctorRecursively(opener); - mFolderRoot->scrollToShowSelection(); + mFolderRoot.get()->applyFunctorRecursively(opener); + mFolderRoot.get()->scrollToShowSelection(); } S32 LLPlacesInventoryPanel::notify(const LLSD& info) @@ -111,11 +111,11 @@ S32 LLPlacesInventoryPanel::notify(const LLSD& info) std::string str_action = info["action"]; if(str_action == "select_first") { - return mFolderRoot->notify(info); + return mFolderRoot.get()->notify(info); } else if(str_action == "select_last") { - return mFolderRoot->notify(info); + return mFolderRoot.get()->notify(info); } } return 0; |