summaryrefslogtreecommitdiff
path: root/indra/newview/llsidepanelinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsidepanelinventory.cpp')
-rw-r--r--indra/newview/llsidepanelinventory.cpp104
1 files changed, 71 insertions, 33 deletions
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 65655f82cd..a800611aac 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -61,8 +61,6 @@ static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_
// Constants
//
-static const char * const INBOX_EXPAND_TIME_SETTING = "LastInventoryInboxExpand";
-
static const char * const INBOX_BUTTON_NAME = "inbox_btn";
static const char * const OUTBOX_BUTTON_NAME = "outbox_btn";
@@ -134,6 +132,8 @@ private:
LLSidepanelInventory::LLSidepanelInventory()
: LLPanel()
, mItemPanel(NULL)
+ , mInventoryPanelInbox(NULL)
+ , mInventoryPanelOutbox(NULL)
, mPanelMainInventory(NULL)
, mInboxEnabled(false)
, mOutboxEnabled(false)
@@ -353,7 +353,7 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
//
LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
- inbox->setupInventoryPanel();
+ mInventoryPanelInbox = inbox->setupInventoryPanel();
}
@@ -382,7 +382,7 @@ void LLSidepanelInventory::observeOutboxModifications(const LLUUID& outboxID)
//
LLPanelMarketplaceOutbox * outbox = getChild<LLPanelMarketplaceOutbox>(MARKETPLACE_OUTBOX_PANEL);
- outbox->setupInventoryPanel();
+ mInventoryPanelOutbox = outbox->setupInventoryPanel();
}
void LLSidepanelInventory::enableInbox(bool enabled)
@@ -404,7 +404,7 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
// Expand the inbox since we have fresh items
LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
- if (inbox && (inbox->getFreshItemCount() > 0))
+ if (inbox)
{
getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true);
onToggleInboxBtn();
@@ -458,13 +458,9 @@ void LLSidepanelInventory::onToggleInboxBtn()
LLButton* otherButton = getChild<LLButton>(OUTBOX_BUTTON_NAME);
LLLayoutPanel* otherPanel = getChild<LLLayoutPanel>(OUTBOX_LAYOUT_PANEL_NAME);
- bool inboxExpanded = manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel);
+ manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel);
- if (inboxExpanded)
- {
- // Save current time as a setting for future new-ness tests
- gSavedSettings.setString(INBOX_EXPAND_TIME_SETTING, LLDate::now().asString());
- }
+ gSavedPerAccountSettings.setString("LastInventoryInboxExpand", LLDate::now().asString());
}
void LLSidepanelInventory::onToggleOutboxBtn()
@@ -535,14 +531,12 @@ void LLSidepanelInventory::onShopButtonClicked()
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
{
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+ LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if (mInventoryPanelInbox)
{
- current_item = inbox->getRootFolder()->getCurSelectedItem();
+ current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
}
if (!current_item)
@@ -551,7 +545,7 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)
}
}
- current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action);
+ current_item->getListener()->performAction(mPanelMainInventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onWearButtonClicked()
@@ -693,19 +687,16 @@ void LLSidepanelInventory::updateVerbs()
bool LLSidepanelInventory::canShare()
{
- LLPanelMainInventory* panel_main_inventory =
- mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
-
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
+ LLInventoryPanel* inbox = mInventoryPanelInbox;
// Avoid flicker in the Recent tab while inventory is being loaded.
if ( (!inbox || inbox->getRootFolder()->getSelectionList().empty())
- && (panel_main_inventory && !panel_main_inventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
+ && (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
{
return false;
}
- return ( (panel_main_inventory ? LLAvatarActions::canShareSelectedItems(panel_main_inventory->getActivePanel()) : false)
+ return ( (mPanelMainInventory ? LLAvatarActions::canShareSelectedItems(mPanelMainInventory->getActivePanel()) : false)
|| (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) );
}
@@ -730,14 +721,13 @@ bool LLSidepanelInventory::canWearSelected()
LLInventoryItem *LLSidepanelInventory::getSelectedItem()
{
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+ LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+
if (!current_item)
{
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if (mInventoryPanelInbox)
{
- current_item = inbox->getRootFolder()->getCurSelectedItem();
+ current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
}
if (!current_item)
@@ -754,14 +744,20 @@ U32 LLSidepanelInventory::getSelectedCount()
{
int count = 0;
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
+ std::set<LLUUID> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
count += selection_list.size();
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if ((count == 0) && mInboxEnabled && (mInventoryPanelInbox != NULL))
{
- selection_list = inbox->getRootFolder()->getSelectionList();
+ selection_list = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+
+ count += selection_list.size();
+ }
+
+ if ((count == 0) && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ selection_list = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
+
count += selection_list.size();
}
@@ -785,3 +781,45 @@ BOOL LLSidepanelInventory::isMainInventoryPanelActive() const
{
return mInventoryPanel->getVisible();
}
+
+void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox, bool clearOutbox)
+{
+ if (clearMain)
+ {
+ LLInventoryPanel * inv_panel = getActivePanel();
+
+ if (inv_panel)
+ {
+ inv_panel->clearSelection();
+ }
+ }
+
+ if (clearInbox && mInboxEnabled && (mInventoryPanelInbox != NULL))
+ {
+ mInventoryPanelInbox->clearSelection();
+ }
+
+ if (clearOutbox && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ mInventoryPanelOutbox->clearSelection();
+ }
+
+ updateVerbs();
+}
+
+std::set<LLUUID> LLSidepanelInventory::getInboxOrOutboxSelectionList()
+{
+ std::set<LLUUID> inventory_selected_uuids;
+
+ if (mInboxEnabled && (mInventoryPanelInbox != NULL))
+ {
+ inventory_selected_uuids = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+ }
+
+ if (inventory_selected_uuids.empty() && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ inventory_selected_uuids = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
+ }
+
+ return inventory_selected_uuids;
+}