mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile: show incorrect cloud password state
While the startup flow should make it obvious when a user is not correctly logged into the cloud, we still do see fairly frequent situations where a user has an incorrect password on a mobile device and is confused about why their data isn't syncing with their PC. Now this is clearly shown in the main menu. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fac006148f
commit
4b0fe3bc38
3 changed files with 39 additions and 3 deletions
|
@ -261,6 +261,22 @@ Kirigami.ApplicationWindow {
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RowLayout {
|
||||||
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.topMargin: 0
|
||||||
|
Kirigami.Heading {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 0
|
||||||
|
visible: text.length > 0
|
||||||
|
level: 5
|
||||||
|
color: "white"
|
||||||
|
text: manager.passwordState
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.weight: Font.Normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
Layout.topMargin: 0
|
Layout.topMargin: 0
|
||||||
|
|
|
@ -393,16 +393,20 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
if (credStatus != qPrefCloudStorage::CS_NOCLOUD) {
|
if (credStatus != qPrefCloudStorage::CS_NOCLOUD) {
|
||||||
appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error));
|
appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error));
|
||||||
setNotificationText(tr("Opening local data file failed"));
|
setNotificationText(tr("Opening local data file failed"));
|
||||||
if (credStatus != qPrefCloudStorage::CS_INCORRECT_USER_PASSWD)
|
if (credStatus != qPrefCloudStorage::CS_INCORRECT_USER_PASSWD) {
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
||||||
|
emit passwordStateChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if we can load from the cache, we know that we have a valid cloud account
|
// if we can load from the cache, we know that we have a valid cloud account
|
||||||
// and we know that there was at least one successful sync with the cloud when
|
// and we know that there was at least one successful sync with the cloud when
|
||||||
// that local cache was created - so there is a common ancestor
|
// that local cache was created - so there is a common ancestor
|
||||||
setLoadFromCloud(true);
|
setLoadFromCloud(true);
|
||||||
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_UNKNOWN)
|
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_UNKNOWN) {
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED);
|
||||||
|
emit passwordStateChanged();
|
||||||
|
}
|
||||||
qPrefUnits::set_unit_system(git_prefs.unit_system);
|
qPrefUnits::set_unit_system(git_prefs.unit_system);
|
||||||
qPrefTechnicalDetails::set_tankbar(git_prefs.tankbar);
|
qPrefTechnicalDetails::set_tankbar(git_prefs.tankbar);
|
||||||
qPrefTechnicalDetails::set_show_ccr_setpoint(git_prefs.show_ccr_setpoint);
|
qPrefTechnicalDetails::set_show_ccr_setpoint(git_prefs.show_ccr_setpoint);
|
||||||
|
@ -572,6 +576,7 @@ void QMLManager::finishSetup()
|
||||||
rememberOldStatus();
|
rememberOldStatus();
|
||||||
set_filename(qPrintable(nocloud_localstorage()));
|
set_filename(qPrintable(nocloud_localstorage()));
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||||
|
emit passwordStateChanged();
|
||||||
saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin());
|
saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin());
|
||||||
appendTextToLog(tr("working in no-cloud mode"));
|
appendTextToLog(tr("working in no-cloud mode"));
|
||||||
int error = parse_file(existing_filename, &divelog);
|
int error = parse_file(existing_filename, &divelog);
|
||||||
|
@ -587,6 +592,7 @@ void QMLManager::finishSetup()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_UNKNOWN);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_UNKNOWN);
|
||||||
|
emit passwordStateChanged();
|
||||||
appendTextToLog(tr("no cloud credentials"));
|
appendTextToLog(tr("no cloud credentials"));
|
||||||
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
|
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
|
||||||
}
|
}
|
||||||
|
@ -651,6 +657,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
|
||||||
!cloudCredentialsChanged) {
|
!cloudCredentialsChanged) {
|
||||||
// just go back to the dive list
|
// just go back to the dive list
|
||||||
qPrefCloudStorage::set_cloud_verification_status(m_oldStatus);
|
qPrefCloudStorage::set_cloud_verification_status(m_oldStatus);
|
||||||
|
emit passwordStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noCloud && !verifyCredentials(email, newPassword, pin)) {
|
if (!noCloud && !verifyCredentials(email, newPassword, pin)) {
|
||||||
|
@ -760,6 +767,7 @@ void QMLManager::deleteAccount()
|
||||||
qPrefCloudStorage::set_cloud_storage_email_encoded("");
|
qPrefCloudStorage::set_cloud_storage_email_encoded("");
|
||||||
qPrefCloudStorage::set_cloud_storage_password("");
|
qPrefCloudStorage::set_cloud_storage_password("");
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||||
|
emit passwordStateChanged();
|
||||||
set_filename(qPrintable(nocloud_localstorage()));
|
set_filename(qPrintable(nocloud_localstorage()));
|
||||||
setStartPageText(tr("Cloud storage account deleted."));
|
setStartPageText(tr("Cloud storage account deleted."));
|
||||||
return;
|
return;
|
||||||
|
@ -863,6 +871,7 @@ void QMLManager::revertToNoCloudIfNeeded()
|
||||||
qPrefCloudStorage::set_cloud_storage_password("");
|
qPrefCloudStorage::set_cloud_storage_password("");
|
||||||
rememberOldStatus();
|
rememberOldStatus();
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||||
|
emit passwordStateChanged();
|
||||||
set_filename(qPrintable(nocloud_localstorage()));
|
set_filename(qPrintable(nocloud_localstorage()));
|
||||||
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
||||||
}
|
}
|
||||||
|
@ -2383,3 +2392,12 @@ QString QMLManager::getSyncState() const
|
||||||
return tr("(changes synced locally)");
|
return tr("(changes synced locally)");
|
||||||
return tr("(synced with cloud)");
|
return tr("(synced with cloud)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// show the state of the cloud login
|
||||||
|
QString QMLManager::getPasswordState() const
|
||||||
|
{
|
||||||
|
auto credStatus = qPrefCloudStorage::cloud_verification_status();
|
||||||
|
if (credStatus == qPrefCloudStorage::CS_INCORRECT_USER_PASSWD)
|
||||||
|
return tr("(incorrect cloud email or password)");
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ class QMLManager : public QObject {
|
||||||
Q_PROPERTY(bool diveListProcessing MEMBER m_diveListProcessing WRITE setDiveListProcessing NOTIFY diveListProcessingChanged)
|
Q_PROPERTY(bool diveListProcessing MEMBER m_diveListProcessing WRITE setDiveListProcessing NOTIFY diveListProcessingChanged)
|
||||||
Q_PROPERTY(bool initialized MEMBER m_initialized NOTIFY initializedChanged)
|
Q_PROPERTY(bool initialized MEMBER m_initialized NOTIFY initializedChanged)
|
||||||
Q_PROPERTY(QString syncState READ getSyncState NOTIFY syncStateChanged)
|
Q_PROPERTY(QString syncState READ getSyncState NOTIFY syncStateChanged)
|
||||||
|
Q_PROPERTY(QString passwordState READ getPasswordState NOTIFY passwordStateChanged)
|
||||||
public:
|
public:
|
||||||
QMLManager();
|
QMLManager();
|
||||||
~QMLManager();
|
~QMLManager();
|
||||||
|
@ -162,6 +162,7 @@ public:
|
||||||
void rememberOldStatus();
|
void rememberOldStatus();
|
||||||
|
|
||||||
QString getSyncState() const;
|
QString getSyncState() const;
|
||||||
|
QString getPasswordState() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void appInitialized();
|
void appInitialized();
|
||||||
|
@ -297,6 +298,7 @@ signals:
|
||||||
void redoTextChanged();
|
void redoTextChanged();
|
||||||
void restartDownloadSignal();
|
void restartDownloadSignal();
|
||||||
void syncStateChanged();
|
void syncStateChanged();
|
||||||
|
void passwordStateChanged();
|
||||||
|
|
||||||
// From upload process
|
// From upload process
|
||||||
void uploadFinish(bool success, const QString &text);
|
void uploadFinish(bool success, const QString &text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue