Skip to content

Commit 55b159e

Browse files
committed
Init
1 parent b348223 commit 55b159e

File tree

21 files changed

+180
-142
lines changed

21 files changed

+180
-142
lines changed

.github/scripts/Configure-AppxManifest.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ elseif ($Branch -eq "StorePreview")
6060
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesPreview"
6161
$xmlDoc.Package.Properties.DisplayName="Files - Preview"
6262
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files - Preview"
63-
$xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName="Files - Preview"
63+
$xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName="49306atecsolution.FilesPreview"
6464

6565
# Remove capability that is only used for the sideload package
6666
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Identity
1717
Name="FilesDev"
1818
Publisher="CN=Files"
19-
Version="3.9.9.0" />
19+
Version="3.9.8.0" />
2020

2121
<Properties>
2222
<DisplayName>Files - Dev</DisplayName>

src/Files.App.BackgroundTasks/Files.App.BackgroundTasks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<Platforms>x86;x64;ARM64</Platforms>
1111
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13+
<IsAotCompatible>true</IsAotCompatible>
1314
</PropertyGroup>
1415

1516
<PropertyGroup>

src/Files.App.CsWin32/Files.App.CsWin32.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<Configurations>Debug;Release</Configurations>
1010
<Platforms>x86;x64;arm64</Platforms>
1111
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
12+
<IsAotCompatible>true</IsAotCompatible>
1213
</PropertyGroup>
1314

1415
<ItemGroup>

src/Files.App.CsWin32/NativeMethods.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ RemoveDirectoryFromApp
4545
GetKeyState
4646
CreateDirectoryFromApp
4747
WNetCancelConnection2
48-
NET_USE_CONNECT_FLAGS
4948
NETRESOURCEW
5049
WNetAddConnection3
5150
CREDENTIALW
@@ -78,7 +77,6 @@ GetAce
7877
SetEntriesInAcl
7978
ACL_SIZE_INFORMATION
8079
DeleteAce
81-
EXPLICIT_ACCESS
8280
ACCESS_ALLOWED_ACE
8381
LookupAccountSid
8482
GetComputerName
@@ -97,6 +95,7 @@ SendMessage
9795
IsWindowVisible
9896
COPYDATASTRUCT
9997
WINDOW_LONG_PTR_INDEX
98+
GetDpiForWindow
10099
CallWindowProc
101100
MINMAXINFO
102101
SUBCLASSPROC
@@ -133,7 +132,6 @@ ShellExecuteEx
133132
CoTaskMemFree
134133
QueryDosDevice
135134
DeviceIoControl
136-
GetLastError
137135
CreateFile
138136
GetVolumeInformation
139137
COMPRESSION_FORMAT
@@ -225,6 +223,3 @@ _SICHINTF
225223
RoGetAgileReference
226224
IQueryInfo
227225
QITIPF_FLAGS
228-
GetKeyboardState
229-
MapVirtualKey
230-
GetKeyboardLayout

src/Files.App.Storage/Files.App.Storage.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<Platforms>x86;x64;arm64</Platforms>
1111
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13+
<IsAotCompatible>true</IsAotCompatible>
1314
</PropertyGroup>
1415

1516
<ItemGroup>

src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public unsafe static HRESULT TryGetThumbnail(this IWindowsStorable storable, int
4444
{
4545
thumbnailData = null;
4646

47-
using ComPtr<IShellItemImageFactory> pShellItemImageFactory = storable.ThisPtr.As<IShellItemImageFactory>();
47+
using ComPtr<IShellItemImageFactory> pShellItemImageFactory = default;
48+
storable.ThisPtr.As(pShellItemImageFactory.GetAddressOf());
4849
if (pShellItemImageFactory.IsNull)
4950
return HRESULT.E_NOINTERFACE;
5051

src/Files.App.Storage/Watchers/RecycleBinWatcher.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Files.App.Storage.Watchers
88
{
9+
[Obsolete]
910
public class RecycleBinWatcher : ITrashWatcher
1011
{
1112
private readonly List<SystemIO.FileSystemWatcher> _watchers = [];

src/Files.App/Data/Commands/HotKey/HotKey.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Frozen;
55
using System.Runtime.InteropServices;
66
using System.Text;
7-
using Windows.Win32;
87
using Forms = System.Windows.Forms;
98

109
namespace Files.App.Data.Commands
@@ -375,17 +374,17 @@ private static string GetKeyCharacter(Forms.Keys key)
375374
var state = new byte[256];
376375

377376
// Get the current keyboard state
378-
if (!PInvoke.GetKeyboardState(state))
377+
if (!Win32PInvoke.GetKeyboardState(state))
379378
return buffer.ToString();
380379

381380
// Convert the key to its virtual key code
382381
var virtualKey = (uint)key;
383382

384383
// Map the virtual key to a scan code
385-
var scanCode = PInvoke.MapVirtualKey(virtualKey, 0);
384+
var scanCode = Win32PInvoke.MapVirtualKey(virtualKey, 0);
386385

387386
// Get the active keyboard layout
388-
var keyboardLayout = PInvoke.GetKeyboardLayout(0);
387+
var keyboardLayout = Win32PInvoke.GetKeyboardLayout(0);
389388

390389
if (Win32PInvoke.ToUnicodeEx(virtualKey, scanCode, state, buffer, buffer.Capacity, 0, keyboardLayout) > 0)
391390
return buffer[^1].ToString();

src/Files.App/Data/Items/NavigationBarSuggestionItem.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4+
using Files.App.Controls;
5+
46
namespace Files.App.Data.Items
57
{
68
[Obsolete("Remove once Omnibar goes out of experimental.")]
7-
public sealed partial class NavigationBarSuggestionItem : ObservableObject
9+
public sealed partial class NavigationBarSuggestionItem : ObservableObject, IOmnibarTextMemberPathProvider
810
{
911
private string? _Text;
1012
public string? Text
@@ -88,5 +90,16 @@ private void UpdatePrimaryDisplay()
8890
}
8991
}
9092
}
93+
94+
public string GetTextMemberPath(string textMemberPath)
95+
{
96+
return textMemberPath switch
97+
{
98+
nameof(Text) => Text,
99+
nameof(PrimaryDisplay) => PrimaryDisplay,
100+
nameof(SearchText) => SearchText,
101+
_ => string.Empty
102+
};
103+
}
91104
}
92105
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using Microsoft.UI.Xaml.Controls;
55
using System.Runtime.InteropServices;
66
using Windows.ApplicationModel.DataTransfer;
7-
using Windows.Win32;
8-
using Windows.Win32.Foundation;
97

108
namespace Files.App.Data.Models
119
{
@@ -129,8 +127,9 @@ public string PCloudDrivePath
129127

130128
/// <summary>
131129
/// Gets or sets a value indicating the AppWindow DPI.
130+
/// TODO update value if the DPI changes
132131
/// </summary>
133-
private float _AppWindowDPI = PInvoke.GetDpiForWindow((HWND)MainWindow.Instance.WindowHandle) / 96f;
132+
private float _AppWindowDPI = Win32PInvoke.GetDpiForWindow(MainWindow.Instance.WindowHandle) / 96f;
134133
public float AppWindowDPI
135134
{
136135
get => _AppWindowDPI;

src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ public static extern bool SetEvent(
7676
IntPtr hEvent
7777
);
7878

79+
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
80+
public static extern int GetDpiForWindow(
81+
IntPtr hwnd
82+
);
83+
7984
[DllImport("ole32.dll")]
8085
public static extern uint CoWaitForMultipleObjects(
8186
uint dwFlags,
@@ -223,6 +228,23 @@ public static extern int ToUnicodeEx(
223228
IntPtr keyboardLayout
224229
);
225230

231+
[DllImport("user32.dll")]
232+
public static extern bool GetKeyboardState(
233+
byte[] lpKeyState
234+
);
235+
236+
[DllImport("user32.dll", CharSet = CharSet.Auto)]
237+
public static extern IntPtr GetKeyboardLayout
238+
(
239+
uint idThread
240+
);
241+
242+
[DllImport("user32.dll")]
243+
public static extern uint MapVirtualKey(
244+
uint code,
245+
uint mapType
246+
);
247+
226248
[DllImport("user32.dll")]
227249
public static extern bool TranslateMessage(
228250
ref MSG lpMsg

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346
IconOnActive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Path}, IsFilled=True}"
347347
IconOnInactive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Path}, IconType=Outline}"
348348
IsDefault="True"
349-
ModeName="{x:Bind Commands.EditPath.LabelWithHotKey, Mode=OneWay}"
349+
ModeName="{helpers:ResourceString Name=Path}"
350350
PlaceholderText="{helpers:ResourceString Name=OmnibarPathModeTextPlaceholder}"
351351
SuggestionItemsSource="{x:Bind ViewModel.PathModeSuggestionItems, Mode=OneWay}"
352352
Text="{x:Bind ViewModel.PathText, Mode=TwoWay}"
@@ -382,50 +382,50 @@
382382
x:Name="OmnibarCommandPaletteMode"
383383
IconOnActive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Commands}, IsFilled=True}"
384384
IconOnInactive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Commands}, IconType=Outline}"
385-
ModeName="{x:Bind Commands.OpenCommandPalette.LabelWithHotKey, Mode=OneWay}"
386-
PlaceholderText="{helpers:ResourceString Name=OmnibarCommandPaletteModeTextPlaceholder}">
387-
<!--<controls:OmnibarMode.SuggestionItemTemplate>
388-
<DataTemplate x:DataType="data:OmnibarPaletteSuggestionItem">
389-
<Grid Height="48" ColumnSpacing="12">
385+
ModeName="{helpers:ResourceString Name=CommandPalette}"
386+
PlaceholderText="{helpers:ResourceString Name=OmnibarCommandPaletteModeTextPlaceholder}"
387+
SuggestionItemsSource="{x:Bind ViewModel.OmnibarCommandPaletteModeSuggestionItems, Mode=OneWay}"
388+
Text="{x:Bind ViewModel.OmnibarCommandPaletteModeText, Mode=TwoWay}"
389+
TextMemberPath="Text">
390+
<controls:OmnibarMode.SuggestionItemTemplate>
391+
<DataTemplate x:DataType="dataitems:NavigationBarSuggestionItem">
392+
<Grid ColumnSpacing="12">
390393
<Grid.ColumnDefinitions>
391394
<ColumnDefinition Width="Auto" />
392395
<ColumnDefinition Width="*" />
393396
<ColumnDefinition Width="Auto" />
394397
</Grid.ColumnDefinitions>
395-
<controls:ThemedIcon
396-
Width="20"
397-
Height="20"
398-
VerticalAlignment="Center"
399-
Style="{StaticResource App.ThemedIcons.Actions.Copying}" />
400-
<StackPanel Grid.Column="1" VerticalAlignment="Center">
401-
<TextBlock
402-
Style="{StaticResource BodyStrongTextBlockStyle}"
403-
Text="{x:Bind Title}"
404-
TextTrimming="CharacterEllipsis"
405-
TextWrapping="NoWrap" />
406-
<TextBlock
407-
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
408-
Style="{StaticResource CaptionTextBlockStyle}"
409-
Text="{x:Bind Description}"
410-
TextTrimming="CharacterEllipsis"
411-
TextWrapping="NoWrap" />
412-
</StackPanel>
413-
<StackPanel Grid.Column="2" VerticalAlignment="Center">
414-
<TextBlock
415-
Text="{x:Bind HotKeys}"
416-
TextTrimming="CharacterEllipsis"
417-
TextWrapping="NoWrap" />
418-
</StackPanel>
398+
399+
<ContentPresenter Grid.Column="0">
400+
<controls:ThemedIcon Style="{ThemeResource App.ThemedIcons.Filter}" />
401+
</ContentPresenter>
402+
403+
<!-- Primary Title -->
404+
<TextBlock
405+
x:Name="PrimaryDisplayBlock"
406+
Grid.Column="1"
407+
Foreground="{ThemeResource TextFillColorPrimaryBrush}"
408+
MaxLines="1"
409+
TextTrimming="CharacterEllipsis"
410+
TextWrapping="NoWrap">
411+
<Run FontWeight="Normal" Text="{x:Bind PrimaryDisplayPreMatched, Mode=OneWay}" /><Run FontWeight="Bold" Text="{x:Bind PrimaryDisplayMatched, Mode=OneWay}" /><Run FontWeight="Normal" Text="{x:Bind PrimaryDisplayPostMatched, Mode=OneWay}" />
412+
</TextBlock>
413+
414+
<!-- Keyboard Shortcuts -->
415+
<keyboard:KeyboardShortcut
416+
x:Name="RightAlignedKeyboardShortcut"
417+
Grid.Column="2"
418+
HotKeys="{x:Bind HotKeys, Mode=OneWay}" />
419419
</Grid>
420420
</DataTemplate>
421-
</controls:OmnibarMode.SuggestionItemTemplate>-->
421+
</controls:OmnibarMode.SuggestionItemTemplate>
422422
</controls:OmnibarMode>
423423

