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/llpanelprofileclassifieds.cpp | |
parent | d7459d87e0b7507b3452aa4effa4dc97e06e8551 (diff) |
SL-15312 Confirm usaved changes dialog when closing floater
Diffstat (limited to 'indra/newview/llpanelprofileclassifieds.cpp')
-rw-r--r-- | indra/newview/llpanelprofileclassifieds.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index 91243169a9..a961422dfe 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -287,11 +287,11 @@ void LLPanelProfileClassifieds::onClickDelete() { LLUUID classified_id = classified_panel->getClassifiedId(); LLSD args; - args["PICK"] = classified_panel->getClassifiedName(); + args["CLASSIFIED"] = classified_panel->getClassifiedName(); LLSD payload; payload["classified_id"] = classified_id; payload["tab_idx"] = mTabContainer->getCurrentPanelIndex(); - LLNotificationsUtil::add("DeleteAvatarPick", args, payload, + LLNotificationsUtil::add("ProfileDeleteClassified", args, payload, boost::bind(&LLPanelProfileClassifieds::callbackDeleteClassified, this, _1, _2)); } } @@ -417,6 +417,32 @@ void LLPanelProfileClassifieds::updateData() } } +bool LLPanelProfileClassifieds::hasNewClassifieds() +{ + for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + { + LLPanelProfileClassified* classified_panel = dynamic_cast<LLPanelProfileClassified*>(mTabContainer->getPanelByIndex(tab_idx)); + if (classified_panel && classified_panel->isNew()) + { + return true; + } + } + return false; +} + +bool LLPanelProfileClassifieds::hasUnsavedChanges() +{ + for (S32 tab_idx = 0; tab_idx < mTabContainer->getTabCount(); ++tab_idx) + { + LLPanelProfileClassified* classified_panel = dynamic_cast<LLPanelProfileClassified*>(mTabContainer->getPanelByIndex(tab_idx)); + if (classified_panel && classified_panel->isDirty()) // includes 'new' + { + return true; + } + } + return false; +} + bool LLPanelProfileClassifieds::canAddNewClassified() { return (mTabContainer->getTabCount() < MAX_AVATAR_CLASSIFIEDS); @@ -427,7 +453,7 @@ bool LLPanelProfileClassifieds::canDeleteClassified() return (mTabContainer->getTabCount() > 0); } -void LLPanelProfileClassifieds::apply() +void LLPanelProfileClassifieds::commitUnsavedChanges() { if (getIsLoaded()) { @@ -701,6 +727,7 @@ void LLPanelProfileClassified::processProperties(void* data, EAvatarProcessorTyp { // see LLPanelProfileClassified::sendUpdate() for notes mIsNewWithErrors = false; + mIsNew = false; setClassifiedName(c_info->name); setDescription(c_info->description); @@ -773,7 +800,10 @@ void LLPanelProfileClassified::updateButtons() mTeleportBtnCnt->setVisible(!edit_mode); mMapBtnCnt->setVisible(!edit_mode); mEditBtnCnt->setVisible(!edit_mode); - mCancelBtnCnt->setVisible(edit_mode); + + // cancel button should either delete unpublished + // classified or not be there at all + mCancelBtnCnt->setVisible(edit_mode && !mIsNew); mSaveBtnCnt->setVisible(edit_mode); mEditButton->setVisible(!edit_mode && getSelfProfile()); } |