summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/browserbox.cpp14
-rw-r--r--src/utils/browserboxtools.cpp19
-rw-r--r--src/utils/browserboxtools.h2
3 files changed, 22 insertions, 13 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 13de696e9..bd565b3d6 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -231,19 +231,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
if (mEnableKeys)
{
- idx1 = tmp.find("###");
- while (idx1 != std::string::npos)
- {
- const size_t idx2 = tmp.find(';', idx1);
- if (idx2 == std::string::npos)
- break;
-
- const std::string str = inputManager.getKeyValueByNameLong(
- tmp.substr(idx1 + 3, idx2 - idx1 - 3));
- tmp.replace(idx1, idx2 - idx1 + 1, str);
-
- idx1 = tmp.find("###");
- }
+ BrowserBoxTools::replaceKeys(tmp);
}
idx1 = tmp.find("@@");
diff --git a/src/utils/browserboxtools.cpp b/src/utils/browserboxtools.cpp
index d39e8e280..6684684ff 100644
--- a/src/utils/browserboxtools.cpp
+++ b/src/utils/browserboxtools.cpp
@@ -23,6 +23,8 @@
#include "main.h"
#include "settings.h"
+#include "input/inputmanager.h"
+
#include "utils/stringutils.h"
#include "debug.h"
@@ -32,3 +34,20 @@ void BrowserBoxTools::replaceVars(std::string &data)
data = replaceAll(data, "%VER%", SMALL_VERSION);
data = replaceAll(data, "%SUPPORTURL%", settings.supportUrl);
}
+
+void BrowserBoxTools::replaceKeys(std::string &data)
+{
+ size_t idx1 = data.find("###");
+ while (idx1 != std::string::npos)
+ {
+ const size_t idx2 = data.find(';', idx1);
+ if (idx2 == std::string::npos)
+ break;
+
+ const std::string str = inputManager.getKeyValueByNameLong(
+ data.substr(idx1 + 3, idx2 - idx1 - 3));
+ data.replace(idx1, idx2 - idx1 + 1, str);
+
+ idx1 = data.find("###");
+ }
+}
diff --git a/src/utils/browserboxtools.h b/src/utils/browserboxtools.h
index eba70118a..c2d0c9dc9 100644
--- a/src/utils/browserboxtools.h
+++ b/src/utils/browserboxtools.h
@@ -28,6 +28,8 @@
namespace BrowserBoxTools
{
void replaceVars(std::string &data);
+
+ void replaceKeys(std::string &data);
} // BrowserBoxTools
#endif // UTILS_BROWSERBOXTOOLS_H