Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Files.App/Data/Contracts/IShellPanesPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,10 @@ public interface IShellPanesPage : IDisposable, INotifyPropertyChanged
/// Focuses the other pane.
/// </summary>
public void FocusOtherPane();

/// <summary>
/// Updates the layout of open panes.
/// </summary>
public void UpdatePanesLayout(bool inlcudeActive = true);
}
}
16 changes: 16 additions & 0 deletions src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,22 @@ public Type GetLayoutType(string path, bool changeLayoutMode = true)
};
}

public void UpdateGroupAndSortOptions(string? path)
{
if (string.IsNullOrWhiteSpace(path))
return;

var preferencesItem = GetLayoutPreferencesForPath(path);
if (preferencesItem is null)
return;

DirectorySortOption = preferencesItem.DirectorySortOption;
DirectorySortDirection = preferencesItem.DirectorySortDirection;
DirectoryGroupOption = preferencesItem.DirectoryGroupOption;
DirectoryGroupByDateUnit = preferencesItem.DirectoryGroupByDateUnit;
DirectoryGroupDirection = preferencesItem.DirectoryGroupDirection;
}

public bool IsPathUsingDefaultLayout(string? path)
{
return UserSettingsService.LayoutSettingsService.SyncFolderPreferencesAcrossDirectories ||
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public async void MultitaskingControl_CurrentInstanceChanged(object? sender, Cur
{
SidebarAdaptiveViewModel.PaneHolder = currentInstance;
SidebarAdaptiveViewModel.PaneHolder.PropertyChanged += PaneHolder_PropertyChanged;
currentInstance.UpdatePanesLayout();
}
SidebarAdaptiveViewModel.NotifyInstanceRelatedPropertiesChanged((navArgs as PaneNavigationArguments)?.LeftPaneNavPathParam);

Expand Down
19 changes: 19 additions & 0 deletions src/Files.App/Views/ShellPanesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ public IShellPage? ActivePane
secondShellPage.IsCurrentInstance = false;

if (ActivePane is not null)
{
ActivePane.IsCurrentInstance = IsCurrentInstance;
}

NotifyPropertyChanged(nameof(ActivePane));
NotifyPropertyChanged(nameof(IsLeftPaneActive));
Expand Down Expand Up @@ -356,6 +358,16 @@ public void FocusOtherPane()
GetPane(0)?.Focus(FocusState.Programmatic);
}

/// <inheritdoc/>
public void UpdatePanesLayout(bool inlcudeActive = true)
{
if (GetPane(0) is IShellPage leftPane && (inlcudeActive || leftPane != ActivePane))
UpdatePaneLayout(leftPane);

if (GetPane(1) is IShellPage rightPane && (inlcudeActive || rightPane != ActivePane))
UpdatePaneLayout(rightPane);
}

// Private methods

private ModernShellPage? GetPane(int index = -1)
Expand Down Expand Up @@ -603,6 +615,13 @@ paneArgs.ShellPaneArrangement is ShellPaneArrangement.None
};
}

private void UpdatePaneLayout(IShellPage pane)
{
var page = pane.SlimContentPage as BaseLayoutPage;
var path = pane.ShellViewModel.CurrentFolder?.ItemPath;
page?.FolderSettings?.UpdateGroupAndSortOptions(path);
}

// Event methods

public Task TabItemDragOver(object sender, DragEventArgs e)
Expand Down
2 changes: 2 additions & 0 deletions src/Files.App/Views/Shells/BaseShellPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ private void FolderSettings_LayoutPreferencesUpdateRequired(object sender, Layou
LayoutPreferencesManager.SetLayoutPreferencesForPath(ShellViewModel.WorkingDirectory, e.LayoutPreference);
if (e.IsAdaptiveLayoutUpdateRequired)
AdaptiveLayoutHelpers.ApplyAdaptativeLayout(InstanceViewModel.FolderSettings, ShellViewModel.FilesAndFolders.ToList());

_PaneHolder.UpdatePanesLayout(false);
}

protected virtual void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryModifiedEventArgs e)
Expand Down