summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2016-04-13 18:59:00 +0300
committerandreykproductengine <akleshchev@productengine.com>2016-04-13 18:59:00 +0300
commiteec33adf34db3fe0c32600808458e4307ede1bf0 (patch)
tree10919302c8706f061e02c97864ed4dbd13aa4fca /indra
parent2311d8c2b200574a0fb38c80222a0f09ce984f67 (diff)
MAINT-3286 FIXED Fix error message on snapshot save when user has no L$
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloaternamedesc.cpp22
-rwxr-xr-xindra/newview/llfloatersnapshot.cpp14
-rwxr-xr-xindra/newview/llfloatersnapshot.h1
-rwxr-xr-xindra/newview/llpanelsnapshotinventory.cpp17
-rwxr-xr-xindra/newview/skins/default/xui/en/notifications.xml16
5 files changed, 63 insertions, 7 deletions
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index 135bbb335e..4a5732aecf 100755
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -42,6 +42,8 @@
#include "llfloaterperms.h"
#include "llviewercontrol.h"
#include "llviewermenufile.h" // upload_new_resource()
+#include "llstatusbar.h" // can_afford_transaction()
+#include "llnotificationsutil.h"
#include "lluictrlfactory.h"
#include "llstring.h"
#include "lleconomy.h"
@@ -161,12 +163,15 @@ void LLFloaterNameDesc::onBtnOK( )
LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
- void *nruserdata = NULL;
- std::string display_name = LLStringUtil::null;
- LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
+ if (can_afford_transaction(expected_upload_cost))
+ {
+ void *nruserdata = NULL;
+ std::string display_name = LLStringUtil::null;
+
+ LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
mFilenameAndPath,
- getChild<LLUICtrl>("name_form")->getValue().asString(),
+ getChild<LLUICtrl>("name_form")->getValue().asString(),
getChild<LLUICtrl>("description_form")->getValue().asString(), 0,
LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
@@ -174,7 +179,14 @@ void LLFloaterNameDesc::onBtnOK( )
LLFloaterPerms::getEveryonePerms("Uploads"),
expected_upload_cost));
- upload_new_resource(uploadInfo, callback, nruserdata);
+ upload_new_resource(uploadInfo, callback, nruserdata);
+ }
+ else
+ {
+ LLSD args;
+ args["COST"] = llformat("%d", expected_upload_cost);
+ LLNotificationsUtil::add("ErrorTextureCannotAfford", args);
+ }
closeFloater(false);
}
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index afec981d56..b906671c7f 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1418,6 +1418,20 @@ void LLFloaterSnapshot::postPanelSwitch()
}
// static
+void LLFloaterSnapshot::inventorySaveFailed()
+{
+ LLFloaterSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return;
+ }
+
+ instance->impl.updateControls(instance);
+ instance->impl.setStatus(Impl::STATUS_FINISHED, false, "inventory");
+}
+
+// static
LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData()
{
// FIXME: May not work for textures.
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 0bb9474bb5..eb3a94999b 100755
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -61,6 +61,7 @@ public:
static BOOL saveLocal();
static void postSave();
static void postPanelSwitch();
+ static void inventorySaveFailed();
static LLPointer<LLImageFormatted> getImageData();
static const LLVector3d& getPosTakenGlobal();
static void setAgentEmail(const std::string& email);
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index c55e230b5e..a2d1752c6a 100755
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -34,6 +34,8 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llviewercontrol.h" // gSavedSettings
+#include "llstatusbar.h" // can_afford_transaction()
+#include "llnotificationsutil.h"
/**
* The panel provides UI for saving snapshot as an inventory texture.
@@ -102,6 +104,17 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
void LLPanelSnapshotInventory::onSend()
{
- LLFloaterSnapshot::saveTexture();
- LLFloaterSnapshot::postSave();
+ S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ if (can_afford_transaction(expected_upload_cost))
+ {
+ LLFloaterSnapshot::saveTexture();
+ LLFloaterSnapshot::postSave();
+ }
+ else
+ {
+ LLSD args;
+ args["COST"] = llformat("%d", expected_upload_cost);
+ LLNotificationsUtil::add("ErrorPhotoCannotAfford", args);
+ LLFloaterSnapshot::inventorySaveFailed();
+ }
}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6b75a2083d..589c05de99 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1166,6 +1166,22 @@ Error encoding snapshot.
<notification
icon="alertmodal.tga"
+ name="ErrorPhotoCannotAfford"
+ type="alertmodal">
+ You need L$[COST] to save a photo to your inventory. You may either buy L$ or save the photo to your computer instead.
+ <tag>fail</tag>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="ErrorTextureCannotAfford"
+ type="alertmodal">
+ You need L$[COST] to save a texture to your inventory. You may either buy L$ or save the photo to your computer instead.
+ <tag>fail</tag>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="ErrorUploadingPostcard"
type="alertmodal">
There was a problem sending a snapshot due to the following reason: [REASON]