Skip to content

Commit

Permalink
[messageserver] Support ~ as specifier for log file paths. Contribute…
Browse files Browse the repository at this point in the history
…s to JB#50368

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Feb 2, 2021
1 parent 466ec92 commit d38a7fa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions rpm/0030-Support-as-specifier-for-log-file-paths.patch
@@ -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

1 change: 1 addition & 0 deletions rpm/qmf-qt5.spec
Expand Up @@ -58,6 +58,7 @@ Patch26: 0026-Handle-encoded-word-s-containing-partial-characters.patch
Patch27: 0027-Allow-a-service-provided-folder-to-be-set-as-the-sta.patch
Patch28: 0028-Add-QMailMessage-CalendarCancellation-flag.patch
Patch29: 0029-Use-a-queued-connection-to-handle-accountsUpdated-si.patch
Patch23: 0030-Support-as-specifier-for-log-file-paths.patch

%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
Expand Down

0 comments on commit d38a7fa

Please sign in to comment.