Skip to content

Commit 215c79a

Browse files
authored
Feature: Disable show more options menu item until shell items are loaded (#11243)
1 parent 79e8030 commit 215c79a

File tree

8 files changed

+30
-18
lines changed

8 files changed

+30
-18
lines changed

src/Files.App/BaseLayout.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,15 @@ public AppModel AppModel
7272
public CommandBarFlyout ItemContextMenuFlyout { get; set; } = new()
7373
{
7474
AlwaysExpanded = true,
75+
AreOpenCloseAnimationsEnabled = false,
76+
Placement = FlyoutPlacementMode.RightEdgeAlignedTop,
7577
};
7678

7779
public CommandBarFlyout BaseContextMenuFlyout { get; set; } = new()
7880
{
7981
AlwaysExpanded = true,
82+
AreOpenCloseAnimationsEnabled = false,
83+
Placement = FlyoutPlacementMode.RightEdgeAlignedTop,
8084
};
8185

8286
public BaseLayoutCommandsViewModel? CommandsViewModel { get; protected set; }
@@ -645,9 +649,9 @@ private async Task LoadMenuItemsAsync()
645649
ItemContextMenuFlyout.SecondaryCommands.Clear();
646650
var (primaryElements, secondaryElements) = ItemModelListToContextFlyoutHelper.GetAppBarItemsFromModel(items);
647651
AddCloseHandler(ItemContextMenuFlyout, primaryElements, secondaryElements);
648-
primaryElements.ForEach(i => ItemContextMenuFlyout.PrimaryCommands.Add(i));
652+
primaryElements.ForEach(ItemContextMenuFlyout.PrimaryCommands.Add);
649653
secondaryElements.OfType<FrameworkElement>().ForEach(i => i.MinWidth = Constants.UI.ContextMenuItemsMaxWidth); // Set menu min width
650-
secondaryElements.ForEach(i => ItemContextMenuFlyout.SecondaryCommands.Add(i));
654+
secondaryElements.ForEach(ItemContextMenuFlyout.SecondaryCommands.Add);
651655

652656
if (InstanceViewModel!.CanTagFilesInPage)
653657
AddNewFileTagsToMenu(ItemContextMenuFlyout);
@@ -756,11 +760,13 @@ private void AddShellItemsToMenu(List<ContextMenuFlyoutItemViewModel> shellMenuI
756760
index++;
757761
}
758762

759-
if (overflowItemFlyout.Items.Count > 0)
763+
if (overflowItemFlyout.Items.Count > 0 && UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu)
760764
{
761-
(contextMenuFlyout.SecondaryCommands.First(x => x is FrameworkElement fe && fe.Tag as string == "OverflowSeparator") as AppBarSeparator)!.Visibility = Visibility.Visible;
762-
overflowItem.Visibility = Visibility.Visible;
765+
overflowItem.Label = "ShowMoreOptions".GetLocalizedResource();
766+
overflowItem.IsEnabled = true;
763767
}
768+
else if (!UserSettingsService.AppearanceSettingsService.MoveShellExtensionsToSubMenu)
769+
overflowItem.Visibility = Visibility.Collapsed;
764770
}
765771
}
766772
else

src/Files.App/Helpers/ContextFlyoutItemHelper.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,12 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseLayoutMenuItems(Curren
641641
},
642642
new ContextMenuFlyoutItemViewModel()
643643
{
644-
Text = "ShowMoreOptions".GetLocalizedResource(),
644+
Text = "LoadingMoreOptions".GetLocalizedResource(),
645645
Glyph = "\xE712",
646646
Items = new List<ContextMenuFlyoutItemViewModel>(),
647647
ID = "ItemOverflow",
648648
Tag = "ItemOverflow",
649-
IsHidden = true,
649+
IsEnabled = false,
650650
},
651651
};
652652
}
@@ -1106,17 +1106,16 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(BaseLayo
11061106
ItemType = ItemType.Separator,
11071107
Tag = "OverflowSeparator",
11081108
ShowInSearchPage = true,
1109-
IsHidden = true,
11101109
},
11111110
new ContextMenuFlyoutItemViewModel()
11121111
{
1113-
Text = "ShowMoreOptions".GetLocalizedResource(),
1112+
Text = "LoadingMoreOptions".GetLocalizedResource(),
11141113
Glyph = "\xE712",
11151114
Items = new List<ContextMenuFlyoutItemViewModel>(),
11161115
ID = "ItemOverflow",
11171116
Tag = "ItemOverflow",
11181117
ShowInSearchPage = true,
1119-
IsHidden = true,
1118+
IsEnabled = false
11201119
},
11211120
};
11221121
}

