summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-04 22:49:50 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-05 15:56:48 +0300
commit011d05e7ff9abfc6052951fee954b1c193ea4fff (patch)
tree02ffbdad94063288d6809b0ae6db20f88a39099c /src/gui
parent4f521dad0d3b06e07bb562f05e524c909b7fe878 (diff)
downloadplus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.gz
plus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.bz2
plus-011d05e7ff9abfc6052951fee954b1c193ea4fff.tar.xz
plus-011d05e7ff9abfc6052951fee954b1c193ea4fff.zip
Add into paths.xml option for set string for commands in links.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp16
-rw-r--r--src/gui/widgets/itemlinkhandler.h3
2 files changed, 13 insertions, 6 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
{
diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h
index 25d6dbe41..6350b9fc3 100644
--- a/src/gui/widgets/itemlinkhandler.h
+++ b/src/gui/widgets/itemlinkhandler.h
@@ -40,7 +40,8 @@ class ItemLinkHandler final : public LinkHandler
MouseEvent *event) override final;
private:
- static void handleCommandLink(const std::string &link);
+ static void handleCommandLink(const std::string &link,
+ const std::string &prefix);
static void handleHelpLink(const std::string &link);