diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-06-02 00:17:54 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-06-02 00:20:30 +0300 |
commit | 3efe64619b772ce8cab596d7e74de48dcc7f6c20 (patch) | |
tree | b951db7f2784ab5af8301151b01cccff5a7bd0b0 /indra/newview/llfloaterprofile.cpp | |
parent | d7459d87e0b7507b3452aa4effa4dc97e06e8551 (diff) |
SL-15312 Confirm usaved changes dialog when closing floater
Diffstat (limited to 'indra/newview/llfloaterprofile.cpp')
-rw-r--r-- | indra/newview/llfloaterprofile.cpp | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp index 78920863e2..a4a9fe8410 100644 --- a/indra/newview/llfloaterprofile.cpp +++ b/indra/newview/llfloaterprofile.cpp @@ -28,9 +28,10 @@ #include "llfloaterprofile.h" +#include "llagent.h" //gAgent +#include "llnotificationsutil.h" #include "llpanelavatar.h" #include "llpanelprofile.h" -#include "llagent.h" //gAgent static const std::string PANEL_PROFILE_VIEW = "panel_profile_view"; @@ -65,6 +66,62 @@ BOOL LLFloaterProfile::postBuild() return TRUE; } +void LLFloaterProfile::onClickCloseBtn(bool app_quitting) +{ + if (!app_quitting) + { + if (mPanelProfile->hasUnpublishedClassifieds()) + { + LLNotificationsUtil::add("ProfileUnpublishedClassified", LLSD(), LLSD(), + boost::bind(&LLFloaterProfile::onUnsavedChangesCallback, this, _1, _2, false)); + } + else if (mPanelProfile->hasUnsavedChanges()) + { + LLNotificationsUtil::add("ProfileUnsavedChanges", LLSD(), LLSD(), + boost::bind(&LLFloaterProfile::onUnsavedChangesCallback, this, _1, _2, true)); + } + else + { + closeFloater(); + } + } + else + { + closeFloater(); + } +} + +void LLFloaterProfile::onUnsavedChangesCallback(const LLSD& notification, const LLSD& response, bool can_save) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (can_save) + { + // savable content + + if (option == 0) // Save + { + mPanelProfile->commitUnsavedChanges(); + closeFloater(); + } + if (option == 1) // Discard + { + closeFloater(); + } + // else cancel + } + else + { + // classifieds + + if (option == 0) // Ok + { + closeFloater(); + } + // else cancel + } + +} + void LLFloaterProfile::createPick(const LLPickData &data) { mPanelProfile->createPick(data); |