diff --git a/Flow.Launcher/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml index 839836b6a..89268437b 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml +++ b/Flow.Launcher/CustomShortcutSetting.xaml @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:flowlauncher="clr-namespace:Flow.Launcher" - Title="{DynamicResource customeQueryHotkeyTitle}" + Title="{DynamicResource customeQueryShortcutTitle}" Width="530" Background="{DynamicResource PopuBGColor}" Foreground="{DynamicResource PopupTextColor}" @@ -67,13 +67,13 @@ FontFamily="Segoe UI" FontSize="20" FontWeight="SemiBold" - Text="{DynamicResource customeQueryHotkeyTitle}" + Text="{DynamicResource customQueryShortcut}" TextAlignment="Left" /> diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs index 2a03d483b..87245d79d 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml.cs +++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs @@ -1,12 +1,8 @@ -using Flow.Launcher.Core.Resource; -using Flow.Launcher.Helper; -using Flow.Launcher.Infrastructure.UserSettings; -using System.Collections.ObjectModel; -using System.Linq; +using System; using System.Windows; using System.Windows.Input; -using System.Windows.Controls; -using System.Collections.Generic; +using Flow.Launcher.Core.Resource; +using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher { @@ -40,6 +36,16 @@ namespace Flow.Launcher private void btnAdd_OnClick(object sender, RoutedEventArgs e) { DialogResult = true; + if (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value))) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut")); + DialogResult = false; + } + else if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value)) + { + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidShortcut")); + DialogResult = false; + } Close(); } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 69c0a73ae..9d34cff28 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -113,8 +113,9 @@ Select a modifier key to open selected result via keyboard. Show Hotkey Show result selection hotkey with results. - Custom Query Hotkey - Query + Custom Query Hotkey + Custom Query Shortcut + Query Shortcut Expanded Delete @@ -211,7 +212,14 @@ Invalid plugin hotkey Update - + + Custom Query Shortcut + Enter a shortcut to automatically expand to the specified query. + Preview + Shortcut is dulplicate, please enter a new Shortcut or edit the existing one. + Invalid Shortcut + + Hotkey Unavailable diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 47933f326..9d45e3862 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2188,14 +2188,14 @@ Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"> - + - + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index f896af4a0..2db00f959 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -415,11 +415,6 @@ namespace Flow.Launcher var shortcutSettingWindow = new CustomShortcutSetting(); if (shortcutSettingWindow.ShowDialog() == true) { - if (settings.CustomShortcuts.Contains(shortcutSettingWindow.ShortCut)) - { - MessageBox.Show("Dulplicate shortcut"); - return; - } settings.CustomShortcuts.Add(shortcutSettingWindow.ShortCut); } }