mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: add status text for cloud sync state
This allows the mobile UI to reflect the three states that the dive list can be in: - changes that haven't been written to local storage - there potentially are changes in local storage that were not synced with the cloud - dive list is in sync with cloud storage The last state could be misleading if the user access the cloud from a different device and makes changes to the cloud storage from there, but from the point of view of this device, the states are consistent. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
01de67a5a6
commit
3a409c51ea
2 changed files with 17 additions and 0 deletions
|
@ -733,6 +733,7 @@ void QMLManager::loadDivesWithValidCredentials()
|
|||
appendTextToLog(QStringLiteral("%1 dives loaded after importing nocloud local storage").arg(dive_table.nr));
|
||||
noCloudToCloud = false;
|
||||
mark_divelist_changed(true);
|
||||
emit syncStateChanged();
|
||||
saveChangesLocal();
|
||||
if (git_local_only == false) {
|
||||
appendTextToLog(QStringLiteral("taking things back offline now that storage is synced"));
|
||||
|
@ -1292,6 +1293,7 @@ void QMLManager::changesNeedSaving()
|
|||
// on iOS
|
||||
// on all other platforms we just save the changes and be done with it
|
||||
mark_divelist_changed(true);
|
||||
emit syncStateChanged();
|
||||
#if defined(Q_OS_IOS)
|
||||
saveChangesLocal();
|
||||
#else
|
||||
|
@ -2251,4 +2253,15 @@ QStringList QMLManager::cloudCacheList() const
|
|||
void QMLManager::updateHaveLocalChanges(bool status)
|
||||
{
|
||||
localChanges = status;
|
||||
emit syncStateChanged();
|
||||
}
|
||||
|
||||
// show the state of the dive list
|
||||
QString QMLManager::getSyncState() const
|
||||
{
|
||||
if (unsavedChanges())
|
||||
return tr("(unsaved changes in memory)");
|
||||
if (localChanges)
|
||||
return tr("(changes synced locally)");
|
||||
return tr("(synced with cloud)");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue