<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Am 03.09.21 um 16:08 schrieb Nuno
Santos:<br>
</div>
<blockquote type="cite"
cite="mid:C2735139-7AE2-47F9-8449-40E2B859FDC1@imaginando.pt">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
So, if the application data is sandboxed, how do we migrate data
that used to be in shared locations to the sandbox?
<div class=""><br class="">
</div>
<div class="">I was using the Documents location to keeps users
presets, but now I will need to migrate those files to inside
the app </div>
<div class=""><br class="">
</div>
<div class="">From your experience what is the most appropriated <span
style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"
class="">QStandardPath</span><span style="caret-color: rgb(0,
0, 0); color: rgb(0, 0, 0);" class=""> </span>location to
store user data from Android 11 onwards?</div>
</blockquote>
I'm always using
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""></span><span style="font-size: 9pt; color: purple;" class=""> QStandardPaths</span><span style="font-size: 9pt;" class="">::<span style="color: rgb(0, 103, 124);" class="">standardLocations</span>(<span style="color: purple;" class="">QStandardPaths</span>::<span style="color: purple;" class="">AppDataLocation</span>).<span style="color: rgb(0, 103, 124);" class="">value</span>(<span style="color: navy;" class="">0</span>) </span></pre>
<p>to store user data. (Android and iOS)<br>
</p>
<p>ekke<br>
</p>
<blockquote type="cite"
cite="mid:C2735139-7AE2-47F9-8449-40E2B859FDC1@imaginando.pt">
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 3 Sep 2021, at 14:53, Jérôme Godbout <<a
href="mailto:jgodbout@dimonoff.com" class=""
moz-do-not-send="true">jgodbout@dimonoff.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<meta charset="UTF-8" class="">
<div class="WordSection1" style="page: WordSection1;
caret-color: rgb(0, 0, 0); font-family: Helvetica;
font-size: 12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px; text-transform:
none; white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class="">Humm not sure about all
the enum, but the one I was using did not. Maybe we
can do a build and print those path for both Android
11 and 12 to compare, but my guess is sthat should be
the same.<o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class=""><o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class="">The Android 11 bring is
that it lock down as private the application folder,
other application can no more access the files/folders
of another application. So if you were sending
files/folders path to another application for them to
open it will no more work. They are now sandboxed.<o:p
class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class=""><o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class="">A bit like iOS
application have been for a while, but on iOS you can
define a group to allow special access to given
application as long as the domain match the group.<o:p
class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class=""><o:p class=""> </o:p></div>
<div style="border-style: solid none none;
border-top-width: 1pt; border-top-color: rgb(181, 196,
223); padding: 3pt 0cm 0cm;" class="">
<p class="MsoNormal" style="margin: 0cm 0cm 12pt;
font-size: 11pt; font-family: Calibri, sans-serif;"><b
class=""><span style="font-size: 12pt;" class="">From:<span
class="Apple-converted-space"> </span></span></b><span
style="font-size: 12pt;" class="">Nuno Santos <<a
href="mailto:nuno.santos@imaginando.pt"
style="color: blue; text-decoration: underline;"
class="" moz-do-not-send="true">nuno.santos@imaginando.pt</a>><br
class="">
<b class="">Date:<span
class="Apple-converted-space"> </span></b>Friday,
September 3, 2021 at 9:33 AM<br class="">
<b class="">To:<span class="Apple-converted-space"> </span></b>Jérôme
Godbout <<a href="mailto:jgodbout@dimonoff.com"
style="color: blue; text-decoration: underline;"
class="" moz-do-not-send="true">jgodbout@dimonoff.com</a>><br
class="">
<b class="">Cc:<span class="Apple-converted-space"> </span></b>ekke
<<a href="mailto:ekke@ekkes-corner.org"
style="color: blue; text-decoration: underline;"
class="" moz-do-not-send="true">ekke@ekkes-corner.org</a>>,
Qt Interest <<a
href="mailto:interest@qt-project.org"
style="color: blue; text-decoration: underline;"
class="" moz-do-not-send="true">interest@qt-project.org</a>><br
class="">
<b class="">Subject:<span
class="Apple-converted-space"> </span></b>Re:
[Interest] Save / load file contents on android<o:p
class=""></o:p></span></p>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class="">But doesn’t
QStandardPath resolve to different locations depending
if legacyExternalStorage is enabled or not?<o:p
class=""></o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family:
Calibri, sans-serif;" class=""><br class="">
<br class="">
<o:p class=""></o:p></div>
<blockquote style="margin-top: 5pt; margin-bottom:
5pt;" class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">On 3
Sep 2021, at 13:51, Jérôme Godbout <<a
href="mailto:jgodbout@dimonoff.com"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true">jgodbout@dimonoff.com</a>>
wrote:<o:p class=""></o:p></div>
</div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><o:p
class=""> </o:p></div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">Take
care with the eternal storage opt out will no
more be possible after November. We will need
to target SDK 12 to publish to the store. So
the 11 opt out flag will no more be possible
(November for existing application, for new
application it’s already started since
august).<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">Try
to push an update asap so your user can
migrate the data to the application proper
folder. Other application cannot access the
files anymore. If your file are already into
the application data folder you do not have to
worry much you still can access them easily.<o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">But
the QStandard path have work fine for us so
far. You can check the actual path it resolve
to on this page (scroll a bit down to see the
path for Android):<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><a
href="https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true">https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum</a><o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
<div style="border-style: solid none none;
border-top-width: 1pt; border-top-color:
rgb(181, 196, 223); padding: 3pt 0cm 0cm;"
class="">
<p class="MsoNormal" style="margin: 0cm 0cm
12pt; font-size: 11pt; font-family: Calibri,
sans-serif;"><b class=""><span
style="font-size: 12pt;" class="">From:<span
class="apple-converted-space"> </span></span></b><span
style="font-size: 12pt;" class="">Interest
<</span><a
href="mailto:interest-bounces@qt-project.org"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true"><span
style="font-size: 12pt;" class="">interest-bounces@qt-project.org</span></a><span
style="font-size: 12pt;" class="">> on
behalf of ekke <</span><a
href="mailto:ekke@ekkes-corner.org"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true"><span
style="font-size: 12pt;" class="">ekke@ekkes-corner.org</span></a><span
style="font-size: 12pt;" class="">><br
class="">
<b class="">Date:<span
class="apple-converted-space"> </span></b>Friday,
September 3, 2021 at 5:47 AM<br class="">
<b class="">To:<span
class="apple-converted-space"> </span></b>Nuno
Santos <</span><a
href="mailto:nuno.santos@imaginando.pt"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true"><span
style="font-size: 12pt;" class="">nuno.santos@imaginando.pt</span></a><span
style="font-size: 12pt;" class="">><br
class="">
<b class="">Cc:<span
class="apple-converted-space"> </span></b>Qt
Interest <</span><a
href="mailto:interest@qt-project.org"
style="color: blue; text-decoration:
underline;" class="" moz-do-not-send="true"><span
style="font-size: 12pt;" class="">interest@qt-project.org</span></a><span
style="font-size: 12pt;" class="">><br
class="">
<b class="">Subject:<span
class="apple-converted-space"> </span></b>Re:
[Interest] Save / load file contents on
android</span></p>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">Hi
Nuno,<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""> <o:p
class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">Am
03.09.21 um 11:05 schrieb Nuno Santos:<o:p
class=""></o:p></div>
</div>
</div>
<blockquote style="margin-top: 5pt; margin-bottom:
5pt;" class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class="">Ekke,<span
class="apple-converted-space"> </span><o:p
class=""></o:p></div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">I have been experiencing some
inconsistencies with Android file access
using QStandardPaths, mostly now that I’m
preparing the ground for Android 11
support. From Android 11 onwards, there
will be changes in the way an app can
access filesystem resources.<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">This problem started when one of
apps was in some systems using legacy file
access while in others was already using
the new storage approach. In order to
temporary fixes this issues I have set the
requestLegacyExternalStorage to true,
however, soon this will end as in Android
11 it will be ignored.<span
class="apple-converted-space"> </span><o:p
class=""></o:p></div>
</div>
</div>
</blockquote>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">I'm in the same situation
as you ;-) have set
requestLegacyExternalStorage ATM<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">last weeks had much work
moving all my projects from Qt 5.13.2 to
5.15.5, so I can prepare for Qt 6.2<o:p
class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">now there will be 3 weeks
vacation<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">then support of Android
11 file storage will be high on my TODO list<o:p
class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">... and hoping then to
find some docs / tips HowTo support this from
Qt ;-)<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;" class=""><span
style="font-size: 9pt; font-family:
Helvetica;" class="">ekke<o:p class=""></o:p></span></div>
<blockquote style="margin-top: 5pt; margin-bottom:
5pt;" class="">
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">One of the current challenges I’m
facing the moving/copying resources from
legacy storage to new storage when using
QStandardPaths and QFileDialog.<o:p
class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">How have you been handling
Android 11 support and data migration from
older versions?<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">Are you able to do it just with
Qt stuff or do you need to handle some of
the things with native android API’s?<o:p
class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">Thanks!<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class="">Nuno<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
font-family: Calibri, sans-serif;"
class=""> <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<blockquote style="margin-top: 5pt;
margin-bottom: 5pt;" class="">
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
11pt; font-family: Calibri,
sans-serif;" class="">On 31 Aug
2021, at 13:38, ekke <<a
href="mailto:ekke@ekkes-corner.org"
style="color: blue;
text-decoration: underline;"
class="" moz-do-not-send="true">ekke@ekkes-corner.org</a>>
wrote:<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div style="margin: 0cm; font-size:
11pt; font-family: Calibri,
sans-serif;" class=""> <o:p class=""></o:p></div>
</div>
<div class="">
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
11pt; font-family: Calibri,
sans-serif;" class=""><span
style="font-size: 9pt;
font-family: Helvetica;"
class="">Am 31.08.21 um 14:12
schrieb Wilhelm Meier via
Interest:</span><o:p class=""></o:p></div>
</div>
</div>
<blockquote style="margin-top: 5pt;
margin-bottom: 5pt; font-variant-caps:
normal; text-align: start;
-webkit-text-stroke-width: 0px;
word-spacing: 0px;" class="">
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Hi all,</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""> </pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">does anybody have a minimum working example how to load / save json file</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">contents (auscii contents) to / from a file on android.</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""> </pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">I made several attempts, but I get weird filenames and I'm not able to</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">load the stored file.</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""> </pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">thx</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">_______________________________________________</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class="">Interest mailing list</pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><a href="mailto:Interest@qt-project.org" style="color: blue; text-decoration: underline;" class="" moz-do-not-send="true">Interest@qt-project.org</a></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><a href="https://lists.qt-project.org/listinfo/interest" style="color: blue; text-decoration: underline;" class="" moz-do-not-send="true">https://lists.qt-project.org/listinfo/interest</a><o:p class=""></o:p></pre>
</blockquote>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New"; caret-color: rgb(0, 0, 0); font-variant-caps: normal; text-align: start; -webkit-text-stroke-width: 0px; word-spacing: 0px;" class=""><span style="font-size: 9pt; color: purple;" class="">Hi,</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: purple;" class="">some snippets HowTo save a JSON. use QVariantMap for a JSON Object or QVariantList for JSON Array</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: purple;" class=""> </span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: purple;" class=""> QJsonDocument</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">jda</span><span style="font-size: 9pt;" class=""> <span style="color: rgb(0, 103, 124);" class="">=</span><span style="color: silver;" class=""> </span><span style="color: purple;" class="">QJsonDocument</span>::<span style="color: rgb(0, 103, 124);" class="">fromVariant</span>(myQVariantMap);</span><o:p class=""></o:p></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New"; caret-color: rgb(0, 0, 0); font-variant-caps: normal; text-align: start; -webkit-text-stroke-width: 0px; word-spacing: 0px;" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">QByteArray</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">buffer</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">=<span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">jda</span>.<span style="color: rgb(0, 103, 124);" class="">toJson</span>();</span><o:p class=""></o:p></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New"; caret-color: rgb(0, 0, 0); font-variant-caps: normal; text-align: start; -webkit-text-stroke-width: 0px; word-spacing: 0px;" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(0, 103, 124);" class="">saveTestFile</span><span style="font-size: 9pt;" class="">(<span style="color: green;" class="">"_my_test.json"</span>,<span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">buffer</span>);</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">...</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class=""> </span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: olive;" class="">void</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">DataServer</span><span style="font-size: 9pt;" class="">::<b class=""><span style="color: rgb(0, 103, 124);" class="">saveTestFile</span></b>(<span style="color: olive;" class="">const</span><span style="color: silver;" class=""> </span><span style="color: purple;" class="">QString</span>&<span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">fileName</span>,<span style="color: silver;" class=""> </span><span style="color: olive;" class="">const</span><span style="color: silver;" class=""> </span><span style="color: purple;" class="">QByteArray</span>&<span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">buffer</span>)</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">{</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">QString</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">filePath</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">=<span style="color: silver;" class=""> </span><span style="color: maroon;" class="">mDataManager</span>-><span style="color: rgb(0, 103, 124);" class="">dataPath</span>(<span style="color: rgb(9, 46, 100);" class="">fileName</span>);</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">QFile</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">saveFile</span><span style="font-size: 9pt;" class="">(<span style="color: rgb(9, 46, 100);" class="">filePath</span>);</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: olive;" class="">if</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">(!<span style="color: rgb(9, 46, 100);" class="">saveFile</span>.<i class=""><span style="color: rgb(0, 103, 124);" class="">open</span></i>(<span style="color: purple;" class="">QIODevice</span>::<span style="color: purple;" class="">WriteOnly</span>))<span style="color: silver;" class=""> </span>{</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: navy;" class="">qWarning</span><span style="font-size: 9pt;" class="">()<span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: green;" class="">"Couldn't open file to write "</span><span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">filePath</span>;</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: olive;" class="">return</span><span style="font-size: 9pt;" class="">;</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">}</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">qint64</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">bytesWritten</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">=<span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">saveFile</span>.<span style="color: rgb(0, 103, 124);" class="">write</span>(<span style="color: rgb(9, 46, 100);" class="">buffer</span>);</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">saveFile</span><span style="font-size: 9pt;" class="">.<i class=""><span style="color: rgb(0, 103, 124);" class="">close</span></i>();</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: navy;" class="">qDebug</span><span style="font-size: 9pt;" class="">()<span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: green;" class="">"Bytes written: "</span><span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">bytesWritten</span><span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: green;" class="">" to: "</span><span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class=""><<</span><span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">filePath</span>;</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">}</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">....</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class=""> </span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">//</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">Android:</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">AppDataLocation</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">works</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">out</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">of</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">the</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">box,</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">iOS</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">you</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">must</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">create</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">the</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">DIR</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">first</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: green;" class="">!!</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: maroon;" class="">mDataRoot</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(0, 103, 124);" class="">=</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">QStandardPaths</span><span style="font-size: 9pt;" class="">::<span style="color: rgb(0, 103, 124);" class="">standardLocations</span>(<span style="color: purple;" class="">QStandardPaths</span>::<span style="color: purple;" class="">AppDataLocation</span>).<span style="color: rgb(0, 103, 124);" class="">value</span>(<span style="color: navy;" class="">0</span>);</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: maroon;" class="">mDataPath</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(0, 103, 124);" class="">=</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: maroon;" class="">mDataRoot</span><span style="font-size: 9pt; color: rgb(0, 103, 124);" class="">+</span><span style="font-size: 9pt; color: green;" class="">"/data/"</span><span style="font-size: 9pt;" class="">;</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">----</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">and reading is similar</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class=""> </span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: rgb(9, 46, 100);" class=""> jda</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(0, 103, 124);" class="">=</span><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: purple;" class="">QJsonDocument</span><span style="font-size: 9pt;" class="">::<span style="color: rgb(0, 103, 124);" class="">fromJson</span>(<span style="color: rgb(9, 46, 100);" class="">dataFile</span>.<span style="color: rgb(0, 103, 124);" class="">readAll</span>());</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: rgb(9, 46, 100);" class="">dataFile</span><span style="font-size: 9pt;" class="">.<i class=""><span style="color: rgb(0, 103, 124);" class="">close</span></i>();</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt; color: olive;" class="">if</span><span style="font-size: 9pt;" class="">(!<span style="color: rgb(9, 46, 100);" class="">jda</span>.<span style="color: rgb(0, 103, 124);" class="">isArray</span>())<span style="color: silver;" class=""> </span>{</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">myMap = <span style="color: rgb(9, 46, 100);" class="">jda</span>.<span style="color: rgb(0, 103, 124);" class="">toVariant</span>().<span style="color: rgb(0, 103, 124);" class="">toMap</span>();</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt; color: silver;" class=""> </span><span style="font-size: 9pt;" class="">} else {</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class=""> my<span style="color: rgb(9, 46, 100);" class="">List</span><span style="color: silver;" class=""> </span><span style="color: rgb(0, 103, 124);" class="">=</span><span style="color: silver;" class=""> </span><span style="color: rgb(9, 46, 100);" class="">jda</span>.<span style="color: rgb(0, 103, 124);" class="">toVariant</span>().<span style="color: rgb(0, 103, 124);" class="">toList</span>();</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class=""> }</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">-----</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";" class=""><span style="font-size: 9pt;" class="">hope it helps</span></pre>
<div class="">
<div style="margin: 0cm; font-size:
11pt; font-family: Calibri,
sans-serif;" class=""><span
style="font-size: 9pt;
font-family: Helvetica;" class="">_______________________________________________<br
class="">
Interest mailing list<br class="">
</span><a
href="mailto:Interest@qt-project.org"
style="color: blue;
text-decoration: underline;"
class="" moz-do-not-send="true"><span
style="font-size: 9pt;
font-family: Helvetica;"
class="">Interest@qt-project.org</span></a><span
style="font-size: 9pt;
font-family: Helvetica;" class=""><br
class="">
</span><a
href="https://lists.qt-project.org/listinfo/interest"
style="color: blue;
text-decoration: underline;"
class="" moz-do-not-send="true"><span
style="font-size: 9pt;
font-family: Helvetica;"
class="">https://lists.qt-project.org/listinfo/interest</span></a></div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<br>
</body>
</html>