diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 58 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 1 |
4 files changed, 59 insertions, 4 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 15916ffaba..eaea1ef972 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -810,7 +810,7 @@ void show_item_original(const LLUUID& item_uuid) { if(main_inventory->isSingleFolderMode()) { - main_inventory->onViewModeClick(); + main_inventory->toggleViewMode(); } main_inventory->resetFilters(); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 076f002f47..037dda70f0 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1843,7 +1843,7 @@ void LLInventoryPanel::setSFViewAndOpenFolder(const LLInventoryPanel* panel, con LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); if (main_inventory && panel->hasAncestor(main_inventory) && !main_inventory->isSingleFolderMode()) { - main_inventory->onViewModeClick(); + main_inventory->toggleViewMode(); main_inventory->setSingleFolderViewRoot(folder_id, false); } } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index ac188abb05..f8c1fcb5f5 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -453,7 +453,7 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); if (main_inventory) { - main_inventory->onViewModeClick(); + main_inventory->toggleViewMode(); if(folder_id.notNull()) { main_inventory->setSingleFolderViewRoot(folder_id); @@ -1329,7 +1329,7 @@ void LLPanelMainInventory::onAddButtonClick() } } -void LLPanelMainInventory::onViewModeClick() +void LLPanelMainInventory::toggleViewMode() { mSingleFolderMode = !mSingleFolderMode; @@ -1354,7 +1354,61 @@ void LLPanelMainInventory::onViewModeClick() sidepanel_inventory->toggleInbox(); } } +} +void LLPanelMainInventory::onViewModeClick() +{ + LLUUID selected_folder; + LLUUID new_root_folder; + if(mSingleFolderMode) + { + selected_folder = mSingleFolderPanelInventory->getSingleFolderRoot(); + } + else + { + LLFolderView* root = getActivePanel()->getRootFolder(); + std::set<LLFolderViewItem*> selection_set = root->getSelectionList(); + if (selection_set.size() == 1) + { + LLFolderViewItem* current_item = *selection_set.begin(); + if (current_item) + { + const LLUUID& id = static_cast<LLFolderViewModelItemInventory*>(current_item->getViewModelItem())->getUUID(); + if(gInventory.getCategory(id) != NULL) + { + new_root_folder = id; + } + else + { + const LLViewerInventoryItem* selected_item = gInventory.getItem(id); + if (selected_item && selected_item->getParentUUID().notNull()) + { + new_root_folder = selected_item->getParentUUID(); + selected_folder = id; + } + } + } + } + } + + toggleViewMode(); + + if (mSingleFolderMode && new_root_folder.notNull()) + { + setSingleFolderViewRoot(new_root_folder, true); + if(selected_folder.notNull()) + { + getActivePanel()->setSelection(selected_folder, TAKE_FOCUS_YES); + } + } + else + { + if(selected_folder.notNull()) + { + selectAllItemsPanel(); + getActivePanel()->setSelection(selected_folder, TAKE_FOCUS_YES); + } + } } void LLPanelMainInventory::onUpFolderClicked() diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index b0f520ac5e..5f488539dd 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -100,6 +100,7 @@ public: void resetFilters(); void onViewModeClick(); + void toggleViewMode(); void onUpFolderClicked(); void onBackFolderClicked(); void onForwardFolderClicked(); |