Add Copy Page URL to media right click menu
This commit is contained in:
@@ -54,6 +54,7 @@
|
|||||||
#include "llviewermenu.h"
|
#include "llviewermenu.h"
|
||||||
|
|
||||||
// linden library includes
|
// linden library includes
|
||||||
|
#include "llclipboard.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llsdutil.h"
|
#include "llsdutil.h"
|
||||||
#include "lltextbox.h"
|
#include "lltextbox.h"
|
||||||
@@ -397,6 +398,7 @@ void LLMediaCtrl::onFocusLost()
|
|||||||
BOOL LLMediaCtrl::postBuild ()
|
BOOL LLMediaCtrl::postBuild ()
|
||||||
{
|
{
|
||||||
/*LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
|
/*LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
|
||||||
|
registar.add("Copy.PageURL", boost::bind(&LLMediaCtrl::onCopyURL, this));
|
||||||
registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
|
registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
|
||||||
registar.add("Open.ViewSource", boost::bind(&LLMediaCtrl::onShowSource, this));
|
registar.add("Open.ViewSource", boost::bind(&LLMediaCtrl::onShowSource, this));
|
||||||
|
|
||||||
@@ -414,6 +416,12 @@ BOOL LLMediaCtrl::postBuild ()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLMediaCtrl::onCopyURL() const
|
||||||
|
{
|
||||||
|
auto wurl = utf8str_to_wstring(mCurrentNavUrl);
|
||||||
|
gClipboard.copyFromSubstring(wurl, 0, wurl.size());
|
||||||
|
}
|
||||||
|
|
||||||
void LLMediaCtrl::onOpenWebInspector()
|
void LLMediaCtrl::onOpenWebInspector()
|
||||||
{
|
{
|
||||||
if (mMediaSource && mMediaSource->hasMedia())
|
if (mMediaSource && mMediaSource->hasMedia())
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ public:
|
|||||||
// Incoming media event dispatcher
|
// Incoming media event dispatcher
|
||||||
void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
|
void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override;
|
||||||
|
|
||||||
|
void onCopyURL() const;
|
||||||
// right click debugging item
|
// right click debugging item
|
||||||
void onOpenWebInspector();
|
void onOpenWebInspector();
|
||||||
void onShowSource();
|
void onShowSource();
|
||||||
|
|||||||
@@ -9433,6 +9433,15 @@ LLMediaCtrl* get_focused_media_ctrl()
|
|||||||
return media_ctrl;
|
return media_ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MediaCtrlCopyURL : public view_listener_t
|
||||||
|
{
|
||||||
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
|
{
|
||||||
|
get_focused_media_ctrl()->onCopyURL();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class MediaCtrlWebInspector : public view_listener_t
|
class MediaCtrlWebInspector : public view_listener_t
|
||||||
{
|
{
|
||||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
@@ -9812,6 +9821,7 @@ void initialize_menus()
|
|||||||
LLTextEditor::addMenuListeners();
|
LLTextEditor::addMenuListeners();
|
||||||
|
|
||||||
// Media Ctrl menus
|
// Media Ctrl menus
|
||||||
|
addMenu(new MediaCtrlCopyURL(), "Copy.PageURL");
|
||||||
addMenu(new MediaCtrlWebInspector(), "Open.WebInspector");
|
addMenu(new MediaCtrlWebInspector(), "Open.WebInspector");
|
||||||
addMenu(new MediaCtrlViewSource(), "Open.ViewSource");
|
addMenu(new MediaCtrlViewSource(), "Open.ViewSource");
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,12 @@
|
|||||||
<menu_item_separator
|
<menu_item_separator
|
||||||
layout="topleft"
|
layout="topleft"
|
||||||
name="undo_separator" />
|
name="undo_separator" />
|
||||||
|
<menu_item_call
|
||||||
|
label="Copy Page URL"
|
||||||
|
name="copy_page_url">
|
||||||
|
<menu_item_call.on_click
|
||||||
|
function="Copy.PageURL" />
|
||||||
|
</menu_item_call>
|
||||||
<menu_item_call
|
<menu_item_call
|
||||||
label="Cut"
|
label="Cut"
|
||||||
layout="topleft"
|
layout="topleft"
|
||||||
|
|||||||
Reference in New Issue
Block a user