Skip to content
Snippets Groups Projects
Commit 800b2f61 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix findChild abuse in inbox sidepanel

parent 61b40146
No related branches found
No related tags found
No related merge requests found
...@@ -216,12 +216,12 @@ BOOL LLSidepanelInventory::postBuild() ...@@ -216,12 +216,12 @@ BOOL LLSidepanelInventory::postBuild()
LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME); LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
// Set up button states and callbacks // Set up button states and callbacks
LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME); mInboxBtn = getChild<LLButton>(INBOX_BUTTON_NAME);
inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); mInboxBtn->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));
// Get the previous inbox state from "InventoryInboxToggleState" setting. // Get the previous inbox state from "InventoryInboxToggleState" setting.
bool is_inbox_collapsed = !inbox_button->getToggleState(); bool is_inbox_collapsed = !mInboxBtn->getToggleState();
// Restore the collapsed inbox panel state // Restore the collapsed inbox panel state
LLLayoutPanel* inbox_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME); LLLayoutPanel* inbox_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
...@@ -344,7 +344,7 @@ void LLSidepanelInventory::openInbox() ...@@ -344,7 +344,7 @@ void LLSidepanelInventory::openInbox()
{ {
if (mInboxEnabled) if (mInboxEnabled)
{ {
getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); mInboxBtn->setToggleState(true);
onToggleInboxBtn(); onToggleInboxBtn();
} }
} }
...@@ -358,7 +358,7 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) ...@@ -358,7 +358,7 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
// Expand the inbox since we have fresh items // Expand the inbox since we have fresh items
if (mInboxEnabled) if (mInboxEnabled)
{ {
getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); mInboxBtn->setToggleState(true);
onToggleInboxBtn(); onToggleInboxBtn();
} }
#endif #endif
...@@ -366,11 +366,10 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) ...@@ -366,11 +366,10 @@ void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id)
void LLSidepanelInventory::onToggleInboxBtn() void LLSidepanelInventory::onToggleInboxBtn()
{ {
LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME);
LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME); LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME); LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
const bool inbox_expanded = inboxButton->getToggleState(); const bool inbox_expanded = mInboxBtn->getToggleState();
// Expand/collapse the indicated panel // Expand/collapse the indicated panel
inv_stack->collapsePanel(inboxPanel, !inbox_expanded); inv_stack->collapsePanel(inboxPanel, !inbox_expanded);
...@@ -399,11 +398,11 @@ void LLSidepanelInventory::onOpen(const LLSD& key) ...@@ -399,11 +398,11 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL); LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
if (inbox && (inbox->getFreshItemCount() > 0)) if (inbox && (inbox->getFreshItemCount() > 0))
{ {
getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); mInboxBtn->setToggleState(true);
onToggleInboxBtn(); onToggleInboxBtn();
} }
#else #else
if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState()) if (mInboxEnabled && mInboxBtn->getToggleState())
{ {
gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
} }
......
...@@ -123,6 +123,7 @@ class LLSidepanelInventory : public LLPanel ...@@ -123,6 +123,7 @@ class LLSidepanelInventory : public LLPanel
LLButton* mPlayBtn; LLButton* mPlayBtn;
LLButton* mTeleportBtn; LLButton* mTeleportBtn;
LLButton* mShopBtn; LLButton* mShopBtn;
LLButton* mInboxBtn = nullptr;
bool mInboxEnabled; bool mInboxEnabled;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment