Skip to content

Commit 18f59bd

Browse files
authored
Feature: Added icon for InstallFont (#12555)
1 parent 2a40abc commit 18f59bd

File tree

4 files changed

+34
-37
lines changed

4 files changed

+34
-37
lines changed
Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-

1+
// Copyright (c) 2023 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
24
using Files.App.Commands;
35
using Files.App.Contexts;
46
using Files.App.Shell;
57
using Files.Backend.Helpers;
68

7-
namespace Files.App.Actions;
8-
9-
internal class InstallCertificateAction : ObservableObject, IAction
9+
namespace Files.App.Actions
1010
{
11-
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();
11+
internal class InstallCertificateAction : ObservableObject, IAction
12+
{
13+
private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>();
1214

13-
public string Label => "Install".GetLocalizedResource();
15+
public string Label => "Install".GetLocalizedResource();
1416

15-
public string Description => "InstallCertificateDescription".GetLocalizedResource();
17+
public string Description => "InstallCertificateDescription".GetLocalizedResource();
1618

17-
public RichGlyph Glyph { get; } = new("\uEB95");
19+
public RichGlyph Glyph { get; } = new("\uEB95");
1820

19-
public bool IsExecutable => context.SelectedItems.Any() &&
20-
context.SelectedItems.All(x => FileExtensionHelpers.IsCertificateFile(x.FileExtension)) &&
21-
context.PageType is not ContentPageTypes.RecycleBin and not ContentPageTypes.ZipFolder;
21+
public bool IsExecutable => context.SelectedItems.Any() &&
22+
context.SelectedItems.All(x => FileExtensionHelpers.IsCertificateFile(x.FileExtension)) &&
23+
context.PageType is not ContentPageTypes.RecycleBin and not ContentPageTypes.ZipFolder;
2224

23-
public InstallCertificateAction()
24-
{
25-
context.PropertyChanged += Context_PropertyChanged;
26-
}
25+
public InstallCertificateAction()
26+
{
27+
context.PropertyChanged += Context_PropertyChanged;
28+
}
2729

28-
public async Task ExecuteAsync()
29-
{
30-
await ContextMenu.InvokeVerb("add", context.SelectedItems.Select(x => x.ItemPath).ToArray());
31-
}
30+
public async Task ExecuteAsync()
31+
{
32+
await ContextMenu.InvokeVerb("add", context.SelectedItems.Select(x => x.ItemPath).ToArray());
33+
}
3234

33-
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
34-
{
35-
if (e.PropertyName == nameof(IContentPageContext.SelectedItems))
35+
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
3636
{
37-
OnPropertyChanged(nameof(IsExecutable));
37+
if (e.PropertyName == nameof(IContentPageContext.SelectedItems))
38+
{
39+
OnPropertyChanged(nameof(IsExecutable));
40+
}
3841
}
3942
}
40-
}
43+
}

src/Files.App/Actions/Content/Install/InstallFontAction.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.Mvvm.ComponentModel;
5-
using CommunityToolkit.Mvvm.DependencyInjection;
4+
using Files.App.Commands;
65
using Files.App.Contexts;
7-
using Files.App.Extensions;
8-
using Files.App.Filesystem;
96
using Files.App.Shell;
107
using Files.Backend.Helpers;
11-
using System.Linq;
12-
using System.Threading.Tasks;
138

149
namespace Files.App.Actions
1510
{
@@ -21,6 +16,8 @@ internal class InstallFontAction : ObservableObject, IAction
2116

2217
public string Description => "InstallFontDescription".GetLocalizedResource();
2318

19+
public RichGlyph Glyph { get; } = new("\uE8D2");
20+
2421
public bool IsExecutable => context.SelectedItems.Any() &&
2522
context.SelectedItems.All(x => FileExtensionHelpers.IsFontFile(x.FileExtension)) &&
2623
context.PageType is not ContentPageTypes.RecycleBin and not ContentPageTypes.ZipFolder;
@@ -49,4 +46,4 @@ public void Context_PropertyChanged(object? sender, System.ComponentModel.Proper
4946
}
5047
}
5148
}
52-
}
49+
}

src/Files.App/Actions/Content/Install/InstallInfDriverAction.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using CommunityToolkit.Mvvm.ComponentModel;
5-
using CommunityToolkit.Mvvm.DependencyInjection;
64
using Files.App.Commands;
75
using Files.App.Contexts;
8-
using Files.App.Extensions;
9-
using Files.App.Filesystem;
106
using Files.App.Shell;
117
using Files.Backend.Helpers;
12-
using System.Threading.Tasks;
138

149
namespace Files.App.Actions
1510
{

src/Files.App/UserControls/InnerNavigationToolbar.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@
397397
Label="{x:Bind Commands.InstallFont.Label}"
398398
LabelPosition="Default"
399399
ToolTipService.ToolTip="{helpers:ResourceString Name=Install}">
400-
<!-- TODO: Add Icon -->
400+
<AppBarButton.Icon>
401+
<FontIcon Glyph="{x:Bind Commands.InstallFont.Glyph.BaseGlyph, Mode=OneTime}" />
402+
</AppBarButton.Icon>
401403
</AppBarButton>
402404

403405
<!-- Install Certificate -->

0 commit comments

Comments
 (0)