Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[messageserver] Support ~ as specifier for log file paths. Contribute…
…s to JB#50368 Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= <tomi.leppanen@jolla.com> | ||
Date: Wed, 1 Jul 2020 13:28:25 +0300 | ||
Subject: [PATCH] Support ~ as specifier for log file paths. | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
With this ~ is expanded to QDir::homePath(). | ||
|
||
Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com> | ||
--- | ||
src/libraries/qmfclient/support/qmaillog.cpp | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/libraries/qmfclient/support/qmaillog.cpp b/src/libraries/qmfclient/support/qmaillog.cpp | ||
index 2c377c33..45c803cd 100644 | ||
--- a/src/libraries/qmfclient/support/qmaillog.cpp | ||
+++ b/src/libraries/qmfclient/support/qmaillog.cpp | ||
@@ -39,6 +39,7 @@ | ||
#include <QHash> | ||
#include <QStringList> | ||
#include <QSettings> | ||
+#include <QDir> | ||
|
||
#include <sys/types.h> | ||
#if !defined(Q_OS_WIN) | ||
@@ -123,9 +124,12 @@ QMF_EXPORT void qMailLoggersRecreate(const QString& organization, const QString& | ||
|
||
const bool syslogEnabled = settings.value(QLatin1String("Syslog/Enabled"), false).toBool(); | ||
const bool stderrEnabled = settings.value(QLatin1String("StdStreamLog/Enabled"), defaultStdError).toBool(); | ||
- const QString filePath = settings.value(QLatin1String("FileLog/Path")).toString(); | ||
+ QString filePath = settings.value(QLatin1String("FileLog/Path")).toString(); | ||
const bool fileEnabled = settings.value(QLatin1String("FileLog/Enabled"), false).toBool() && !filePath.isEmpty(); | ||
|
||
+ if (filePath.startsWith(QStringLiteral("~/"))) | ||
+ filePath.replace(0, 1, QDir::homePath()); | ||
+ | ||
LogSystem& loggers = LogSystem::getInstance(); | ||
loggers.clear(); | ||
|
||
-- | ||
2.29.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters