Skip to content

Commit cde272a

Browse files
Fix hard-coded text
1 parent d394d86 commit cde272a

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
3737

3838
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
3939
{
40-
if (!update && (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value)) || _settings.BuiltinShortcuts.Contains(new CustomShortcutModel(Key, Value))))
40+
if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value))
4141
{
42-
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut"));
42+
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("emptyShortcut"));
4343
return;
4444
}
45-
if (String.IsNullOrEmpty(Key) || String.IsNullOrEmpty(Value))
45+
if (!update && (_settings.CustomShortcuts.Contains(new CustomShortcutModel(Key, Value)) || _settings.BuiltinShortcuts.Contains(new CustomShortcutModel(Key, Value))))
4646
{
47-
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidShortcut"));
47+
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("dulplicateShortcut"));
4848
return;
4949
}
5050
DialogResult = true;

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@
214214

215215
<!-- Custom Query Shortcut Dialog -->
216216
<system:String x:Key="customeQueryShortcutTitle">Custom Query Shortcut</system:String>
217-
<system:String x:Key="customeQueryShortcutTips">Enter a shortcut to automatically expand to the specified query.</system:String>
217+
<system:String x:Key="customeQueryShortcutTips">Enter a shortcut that automatically expands to the specified query.</system:String>
218218
<system:String x:Key="dulplicateShortcut">Shortcut is dulplicate, please enter a new Shortcut or edit the existing one.</system:String>
219-
<system:String x:Key="invalidShortcut">Invalid Shortcut</system:String>
219+
<system:String x:Key="emptyShortcut">Shortcut and/or its expansion is empty.</system:String>
220+
<system:String x:Key="uneditableShortcut">This shortcut cannot be deleted or edited.</system:String>
220221

221222
<!-- Hotkey Control -->
222223
<system:String x:Key="hotkeyUnavailable">Hotkey Unavailable</system:String>

Flow.Launcher/SettingWindow.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,7 @@
21312131
<GridView>
21322132
<GridViewColumn Width="180" Header="{DynamicResource hotkey}">
21332133
<GridViewColumn.CellTemplate>
2134-
<DataTemplate
2135-
="userSettings:CustomPluginHotkey">
2134+
<DataTemplate DataType="userSettings:CustomPluginHotkey">
21362135
<TextBlock Text="{Binding Hotkey}" />
21372136
</DataTemplate>
21382137
</GridViewColumn.CellTemplate>

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private void OnDeleteCustomShortCutClick(object sender, RoutedEventArgs e)
383383
}
384384
else if (!item.CanBeEdited)
385385
{
386-
MessageBox.Show("This shortcut cannot be deleted or edited."); // TODO
386+
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("uneditableShortcut"));
387387
return;
388388
}
389389

@@ -401,22 +401,21 @@ private void OnDeleteCustomShortCutClick(object sender, RoutedEventArgs e)
401401
private void OnEditCustomShortCutClick(object sender, RoutedEventArgs e)
402402
{
403403
var item = viewModel.SelectedCustomShortcut;
404-
if (item != null)
404+
if (item == null)
405405
{
406-
if (!item.CanBeEdited)
407-
{
408-
MessageBox.Show("This shortcut cannot be deleted or edited.");
409-
return;
410-
}
411-
var shortcutSettingWindow = new CustomShortcutSetting(item, settings);
412-
if (shortcutSettingWindow.ShowDialog() == true)
413-
{
414-
viewModel.EditShortcut(item, shortcutSettingWindow.ShortCut);
415-
}
406+
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
407+
return;
416408
}
417-
else
409+
else if (!item.CanBeEdited)
418410
{
419-
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
411+
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("uneditableShortcut"));
412+
return;
413+
}
414+
415+
var shortcutSettingWindow = new CustomShortcutSetting(item, settings);
416+
if (shortcutSettingWindow.ShowDialog() == true)
417+
{
418+
viewModel.EditShortcut(item, shortcutSettingWindow.ShortCut);
420419
}
421420
}
422421

0 commit comments

Comments
 (0)