Skip to content

Commit 53806c1

Browse files
authored
Feature: Added support for always displaying the status center (#17151)
1 parent df84e67 commit 53806c1

File tree

8 files changed

+90
-9
lines changed

8 files changed

+90
-9
lines changed

src/Files.App/Data/Contracts/IAppearanceSettingsService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,11 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
116116
/// Gets or sets a value whether the shelf pane toggle button should be displayed.
117117
/// </summary>
118118
bool ShowShelfPaneToggleButton{ get; set; }
119+
120+
121+
/// <summary>
122+
/// Gets or sets a value indicating when to display the Status Center button.
123+
/// </summary>
124+
StatusCenterVisibility StatusCenterVisibility { get; set; }
119125
}
120126
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
namespace Files.App.Data.Enums
5+
{
6+
public enum StatusCenterVisibility
7+
{
8+
/// <summary>
9+
/// Always displayed.
10+
/// </summary>
11+
Always,
12+
13+
/// <summary>
14+
/// During active file operations.
15+
/// </summary>
16+
DuringOngoingFileOperations,
17+
}
18+
}

src/Files.App/Services/Settings/AppearanceSettingsService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ public bool ShowShelfPaneToggleButton
159159
set => Set(value);
160160
}
161161

162+
/// <inheritdoc/>
163+
public StatusCenterVisibility StatusCenterVisibility
164+
{
165+
get => Get(StatusCenterVisibility.Always);
166+
set => Set(value);
167+
}
168+
162169
protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
163170
{
164171
base.RaiseOnSettingChangedEvent(sender, e);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,4 +4226,10 @@
42264226
<data name="OmnibarSearchModeTextPlaceholder" xml:space="preserve">
42274227
<value>Search for files and folders...</value>
42284228
</data>
4229+
<data name="DuringOngoingFileOperations" xml:space="preserve">
4230+
<value>During file operations</value>
4231+
</data>
4232+
<data name="ShowStatusCenterButton" xml:space="preserve">
4233+
<value>Show status center button</value>
4234+
</data>
42294235
</root>

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,17 +471,16 @@
471471
AutomationProperties.Name="{helpers:ResourceString Name=StatusCenter}"
472472
Style="{StaticResource AddressToolbarButtonStyle}"
473473
ToolTipService.ToolTip="{helpers:ResourceString Name=StatusCenter}"
474-
Visibility="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}">
474+
Visibility="{x:Bind ViewModel.ShowStatusCenterButton, Mode=OneWay}">
475475

476476
<Grid Margin="-16">
477477

478-
<!-- Enable icon again if we add option to always display on the toolbar
479-
<ThemedIcon
480-
x:Name="StatusCenterIcon"
481-
Width="16"
482-
Height="16"
483-
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItemInProgress, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
484-
Style="{StaticResource App.ThemedIcons.StatusCenter}" />-->
478+
<controls:ThemedIcon
479+
x:Name="StatusCenterIcon"
480+
Width="16"
481+
Height="16"
482+
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItem, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
483+
Style="{StaticResource App.ThemedIcons.StatusCenter}" />
485484

486485
<ProgressRing
487486
x:Name="MedianOperationProgressRing"
@@ -496,6 +495,7 @@
496495
x:Name="StatusInfoBadge"
497496
HorizontalAlignment="Center"
498497
VerticalAlignment="Center"
498+
Visibility="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}"
499499
Value="{x:Bind OngoingTasksViewModel.InfoBadgeValue, Mode=OneWay}" />
500500

501501
</Grid>
@@ -594,7 +594,7 @@
594594
</VisualState>
595595
<VisualState x:Name="StatusButtonVisible">
596596
<VisualState.StateTriggers>
597-
<triggers:IsEqualStateTrigger Value="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}" To="True" />
597+
<triggers:IsEqualStateTrigger Value="{x:Bind ViewModel.ShowStatusCenterButton, Mode=OneWay}" To="True" />
598598
</VisualState.StateTriggers>
599599
<VisualState.Setters>
600600
<Setter Target="RightSideActionsStackPanel.Margin" Value="0,0,4,0" />

src/Files.App/ViewModels/Settings/AppearanceViewModel.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public sealed partial class AppearanceViewModel : ObservableObject
2424

2525
public Dictionary<HorizontalAlignment, string> ImageHorizontalAlignmentTypes { get; private set; } = [];
2626

27+
public Dictionary<StatusCenterVisibility, string> StatusCenterVisibilityOptions { get; private set; } = [];
28+
2729
public ObservableCollection<AppThemeResourceItem> AppThemeResources { get; }
2830

2931
public ICommand SelectImageCommand { get; }
@@ -76,6 +78,11 @@ public AppearanceViewModel(IUserSettingsService userSettingsService, IResourcesS
7678

7779
UpdateSelectedResource();
7880

81+
// StatusCenterVisibility
82+
StatusCenterVisibilityOptions.Add(StatusCenterVisibility.Always, Strings.Always.GetLocalizedResource());
83+
StatusCenterVisibilityOptions.Add(StatusCenterVisibility.DuringOngoingFileOperations, Strings.DuringOngoingFileOperations.GetLocalizedResource());
84+
SelectedStatusCenterVisibilityOption = StatusCenterVisibilityOptions[UserSettingsService.AppearanceSettingsService.StatusCenterVisibility];
85+
7986
SelectImageCommand = new RelayCommand(SelectBackgroundImage);
8087
RemoveImageCommand = new RelayCommand(RemoveBackgroundImage);
8188
}
@@ -330,6 +337,19 @@ public bool ShowShelfPaneToggleButton
330337
}
331338
}
332339

