If we are in no cloud mode
- allow adding dives via the menu
- enabling / disabling automatic sync makes no sense.
- if the user wants to manually sync the cloud, they need to first enter
credentials.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Given that currently we don't deal well with not having a git repository
that is linked to cloud storage, don't allow people to add dives unless
there are verified cloud credentials.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Due to a change in Kirigami on most tablets even in landscape mode we are
only showing one column. Because of this I missed the fact that I had
broken multi column support by mistake. Without setting the width of the
dive list it expands all the way and prevents the showing of two pages
next to each other.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
put the margins only around the fullscreen delegate of the listview,
making the listview go all trough the screen edges.
This because the cutted effect when the list view is half scrolled
looks quite ugly. Making the ListView reach the borders
also moves the scroll indicator at the screen edge
where it conventionally is.
Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes sure that if the user switches to offline mode they don't get
incorrect notifications that tell them that they are accessing cloud
storage.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If you switch back to the dive list by swiping horizontally you stay in
edit/add mode and then can't select a dive on the dive list. This way you
have to discard or save the edit, first.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The TextButton was what we used for actions very early on, and the TopBar
has now been replaced by the Kirigami header bar.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 50ebdd020e3c of the Kirigami project the syntax with which
actions are added to pages has changed. This commit tracks that, adds the
new file that was added in Kirigami and also removes the now obsolete
context menus (since we have a working back button on iOS now)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there is no GPS source or if permission to use it was denied, don't
offer to run the GPS service or to detect the current location when
adding or editing dives.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This exposes a locationServiceAvailable property to QML and keeps it in
sync with the corresponding state in the GpsLocation widget.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I couldn't figure out how to break this down into small, useful commits.
Part of the problem is that I kept going while working on this and as you
can see from looking at the commit, diff tries so hard to find small code
fragments that moved around, that the diff overall becomes quite
unreadable and it seemed impossible to recreate the sequence of steps
after the fact.
It all started with adding the parsing for the GPS coordinates. But while
testing that code I found several issues with the rest of the function.
Most importantly it seemed ridiculous that we carefully tried to match the
texts that the DiveObjectHelper would create for the various fields,
instead of just using the DiveObjectHelper to do just that. And once I had
converted that I once again realized just how long and hard to understand
that function was getting and decided to break out some of the more
complex parts into their own helper functions.
But of course all this didn't happen in this logical, structured, ordered
way. Instead I did all of these things at the same time, testing,
rearranging, etc.
So in the end I went with one BIG commit that does all of this in one fell
swoop.
This adds four helper functions to deal with start time/date, duration,
location and gps coordinates, and depth of the dive.
To avoid mistakes when dealing with the GPS coordinates, there's another
helper to encapsulate the creation of the dive site and we switched to a
current GPS location.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There were several logical flaws here. Ugh.
Don't save things if there are no unsaved changes, if we haven't
initialized this repository from the cloud or if we are already saving
things.
Then, once we decide that we should save, first always save to the local
cache and then check if we should save to the cloud and do so if
requested.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let's not discard our GPS location when editing site name on mobile.
Fixes#1051
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit 339411cca69b in Kirigami master tries to reparent the OverlaySheet
to the page that it is related to. Unfortunately the heuristic used there
to find the right object assumes that every page has a contentItem
property, which our DiveDetails page doesn't have.
As a hack to work around this issue (until this is fixed upstream in
Kirigami) we simply create such a property. This commit should be
reverted once Kirigami upstream has been fixed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The manager can now directly update the index of the selected dive, and
the UI tells the manager the timestamp of the currently selected dive.
This allows the manager to pick the best possible dive as selected dive
if things change (for example if the dive list gets reloaded because it
changed in cloud storage).
Fixes#1009
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the automatic sync is turned off we could be stuck in a state where we
always thought that we were already in the middle of a save.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Before it had the next dive still selected.
Fixes#1053
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Android we can save locally right away, but we don't want to make the user
wait for a network sync. Sadly, on Android currently the saving in the
background doesn't work and the save will run when the user comes back.
Definitely not ideal.
On iOS the situation is different - a save to the local git cache takes
surprisingly long. Must be the shitty file system they use or something.
Because of that we only mark the dive list changed and instead save the next
time the app is not in the foreground (which works on iOS but not on Android -
go figure).
On all the other OSs (I guess that would be desktop builds of
Subsurface-mobile? But there may be other mobile OSs that people might want to
build it on) we save both locally and to the cloud right away.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So when the user taps on the manual cloud sync, we always force access to
the cloud server. Otherwise we only access the cloud server if
git_local_only isn't set.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove the border and make them look more like labels. This adds a
StyledTextField for that purpose. And while we are at it, we can make that
StyledTextField a little prettier.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>