mobile UI: add ability to unset the default cylinder

This was requested in a 'bug report' by a user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-01-20 09:29:05 -08:00
parent 77352751fa
commit 51a242a1db
2 changed files with 8 additions and 1 deletions

View file

@ -94,7 +94,12 @@ Kirigami.ScrollablePage {
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
onActivated: {
PrefEquipment.default_cylinder = defaultCylinderBox.currentText
// the entry for 'no default cylinder' is known to be the top, but its text
// is possibly translated so check against the index
if (currentIndex === 0)
PrefEquipment.default_cylinder = ""
else
PrefEquipment.default_cylinder = defaultCylinderBox.currentText
}
}
}

View file

@ -1807,6 +1807,8 @@ QStringList QMLManager::cylinderInit() const
cylinders.removeDuplicates();
cylinders.sort();
// now add fist one that indicates that the user wants no default cylinder
cylinders.prepend(tr("no default cylinder"));
return cylinders;
}