Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal abstract class BaseOpenInNewWindowAction : ObservableObject, IAction
protected IContentPageContext ContentPageContext { get; } = Ioc.Default.GetRequiredService<IContentPageContext>();
protected IHomePageContext HomePageContext { get; } = Ioc.Default.GetRequiredService<IHomePageContext>();
protected ISidebarContext SidebarContext { get; } = Ioc.Default.GetRequiredService<ISidebarContext>();
protected IStorageTrashBinService StorageTrashBinService { get; } = Ioc.Default.GetRequiredService<IStorageTrashBinService>();

public string Label
=> Strings.OpenInNewWindow.GetLocalizedResource();
Expand Down Expand Up @@ -49,6 +50,9 @@ public virtual async Task ExecuteAsync(object? parameter = null)
foreach (ListedItem listedItem in items)
{
var selectedItemPath = (listedItem as IShortcutItem)?.TargetPath ?? listedItem.ItemPath;
if (StorageTrashBinService.IsUnderTrashBin(selectedItemPath))
selectedItemPath = Uri.EscapeDataString(Constants.UserEnvironmentPaths.RecycleBinPath);

var folderUri = new Uri($"files-dev:?folder={@selectedItemPath}");

await Launcher.LaunchUriAsync(folderUri);
Expand Down
28 changes: 27 additions & 1 deletion src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,34 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
var path = navigationArguments.NavPathParam;
var pathRoot = GetPathRoot(path);
var pathStack = new Stack<string>();
var storageTrashBinService = Ioc.Default.GetRequiredService<IStorageTrashBinService>();
if (storageTrashBinService.IsUnderTrashBin(path))
{
var recycleBinPath = $"{pathRoot}$Recycle.Bin";
var tempPath = path;
var pathsToAdd = new List<string>();

while (!string.IsNullOrEmpty(tempPath))
{
var parentPath = GetParentDir(tempPath);

if (!string.IsNullOrEmpty(parentPath) && parentPath.Equals(recycleBinPath, StringComparison.OrdinalIgnoreCase))
// SID folder? stop here
break;

if (tempPath.Equals(recycleBinPath, StringComparison.OrdinalIgnoreCase))
break;

if (!string.IsNullOrEmpty(pathRoot))
pathsToAdd.Add(tempPath);
tempPath = parentPath;
}

foreach (var pathToAdd in pathsToAdd)
pathStack.Push(pathToAdd);

path = Constants.UserEnvironmentPaths.RecycleBinPath;
}
else if (!string.IsNullOrEmpty(pathRoot))
{
var rootPathList = App.QuickAccessManager.Model.PinnedFolders.Select(NormalizePath)
.Concat(CloudDrivesManager.Drives.Select(x => NormalizePath(x.Path))).ToList()
Expand Down
Loading