feat: owner review 2 phase 5c: originals, local render, clean-up and the workspace settings #18

Merged
Alby96 merged 42 commits from review2-p5c into main 2026-11-04 20:03:58 +01:00
2 changed files with 23 additions and 2 deletions
Showing only changes of commit e0644e5304 - Show all commits

No files matched your search

@@ -106,7 +106,7 @@ public sealed class WorkspaceSettingsRows(AppSettings settings, Action save, Fun
public RelayCommand OpenCommand { get; } = new(open);
/// <summary>Uses another folder, after its plan (WorkspaceFolderChange); none where the folder cannot change, nor while it moves.</summary>
public AsyncRelayCommand ChangeCommand => _change ??= new AsyncRelayCommand(() => ThenReadMoveAsync(change), () => change is not null && !IsMoving);
public AsyncRelayCommand ChangeCommand => _change ??= new AsyncRelayCommand(() => ThenReadMoveAsync(change), () => change is not null && !IsHeld);
private AsyncRelayCommand? _change;
@@ -116,7 +116,7 @@ public sealed class WorkspaceSettingsRows(AppSettings settings, Action save, Fun
public string ChangeToolTip => MoveState ?? Loc.L("Tooltips.Settings.ChangeWorkspace");
/// <summary>Moves the folder with its projects, after its plan (WorkspaceFolderChange.MoveAsync); none where it cannot move, nor while it moves.</summary>
public AsyncRelayCommand MoveCommand => _move ??= new AsyncRelayCommand(() => ThenReadMoveAsync(services?.Move), () => services?.Move is not null && !IsMoving);
public AsyncRelayCommand MoveCommand => _move ??= new AsyncRelayCommand(() => ThenReadMoveAsync(services?.Move), () => services?.Move is not null && !IsHeld);
private AsyncRelayCommand? _move;
@@ -430,6 +430,12 @@ public sealed class WorkspaceSettingsRows(AppSettings settings, Action save, Fun
/// <summary>A move holds the workspace, as read last (read once when not known since the last refresh).</summary>
private bool IsMoving => _moving ??= services?.IsMoving() ?? false;
/// <summary>
/// Change… and Move… wait: a move holds the folder, or one stopped and Resume takes it up (also one that switched here
/// and left part of the folder it came from: another folder now would leave that part with no Resume).
/// </summary>
private bool IsHeld => _unfinished || IsMoving;
private async Task ResumeMoveAsync()
{
if (services?.ResumeMove is not { } resume) return;
@@ -722,6 +722,21 @@ public sealed class SettingsLogicTests
Assert.True(rows.MoveCommand.CanExecute(null));
}
[Test]
public async Task AMoveThatSwitchedHereAndLeftPartOfItsOldFolderStillHoldsChangeAndMove()
{
// The folder in use holds no journal (the move switched to it), but the old folder still does: Resume clears it,
// and another folder chosen first would leave that part with no Resume.
var (_, rows, _) = WorkspaceRows(new FakeWorkspace(), move: () => Task.CompletedTask, isMoving: () => false, unfinished: () => true,
resume: () => Task.CompletedTask);
await rows.MeasureAsync();
Assert.True(rows.CanResumeMove);
Assert.Equal((Loc.L("Tooltips.Settings.Workspace.MoveUnfinished"), Loc.L("Tooltips.Settings.Workspace.MoveUnfinished")), (rows.ChangeToolTip, rows.MoveToolTip));
Assert.False(rows.ChangeCommand.CanExecute(null));
Assert.False(rows.MoveCommand.CanExecute(null));
}
[Test]
public void ADefaultMediaOrOpenPolicySetElsewhereReadsAsEverythingAppliesIt()
{