From f9530d88fb476f80dc8a240924fa88209e5c29ea Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 12 Sep 2012 15:09:31 +0300 Subject: Show dialog with question before opening url from chat. --- src/gui/widgets/itemlinkhandler.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/gui/widgets') 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 #include +#include + #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); } } -- cgit v1.2.3-70-g09d2