424424
<controls:OmnibarMode
425425
x:Name="OmnibarSearchMode"
426426
IconOnActive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Search}, IsFilled=True}"
427427
IconOnInactive="{controls:ThemedIconMarkup Style={StaticResource App.ThemedIcons.Omnibar.Search}, IconType=Outline}"
428-
ModeName="{x:Bind Commands.Search.LabelWithHotKey, Mode=OneWay}"
428+
ModeName="{helpers:ResourceString Name=Search}"
429429
PlaceholderText="{helpers:ResourceString Name=OmnibarSearchModeTextPlaceholder}" />
430430

431431
</controls:Omnibar>

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,47 @@ private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs
256256

257257
private async void Omnibar_QuerySubmitted(Omnibar sender, OmnibarQuerySubmittedEventArgs args)
258258
{
259-
await ViewModel.HandleItemNavigationAsync(args.Text);
259+
if (Omnibar.CurrentSelectedMode == OmnibarPathMode)
260+
{
261+
await ViewModel.HandleItemNavigationAsync(args.Text);
262+
}
263+
else if (Omnibar.CurrentSelectedMode == OmnibarCommandPaletteMode)
264+
{
265+
}
266+
else if (Omnibar.CurrentSelectedMode == OmnibarSearchMode)
267+
{
268+
}
260269
}
261270

262271
private async void Omnibar_SuggestionChosen(Omnibar sender, OmnibarSuggestionChosenEventArgs args)
263272
{
264-
if (args.SelectedItem is OmnibarPathModeSuggestionModel item &&
265-
!string.IsNullOrEmpty(item.Path))
266-
await ViewModel.HandleItemNavigationAsync(item.Path);
273+
if (Omnibar.CurrentSelectedMode == OmnibarPathMode)
274+
{
275+
if (args.SelectedItem is OmnibarPathModeSuggestionModel item &&
276+
!string.IsNullOrEmpty(item.Path))
277+
await ViewModel.HandleItemNavigationAsync(item.Path);
278+
}
279+
else if (Omnibar.CurrentSelectedMode == OmnibarCommandPaletteMode)
280+
{
281+
}
282+
else if (Omnibar.CurrentSelectedMode == OmnibarSearchMode)
283+
{
284+
}
267285
}
268286

269287
private async void Omnibar_TextChanged(Omnibar sender, OmnibarTextChangedEventArgs args)
270288
{
271-
await ViewModel.PopulateOmnibarSuggestionsForPathMode();
289+
if (Omnibar.CurrentSelectedMode == OmnibarPathMode)
290+
{
291+
await ViewModel.PopulateOmnibarSuggestionsForPathMode();
292+
}
293+
else if (Omnibar.CurrentSelectedMode == OmnibarCommandPaletteMode)
294+
{
295+
ViewModel.PopulateOmnibarSuggestionsForCommandPaletteMode();
296+
}
297+
else if (Omnibar.CurrentSelectedMode == OmnibarSearchMode)
298+
{
299+
}
272300
}
273301

274302
private async void BreadcrumbBar_ItemClicked(Controls.BreadcrumbBar sender, Controls.BreadcrumbBarItemClickedEventArgs args)

0 commit comments

Comments
 (0)