summaryrefslogtreecommitdiff
path: root/indra/newview/llsidepanelappearance.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-08 18:18:42 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-08 18:18:42 -0400
commit2711ba44f69afa3ed1df9fefc0b1403b40f0ec35 (patch)
tree7b3b6b06fba9e82f282558bc7603e65a7faa08b9 /indra/newview/llsidepanelappearance.cpp
parent4bbcd26941c3be6b83214d0dc45c70f99e474dda (diff)
parenta2a25c9ed5de12cfb8a08844682368dc236a1b42 (diff)
merge
Diffstat (limited to 'indra/newview/llsidepanelappearance.cpp')
-rw-r--r--indra/newview/llsidepanelappearance.cpp88
1 files changed, 85 insertions, 3 deletions
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 74fa5a87bb..53b5593ac9 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -48,6 +48,8 @@
#include "llviewerregion.h"
#include "llvoavatarself.h"
#include "llviewerwearable.h"
+#include "llnotificationsutil.h"
+#include "llfloatersidepanelcontainer.h"
static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
@@ -70,13 +72,84 @@ private:
LLSidepanelAppearance *mPanel;
};
+bool LLSidepanelAppearance::callBackExitWithoutSaveViaBack(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 )
+ {
+ gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", TRUE);
+ LLAppearanceMgr::instance().setOutfitDirty( true );
+ showOutfitsInventoryPanel();
+ LLAppearanceMgr::getInstance()->wearBaseOutfit();
+ return true;
+ }
+ gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", FALSE);
+ return false;
+}
+
+bool LLSidepanelAppearance::callBackExitWithoutSaveViaClose(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if ( option == 0 )
+ {
+ gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", TRUE);
+ mEditWearable->revertChanges();
+ LLAppearanceMgr::getInstance()->wearBaseOutfit();
+ mLLFloaterSidePanelContainer->close();
+ return true;
+ }
+ gSavedSettings.setBOOL("ExitOutfitEditWithoutSave", FALSE);
+ return false;
+}
+
+void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaClose()
+{
+ if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+ {
+ LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+ LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
+ }
+ else
+ {
+ showOutfitsInventoryPanel();
+ }
+}
+
+void LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack()
+{
+ if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !mSidePanelJustOpened && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+ {
+ LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+ LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaBack,pSelf,_1,_2) );
+ }
+ else
+ {
+ showOutfitsInventoryPanel();
+ }
+}
+
+void LLSidepanelAppearance::onClose(LLFloaterSidePanelContainer* obj)
+{
+ mLLFloaterSidePanelContainer = obj;
+ if ( LLAppearanceMgr::getInstance()->isOutfitDirty() && !LLAppearanceMgr::getInstance()->isOutfitLocked() )
+ {
+ LLSidepanelAppearance* pSelf = (LLSidepanelAppearance *)this;
+ LLNotificationsUtil::add("ConfirmExitWithoutSave", LLSD(), LLSD(), boost::bind(&LLSidepanelAppearance::callBackExitWithoutSaveViaClose,pSelf,_1,_2) );
+ }
+ else
+ {
+ mLLFloaterSidePanelContainer->close();
+ }
+}
+
LLSidepanelAppearance::LLSidepanelAppearance() :
LLPanel(),
mFilterSubString(LLStringUtil::null),
mFilterEditor(NULL),
mOutfitEdit(NULL),
mCurrOutfitPanel(NULL),
- mOpened(false)
+ mOpened(false),
+ mSidePanelJustOpened(true)
{
LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, ""));
@@ -85,6 +158,8 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true));
gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false));
+
+
}
LLSidepanelAppearance::~LLSidepanelAppearance()
@@ -119,8 +194,8 @@ BOOL LLSidepanelAppearance::postBuild()
{
LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
if (back_btn)
- {
- back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this));
+ {
+ back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onClickConfirmExitWithoutSaveViaBack, this));
}
}
@@ -144,6 +219,7 @@ BOOL LLSidepanelAppearance::postBuild()
setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2));
+
return TRUE;
}
@@ -183,6 +259,12 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
{
+ //handle leaving and subsequent user verification of discarding any unsaved data
+ if ( mSidePanelJustOpened )
+ {
+ mSidePanelJustOpened = false;
+ }
+
LLSD visibility;
visibility["visible"] = new_visibility.asBoolean();
visibility["reset_accordion"] = false;