forked from files-community/Files
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Added option to prioritize files when sorting (files-communi…
- Loading branch information
1 parent
5e9113a
commit d3f06b0
Showing
20 changed files
with
248 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class SortFilesFirstAction : ObservableObject, IToggleAction | ||
{ | ||
private readonly IDisplayPageContext context; | ||
|
||
public string Label | ||
=> "SortFilesFirst".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "SortFilesFirstDescription".GetLocalizedResource(); | ||
|
||
public bool IsOn | ||
=> context.SortFilesFirst && !context.SortDirectoriesAlongsideFiles; | ||
|
||
public SortFilesFirstAction() | ||
{ | ||
context = Ioc.Default.GetRequiredService<IDisplayPageContext>(); | ||
|
||
context.PropertyChanged += Context_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync() | ||
{ | ||
context.SortFilesFirst = true; | ||
context.SortDirectoriesAlongsideFiles = false; | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(IDisplayPageContext.SortFilesFirst) or nameof(IDisplayPageContext.SortDirectoriesAlongsideFiles)) | ||
OnPropertyChanged(nameof(IsOn)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2023 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class SortFoldersFirstAction : ObservableObject, IToggleAction | ||
{ | ||
private readonly IDisplayPageContext context; | ||
|
||
public string Label | ||
=> "SortFoldersFirst".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "SortFoldersFirstDescription".GetLocalizedResource(); | ||
|
||
public bool IsOn | ||
=> !context.SortFilesFirst && !context.SortDirectoriesAlongsideFiles; | ||
|
||
public SortFoldersFirstAction() | ||
{ | ||
context = Ioc.Default.GetRequiredService<IDisplayPageContext>(); | ||
|
||
context.PropertyChanged += Context_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync() | ||
{ | ||
context.SortFilesFirst = false; | ||
context.SortDirectoriesAlongsideFiles = false; | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(IDisplayPageContext.SortFilesFirst) or nameof(IDisplayPageContext.SortDirectoriesAlongsideFiles)) | ||
OnPropertyChanged(nameof(IsOn)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.