summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-08-22 19:32:50 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-08-22 19:32:50 +0300
commita1e6383b5f79a14d3394f5d849a1386ff72341c3 (patch)
tree233cff4c6913a707ee8285907bfdda68273c0fe1 /indra
parentc24f638088f3d67ceebe82520787a4d344ebd72f (diff)
MAINT-8926 Don't allow overwritting default preset
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatersaveprefpreset.cpp7
-rw-r--r--indra/newview/llpresetsmanager.cpp5
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml7
3 files changed, 18 insertions, 1 deletions
diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp
index 6320c6b626..684778c93a 100644
--- a/indra/newview/llfloatersaveprefpreset.cpp
+++ b/indra/newview/llfloatersaveprefpreset.cpp
@@ -34,6 +34,7 @@
#include "llfloaterreg.h"
#include "llnotificationsutil.h"
#include "llpresetsmanager.h"
+#include "lltrans.h"
LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key)
: LLFloater(key)
@@ -86,7 +87,11 @@ void LLFloaterSavePrefPreset::onBtnSave()
{
std::string name = mPresetCombo->getSimple();
- if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
+ if ((name == LLTrans::getString(PRESETS_DEFAULT)) || (name == PRESETS_DEFAULT))
+ {
+ LLNotificationsUtil::add("DefaultPresetNotSaved");
+ }
+ else if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name))
{
LLSD args;
args["NAME"] = name;
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 96818d5a21..df93572508 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -138,6 +138,11 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
{
name = PRESETS_DEFAULT;
}
+ if (!createDefault && name == PRESETS_DEFAULT)
+ {
+ LL_WARNS() << "Should not overwrite default" << LL_ENDL;
+ return false;
+ }
bool saved = false;
std::vector<std::string> name_list;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6b164c660a..9eaa5330c3 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -8277,6 +8277,13 @@ Failed to save snapshot to [PATH]: Directory does not exist.
type="notifytip">
Error saving preset [NAME].
</notification>
+
+ <notification
+ icon="notifytip.tga"
+ name="DefaultPresetNotSaved"
+ type="notifytip">
+Can not overwrite default preset.
+ </notification>
<notification
icon="notifytip.tga"