340+
private string selectedStatusCenterVisibilityOption;
341+
public string SelectedStatusCenterVisibilityOption
342+
{
343+
get => selectedStatusCenterVisibilityOption;
344+
set
345+
{
346+
if (SetProperty(ref selectedStatusCenterVisibilityOption, value))
347+
{
348+
UserSettingsService.AppearanceSettingsService.StatusCenterVisibility = StatusCenterVisibilityOptions.First(e => e.Value == value).Key;
349+
}
350+
}
351+
}
352+
333353
public bool IsAppEnvironmentDev
334354
{
335355
get => AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;

src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr
3636
private readonly IUpdateService UpdateService = Ioc.Default.GetRequiredService<IUpdateService>();
3737
private readonly ICommandManager Commands = Ioc.Default.GetRequiredService<ICommandManager>();
3838
private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService<IContentPageContext>();
39+
private readonly StatusCenterViewModel OngoingTasksViewModel = Ioc.Default.GetRequiredService<StatusCenterViewModel>();
3940

4041
// Fields
4142

@@ -79,6 +80,9 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr
7980

8081
public bool ShowHomeButton => AppearanceSettingsService.ShowHomeButton;
8182
public bool EnableOmnibar => GeneralSettingsService.EnableOmnibar;
83+
public bool ShowStatusCenterButton =>
84+
AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.Always ||
85+
(AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.DuringOngoingFileOperations && OngoingTasksViewModel.HasAnyItem);
8286

8387
public bool ShowShelfPaneToggleButton => AppearanceSettingsService.ShowShelfPaneToggleButton && AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;
8488

@@ -369,6 +373,9 @@ public NavigationToolbarViewModel()
369373
case nameof(AppearanceSettingsService.ShowHomeButton):
370374
OnPropertyChanged(nameof(ShowHomeButton));
371375
break;
376+
case nameof(AppearanceSettingsService.StatusCenterVisibility):
377+
OnPropertyChanged(nameof(ShowStatusCenterButton));
378+
break;
372379
case nameof(AppearanceSettingsService.ShowShelfPaneToggleButton):
373380
OnPropertyChanged(nameof(ShowShelfPaneToggleButton));
374381
break;
@@ -383,6 +390,15 @@ public NavigationToolbarViewModel()
383390
break;
384391
}
385392
};
393+
OngoingTasksViewModel.PropertyChanged += (s, e) =>
394+
{
395+
switch (e.PropertyName)
396+
{
397+
case nameof(OngoingTasksViewModel.HasAnyItem):
398+
OnPropertyChanged(nameof(ShowStatusCenterButton));
399+
break;
400+
}
401+
};
386402
}
387403

388404
// Methods

src/Files.App/Views/Settings/AppearancePage.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@
270270
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=ShowToolbar}">
271271
<ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=ShowToolbar}" IsOn="{x:Bind ViewModel.ShowToolbar, Mode=TwoWay}" />
272272
</wctcontrols:SettingsCard>
273+
274+
<!-- Show status center -->
275+
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=ShowStatusCenterButton}">
276+
<uc:ComboBoxEx
277+
AutomationProperties.Name="{helpers:ResourceString Name=ShowStatusCenterButton}"
278+
ItemsSource="{x:Bind ViewModel.StatusCenterVisibilityOptions.Values}"
279+
SelectedItem="{x:Bind ViewModel.SelectedStatusCenterVisibilityOption, Mode=TwoWay}" />
280+
</wctcontrols:SettingsCard>
273281
</wctcontrols:SettingsExpander.Items>
274282
</wctcontrols:SettingsExpander>
275283
</StackPanel>

0 commit comments

Comments
 (0)