Skip to content

Feature: Move open with to main menu when right clicking recent files #11304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 16, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/Files.App/Helpers/ShellContextMenuHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,15 @@ public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemCo
var openWithItem = shellMenuItems.Where(x => (x.Tag as Win32ContextMenuItem)?.CommandString == "openas").ToList().FirstOrDefault();
if (openWithItem is not null)
{
openWithItem.ColoredIcon = new ColoredIconModel()
{
BaseLayerGlyph = "\uF049",
OverlayLayerGlyph = "\uF04A",
};
var (_, openWithItems) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(new List<ContextMenuFlyoutItemViewModel>() { openWithItem });
var placeholder = itemContextMenuFlyout.SecondaryCommands.Where(x => Equals((x as AppBarButton)?.Tag, "OpenWithPlaceholder")).FirstOrDefault() as AppBarButton;
if (placeholder is not null)
placeholder.Visibility = Visibility.Collapsed;
itemContextMenuFlyout.SecondaryCommands.Insert(0, openWithItems.FirstOrDefault());
shellMenuItems.Remove(openWithItem);
}
Expand Down
9 changes: 8 additions & 1 deletion src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e)
secondaryElements.ForEach(i => itemContextMenuFlyout.SecondaryCommands.Add(i));
itemContextMenuFlyout.ShowAt(recentItemsGrid, new FlyoutShowOptions { Position = e.GetPosition(recentItemsGrid) });

_ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout);
_ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout, showOpenWithMenu: true);

e.Handled = true;
}
Expand All @@ -126,6 +126,13 @@ public override List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCard
{
return new List<ContextMenuFlyoutItemViewModel>()
{
new ContextMenuFlyoutItemViewModel()
{
Text = "OpenItemsWithCaptionText".GetLocalizedResource(),
Glyph = "\uE17D",
Tag = "OpenWithPlaceholder",
IsEnabled = false
},
new ContextMenuFlyoutItemViewModel()
{
Text = "RecentItemRemove/Text".GetLocalizedResource(),
Expand Down