summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2012-07-11 18:58:41 -0400
committerJonathan Yap <none@none>2012-07-11 18:58:41 -0400
commite4cea7631293b1192bfe720146410c1aa61654aa (patch)
treede063c6204ac7fae9a6672fd28756d0c3a336b7e
parent90547ff411db177bf6424ca553449a81a808fc0f (diff)
STORM-1898 Add "Copy SLURL" to context menu when right clicking Landmarks in Inventory
-rw-r--r--indra/newview/llinventorybridge.cpp28
-rw-r--r--indra/newview/llinventorybridge.h3
-rw-r--r--indra/newview/skins/default/xui/en/menu_inventory.xml8
3 files changed, 38 insertions, 1 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index b86c453d61..657e149319 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -71,6 +71,9 @@
#include "llviewerwindow.h"
#include "llvoavatarself.h"
#include "llwearablelist.h"
+#include "lllandmarkactions.h"
+
+void copy_slurl_to_clipboard_callback_inv(const std::string& slurl);
// Marketplace outbox current disabled
#define ENABLE_MERCHANT_OUTBOX_CONTEXT_MENU 1
@@ -1396,6 +1399,29 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
const LLUUID outbox_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
copy_item_to_outbox(itemp, outbox_id, LLUUID::null, LLToolDragAndDrop::getOperationId());
}
+ else if ("copy_slurl" == action)
+ {
+ LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
+ if(item)
+ {
+ LLUUID asset_id = item->getAssetUUID();
+ LLLandmark* landmark = gLandmarkList.getAsset(asset_id);
+ if (landmark)
+ {
+ LLVector3d global_pos;
+ landmark->getGlobalPos(global_pos);
+ LLLandmarkActions::getSLURLfromPosGlobal(global_pos, &copy_slurl_to_clipboard_callback_inv, true);
+ }
+ }
+ }
+}
+
+void copy_slurl_to_clipboard_callback_inv(const std::string& slurl)
+{
+ gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl));
+ LLSD args;
+ args["SLURL"] = slurl;
+ LLNotificationsUtil::add("CopySLURL", args);
}
void LLItemBridge::selectItem()
@@ -4397,6 +4423,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
items.push_back(std::string("Landmark Separator"));
+ items.push_back(std::string("url_copy"));
items.push_back(std::string("About Landmark"));
}
@@ -4405,6 +4432,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// info panel can be shown at a time.
if ((flags & FIRST_SELECTED_ITEM) == 0)
{
+ disabled_items.push_back(std::string("url_copy"));
disabled_items.push_back(std::string("About Landmark"));
}
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index dc9e88d54d..118430efe1 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -197,6 +197,8 @@ public:
const LLUUID& uuid) :
LLInvFVBridge(inventory, root, uuid) {}
+ typedef boost::function<void(std::string& slurl)> slurl_callback_t;
+
virtual void performAction(LLInventoryModel* model, std::string action);
virtual void selectItem();
virtual void restoreItem();
@@ -214,7 +216,6 @@ public:
virtual BOOL isItemCopyable() const;
virtual BOOL hasChildren() const { return FALSE; }
virtual BOOL isUpToDate() const { return TRUE; }
-
/*virtual*/ void clearDisplayName() { mDisplayName.clear(); }
LLViewerInventoryItem* getItem() const;
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index b13bf5b508..13dc0b941a 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -537,6 +537,14 @@
layout="topleft"
name="Landmark Separator" />
<menu_item_call
+ label="Copy SLurl"
+ layout="topleft"
+ name="url_copy">
+ <menu_item_call.on_click
+ function="Inventory.DoToSelected"
+ parameter="copy_slurl" />
+ </menu_item_call>
+ <menu_item_call
label="About Landmark"
layout="topleft"
name="About Landmark">