summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemlinkhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-16 14:41:11 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-16 14:41:11 +0300
commit70d4f24f38a4036f84c1f71803173199e95ad675 (patch)
tree0abd0ad2c45092e07a39011602fbd6ab60b3a513 /src/gui/widgets/itemlinkhandler.cpp
parent90752e4a52d85ac3c77ed2ed28227e8a45b250ab (diff)
downloadmanaplus-70d4f24f38a4036f84c1f71803173199e95ad675.tar.gz
manaplus-70d4f24f38a4036f84c1f71803173199e95ad675.tar.bz2
manaplus-70d4f24f38a4036f84c1f71803173199e95ad675.tar.xz
manaplus-70d4f24f38a4036f84c1f71803173199e95ad675.zip
Add context menu to browserbox http links.
Diffstat (limited to 'src/gui/widgets/itemlinkhandler.cpp')
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 293eb5237..4c5baa8a5 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -35,6 +35,7 @@
#include <string>
#include <guichan/actionlistener.hpp>
+#include <guichan/mouseinput.hpp>
#include "debug.h"
@@ -61,7 +62,7 @@ ItemLinkHandler::~ItemLinkHandler()
}
void ItemLinkHandler::handleLink(const std::string &link,
- gcn::MouseEvent *event A_UNUSED)
+ gcn::MouseEvent *event)
{
if (!strStartWith(link, "http://"))
{
@@ -92,11 +93,22 @@ void ItemLinkHandler::handleLink(const std::string &link,
}
else
{
+ if (!event)
+ return;
std::string url = link;
replaceAll(url, " ", "");
listener.url = url;
- ConfirmDialog *const confirmDlg = new ConfirmDialog(
- _("Open url"), url, false, true);
- confirmDlg->addActionListener(&listener);
+ const int button = event->getButton();
+ if (button == gcn::MouseInput::LEFT)
+ {
+ ConfirmDialog *const confirmDlg = new ConfirmDialog(
+ _("Open url"), url, false, true);
+ confirmDlg->addActionListener(&listener);
+ }
+ else if (button == gcn::MouseInput::RIGHT)
+ {
+ if (viewport)
+ viewport->showLinkPopup(url);
+ }
}
}