Skip to content

Commit 5c09ad6

Browse files
committed
Revert "Merge branch 'main' into 5bfa/CQ-Omnibar2"
This reverts commit b2102b2, reversing changes made to a3c54ed.
1 parent b2102b2 commit 5c09ad6

File tree

9 files changed

+40
-30
lines changed

9 files changed

+40
-30
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="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

+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.9.0" />
19+
Version="3.9.8.0" />
2020

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

src/Files.App.CsWin32/NativeMethods.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ SendMessage
9797
IsWindowVisible
9898
COPYDATASTRUCT
9999
WINDOW_LONG_PTR_INDEX
100+
GetDpiForWindow
100101
CallWindowProc
101102
MINMAXINFO
102103
SUBCLASSPROC
@@ -225,6 +226,3 @@ _SICHINTF
225226
RoGetAgileReference
226227
IQueryInfo
227228
QITIPF_FLAGS
228-
GetKeyboardState
229-
MapVirtualKey
230-
GetKeyboardLayout

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

+3-4
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/Models/AppModel.cs

+2-3
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

+22
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

+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="{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,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="{x:Bind Commands.OpenCommandPalette.LabelWithHotKey, Mode=OneWay}"
385+
ModeName="{helpers:ResourceString Name=CommandPalette}"
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="{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/Utils/Cloud/CloudDrivesDetector.cs

+6-10
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,
9694
_ => null,
9795
};
9896

9997
if (cloudProvider is null)
10098
continue;
10199

102100
var nextCloudValue = (string?)namespaceSubKey?.GetValue(string.Empty);
103-
var clsidDefaultValue = (string?)clsidSubKey?.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);
104104

105105
using var defaultIconKey = clsidSubKey?.OpenSubKey(@"DefaultIcon");
106106
var iconPath = (string?)defaultIconKey?.GetValue(string.Empty);
@@ -115,12 +115,10 @@ 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(clsidDefaultValue) ? clsidDefaultValue : "ownCloud",
118+
CloudProviders.ownCloud => !string.IsNullOrEmpty(ownCloudValue) ? ownCloudValue : "ownCloud",
119119
CloudProviders.ProtonDrive => $"Proton Drive",
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",
120+
CloudProviders.kDrive => !string.IsNullOrEmpty(kDriveValue) ? kDriveValue : "kDrive",
121+
CloudProviders.LucidLink => !string.IsNullOrEmpty(lucidLinkValue) ? lucidLinkValue : "lucidLink",
124122
_ => null
125123
},
126124
SyncFolder = syncedFolder,
@@ -351,8 +349,6 @@ private static string GetDriveType(string driveIdentifier, RegistryKey? namespac
351349
return "ownCloud";
352350
if (driveIdentifier.StartsWith("ProtonDrive"))
353351
return "ProtonDrive";
354-
if (driveIdentifier.StartsWith("SyncCom"))
355-
return "SyncCom";
356352

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

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

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

4646
LucidLink,
4747

48-
kDrive,
49-
50-
SyncDrive,
51-
52-
MagentaCloud
48+
kDrive
5349
}
5450
}

0 commit comments

Comments
 (0)