Warning, /graphics/krita/3rdparty/ext_frameworks/0001-Android-Fix-a-bug-where-new-file-wouldn-t-be-created.patch is written in an unsupported language. File is not indexed.
0001 From 40ff273f7170036137c999610331528d53255113 Mon Sep 17 00:00:00 2001
0002 From: Sharaf Zaman <shzam@sdf.org>
0003 Date: Tue, 10 Jan 2023 15:09:10 +0000
0004 Subject: [PATCH] Android: Fix a bug where new file wouldn't be created
0005
0006 for cases where the config path is a content:// Uri. One can only save
0007 to them through direct write, so this is important.
0008
0009 Relevant code: https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/corelib/io/qsavefile.cpp#L218
0010
0011 Corresponding bug report: https://krita-artists.org/t/cannot-save-input-profile-does-not-persist-on-startup-on-android/55693
0012 ---
0013 src/core/kconfigini.cpp | 11 +++++++++++
0014 1 file changed, 11 insertions(+)
0015
0016 diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
0017 index d1bd2a0a..b1ed53b1 100644
0018 --- a/src/core/kconfigini.cpp
0019 +++ b/src/core/kconfigini.cpp
0020 @@ -476,7 +476,18 @@ bool KConfigIniBackend::writeConfig(const QByteArray &locale, KEntryMap &entryMa
0021 if (createNew) {
0022 QSaveFile file(filePath());
0023 if (!file.open(QIODevice::WriteOnly)) {
0024 +#ifdef Q_OS_ANDROID
0025 + // HACK: when we are dealing with content:// URIs, QSaveFile has to rely on DirectWrite.
0026 + // Otherwise this method returns a false and we're done.
0027 + file.setDirectWriteFallback(true);
0028 + if (!file.open(QIODevice::WriteOnly)) {
0029 + qWarning(KCONFIG_CORE_LOG) << "Couldn't create a new file:" << filePath() << ". Error:" << file.errorString();
0030 + return false;
0031 + }
0032 +#else
0033 + qWarning(KCONFIG_CORE_LOG) << "Couldn't create a new file:" << filePath() << ". Error:" << file.errorString();
0034 return false;
0035 +#endif
0036 }
0037
0038 file.setTextModeEnabled(true); // to get eol translation
0039 --
0040 2.39.0
0041