<div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 5:32 PM Dirk Hohndel <<a href="mailto:dirk@hohndel.org">dirk@hohndel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><br><div><blockquote type="cite"><div>On Oct 29, 2018, at 8:17 AM, Miika Turkia <<a href="mailto:miika.turkia@gmail.com" target="_blank">miika.turkia@gmail.com</a>> wrote:</div><br class="gmail-m_-180146222681480971Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 4:34 PM Dirk Hohndel <<a href="mailto:dirk@hohndel.org" target="_blank">dirk@hohndel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On Oct 28, 2018, at 9:40 PM, Miika Turkia <<a href="mailto:miika.turkia@gmail.com" target="_blank">miika.turkia@gmail.com</a>> wrote:<br>
> <br>
> I have tried to implement copy-paste functionality for the Subsurface-mobile. The current branch (mobile-copy) seems to be working but when re-opening Subsurface, nothing has been saved. So what is the trick to actually save data when using QML? So far, I have tried to mark the divelist changed and manually save to cloud, and what not, but am I manipulating wrong data or what, as nothing seems to actually save what I have changed?<br>
<br>
Call QMLManager::changesNeedSaving()<br>
The problem is that right now on Android we only save the changes locally and the logic that we had in place to save them to the cloud when the app switches to the background may no longer be working.<br>
But at least this function should get them saved to the local git repo<br></blockquote><div><br></div><div>I am calling that, but still nothing gets saved. Not locally and not on cloud.<br></div></div></div></div></blockquote><br></div><div>That's strange, because that function calls mark_divelist_changed(true) - so anything that is in the divelist should be saved to the local repo.</div><div><br></div><div>After you call that function, what is added to your log?</div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">asked to save changes but no unsaved changes</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-family:Helvetica;font-size:12px">or</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">save operation in progress already</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="font-family:Helvetica;font-size:12px">would explain why nothing gets saved.</span></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="font-family:Helvetica;font-size:12px">Otherwise you should get a "Save changes to local cache".</span></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span style="font-family:Helvetica;font-size:12px">And then there are a bunch more possible reasons why it wouldn't update things - look at the awkwardly named "loadDivesWithValidCredentials()" function (which is, in fact, where we save things...)</span></span></div></div></div></blockquote><div><br></div><div>Log seems like everything gets saved:</div><div>---8<---<br></div><div>INFO: "14.123: Save changes to local cache"<br>INFO: "14.127: Synchronising data file"<br>INFO: "14.128: Preparing to save data"<br>INFO: "14.129: Start saving data"<br>INFO: "14.130: Start saving dives"<br>INFO: "14.132: Done creating local cache"<br> ---8<---</div><div><br></div><div>Anyway, it seems to be that Linus' hint of calling invalidate_dive_cache() did the trick.<br></div><div><br></div><div>tnx<br></div><div>miika<br></div></div></div></div>