mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: pull undo/redo notification text up
When changes need saving, the notification text was set quite deep in the calltree in "saveChangesLocal()". I don't know why this was put so deep in the call tree. In any case, it prevents asynchronous saving of the data. Therefore, pull it up to chnagesNeedSaving(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
dd466d2d48
commit
2172e18298
2 changed files with 17 additions and 16 deletions
|
@ -1452,11 +1452,21 @@ void QMLManager::changesNeedSaving(bool fromUndo)
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
emit syncStateChanged();
|
emit syncStateChanged();
|
||||||
#if defined(Q_OS_IOS)
|
#if defined(Q_OS_IOS)
|
||||||
saveChangesLocal(fromUndo);
|
saveChangesLocal();
|
||||||
#else
|
#else
|
||||||
saveChangesCloud(false, fromUndo);
|
saveChangesCloud(false);
|
||||||
#endif
|
#endif
|
||||||
updateAllGlobalLists();
|
updateAllGlobalLists();
|
||||||
|
|
||||||
|
// provide a useful undo/redo notification
|
||||||
|
// NOTE: the QML UI interprets a leading '[action]' (where only the two brackets are checked for)
|
||||||
|
// as an indication to use the text between those two brackets as the label of a button that
|
||||||
|
// can be used to open the context menu
|
||||||
|
QString msgFormat = tr("[%1]Changes saved:'%2'.\n%1 possible via context menu");
|
||||||
|
if (fromUndo)
|
||||||
|
setNotificationText(msgFormat.arg(tr("Redo")).arg(tr("Undo: %1").arg(getRedoText())));
|
||||||
|
else
|
||||||
|
setNotificationText(msgFormat.arg(tr("Undo")).arg(getUndoText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::openNoCloudRepo()
|
void QMLManager::openNoCloudRepo()
|
||||||
|
@ -1482,7 +1492,7 @@ void QMLManager::openNoCloudRepo()
|
||||||
openLocalThenRemote(filename);
|
openLocalThenRemote(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::saveChangesLocal(bool fromUndo)
|
void QMLManager::saveChangesLocal()
|
||||||
{
|
{
|
||||||
if (unsavedChanges()) {
|
if (unsavedChanges()) {
|
||||||
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NOCLOUD) {
|
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NOCLOUD) {
|
||||||
|
@ -1512,21 +1522,12 @@ void QMLManager::saveChangesLocal(bool fromUndo)
|
||||||
mark_divelist_changed(false);
|
mark_divelist_changed(false);
|
||||||
Command::setClean();
|
Command::setClean();
|
||||||
updateHaveLocalChanges(true);
|
updateHaveLocalChanges(true);
|
||||||
// provide a useful undo/redo notification
|
|
||||||
// NOTE: the QML UI interprets a leading '[action]' (where only the two brackets are checked for)
|
|
||||||
// as an indication to use the text between those two brackets as the label of a button that
|
|
||||||
// can be used to open the context menu
|
|
||||||
QString msgFormat = tr("[%1]Changes saved:'%2'.\n%1 possible via context menu");
|
|
||||||
if (fromUndo)
|
|
||||||
setNotificationText(msgFormat.arg(tr("Redo")).arg(tr("Undo: %1").arg(getRedoText())));
|
|
||||||
else
|
|
||||||
setNotificationText(msgFormat.arg(tr("Undo")).arg(getUndoText()));
|
|
||||||
} else {
|
} else {
|
||||||
appendTextToLog("local save requested with no unsaved changes");
|
appendTextToLog("local save requested with no unsaved changes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::saveChangesCloud(bool forceRemoteSync, bool fromUndo)
|
void QMLManager::saveChangesCloud(bool forceRemoteSync)
|
||||||
{
|
{
|
||||||
if (!unsavedChanges() && !forceRemoteSync) {
|
if (!unsavedChanges() && !forceRemoteSync) {
|
||||||
appendTextToLog("asked to save changes but no unsaved changes");
|
appendTextToLog("asked to save changes but no unsaved changes");
|
||||||
|
@ -1534,7 +1535,7 @@ void QMLManager::saveChangesCloud(bool forceRemoteSync, bool fromUndo)
|
||||||
}
|
}
|
||||||
// first we need to store any unsaved changes to the local repo
|
// first we need to store any unsaved changes to the local repo
|
||||||
gitProgressCB("Save changes to local cache");
|
gitProgressCB("Save changes to local cache");
|
||||||
saveChangesLocal(fromUndo);
|
saveChangesLocal();
|
||||||
// if the user asked not to push to the cloud we are done
|
// if the user asked not to push to the cloud we are done
|
||||||
if (git_local_only && !forceRemoteSync)
|
if (git_local_only && !forceRemoteSync)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -179,7 +179,7 @@ public slots:
|
||||||
void addDiveToTrip(int id, int tripId);
|
void addDiveToTrip(int id, int tripId);
|
||||||
void changesNeedSaving(bool fromUndo = false);
|
void changesNeedSaving(bool fromUndo = false);
|
||||||
void openNoCloudRepo();
|
void openNoCloudRepo();
|
||||||
void saveChangesCloud(bool forceRemoteSync, bool fromUndo = false);
|
void saveChangesCloud(bool forceRemoteSync);
|
||||||
void selectDive(int id);
|
void selectDive(int id);
|
||||||
void deleteDive(int id);
|
void deleteDive(int id);
|
||||||
void deleteAccount();
|
void deleteAccount();
|
||||||
|
@ -262,7 +262,7 @@ private:
|
||||||
void consumeFinishedLoad();
|
void consumeFinishedLoad();
|
||||||
void mergeLocalRepo();
|
void mergeLocalRepo();
|
||||||
void openLocalThenRemote(QString url);
|
void openLocalThenRemote(QString url);
|
||||||
void saveChangesLocal(bool fromUndo = false);
|
void saveChangesLocal();
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
QString appLogFileName;
|
QString appLogFileName;
|
||||||
|
|
Loading…
Add table
Reference in a new issue