mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: save with unchanged credentials returns to dive list
If the user is on the credentials page, doesn't change the credentials but simply taps on save, they now get back to the dive list. Fixes #1047 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f21b36d9ba
commit
6a23e0ef66
3 changed files with 24 additions and 1 deletions
|
@ -16,7 +16,7 @@ Kirigami.ApplicationWindow {
|
||||||
header.preferredHeight: Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1)
|
header.preferredHeight: Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1)
|
||||||
header.maximumHeight: Kirigami.Units.gridUnit * 2
|
header.maximumHeight: Kirigami.Units.gridUnit * 2
|
||||||
property bool fullscreen: true
|
property bool fullscreen: true
|
||||||
property int oldStatus: -1
|
property alias oldStatus: manager.oldStatus
|
||||||
property alias accessingCloud: manager.accessingCloud
|
property alias accessingCloud: manager.accessingCloud
|
||||||
property QtObject notification: null
|
property QtObject notification: null
|
||||||
property bool showingDiveList: false
|
property bool showingDiveList: false
|
||||||
|
|
|
@ -213,6 +213,10 @@ void QMLManager::saveCloudCredentials()
|
||||||
|
|
||||||
cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()));
|
cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()));
|
||||||
|
|
||||||
|
if (!cloudCredentialsChanged) {
|
||||||
|
// just go back to the dive list
|
||||||
|
setCredentialStatus(oldStatus());
|
||||||
|
}
|
||||||
if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) {
|
if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) {
|
||||||
free(prefs.cloud_storage_password);
|
free(prefs.cloud_storage_password);
|
||||||
prefs.cloud_storage_password = strdup(qPrintable(cloudPassword()));
|
prefs.cloud_storage_password = strdup(qPrintable(cloudPassword()));
|
||||||
|
@ -1014,6 +1018,19 @@ void QMLManager::setCredentialStatus(const credentialStatus_t value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMLManager::credentialStatus_t QMLManager::oldStatus() const
|
||||||
|
{
|
||||||
|
return m_oldStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QMLManager::setOldStatus(const credentialStatus_t value)
|
||||||
|
{
|
||||||
|
if (m_oldStatus != value) {
|
||||||
|
m_oldStatus = value;
|
||||||
|
emit oldStatusChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// where in the QML dive list is that dive?
|
// where in the QML dive list is that dive?
|
||||||
int QMLManager::getIndex(const QString &diveId)
|
int QMLManager::getIndex(const QString &diveId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ class QMLManager : public QObject {
|
||||||
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
||||||
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
||||||
Q_PROPERTY(credentialStatus_t credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
|
Q_PROPERTY(credentialStatus_t credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
|
||||||
|
Q_PROPERTY(credentialStatus_t oldStatus READ oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
|
||||||
Q_PROPERTY(int accessingCloud READ accessingCloud WRITE setAccessingCloud NOTIFY accessingCloudChanged)
|
Q_PROPERTY(int accessingCloud READ accessingCloud WRITE setAccessingCloud NOTIFY accessingCloudChanged)
|
||||||
Q_PROPERTY(bool syncToCloud READ syncToCloud WRITE setSyncToCloud NOTIFY syncToCloudChanged)
|
Q_PROPERTY(bool syncToCloud READ syncToCloud WRITE setSyncToCloud NOTIFY syncToCloudChanged)
|
||||||
|
|
||||||
|
@ -67,6 +68,9 @@ public:
|
||||||
credentialStatus_t credentialStatus() const;
|
credentialStatus_t credentialStatus() const;
|
||||||
void setCredentialStatus(const credentialStatus_t value);
|
void setCredentialStatus(const credentialStatus_t value);
|
||||||
|
|
||||||
|
credentialStatus_t oldStatus() const;
|
||||||
|
void setOldStatus(const credentialStatus_t value);
|
||||||
|
|
||||||
QString logText() const;
|
QString logText() const;
|
||||||
void setLogText(const QString &logText);
|
void setLogText(const QString &logText);
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ private:
|
||||||
int m_accessingCloud;
|
int m_accessingCloud;
|
||||||
bool m_syncToCloud;
|
bool m_syncToCloud;
|
||||||
credentialStatus_t m_credentialStatus;
|
credentialStatus_t m_credentialStatus;
|
||||||
|
credentialStatus_t m_oldStatus;
|
||||||
qreal m_lastDevicePixelRatio;
|
qreal m_lastDevicePixelRatio;
|
||||||
QElapsedTimer timer;
|
QElapsedTimer timer;
|
||||||
bool alreadySaving;
|
bool alreadySaving;
|
||||||
|
@ -154,6 +159,7 @@ signals:
|
||||||
void loadFromCloudChanged();
|
void loadFromCloudChanged();
|
||||||
void startPageTextChanged();
|
void startPageTextChanged();
|
||||||
void credentialStatusChanged();
|
void credentialStatusChanged();
|
||||||
|
void oldStatusChanged();
|
||||||
void accessingCloudChanged();
|
void accessingCloudChanged();
|
||||||
void syncToCloudChanged();
|
void syncToCloudChanged();
|
||||||
void sendScreenChanged(QScreen *screen);
|
void sendScreenChanged(QScreen *screen);
|
||||||
|
|
Loading…
Add table
Reference in a new issue