summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-12 15:09:31 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-12 15:09:31 +0300
commitf9530d88fb476f80dc8a240924fa88209e5c29ea (patch)
treedb82879cd293c6ee607a6d98422b1d788de29f3f /src/gui/widgets
parent251cd4a76fd2b986a1153909eb4e8893d6014c68 (diff)
downloadmanaverse-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.gz
manaverse-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.bz2
manaverse-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.xz
manaverse-f9530d88fb476f80dc8a240924fa88209e5c29ea.zip
Show dialog with question before opening url from chat.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 5ba400499..3a4bf165b 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -24,16 +24,31 @@
#include "item.h"
+#include "gui/confirmdialog.h"
#include "gui/itempopup.h"
#include "gui/viewport.h"
+#include "utils/gettext.h"
#include "utils/process.h"
#include <sstream>
#include <string>
+#include <guichan/actionlistener.hpp>
+
#include "debug.h"
+struct OpenUrlListener : public gcn::ActionListener
+{
+ void action(const gcn::ActionEvent &event)
+ {
+ if (event.getId() == "yes")
+ openBrowser(url);
+ }
+
+ std::string url;
+} listener;
+
ItemLinkHandler::ItemLinkHandler() :
mItemPopup(new ItemPopup)
{
@@ -79,6 +94,9 @@ void ItemLinkHandler::handleLink(const std::string &link,
{
std::string url = link;
replaceAll(url, " ", "");
- openBrowser(url);
+ listener.url = url;
+ ConfirmDialog *confirmDlg = new ConfirmDialog(
+ _("Open url"), url, false, true);
+ confirmDlg->addActionListener(&listener);
}
}