summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersidepanelcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersidepanelcontainer.cpp')
-rwxr-xr-xindra/newview/llfloatersidepanelcontainer.cpp80
1 files changed, 63 insertions, 17 deletions
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index 5f9556a870..d5bb8157cf 100755
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -45,8 +45,22 @@ LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const
// Prevent transient floaters (e.g. IM windows) from hiding
// when this floater is clicked.
LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this);
+ //We want this container to handle the shutdown logic of the sidepanelappearance.
+ mVerifyUponClose = TRUE;
}
+BOOL LLFloaterSidePanelContainer::postBuild()
+{
+ setCloseConfirmationCallback( boost::bind(&LLFloaterSidePanelContainer::onConfirmationClose,this,_2));
+ return TRUE;
+}
+
+void LLFloaterSidePanelContainer::onConfirmationClose( const LLSD &confirm )
+{
+ onClickCloseBtn();
+}
+
+
LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer()
{
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
@@ -59,22 +73,18 @@ void LLFloaterSidePanelContainer::onOpen(const LLSD& key)
void LLFloaterSidePanelContainer::onClickCloseBtn()
{
- LLPanelOutfitEdit* panel_outfit_edit =
- dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
- if (panel_outfit_edit)
+ LLSidepanelAppearance* panel = getSidePanelAppearance();
+ if ( panel )
{
- LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit);
- if (parent == this )
- {
- LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
- if ( panel_appearance )
- {
- panel_appearance->getWearable()->onClose();
- panel_appearance->showOutfitsInventoryPanel();
- }
- }
+ panel->onClose( this );
}
-
+ else
+ {
+ LLFloater::onClickCloseBtn();
+ }
+}
+void LLFloaterSidePanelContainer::close()
+{
LLFloater::onClickCloseBtn();
}
@@ -85,7 +95,7 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
if (!getVisible())
{
- openFloater();
+ openFloater();
}
LLPanel* panel = NULL;
@@ -106,10 +116,30 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, const LLSD& key)
{
- LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
+ //If we're already open then check whether anything is dirty
+ LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance<LLFloaterSidePanelContainer>(floater_name);
if (floaterp)
{
- floaterp->openChildPanel(sMainPanelName, key);
+ if ( floaterp->getVisible() )
+ {
+ LLSidepanelAppearance* panel = floaterp->getSidePanelAppearance();
+ if ( panel )
+ {
+ if ( panel->checkForDirtyEdits() )
+ {
+ panel->onClickConfirmExitWithoutSaveIntoAppearance();
+ }
+ else
+ {
+ //or a call into some new f() that just shows inv panel?
+ floaterp->openChildPanel(sMainPanelName, key);
+ }
+ }
+ }
+ else
+ {
+ floaterp->openChildPanel(sMainPanelName, key);
+ }
}
}
@@ -133,3 +163,19 @@ LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name,
return NULL;
}
+
+LLSidepanelAppearance* LLFloaterSidePanelContainer::getSidePanelAppearance()
+{
+ LLSidepanelAppearance* panel_appearance = NULL;
+ LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast<LLPanelOutfitEdit*>(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit"));
+ if (panel_outfit_edit)
+ {
+ LLFloater *parent = gFloaterView->getParentFloater(panel_outfit_edit);
+ if (parent == this )
+ {
+ panel_appearance = dynamic_cast<LLSidepanelAppearance*>(getPanel("appearance"));
+ }
+ }
+ return panel_appearance;
+
+}