Skip to content

Commit 3efdaef

Browse files
authored
Fix: Fixed issue where context menu icons wouldn't load in archives or FTP servers (#13238)
1 parent d55f3bc commit 3efdaef

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Files.App/Helpers/MenuFlyout/ContextFlyoutItemHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,16 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
561561
ShowItem = isDriveRoot,
562562
IsEnabled = false
563563
},
564+
// Shell extensions are not available on the FTP server or in the archive,
565+
// but following items are intentionally added because icons in the context menu will not appear
566+
// unless there is at least one menu item with an icon that is not an OpacityIcon. (#12943)
564567
new ContextMenuFlyoutItemViewModel()
565568
{
566569
ItemType = ContextMenuFlyoutItemType.Separator,
567570
Tag = "OverflowSeparator",
571+
ShowInFtpPage = true,
572+
ShowInZipPage = true,
573+
ShowInRecycleBin = true,
568574
ShowInSearchPage = true,
569575
},
570576
new ContextMenuFlyoutItemViewModel()
@@ -574,6 +580,8 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
574580
Items = new List<ContextMenuFlyoutItemViewModel>(),
575581
ID = "ItemOverflow",
576582
Tag = "ItemOverflow",
583+
ShowInFtpPage = true,
584+
ShowInZipPage = true,
577585
ShowInRecycleBin = true,
578586
ShowInSearchPage = true,
579587
IsEnabled = false

src/Files.App/Views/LayoutModes/BaseLayout.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,18 @@ public async void BaseContextFlyout_Opening(object? sender, object e)
605605
secondaryElements.OfType<FrameworkElement>().ForEach(i => i.MinWidth = Constants.UI.ContextMenuItemsMaxWidth);
606606
secondaryElements.ForEach(i => BaseContextMenuFlyout.SecondaryCommands.Add(i));
607607

608-
if (!InstanceViewModel!.IsPageTypeSearchResults && !InstanceViewModel.IsPageTypeZipFolder)
608+
if (!InstanceViewModel!.IsPageTypeSearchResults && !InstanceViewModel.IsPageTypeZipFolder && !InstanceViewModel.IsPageTypeFtp)
609609
{
610610
var shellMenuItems = await ContextFlyoutItemHelper.GetItemContextShellCommandsAsync(workingDir: ParentShellPageInstance.FilesystemViewModel.WorkingDirectory, selectedItems: new List<ListedItem>(), shiftPressed: shiftPressed, showOpenMenu: false, shellContextMenuItemCancellationToken.Token);
611611
if (shellMenuItems.Any())
612612
await AddShellMenuItemsAsync(shellMenuItems, BaseContextMenuFlyout, shiftPressed);
613613
else
614614
RemoveOverflow(BaseContextMenuFlyout);
615615
}
616+
else
617+
{
618+
RemoveOverflow(BaseContextMenuFlyout);
619+
}
616620
}
617621
catch (Exception error)
618622
{
@@ -667,14 +671,18 @@ private async Task LoadMenuItemsAsync()
667671
if (InstanceViewModel!.CanTagFilesInPage)
668672
AddNewFileTagsToMenu(ItemContextMenuFlyout);
669673

670-
if (!InstanceViewModel.IsPageTypeZipFolder)
674+
if (!InstanceViewModel.IsPageTypeZipFolder && !InstanceViewModel.IsPageTypeFtp)
671675
{
672676
var shellMenuItems = await ContextFlyoutItemHelper.GetItemContextShellCommandsAsync(workingDir: ParentShellPageInstance.FilesystemViewModel.WorkingDirectory, selectedItems: SelectedItems!, shiftPressed: shiftPressed, showOpenMenu: false, shellContextMenuItemCancellationToken.Token);
673677
if (shellMenuItems.Any())
674678
await AddShellMenuItemsAsync(shellMenuItems, ItemContextMenuFlyout, shiftPressed);
675679
else
676680
RemoveOverflow(ItemContextMenuFlyout);
677681
}
682+
else
683+
{
684+
RemoveOverflow(ItemContextMenuFlyout);
685+
}
678686
}
679687

680688
private void AddCloseHandler(CommandBarFlyout flyout, IList<ICommandBarElement> primaryElements, IList<ICommandBarElement> secondaryElements)

0 commit comments

Comments
 (0)