mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Mobile: clear dive data via model
Clearing the dive data directly in the core leaves us with an inconsistent model. Therefore, clear via the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f0fc1f3a56
commit
649ac1f83a
3 changed files with 10 additions and 2 deletions
|
@ -277,7 +277,7 @@ void QMLManager::applicationStateChanged(Qt::ApplicationState state)
|
||||||
|
|
||||||
void QMLManager::openLocalThenRemote(QString url)
|
void QMLManager::openLocalThenRemote(QString url)
|
||||||
{
|
{
|
||||||
clear_dive_file_data();
|
DiveListModel::instance()->clear();
|
||||||
setNotificationText(tr("Open local dive data file"));
|
setNotificationText(tr("Open local dive data file"));
|
||||||
QByteArray fileNamePrt = QFile::encodeName(url);
|
QByteArray fileNamePrt = QFile::encodeName(url);
|
||||||
bool glo = git_local_only;
|
bool glo = git_local_only;
|
||||||
|
@ -730,7 +730,7 @@ void QMLManager::loadDivesWithValidCredentials()
|
||||||
// if we aren't switching from no-cloud mode, let's clear the dive data
|
// if we aren't switching from no-cloud mode, let's clear the dive data
|
||||||
if (!noCloudToCloud) {
|
if (!noCloudToCloud) {
|
||||||
appendTextToLog("Clear out in memory dive data");
|
appendTextToLog("Clear out in memory dive data");
|
||||||
clear_dive_file_data();
|
DiveListModel::instance()->clear();
|
||||||
} else {
|
} else {
|
||||||
appendTextToLog("Switching from no cloud mode; keep in memory dive data");
|
appendTextToLog("Switching from no cloud mode; keep in memory dive data");
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,13 @@ void DiveListModel::updateDive(int i, dive *d)
|
||||||
insertDive(i);
|
insertDive(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiveListModel::clear()
|
||||||
|
{
|
||||||
|
beginResetModel();
|
||||||
|
clear_dive_file_data();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
void DiveListModel::reload()
|
void DiveListModel::reload()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
QString startAddDive();
|
QString startAddDive();
|
||||||
void resetInternalData();
|
void resetInternalData();
|
||||||
|
void clear(); // Clear all dives in core
|
||||||
Q_INVOKABLE DiveObjectHelper at(int i);
|
Q_INVOKABLE DiveObjectHelper at(int i);
|
||||||
private:
|
private:
|
||||||
static DiveListModel *m_instance;
|
static DiveListModel *m_instance;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue