aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/utils/CommonUtils.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-12 23:03:57 +0000
committersaturneric <[email protected]>2025-04-12 23:03:57 +0000
commit571cfb16ccfd7ac6bc59b5acc77a94d0bdcf0990 (patch)
treea4efe7ba4d5344897c60513c03172d5de0191658 /src/core/utils/CommonUtils.cpp
parentfix: upgrade to gpgme 1.24.2 (diff)
downloadGpgFrontend-571cfb16ccfd7ac6bc59b5acc77a94d0bdcf0990.tar.gz
GpgFrontend-571cfb16ccfd7ac6bc59b5acc77a94d0bdcf0990.zip
feat: add openpgp smart card support
Diffstat (limited to 'src/core/utils/CommonUtils.cpp')
-rw-r--r--src/core/utils/CommonUtils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp
index 9687acd4..0adc4d7f 100644
--- a/src/core/utils/CommonUtils.cpp
+++ b/src/core/utils/CommonUtils.cpp
@@ -98,4 +98,13 @@ auto GFUnStrDup(const char* s) -> QString {
auto GPGFRONTEND_CORE_EXPORT IsFlatpakENV() -> bool {
return QString::fromLocal8Bit(qgetenv("container")) == "flatpak";
}
+
+auto GPGFRONTEND_CORE_EXPORT ParseHexEncodedVersionTuple(const QString& s)
+ -> int {
+ // s is a hex-encoded, unsigned int-packed version tuple,
+ // i.e. each byte represents one part of the version tuple
+ bool ok;
+ const auto version = s.toUtf8().toUInt(&ok, 16);
+ return ok ? static_cast<int>(version) : -1;
+}
} // namespace GpgFrontend \ No newline at end of file