Skip to content

Commit 00ca8ca

Browse files
authored
Merge branch 'main' into terminal
2 parents 62148d4 + 0ab38a9 commit 00ca8ca

File tree

84 files changed

+5552
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5552
-568
lines changed

src/Files.App (Package)/Files.Package.wapproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<DisableXbfLineInfo>False</DisableXbfLineInfo>
1515
<GenerateTestArtifacts>True</GenerateTestArtifacts>
1616
<AppxBundleAutoResourcePackageQualifiers>Scale|DXFeatureLevel</AppxBundleAutoResourcePackageQualifiers>
17-
<AppxDefaultResourceQualifiers>Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;ku-Arab;lt-LT;lv-LV;nb-NO;nl-NL;or-IN;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant</AppxDefaultResourceQualifiers>
17+
<AppxDefaultResourceQualifiers>Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;ku-Arab;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;or-IN;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant</AppxDefaultResourceQualifiers>
1818
<UapAppxPackageBuildMode>StoreUpload</UapAppxPackageBuildMode>
1919
<HoursBetweenUpdateChecks>255</HoursBetweenUpdateChecks>
2020
<EntryPointProjectUniqueName>..\Files.App\Files.App.csproj</EntryPointProjectUniqueName>

src/Files.App (Package)/Package.appxmanifest

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<!-- Copyright (c) 2024 Files Community. Licensed under the MIT License. See the LICENSE. -->
33
<Package
44
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
@@ -16,7 +16,7 @@
1616
<Identity
1717
Name="FilesDev"
1818
Publisher="CN=Files"
19-
Version="3.4.18.0" />
19+
Version="3.5.2.0" />
2020

2121
<Properties>
2222
<DisplayName>Files - Dev</DisplayName>
@@ -59,7 +59,8 @@
5959
<Resource Language="ko-KR" />
6060
<Resource Language="ku-Arab" />
6161
<Resource Language="lt-LT" />
62-
<Resource Language="lv-LV" />
62+
<Resource Language="lv-LV" />
63+
<Resource Language="ms-MY" />
6364
<Resource Language="nb-NO" />
6465
<Resource Language="nl-NL" />
6566
<Resource Language="or-IN" />

src/Files.App.Server/Files.App.Server.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<OutputType>WinExe</OutputType>
55
<DefaultLanguage>en-US</DefaultLanguage>
66
<AppxBundleAutoResourcePackageQualifiers>Scale|DXFeatureLevel</AppxBundleAutoResourcePackageQualifiers>
7-
<AppxDefaultResourceQualifiers>Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;ku-Arab;lt-LT;lv-LV;nb-NO;nl-NL;or-IN;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant</AppxDefaultResourceQualifiers>
7+
<AppxDefaultResourceQualifiers>Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;ku-Arab;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;or-IN;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant</AppxDefaultResourceQualifiers>
88
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
99
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
1010
<ImplicitUsings>enable</ImplicitUsings>

src/Files.App/7zArm64.dll

1.67 MB
Binary file not shown.

src/Files.App/Actions/Navigation/ClosePaneAction.cs src/Files.App/Actions/Navigation/CloseActivePaneAction.cs

