-
-
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.
Merge branch 'main' into Bug_Drag_Multiple_Files_Tag_Area
- Loading branch information
Showing
208 changed files
with
1,825 additions
and
1,419 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.DependencyInjection; | ||
using Files.App.Commands; | ||
using Files.App.Contexts; | ||
using Files.App.Extensions; | ||
using Files.App.Helpers; | ||
using Files.Backend.Enums; | ||
using Files.Backend.Services; | ||
using Files.Backend.ViewModels.Dialogs.AddItemDialog; | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class AddItemAction : ObservableObject, IAction | ||
{ | ||
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>(); | ||
|
||
private readonly IDialogService dialogService = Ioc.Default.GetRequiredService<IDialogService>(); | ||
|
||
private readonly AddItemDialogViewModel viewModel = new(); | ||
|
||
public string Label { get; } = "BaseLayoutContextFlyoutNew/Label".GetLocalizedResource(); | ||
|
||
public string Description => "AddItemDescription".GetLocalizedResource(); | ||
|
||
public HotKey HotKey { get; } = new(Keys.N, KeyModifiers.CtrlShift); | ||
|
||
public RichGlyph Glyph { get; } = new(opacityStyle: "ColorIconNew"); | ||
|
||
public bool IsExecutable => context.CanCreateItem && !context.HasSelection; | ||
|
||
public AddItemAction() | ||
{ | ||
context.PropertyChanged += Context_PropertyChanged; | ||
} | ||
|
||
public async Task ExecuteAsync() | ||
{ | ||
await dialogService.ShowDialogAsync(viewModel); | ||
|
||
if (viewModel.ResultType.ItemType == AddItemDialogItemType.Shortcut) | ||
await Ioc.Default.GetRequiredService<ICommandManager>().CreateShortcutFromDialog.ExecuteAsync(); | ||
else if (viewModel.ResultType.ItemType != AddItemDialogItemType.Cancel) | ||
UIFilesystemHelpers.CreateFileFromDialogResultType( | ||
viewModel.ResultType.ItemType, | ||
viewModel.ResultType.ItemInfo, | ||
context.ShellPage!); | ||
} | ||
|
||
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) | ||
{ | ||
switch (e.PropertyName) | ||
{ | ||
case nameof(IContentPageContext.CanCreateItem): | ||
case nameof(IContentPageContext.HasSelection): | ||
OnPropertyChanged(nameof(IsExecutable)); | ||
break; | ||
} | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using CommunityToolkit.Mvvm.DependencyInjection; | ||
using Files.App.Commands; | ||
using Files.App.Contexts; | ||
using Files.App.Extensions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class EditPathAction : IAction | ||
{ | ||
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>(); | ||
|
||
public string Label { get; } = "EditPath".GetLocalizedResource(); | ||
|
||
public string Description { get; } = "EditPathDescription".GetLocalizedResource(); | ||
|
||
public HotKey HotKey { get; } = new(Keys.L, KeyModifiers.Ctrl); | ||
|
||
public HotKey SecondHotKey { get; } = new(Keys.D, KeyModifiers.Menu); | ||
|
||
public Task ExecuteAsync() | ||
{ | ||
if (context.ShellPage is not null) | ||
context.ShellPage.ToolbarViewModel.IsEditModeEnabled = true; | ||
|
||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
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.