Skip to content

Commit 730625c

Browse files
committed
Remove ChangeHotkey event & Remove deprecated functions
1 parent 2cf6bfb commit 730625c

File tree

6 files changed

+5
-82
lines changed

6 files changed

+5
-82
lines changed

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -246,20 +246,6 @@ private static void ChangeRegisteredHotkey(RegisteredHotkeyType registeredType,
246246

247247
#endregion
248248

249-
// TODO: Deprecated
250-
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
251-
{
252-
if (!_mainViewModel.ShouldIgnoreHotkeys())
253-
_mainViewModel.ToggleFlowLauncher();
254-
}
255-
256-
// TODO: Deprecated
257-
private static void OnToggleHotkeyWithChefKeys()
258-
{
259-
if (!_mainViewModel.ShouldIgnoreHotkeys())
260-
_mainViewModel.ToggleFlowLauncher();
261-
}
262-
263249
// TODO: Deprecated
264250
private static void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
265251
{
@@ -268,27 +254,7 @@ private static void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> ac
268254
}
269255

270256
// TODO: Deprecated
271-
private static void SetWithChefKeys(string hotkeyStr)
272-
{
273-
try
274-
{
275-
ChefKeysManager.RegisterHotkey(hotkeyStr, hotkeyStr, OnToggleHotkeyWithChefKeys);
276-
ChefKeysManager.Start();
277-
}
278-
catch (Exception e)
279-
{
280-
App.API.LogError(ClassName,
281-
string.Format("Error registering hotkey: {0} \nStackTrace:{1}",
282-
e.Message,
283-
e.StackTrace));
284-
string errorMsg = string.Format(App.API.GetTranslation("registerHotkeyFailed"), hotkeyStr);
285-
string errorMsgTitle = App.API.GetTranslation("MessageBoxTitle");
286-
App.API.ShowMsgBox(errorMsg, errorMsgTitle);
287-
}
288-
}
289-
290-
// TODO: Deprecated
291-
internal static void SetHotkey(HotkeyModel hotkey, EventHandler<HotkeyEventArgs> action)
257+
private static void SetHotkey(HotkeyModel hotkey, EventHandler<HotkeyEventArgs> action)
292258
{
293259
if (hotkey.IsEmpty)
294260
{
@@ -298,12 +264,6 @@ internal static void SetHotkey(HotkeyModel hotkey, EventHandler<HotkeyEventArgs>
298264
string hotkeyStr = hotkey.ToString();
299265
try
300266
{
301-
if (hotkeyStr == "LWin" || hotkeyStr == "RWin")
302-
{
303-
SetWithChefKeys(hotkeyStr);
304-
return;
305-
}
306-
307267
HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys, action);
308268
}
309269
catch (Exception e)
@@ -324,12 +284,6 @@ internal static void RemoveHotkey(string hotkeyStr)
324284
{
325285
try
326286
{
327-
if (hotkeyStr == "LWin" || hotkeyStr == "RWin")
328-
{
329-
RemoveWithChefKeys(hotkeyStr);
330-
return;
331-
}
332-
333287
if (!string.IsNullOrEmpty(hotkeyStr))
334288
HotkeyManager.Current.Remove(hotkeyStr);
335289
}
@@ -345,13 +299,6 @@ internal static void RemoveHotkey(string hotkeyStr)
345299
}
346300
}
347301

348-
// TODO: Deprecated
349-
private static void RemoveWithChefKeys(string hotkeyStr)
350-
{
351-
ChefKeysManager.UnregisterHotkey(hotkeyStr);
352-
ChefKeysManager.Stop();
353-
}
354-
355302
#region Hotkey Setting
356303

357304
private static void SetHotkey(RegisteredHotkeyData hotkeyData)

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,6 @@ public void GetNewHotkey(object sender, RoutedEventArgs e)
242242

243243
private async Task OpenHotkeyDialogAsync()
244244
{
245-
if (!string.IsNullOrEmpty(Hotkey))
246-
{
247-
HotKeyMapper.RemoveHotkey(Hotkey);
248-
}
249-
250245
var dialog = new HotkeyControlDialog(Hotkey, DefaultHotkey, WindowTitle)
251246
{
252247
Owner = Window.GetWindow(this)
@@ -300,8 +295,6 @@ private void SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
300295

301296
public void Delete()
302297
{
303-
if (!string.IsNullOrEmpty(Hotkey))
304-
HotKeyMapper.RemoveHotkey(Hotkey);
305298
Hotkey = "";
306299
SetKeysToDisplay(new HotkeyModel(false, false, false, false, Key.None));
307300
}
@@ -318,7 +311,6 @@ private void SetKeysToDisplay(HotkeyModel? hotkey)
318311

319312
foreach (var key in hotkey.Value.EnumerateDisplayKeys()!)
320313
{
321-
322314
KeysToDisplay.Add(key);
323315
}
324316
}

Flow.Launcher/Resources/Pages/WelcomePage2.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<Grid>
3939
<Grid.RowDefinitions>
4040
<RowDefinition Height="250" />
41-
<RowDefinition Height="340"/>
41+
<RowDefinition Height="340" />
4242
</Grid.RowDefinitions>
4343

4444
<Border Grid.Row="0" HorizontalAlignment="Stretch">
@@ -90,11 +90,12 @@
9090
</Border>
9191

9292
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
93-
<StackPanel Margin="24 20 24 20">
93+
<StackPanel Margin="24 20 24 20">
9494
<TextBlock
9595
FontSize="20"
9696
FontWeight="SemiBold"
97-
Text="{DynamicResource Welcome_Page2_Title}" TextWrapping="WrapWithOverflow"/>
97+
Text="{DynamicResource Welcome_Page2_Title}"
98+
TextWrapping="WrapWithOverflow" />
9899
<TextBlock
99100
Margin="0 10 0 0"
100101
FontSize="14"
@@ -112,7 +113,6 @@
112113
Text="{DynamicResource flowlauncherHotkey}" />
113114
<flowlauncher:HotkeyControl
114115
Margin="0 8 0 0"
115-
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
116116
DefaultHotkey="Alt+Space"
117117
Type="Hotkey"
118118
ValidateKeyGesture="True"

Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using System.Windows.Media;
22
using System.Windows.Navigation;
3-
using CommunityToolkit.Mvvm.Input;
43
using CommunityToolkit.Mvvm.DependencyInjection;
54
using Flow.Launcher.Helper;
6-
using Flow.Launcher.Infrastructure.Hotkey;
75
using Flow.Launcher.Infrastructure.UserSettings;
86
using Flow.Launcher.ViewModel;
97

@@ -27,12 +25,6 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
2725
base.OnNavigatedTo(e);
2826
}
2927

30-
[RelayCommand]
31-
private static void SetTogglingHotkey(HotkeyModel hotkey)
32-
{
33-
HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey);
34-
}
35-
3628
public Brush PreviewBackground
3729
{
3830
get => WallpaperPathRetrieval.GetWallpaperBrush();

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using CommunityToolkit.Mvvm.Input;
44
using Flow.Launcher.Helper;
55
using Flow.Launcher.Infrastructure;
6-
using Flow.Launcher.Infrastructure.Hotkey;
76
using Flow.Launcher.Infrastructure.UserSettings;
87
using Flow.Launcher.Plugin;
98

@@ -28,12 +27,6 @@ public SettingsPaneHotkeyViewModel(Settings settings)
2827
Settings = settings;
2928
}
3029

31-
[RelayCommand]
32-
private void SetTogglingHotkey(HotkeyModel hotkey)
33-
{
34-
HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey);
35-
}
36-
3730
[RelayCommand]
3831
private void CustomHotkeyDelete()
3932
{

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
Icon="&#xeda7;"
3333
Sub="{DynamicResource flowlauncherHotkeyToolTip}">
3434
<flowlauncher:HotkeyControl
35-
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
3635
DefaultHotkey="Alt+Space"
3736
Type="Hotkey"
3837
ValidateKeyGesture="True"

0 commit comments

Comments
 (0)