Skip to content

Commit d394d86

Browse files
Bugfix
1 parent 334d58d commit d394d86

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public override int GetHashCode()
4646
public void Deconstruct(out string key, out string value)
4747
{
4848
key = Key;
49-
value = Expand();
49+
value = Value;
5050
}
5151

5252
public static implicit operator (string Key, string Value)(CustomShortcutModel shortcut)

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Flow.Launcher.Plugin.SharedModels;
99
using Flow.Launcher;
1010
using Flow.Launcher.ViewModel;
11+
1112
namespace Flow.Launcher.Infrastructure.UserSettings
1213
{
1314
public class Settings : BaseModel

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ public CustomShortcutSetting(Settings settings)
2020
InitializeComponent();
2121
}
2222

23-
public CustomShortcutSetting((string, string) shortcut, Settings settings)
23+
public CustomShortcutSetting(CustomShortcutModel shortcut, Settings settings)
2424
{
25-
(Key, Value) = shortcut;
25+
Key = shortcut.Key;
26+
Value = shortcut.Value;
2627
_settings = settings;
2728
update = true;
2829
InitializeComponent();

Flow.Launcher/SettingWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,8 @@
21312131
<GridView>
21322132
<GridViewColumn Width="180" Header="{DynamicResource hotkey}">
21332133
<GridViewColumn.CellTemplate>
2134-
<DataTemplate DataType="userSettings:CustomPluginHotkey">
2134+
<DataTemplate
2135+
="userSettings:CustomPluginHotkey">
21352136
<TextBlock Text="{Binding Hotkey}" />
21362137
</DataTemplate>
21372138
</GridViewColumn.CellTemplate>
@@ -2184,7 +2185,6 @@
21842185
BorderThickness="1"
21852186
ItemsSource="{Binding ShortCuts}"
21862187
SelectedItem="{Binding SelectedCustomShortcut}"
2187-
SelectedIndex="{Binding SelectCustomShortcutIndex}"
21882188
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
21892189
<ListView.View>
21902190
<GridView>

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ private void OnEditCustomShortCutClick(object sender, RoutedEventArgs e)
411411
var shortcutSettingWindow = new CustomShortcutSetting(item, settings);
412412
if (shortcutSettingWindow.ShowDialog() == true)
413413
{
414-
viewModel.EditShortcut(item);
414+
viewModel.EditShortcut(item, shortcutSettingWindow.ShortCut);
415415
}
416416
}
417417
else

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,18 +543,17 @@ public FamilyTypeface SelectedResultFontFaces
543543
public CustomPluginHotkey SelectedCustomPluginHotkey { get; set; }
544544

545545
public CustomShortcutModel? SelectedCustomShortcut { get; set; }
546-
public int? SelectCustomShortcutIndex { get; set; }
547546

548547
public void AddShortcut(CustomShortcutModel shortcut)
549548
{
550549
Settings.CustomShortcuts.Add(shortcut);
551550
ShortCuts.Add(shortcut);
552551
}
553552

554-
public void EditShortcut(CustomShortcutModel shortcut)
553+
public void EditShortcut(CustomShortcutModel oldShortcut, CustomShortcutModel newShortcut)
555554
{
556-
Settings.CustomShortcuts[ShortCuts.IndexOf(shortcut)] = shortcut;
557-
ShortCuts[ShortCuts.IndexOf(shortcut)] = shortcut;
555+
RemoveShortcut(oldShortcut);
556+
AddShortcut(newShortcut);
558557
}
559558

560559
public void RemoveShortcut(CustomShortcutModel shortcut)

0 commit comments

Comments
 (0)