-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
1 parent
b6c3ca9
commit 4970a44
Showing
10 changed files
with
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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 System; | ||
using System.Threading.Tasks; | ||
using Windows.ApplicationModel.DataTransfer; | ||
using Windows.System; | ||
|
||
namespace Files.App.Actions | ||
{ | ||
internal class CopyPathAction : IAction | ||
{ | ||
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>(); | ||
|
||
public string Label { get; } = "CopyLocation".GetLocalizedResource(); | ||
|
||
public RichGlyph Glyph { get; } = new RichGlyph(opacityStyle: "ColorIconCopyLocation"); | ||
|
||
public HotKey HotKey { get; } = new(VirtualKey.C, VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift); | ||
|
||
public async Task ExecuteAsync() | ||
{ | ||
if (context.ShellPage?.SlimContentPage is not null) | ||
{ | ||
var path = context.ShellPage.SlimContentPage.SelectedItem is not null | ||
? context.ShellPage.SlimContentPage.SelectedItem.ItemPath | ||
: context.ShellPage.FilesystemViewModel.WorkingDirectory; | ||
|
||
if (FtpHelpers.IsFtpPath(path)) | ||
path = path.Replace("\\", "/", StringComparison.Ordinal); | ||
|
||
DataPackage data = new(); | ||
data.SetText(path); | ||
|
||
Clipboard.SetContent(data); | ||
Clipboard.Flush(); | ||
} | ||
} | ||
} | ||
} |
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