summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-10 17:39:24 +0200
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-03-10 17:39:24 +0200
commite364b90d61b7711c088d9bca7307e3760f28c59d (patch)
tree1bdbc8dace6c11d9be27e975251f2e0058ef05da /indra
parentfa50ce4b1054a453a97a81d64eb8099cae6f4cb5 (diff)
SL-19335 Switching view (using the switch button) should select appropriate folder
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventoryfunctions.cpp2
-rw-r--r--indra/newview/llinventorypanel.cpp2
-rw-r--r--indra/newview/llpanelmaininventory.cpp58
-rw-r--r--indra/newview/llpanelmaininventory.h1
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();