summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp121
1 files changed, 91 insertions, 30 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d610b920b9..93269db380 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -563,6 +563,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
{
setSelection(item_id, FALSE);
}
+ updateFolderLabel(model_item->getParentUUID());
}
//////////////////////////////
@@ -574,6 +575,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
// Don't process the item if it is the root
if (old_parent)
{
+ LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem());
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID());
// Item has been moved.
if (old_parent != new_parent)
@@ -591,6 +593,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
setSelection(item_id, FALSE);
}
}
+ updateFolderLabel(model_item->getParentUUID());
}
else
{
@@ -602,6 +605,10 @@ void LLInventoryPanel::modelChanged(U32 mask)
// doesn't include trash). Just remove the item's UI.
view_item->destroyView();
}
+ if(viewmodel_folder)
+ {
+ updateFolderLabel(viewmodel_folder->getUUID());
+ }
old_parent->getViewModelItem()->dirtyDescendantsFilter();
}
}
@@ -619,6 +626,11 @@ void LLInventoryPanel::modelChanged(U32 mask)
if(parent)
{
parent->getViewModelItem()->dirtyDescendantsFilter();
+ LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem());
+ if(viewmodel_folder)
+ {
+ updateFolderLabel(viewmodel_folder->getUUID());
+ }
}
}
}
@@ -1110,6 +1122,73 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
fv->startRenamingSelectedItem();
}
}
+
+ std::set<LLFolderViewItem*> selected_items = mFolderRoot.get()->getSelectionList();
+ LLFolderViewItem* prev_folder_item = getItemByID(mPreviousSelectedFolder);
+
+ if (selected_items.size() == 1)
+ {
+ std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin();
+ LLFolderViewItem* folder_item = (*iter);
+ if(folder_item && (folder_item != prev_folder_item))
+ {
+ LLFolderViewModelItemInventory* fve_listener = static_cast<LLFolderViewModelItemInventory*>(folder_item->getViewModelItem());
+ if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
+ {
+ if(prev_folder_item)
+ {
+ LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+ if(prev_bridge)
+ {
+ prev_bridge->clearDisplayName();
+ prev_bridge->setShowDescendantsCount(false);
+ prev_folder_item->refresh();
+ }
+ }
+
+ LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+ if(bridge)
+ {
+ bridge->clearDisplayName();
+ bridge->setShowDescendantsCount(true);
+ folder_item->refresh();
+ mPreviousSelectedFolder = bridge->getUUID();
+ }
+ }
+ }
+ }
+ else
+ {
+ if(prev_folder_item)
+ {
+ LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
+ if(prev_bridge)
+ {
+ prev_bridge->clearDisplayName();
+ prev_bridge->setShowDescendantsCount(false);
+ prev_folder_item->refresh();
+ }
+ }
+ mPreviousSelectedFolder = LLUUID();
+ }
+
+}
+
+void LLInventoryPanel::updateFolderLabel(const LLUUID& folder_id)
+{
+ if(folder_id != mPreviousSelectedFolder) return;
+
+ LLFolderViewItem* folder_item = getItemByID(mPreviousSelectedFolder);
+ if(folder_item)
+ {
+ LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
+ if(bridge)
+ {
+ bridge->clearDisplayName();
+ bridge->setShowDescendantsCount(true);
+ folder_item->refresh();
+ }
+ }
}
void LLInventoryPanel::doCreate(const LLSD& userdata)
@@ -1364,10 +1443,12 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
}
//static
-void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id, BOOL main_panel)
+void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const LLUUID& obj_id, BOOL main_panel, BOOL take_keyboard_focus, BOOL reset_filter)
{
LLInventoryPanel *active_panel;
- if (main_panel)
+ bool in_inbox = (gInventory.isObjectDescendentOf(obj_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX)));
+
+ if (main_panel && !in_inbox)
{
LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory")->selectAllItemsPanel();
}
@@ -1376,42 +1457,22 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
if (active_panel)
{
LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL;
-
- LLViewerInventoryItem * item = gInventory.getItem(obj_id);
- LLViewerInventoryCategory * cat = gInventory.getCategory(obj_id);
-
- bool in_inbox = false;
-
- LLViewerInventoryCategory * parent_cat = NULL;
-
- if (item)
- {
- parent_cat = gInventory.getCategory(item->getParentUUID());
- }
- else if (cat)
- {
- parent_cat = gInventory.getCategory(cat->getParentUUID());
- }
-
- if (parent_cat)
+
+ if (reset_filter)
{
- in_inbox = (LLFolderType::FT_INBOX == parent_cat->getPreferredType());
+ reset_inventory_filter();
}
-
+
if (in_inbox)
{
LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
LLInventoryPanel * inventory_panel = NULL;
-
- if (in_inbox)
- {
- sidepanel_inventory->openInbox();
- inventory_panel = sidepanel_inventory->getInboxPanel();
- }
+ sidepanel_inventory->openInbox();
+ inventory_panel = sidepanel_inventory->getInboxPanel();
if (inventory_panel)
{
- inventory_panel->setSelection(obj_id, TAKE_FOCUS_YES);
+ inventory_panel->setSelection(obj_id, take_keyboard_focus);
}
}
else
@@ -1421,7 +1482,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L
{
floater_inventory->setFocus(TRUE);
}
- active_panel->setSelection(obj_id, TAKE_FOCUS_YES);
+ active_panel->setSelection(obj_id, take_keyboard_focus);
}
}
}