Stop promising to ask for an export folder
An empty device destination read "Ask each time" on the settings page, and nothing asks: an export made with the field blank is refused with "no export folder is set". Say what will happen.
This commit is contained in:
@@ -885,9 +885,14 @@ impl ExportSettings {
|
|||||||
///
|
///
|
||||||
/// The library root has to read as a place rather than as a blank field,
|
/// The library root has to read as a place rather than as a blank field,
|
||||||
/// or confirming the picker where it opens looks like it did nothing.
|
/// or confirming the picker where it opens looks like it did nothing.
|
||||||
|
///
|
||||||
|
/// An empty device folder used to read "Ask each time", which nothing
|
||||||
|
/// does: no platform asks, and an export made with the field blank is
|
||||||
|
/// refused with "no export folder is set". The label now says what will
|
||||||
|
/// happen rather than what was once meant to.
|
||||||
pub fn destination_label(&self) -> &str {
|
pub fn destination_label(&self) -> &str {
|
||||||
match self.target {
|
match self.target {
|
||||||
ExportTarget::Device if self.destination.trim().is_empty() => "Ask each time",
|
ExportTarget::Device if self.destination.trim().is_empty() => "Not set",
|
||||||
ExportTarget::Device => &self.destination,
|
ExportTarget::Device => &self.destination,
|
||||||
ExportTarget::Remote if self.remote_destination.trim().is_empty() => "Library root",
|
ExportTarget::Remote if self.remote_destination.trim().is_empty() => "Library root",
|
||||||
ExportTarget::Remote => &self.remote_destination,
|
ExportTarget::Remote => &self.remote_destination,
|
||||||
@@ -1621,14 +1626,15 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn an_empty_device_destination_still_means_ask() {
|
fn an_empty_device_destination_is_not_set_and_says_so() {
|
||||||
// The asymmetry is deliberate: a filesystem has no folder worth
|
// The asymmetry is deliberate: a filesystem has no folder worth
|
||||||
// assuming, so empty there is a question rather than an answer.
|
// assuming, so empty there is a gap rather than an answer — and the
|
||||||
|
// label must not promise a question nobody will be asked.
|
||||||
let mut s = Settings::default();
|
let mut s = Settings::default();
|
||||||
s.export.target = ExportTarget::Device;
|
s.export.target = ExportTarget::Device;
|
||||||
s.export.destination = String::new();
|
s.export.destination = String::new();
|
||||||
assert!(!s.export.destination_is_set());
|
assert!(!s.export.destination_is_set());
|
||||||
assert_eq!(s.export.destination_label(), "Ask each time");
|
assert_eq!(s.export.destination_label(), "Not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1161,7 +1161,10 @@ export component SettingsPage inherits Rectangle {
|
|||||||
|
|
||||||
TextRow {
|
TextRow {
|
||||||
label: "Destination";
|
label: "Destination";
|
||||||
hint: "empty asks each time";
|
// What an empty field does, not what it was once
|
||||||
|
// going to do: nothing asks, and an export with
|
||||||
|
// no folder is refused and says so in the header.
|
||||||
|
hint: "a folder on this device; exports are refused until one is set";
|
||||||
text <=> root.destination;
|
text <=> root.destination;
|
||||||
field-width: 320px;
|
field-width: 320px;
|
||||||
placeholder: root.destination-hint;
|
placeholder: root.destination-hint;
|
||||||
|
|||||||
Reference in New Issue
Block a user