Blob Blame History Raw
From 1d510c6152efe43195bc14f56f472eec0ad0af6f Mon Sep 17 00:00:00 2001
From: tuxmaster5000 <837503+tuxmaster5000@users.noreply.github.com>
Date: Sun, 10 Mar 2019 14:49:42 +0100
Subject: [PATCH 1/2] - Load translation from Qt path on Linux(relase build) -
 Load config.json from /usr/share/AusweisApp2 on Linux(relase build) Both are
 needed, to package the app as an rpm package.

---
 src/global/FileDestination.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: AusweisApp2-1.14.3/src/global/FileDestination.h
===================================================================
--- AusweisApp2-1.14.3.orig/src/global/FileDestination.h
+++ AusweisApp2-1.14.3/src/global/FileDestination.h
@@ -8,6 +8,7 @@
 
 #include <QCoreApplication>
 #include <QStringBuilder>
+#include <QLibraryInfo>
 
 namespace governikus
 {
@@ -24,6 +25,9 @@ class FileDestination
 			#ifdef Q_OS_ANDROID
 			return QStringLiteral("assets:");
 
+			#elif defined(Q_OS_LINUX)
+			return QStringLiteral("/usr/share/AusweisApp2");
+
 			#else
 			return QCoreApplication::applicationDirPath();
 
@@ -34,13 +38,23 @@ class FileDestination
 	public:
 		static QString getPath(const QString& pFilename)
 		{
-			return getPath() % QLatin1Char('/') % pFilename;
+			#if defined(Q_OS_LINUX)
+			if (pFilename.compare(QStringLiteral("translations")) == 0)
+				return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+			else
+			#endif
+				return getPath() % QLatin1Char('/') % pFilename;
 		}
 
 
 		static QString getPath(const char* pFilename)
 		{
-			return getPath() % QLatin1Char('/') % QString::fromUtf8(pFilename);
+			#if defined(Q_OS_LINUX)
+			if (strcmp(pFilename, "translations") == 0)
+				return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+			else
+			#endif
+				return getPath() % QLatin1Char('/') % QString::fromUtf8(pFilename);
 		}