+9-12
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
namespace Files.App.Actions
55
{
6-
internal sealed class ClosePaneAction : ObservableObject, IAction
6+
internal sealed class CloseActivePaneAction : ObservableObject, IAction
77
{
8-
private readonly IContentPageContext context;
8+
private IContentPageContext ContentPageContext { get; } = Ioc.Default.GetRequiredService<IContentPageContext>();
99

1010
public string Label
11-
=> "NavigationToolbarClosePane/Label".GetLocalizedResource();
11+
=> "CloseActivePane".GetLocalizedResource();
1212

1313
public string Description
14-
=> "ClosePaneDescription".GetLocalizedResource();
14+
=> "CloseActivePaneDescription".GetLocalizedResource();
1515

1616
public HotKey HotKey
1717
=> new(Keys.W, KeyModifiers.CtrlShift);
@@ -20,23 +20,20 @@ public RichGlyph Glyph
2020
=> new("\uE89F");
2121

2222
public bool IsExecutable
23-
=> context.IsMultiPaneActive;
23+
=> ContentPageContext.IsMultiPaneActive;
2424

25-
public ClosePaneAction()
25+
public CloseActivePaneAction()
2626
{
27-
context = Ioc.Default.GetRequiredService<IContentPageContext>();
28-
29-
context.PropertyChanged += Context_PropertyChanged;
27+
ContentPageContext.PropertyChanged += ContentPageContext_PropertyChanged;
3028
}
3129

3230
public Task ExecuteAsync(object? parameter = null)
3331
{
34-
context.ShellPage!.PaneHolder.CloseSecondaryPane();
35-
32+
ContentPageContext.ShellPage?.PaneHolder.CloseActivePane();
3633
return Task.CompletedTask;
3734
}
3835

39-
private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
36+
private void ContentPageContext_PropertyChanged(object? sender, PropertyChangedEventArgs e)
4037
{
4138
switch (e.PropertyName)
4239
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Actions
5+
{
6+
internal sealed class ToggleToolbarAction : ObservableObject, IToggleAction
7+
{
8+
private IAppearanceSettingsService AppearanceSettingsService { get; } = Ioc.Default.GetRequiredService<IAppearanceSettingsService>();
9+
10+
public string Label
11+
=> "ToggleToolbar".GetLocalizedResource();
12+
13+
public string Description
14+
=> "ToggleToolbar".GetLocalizedResource();
15+
16+
public HotKey HotKey
17+
=> new(Keys.B, KeyModifiers.CtrlShift);
18+
19+
public bool IsOn
20+
=> AppearanceSettingsService.ShowToolbar;
21+
22+
public ToggleToolbarAction()
23+
{
24+
AppearanceSettingsService.PropertyChanged += ViewModel_PropertyChanged;
25+
}
26+
27+
public Task ExecuteAsync(object? parameter = null)
28+
{
29+
AppearanceSettingsService.ShowToolbar = !IsOn;
30+
31+
return Task.CompletedTask;
32+
}
33+
34+
private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
35+
{
36+
if (e.PropertyName is nameof(AppearanceSettingsService.ShowToolbar))
37+
OnPropertyChanged(nameof(IsOn));
38+
}
39+
}
40+
}

src/Files.App/Data/Commands/Manager/CommandCodes.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public enum CommandCodes
2424
TogglePreviewPane,
2525
ToggleDetailsPane,
2626
ToggleInfoPane,
27+
ToggleToolbar,
2728

2829
// File System
2930
CopyItem,
@@ -186,7 +187,7 @@ public enum CommandCodes
186187
NextTab,
187188
CloseSelectedTab,
188189
OpenNewPane,
189-
ClosePane,
190+
CloseActivePane,
190191
FocusLeftPane,
191192
FocusRightPane,
192193

src/Files.App/Data/Commands/Manager/CommandManager.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public IRichCommand this[HotKey hotKey]
5555
public IRichCommand TogglePreviewPane => commands[CommandCodes.TogglePreviewPane];
5656
public IRichCommand ToggleDetailsPane => commands[CommandCodes.ToggleDetailsPane];
5757
public IRichCommand ToggleInfoPane => commands[CommandCodes.ToggleInfoPane];
58+
public IRichCommand ToggleToolbar => commands[CommandCodes.ToggleToolbar];
5859
public IRichCommand SelectAll => commands[CommandCodes.SelectAll];
5960
public IRichCommand InvertSelection => commands[CommandCodes.InvertSelection];
6061
public IRichCommand ClearSelection => commands[CommandCodes.ClearSelection];
@@ -191,7 +192,7 @@ public IRichCommand this[HotKey hotKey]
191192
public IRichCommand NextTab => commands[CommandCodes.NextTab];
192193
public IRichCommand CloseSelectedTab => commands[CommandCodes.CloseSelectedTab];
193194
public IRichCommand OpenNewPane => commands[CommandCodes.OpenNewPane];
194-
public IRichCommand ClosePane => commands[CommandCodes.ClosePane];
195+
public IRichCommand CloseActivePane => commands[CommandCodes.CloseActivePane];
195196
public IRichCommand FocusLeftPane => commands[CommandCodes.FocusLeftPane];
196197
public IRichCommand FocusRightPane => commands[CommandCodes.FocusRightPane];
197198
public IRichCommand OpenFileLocation => commands[CommandCodes.OpenFileLocation];
@@ -238,6 +239,7 @@ public IEnumerator<IRichCommand> GetEnumerator() =>
238239
[CommandCodes.TogglePreviewPane] = new TogglePreviewPaneAction(),
239240
[CommandCodes.ToggleDetailsPane] = new ToggleDetailsPaneAction(),
240241
[CommandCodes.ToggleInfoPane] = new ToggleInfoPaneAction(),
242+
[CommandCodes.ToggleToolbar] = new ToggleToolbarAction(),
241243
[CommandCodes.SelectAll] = new SelectAllAction(),
242244
[CommandCodes.InvertSelection] = new InvertSelectionAction(),
243245
[CommandCodes.ClearSelection] = new ClearSelectionAction(),
@@ -374,7 +376,7 @@ public IEnumerator<IRichCommand> GetEnumerator() =>
374376
[CommandCodes.NextTab] = new NextTabAction(),
375377
[CommandCodes.CloseSelectedTab] = new CloseSelectedTabAction(),
376378
[CommandCodes.OpenNewPane] = new OpenNewPaneAction(),
377-
[CommandCodes.ClosePane] = new ClosePaneAction(),
379+
[CommandCodes.CloseActivePane] = new CloseActivePaneAction(),
378380
[CommandCodes.FocusLeftPane] = new FocusLeftPaneAction(),
379381
[CommandCodes.FocusRightPane] = new FocusRightPaneAction(),
380382
[CommandCodes.OpenFileLocation] = new OpenFileLocationAction(),

src/Files.App/Data/Commands/Manager/ICommandManager.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
2929
IRichCommand TogglePreviewPane { get; }
3030
IRichCommand ToggleDetailsPane { get; }
3131
IRichCommand ToggleInfoPane { get; }
32+
IRichCommand ToggleToolbar { get; }
3233

3334
IRichCommand CopyItem { get; }
3435
IRichCommand CopyPath { get; }
@@ -171,7 +172,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
171172
IRichCommand NextTab { get; }
172173
IRichCommand CloseSelectedTab { get; }
173174
IRichCommand OpenNewPane { get; }
174-
IRichCommand ClosePane { get; }
175+
IRichCommand CloseActivePane { get; }
175176
IRichCommand FocusLeftPane { get; }
176177
IRichCommand FocusRightPane { get; }
177178

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface IShellPanesPage : IDisposable, INotifyPropertyChanged
1616

1717
public void OpenSecondaryPane(string path);
1818

19-
public void CloseSecondaryPane();
19+
public void CloseActivePane();
2020

2121
public void FocusLeftPane();
2222

src/Files.App/Data/Models/AppModel.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using Microsoft.UI.Xaml.Controls;
5+
using System.Runtime.InteropServices;
56
using Windows.ApplicationModel.DataTransfer;
67

78
namespace Files.App.Data.Models
@@ -35,11 +36,18 @@ public int TabStripSelectedIndex
3536
{
3637
SetProperty(ref _TabStripSelectedIndex, value);
3738

38-
if (value >= 0 && value < MainPageViewModel.AppInstances.Count)
39+
try
3940
{
40-
var rootFrame = (Frame)MainWindow.Instance.Content;
41-
var mainView = (MainPage)rootFrame.Content;
42-
mainView.ViewModel.SelectedTabItem = MainPageViewModel.AppInstances[value];
41+
if (value >= 0 && value < MainPageViewModel.AppInstances.Count)
42+
{
43+
var rootFrame = (Frame)MainWindow.Instance.Content;
44+
var mainView = (MainPage)rootFrame.Content;
45+
mainView.ViewModel.SelectedTabItem = MainPageViewModel.AppInstances[value];
46+
}
47+
}
48+
catch (COMException)
49+
{
50+
4351
}
4452
}
4553
}

src/Files.App/Dialogs/FilesystemOperationDialog.xaml.cs

+13-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Licensed under the MIT License. See the LICENSE.
33

44
using CommunityToolkit.WinUI.UI;
5+
using Microsoft.Extensions.Logging;
56
using Microsoft.UI.Xaml;
67
using Microsoft.UI.Xaml.Controls;
7-
using Microsoft.UI.Xaml.Media;
88

99
namespace Files.App.Dialogs
1010
{
@@ -55,8 +55,18 @@ private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
5555

5656
private void UpdateDialogLayout()
5757
{
58-
if (ViewModel.FileSystemDialogMode.ConflictsExist)
59-
ContainerGrid.Width = MainWindow.Instance.Bounds.Width <= 700 ? MainWindow.Instance.Bounds.Width - 50 : 650;
58+
try
59+
{
60+
if (ViewModel.FileSystemDialogMode.ConflictsExist)
61+
ContainerGrid.Width = MainWindow.Instance.Bounds.Width <= 700 ? MainWindow.Instance.Bounds.Width - 50 : 650;
62+
}
63+
catch (Exception ex)
64+
{
65+
// Handle exception in case WinUI Windows is closed
66+
// (see https://github.com/files-community/Files/issues/15599)
67+
68+
App.Logger.LogWarning(ex, ex.Message);
69+
}
6070
}
6171

6272
protected override void OnApplyTemplate()

src/Files.App/Extensions/DispatcherQueueExtensions.cs

+51-13
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ public static Task EnqueueOrInvokeAsync(this DispatcherQueue? dispatcher, Func<T
1313
return SafetyExtensions.IgnoreExceptions(() =>
1414
{
1515
if (dispatcher is not null)
16-
return dispatcher.EnqueueAsync(function, priority);
17-
else
18-
return function();
16+
{
17+
try
18+
{
19+
return dispatcher.EnqueueAsync(function, priority);
20+
}
21+
catch (InvalidOperationException ex)
22+
{
23+
if (ex.Message is not "Failed to enqueue the operation")
24+
throw;
25+
}
26+
}
27+
28+
return function();
1929
}, App.Logger, typeof(COMException));
2030
}
2131

@@ -24,9 +34,19 @@ public static Task EnqueueOrInvokeAsync(this DispatcherQueue? dispatcher, Func<T
2434
return SafetyExtensions.IgnoreExceptions(() =>
2535
{
2636
if (dispatcher is not null)
27-
return dispatcher.EnqueueAsync(function, priority);
28-
else
29-
return function();
37+
{
38+
try
39+
{
40+
return dispatcher.EnqueueAsync(function, priority);
41+
}
42+
catch (InvalidOperationException ex)
43+
{
44+
if (ex.Message is not "Failed to enqueue the operation")
45+
throw;
46+
}
47+
}
48+
49+
return function();
3050
}, App.Logger, typeof(COMException));
3151
}
3252

@@ -35,12 +55,20 @@ public static Task EnqueueOrInvokeAsync(this DispatcherQueue? dispatcher, Action
3555
return SafetyExtensions.IgnoreExceptions(() =>
3656
{
3757
if (dispatcher is not null)
38-
return dispatcher.EnqueueAsync(function, priority);
39-
else
4058
{
41-
function();
42-
return Task.CompletedTask;
59+
try
60+
{
61+
return dispatcher.EnqueueAsync(function, priority);
62+
}
63+
catch (InvalidOperationException ex)
64+
{
65+
if (ex.Message is not "Failed to enqueue the operation")
66+
throw;
67+
}
4368
}
69+
70+
function();
71+
return Task.CompletedTask;
4472
}, App.Logger, typeof(COMException));
4573
}
4674

@@ -49,9 +77,19 @@ public static Task EnqueueOrInvokeAsync(this DispatcherQueue? dispatcher, Action
4977
return SafetyExtensions.IgnoreExceptions(() =>
5078
{
5179
if (dispatcher is not null)
52-
return dispatcher.EnqueueAsync(function, priority);
53-
else
54-
return Task.FromResult(function());
80+
{
81+
try
82+
{
83+
return dispatcher.EnqueueAsync(function, priority);
84+
}
85+
catch (InvalidOperationException ex)
86+
{
87+
if (ex.Message is not "Failed to enqueue the operation")
88+
throw;
89+
}
90+
}
91+
92+
return Task.FromResult(function());
5593
}, App.Logger, typeof(COMException));
5694
}
5795

0 commit comments

Comments
 (0)