From 70d4f24f38a4036f84c1f71803173199e95ad675 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 16 Jan 2013 14:41:11 +0300 Subject: Add context menu to browserbox http links. --- src/gui/popupmenu.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/gui/popupmenu.cpp') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 844fc4e3f..807f5413e 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -69,7 +69,9 @@ #include "resources/iteminfo.h" +#include "utils/copynpaste.h" #include "utils/gettext.h" +#include "utils/process.h" #include @@ -1549,6 +1551,14 @@ void PopupMenu::handleLink(const std::string &link, if (mTextField) mTextField->handlePaste(); } + else if (link == "open link" && !mNick.empty()) + { + openBrowser(mNick); + } + else if (link == "clipboard link" && !mNick.empty()) + { + sendBuffer(mNick); + } else if (!link.compare(0, 10, "guild-pos-")) { if (player_node) @@ -2079,6 +2089,23 @@ void PopupMenu::showTextFieldPopup(int x, int y, TextField *input) showPopup(x, y); } +void PopupMenu::showLinkPopup(const int x, const int y, + const std::string &link) +{ + mX = x; + mY = y; + mNick = link; + + mBrowserBox->clearRows(); + + mBrowserBox->addRow("open link", _("Open link")); + mBrowserBox->addRow("clipboard link", _("Copy to clipboard")); + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow("cancel", _("Cancel")); + + showPopup(x, y); +} + void PopupMenu::showPopup(int x, int y) { const int pad2 = 2 * getPadding(); -- cgit v1.2.3-70-g09d2