src/Files.App/Helpers/ShellContextMenuHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ public static async Task LoadShellMenuItems(string path, CommandBarFlyout itemCo
288288
if (flyoutItems is not null)
289289
overflowItems.ForEach(i => flyoutItems.Add(i));
290290
overflowItem.Visibility = overflowItems.Any() ? Visibility.Visible : Visibility.Collapsed;
291+
292+
overflowItem.Label = "ShowMoreOptions".GetLocalizedResource();
293+
overflowItem.IsEnabled = true;
291294
}
292295
}
293296
catch { }

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,4 +2928,7 @@
29282928
<data name="Never" xml:space="preserve">
29292929
<value>Never</value>
29302930
</data>
2931+
<data name="LoadingMoreOptions" xml:space="preserve">
2932+
<value>Loading more options...</value>
2933+
</data>
29312934
</root>

src/Files.App/UserControls/SidebarControl.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,13 @@ private List<ContextMenuFlyoutItemViewModel> GetLocationItemMenuItems(INavigatio
276276
},
277277
new ContextMenuFlyoutItemViewModel()
278278
{
279-
Text = "ShowMoreOptions".GetLocalizedResource(),
279+
Text = "LoadingMoreOptions".GetLocalizedResource(),
280280
Glyph = "\xE712",
281281
Items = new List<ContextMenuFlyoutItemViewModel>(),
282282
ID = "ItemOverflow",
283283
Tag = "ItemOverflow",
284-
IsHidden = true,
284+
IsEnabled = false,
285+
IsHidden = !options.ShowShellItems,
285286
}
286287
}.Where(x => x.ShowItem).ToList();
287288
}

src/Files.App/UserControls/Widgets/DrivesWidget.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ public override List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCard
206206
},
207207
new ContextMenuFlyoutItemViewModel()
208208
{
209-
Text = "ShowMoreOptions".GetLocalizedResource(),
209+
Text = "LoadingMoreOptions".GetLocalizedResource(),
210210
Glyph = "\xE712",
211211
Items = new List<ContextMenuFlyoutItemViewModel>(),
212212
ID = "ItemOverflow",
213213
Tag = "ItemOverflow",
214-
IsHidden = true
214+
IsEnabled = false,
215215
}
216216
}.Where(x => x.ShowItem).ToList();
217217
}

src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ public override List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCard
228228
},
229229
new ContextMenuFlyoutItemViewModel()
230230
{
231-
Text = "ShowMoreOptions".GetLocalizedResource(),
231+
Text = "LoadingMoreOptions".GetLocalizedResource(),
232232
Glyph = "\xE712",
233233
Items = new List<ContextMenuFlyoutItemViewModel>(),
234234
ID = "ItemOverflow",
235235
Tag = "ItemOverflow",
236-
IsHidden = true
236+
IsEnabled = false,
237237
}
238238
}.Where(x => x.ShowItem).ToList();
239239
}

src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ public override List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCard
153153
},
154154
new ContextMenuFlyoutItemViewModel()
155155
{
156-
Text = "ShowMoreOptions".GetLocalizedResource(),
156+
Text = "LoadingMoreOptions".GetLocalizedResource(),
157157
Glyph = "\xE712",
158158
Items = new List<ContextMenuFlyoutItemViewModel>(),
159159
ID = "ItemOverflow",
160160
Tag = "ItemOverflow",
161-
IsHidden = true
161+
IsEnabled = false,
162162
}
163163
};
164164
}

0 commit comments

Comments
 (0)