diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-04 22:49:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-05 15:56:48 +0300 |
commit | 011d05e7ff9abfc6052951fee954b1c193ea4fff (patch) | |
tree | 02ffbdad94063288d6809b0ae6db20f88a39099c /src/gui/widgets/itemlinkhandler.cpp | |
parent | 4f521dad0d3b06e07bb562f05e524c909b7fe878 (diff) | |
download | manaplus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.gz manaplus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.bz2 manaplus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.xz manaplus-011d05e7ff9abfc6052951fee954b1c193ea4fff.zip |
Add into paths.xml option for set string for commands in links.
Diffstat (limited to 'src/gui/widgets/itemlinkhandler.cpp')
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 86d0a5eec..a8e90acd7 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -23,6 +23,7 @@ #include "gui/widgets/itemlinkhandler.h" #include "itemcolormanager.h" +#include "settings.h" #include "gui/viewport.h" @@ -59,14 +60,16 @@ ItemLinkHandler::~ItemLinkHandler() { } -void ItemLinkHandler::handleCommandLink(const std::string &link) +void ItemLinkHandler::handleCommandLink(const std::string &link, + const std::string &prefix) { std::string cmd; std::string args; - if (!parse2Str(link.substr(1), cmd, args)) + const std::string cmdStr = link.substr(prefix.size()); + if (!parse2Str(cmdStr, cmd, args)) { - cmd = link.substr(1); + cmd = cmdStr; args.clear(); } inputManager.executeRemoteChatCommand(cmd, args, nullptr); @@ -158,7 +161,6 @@ void ItemLinkHandler::handleSearchLink(const std::string &link) void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *const event) { - logger->log("link: " + link); if (strStartWith(link, "http://") || strStartWith(link, "https://")) { handleHttpLink(link, event); @@ -171,9 +173,13 @@ void ItemLinkHandler::handleLink(const std::string &link, { handleHelpLink(link); } + else if (strStartWith(link, settings.linkCommandSymbol)) + { + handleCommandLink(link, settings.linkCommandSymbol); + } else if (strStartWith(link, "=")) { - handleCommandLink(link); + handleCommandLink(link, "="); } else { |