-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
134 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2024 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
using Microsoft.UI.Xaml.Controls; | ||
using Windows.Foundation.Metadata; | ||
using Windows.Storage; | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal sealed class FlattenAction : ObservableObject, IAction | ||
{ | ||
private readonly IContentPageContext context; | ||
private readonly IGeneralSettingsService GeneralSettingsService = Ioc.Default.GetRequiredService<IGeneralSettingsService>(); | ||
|
||
public string Label | ||
=> "Flatten".GetLocalizedResource(); | ||
|
||
public string Description | ||
=> "FlattenDescription".GetLocalizedResource(); | ||
|
||
public bool IsExecutable => | ||
GeneralSettingsService.ShowFlattenOptions && | ||
context.ShellPage is not null && | ||
context.HasSelection && | ||
context.SelectedItem?.PrimaryItemAttribute is StorageItemTypes.Folder; | ||
|
||
public FlattenAction() | ||
{ | ||
context = Ioc.Default.GetRequiredService<IContentPageContext>(); | ||
|
||
context.PropertyChanged += Context_PropertyChanged; | ||
} | ||
|
||
public Task ExecuteAsync(object? parameter = null) | ||
{ | ||
var optionsDialog = new ContentDialog() | ||
{ | ||
Title = "FlattenFolderDialogTitle".GetLocalizedResource(), | ||
Content = "FlattenFolderDialogContent".GetLocalizedResource(), | ||
PrimaryButtonText = "OK".GetLocalizedResource(), | ||
DefaultButton = ContentDialogButton.Primary | ||
}; | ||
|
||
if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) | ||
optionsDialog.XamlRoot = MainWindow.Instance.Content.XamlRoot; | ||
|
||
return optionsDialog.TryShowAsync(); | ||
} | ||
|
||
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName is nameof(IContentPageContext.HasSelection)) | ||
OnPropertyChanged(nameof(IsExecutable)); | ||
} | ||
} | ||
} |
107 changes: 0 additions & 107 deletions
107
src/Files.App/Actions/FileSystem/FlattenSingleAction.cs
This file was deleted.
Oops, something went wrong.
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.