mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML-UI: refuse to save to cloud unless you loaded from cloud, first
This prevents people from overwriting a perfectly fine repository with an empty one. Typically happens when you first enter your cloud credentials and then don't Load Dives right away. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
789c32bf4c
commit
f17041e1cb
2 changed files with 22 additions and 0 deletions
|
|
@ -129,6 +129,7 @@ void QMLManager::loadDives()
|
|||
DiveListModel::instance()->addDive(d);
|
||||
}
|
||||
appendTextToLog(QString("%1 dives loaded").arg(i));
|
||||
setLoadFromCloud(true);
|
||||
}
|
||||
|
||||
void QMLManager::commitChanges(QString diveId, QString suit, QString buddy, QString diveMaster, QString notes)
|
||||
|
|
@ -162,6 +163,10 @@ void QMLManager::commitChanges(QString diveId, QString suit, QString buddy, QStr
|
|||
|
||||
void QMLManager::saveChanges()
|
||||
{
|
||||
if (!loadFromCloud()) {
|
||||
qmlUiShowMessage("Don't save dives without loading from the cloud, first.");
|
||||
return;
|
||||
}
|
||||
qmlUiShowMessage("Saving dives.");
|
||||
QString fileName;
|
||||
if (getCloudURL(fileName)) {
|
||||
|
|
@ -287,3 +292,14 @@ void QMLManager::setTimeThreshold(int time)
|
|||
m_timeThreshold = time;
|
||||
emit timeThresholdChanged();
|
||||
}
|
||||
|
||||
bool QMLManager::loadFromCloud() const
|
||||
{
|
||||
return m_loadFromCloud;
|
||||
}
|
||||
|
||||
void QMLManager::setLoadFromCloud(bool done)
|
||||
{
|
||||
m_loadFromCloud = done;
|
||||
emit loadFromCloudChanged();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue