Skip to content

Commit b2102b2

Browse files
committed
Merge branch 'main' into 5bfa/CQ-Omnibar2
2 parents a3c54ed + b348223 commit b2102b2

File tree

9 files changed

+30
-40
lines changed

9 files changed

+30
-40
lines changed

.github/scripts/Configure-AppxManifest.ps1

+1-1
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="49306atecsolution.FilesPreview"
63+
$xmlDoc.Package.Applications.Application.VisualElements.DefaultTile.ShortName="Files - Preview"
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

+1-1
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.8.0" />
19+
Version="3.9.9.0" />
2020

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

src/Files.App.CsWin32/NativeMethods.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ SendMessage
9797
IsWindowVisible
9898
COPYDATASTRUCT
9999
WINDOW_LONG_PTR_INDEX
100-
GetDpiForWindow
101100
CallWindowProc
102101
MINMAXINFO
103102
SUBCLASSPROC
@@ -226,3 +225,6 @@ _SICHINTF
226225
RoGetAgileReference
227226
IQueryInfo
228227
QITIPF_FLAGS
228+
GetKeyboardState
229+
MapVirtualKey
230+
GetKeyboardLayout

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Frozen;
55
using System.Runtime.InteropServices;
66
using System.Text;
7+
using Windows.Win32;
78
using Forms = System.Windows.Forms;
89

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

376377
// Get the current keyboard state
377-
if (!Win32PInvoke.GetKeyboardState(state))
378+
if (!PInvoke.GetKeyboardState(state))
378379
return buffer.ToString();
379380

380381
// Convert the key to its virtual key code
381382
var virtualKey = (uint)key;
382383

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

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

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

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
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;
79

810
namespace Files.App.Data.Models
911
{
@@ -127,9 +129,8 @@ public string PCloudDrivePath
127129

128130
/// <summary>
129131
/// Gets or sets a value indicating the AppWindow DPI.
130-
/// TODO update value if the DPI changes
131132
/// </summary>
132-
private float _AppWindowDPI = Win32PInvoke.GetDpiForWindow(MainWindow.Instance.WindowHandle) / 96f;
133+
private float _AppWindowDPI = PInvoke.GetDpiForWindow((HWND)MainWindow.Instance.WindowHandle) / 96f;
133134
public float AppWindowDPI
134135
{
135136
get => _AppWindowDPI;

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

-22
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ 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-
8479
[DllImport("ole32.dll")]
8580
public static extern uint CoWaitForMultipleObjects(
8681
uint dwFlags,
@@ -228,23 +223,6 @@ public static extern int ToUnicodeEx(
228223
IntPtr keyboardLayout
229224
);
230225

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-
248226
[DllImport("user32.dll")]
249227
public static extern bool TranslateMessage(
250228
ref MSG lpMsg

src/Files.App/UserControls/NavigationToolbar.xaml

+3-3
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="{helpers:ResourceString Name=Path}"
349+
ModeName="{x:Bind Commands.EditPath.LabelWithHotKey, Mode=OneWay}"
350350
PlaceholderText="{helpers:ResourceString Name=OmnibarPathModeTextPlaceholder}"
351351
SuggestionItemsSource="{x:Bind ViewModel.PathModeSuggestionItems, Mode=OneWay}"
352352
Text="{x:Bind ViewModel.PathText, Mode=TwoWay}"
@@ -382,7 +382,7 @@
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="{helpers:ResourceString Name=CommandPalette}"
385+
ModeName="{x:Bind Commands.OpenCommandPalette.LabelWithHotKey, Mode=OneWay}"
386386
PlaceholderText="{helpers:ResourceString Name=OmnibarCommandPaletteModeTextPlaceholder}"
387387
SuggestionItemsSource="{x:Bind ViewModel.OmnibarCommandPaletteModeSuggestionItems, Mode=OneWay}"
388388
Text="{x:Bind ViewModel.OmnibarCommandPaletteModeText, Mode=TwoWay}"
@@ -425,7 +425,7 @@
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="{helpers:ResourceString Name=Search}"
428+
ModeName="{x:Bind Commands.Search.LabelWithHotKey, Mode=OneWay}"
429429
PlaceholderText="{helpers:ResourceString Name=OmnibarSearchModeTextPlaceholder}" />
430430

431431
</controls:Omnibar>

src/Files.App/Utils/Cloud/CloudDrivesDetector.cs

+10-6
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
9191
"ProtonDrive" => CloudProviders.ProtonDrive,
9292
"kDrive" => CloudProviders.kDrive,
9393
"Lucid" => CloudProviders.LucidLink,
94+
"SyncCom" => CloudProviders.SyncDrive,
95+
"MagentaCLOUD" => CloudProviders.MagentaCloud,
9496
_ => null,
9597
};
9698

9799
if (cloudProvider is null)
98100
continue;
99101

100102
var nextCloudValue = (string?)namespaceSubKey?.GetValue(string.Empty);
101-
var ownCloudValue = (string?)clsidSubKey?.GetValue(string.Empty);
102-
var kDriveValue = (string?)clsidSubKey?.GetValue(string.Empty);
103-
var lucidLinkValue = (string?)clsidSubKey?.GetValue(string.Empty);
103+
var clsidDefaultValue = (string?)clsidSubKey?.GetValue(string.Empty);
104104

105105
using var defaultIconKey = clsidSubKey?.OpenSubKey(@"DefaultIcon");
106106
var iconPath = (string?)defaultIconKey?.GetValue(string.Empty);
@@ -115,10 +115,12 @@ private static Task<IEnumerable<ICloudProvider>> DetectGenericCloudDrive()
115115
CloudProviders.AppleCloudDrive => $"iCloud Drive",
116116
CloudProviders.AppleCloudPhotos => $"iCloud Photos",
117117
CloudProviders.AdobeCreativeCloud => $"Creative Cloud Files",
118-
CloudProviders.ownCloud => !string.IsNullOrEmpty(ownCloudValue) ? ownCloudValue : "ownCloud",
118+
CloudProviders.ownCloud => !string.IsNullOrEmpty(clsidDefaultValue) ? clsidDefaultValue : "ownCloud",
119119
CloudProviders.ProtonDrive => $"Proton Drive",
120-
CloudProviders.kDrive => !string.IsNullOrEmpty(kDriveValue) ? kDriveValue : "kDrive",
121-
CloudProviders.LucidLink => !string.IsNullOrEmpty(lucidLinkValue) ? lucidLinkValue : "lucidLink",
120+
CloudProviders.kDrive => !string.IsNullOrEmpty(clsidDefaultValue) ? clsidDefaultValue : "kDrive",
121+
CloudProviders.LucidLink => !string.IsNullOrEmpty(clsidDefaultValue) ? clsidDefaultValue : "lucidLink",
122+
CloudProviders.SyncDrive => !string.IsNullOrEmpty(clsidDefaultValue) ? clsidDefaultValue : "Sync",
123+
CloudProviders.MagentaCloud => !string.IsNullOrEmpty(clsidDefaultValue) ? clsidDefaultValue : "MagentaCLOUD",
122124
_ => null
123125
},
124126
SyncFolder = syncedFolder,
@@ -349,6 +351,8 @@ private static string GetDriveType(string driveIdentifier, RegistryKey? namespac
349351
return "ownCloud";
350352
if (driveIdentifier.StartsWith("ProtonDrive"))
351353
return "ProtonDrive";
354+
if (driveIdentifier.StartsWith("SyncCom"))
355+
return "SyncCom";
352356

353357
// Nextcloud specific
354358
var appNameFromNamespace = (string?)namespaceSubKey?.GetValue("ApplicationName");

src/Files.App/Utils/Cloud/CloudProviders.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public enum CloudProviders
4545

4646
LucidLink,
4747

48-
kDrive
48+
kDrive,
49+
50+
SyncDrive,
51+
52+
MagentaCloud
4953
}
5054
}

0 commit comments

Comments
 (0)