Mobile: use a default weight name when adding weight system

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-08-11 09:11:06 -07:00
parent 6b92edc9ab
commit 0eb14828b5

View file

@ -487,7 +487,7 @@ void QMLManager::saveCloudCredentials()
} }
cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password, cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password,
qPrintable(QMLPrefs::instance()->cloudPassword())); qPrintable(QMLPrefs::instance()->cloudPassword()));
if (QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_NOCLOUD && if (QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_NOCLOUD &&
!cloudCredentialsChanged) { !cloudCredentialsChanged) {
@ -1045,8 +1045,8 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
// not sure what we'd do if there was more than one weight system // not sure what we'd do if there was more than one weight system
// defined - for now just ignore that case // defined - for now just ignore that case
if (d->weightsystems.nr == 0) { if (d->weightsystems.nr == 0) {
weightsystem_t ws = { { parseWeightToGrams(weight) } , "" }; weightsystem_t ws = { { parseWeightToGrams(weight) } , strdup(qPrintable(tr("weight"))) };
add_cloned_weightsystem(&d->weightsystems, ws); add_to_weightsystem_table(&d->weightsystems, 0, ws); // takes ownership of the string
} else if (d->weightsystems.nr == 1) { } else if (d->weightsystems.nr == 1) {
d->weightsystems.weightsystems[0].weight.grams = parseWeightToGrams(weight); d->weightsystems.weightsystems[0].weight.grams = parseWeightToGrams(weight);
} }