diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-12 15:09:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-12 15:09:31 +0300 |
commit | f9530d88fb476f80dc8a240924fa88209e5c29ea (patch) | |
tree | db82879cd293c6ee607a6d98422b1d788de29f3f | |
parent | 251cd4a76fd2b986a1153909eb4e8893d6014c68 (diff) | |
download | plus-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.gz plus-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.bz2 plus-f9530d88fb476f80dc8a240924fa88209e5c29ea.tar.xz plus-f9530d88fb476f80dc8a240924fa88209e5c29ea.zip |
Show dialog with question before opening url from chat.
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 20 |
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); } } |