summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatergesture.cpp
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2019-07-29 17:42:44 +0300
committermaxim_productengine <mnikolenko@productengine.com>2019-07-29 17:42:44 +0300
commita28386b93472f7881b6d75a06f4ecf5fbd456a17 (patch)
treee692b6c52dd520535df1ce97b6da7a84bcadb740 /indra/newview/llfloatergesture.cpp
parentb1b102cf662b9deb00c6231ca335fcf46b86034c (diff)
SL-9189 Add ability to rename gesture in Gesture list
Diffstat (limited to 'indra/newview/llfloatergesture.cpp')
-rw-r--r--indra/newview/llfloatergesture.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index b840d37c4d..e778e8eb9e 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -41,6 +41,7 @@
#include "llkeyboard.h"
#include "llmenugl.h"
#include "llmultigesture.h"
+#include "llnotificationsutil.h"
#include "llpreviewgesture.h"
#include "llscrolllistctrl.h"
#include "lltrans.h"
@@ -125,6 +126,7 @@ LLFloaterGesture::LLFloaterGesture(const LLSD& key)
mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
+ mCommitCallbackRegistrar.add("Gesture.Action.Rename", boost::bind(&LLFloaterGesture::onRenameSelected, this));
mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
}
@@ -430,6 +432,19 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command)
{
return mGestureList->getAllSelected().size() == 1;
}
+ else if ("rename_gesture" == command_name)
+ {
+ if (mGestureList->getAllSelected().size() == 1)
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(mGestureList->getCurrentID());
+
+ if (item && item->getPermissions().allowModifyBy(gAgentID))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
return true;
}
@@ -514,6 +529,44 @@ void LLFloaterGesture::onActivateBtnClick()
}
}
+void LLFloaterGesture::onRenameSelected()
+{
+ LLViewerInventoryItem* gesture = gInventory.getItem(mGestureList->getCurrentID());
+ if (!gesture)
+ {
+ return;
+ }
+
+ LLSD args;
+ args["NAME"] = gesture->getName();
+
+ LLSD payload;
+ payload["gesture_id"] = mGestureList->getCurrentID();
+
+ LLNotificationsUtil::add("RenameGesture", args, payload, boost::bind(onGestureRename, _1, _2));
+
+}
+
+void LLFloaterGesture::onGestureRename(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (option != 0) return; // canceled
+
+ std::string new_name = response["new_name"].asString();
+ LLInventoryObject::correctInventoryName(new_name);
+ if (!new_name.empty())
+ {
+ LLUUID item_id = notification["payload"]["gesture_id"].asUUID();
+ LLViewerInventoryItem* gesture = gInventory.getItem(item_id);
+ if (gesture && (gesture->getName() != new_name))
+ {
+ LLSD updates;
+ updates["name"] = new_name;
+ update_inventory_item(item_id, updates, NULL);
+ }
+ }
+}
+
void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
{
std::string command_name = command.asString();