Skip to content

Commit 642ea4a

Browse files
bugfix
1 parent 5103b2b commit 642ea4a

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@
3636
<system:String x:Key="flowlauncher_plugin_program_delete_program_source">Are you sure you want to delete the selected program sources?</system:String>
3737

3838
<system:String x:Key="flowlauncher_plugin_program_update">OK</system:String>
39-
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Program Plugin will only index files that end with the following file types.</system:String>
39+
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Program Plugin will only index files with following suffixes.</system:String>
4040
<system:String x:Key="flowlauncher_plugin_program_update_file_suffixes">Successfully updated file suffixes</system:String>
4141
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
4242
<system:String x:Key="flowlauncher_plugin_protocols_cannot_empty">Protocols can't be empty</system:String>
4343

44-
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">Excutable Types</system:String>
45-
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_types">URL Types</system:String>
46-
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_urls">Custom URL Types</system:String>
47-
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_file_types">Custom File Types</system:String>
44+
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">File Suffixes</system:String>
45+
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_types">URL Protocols</system:String>
46+
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_urls">Custom URL Protocols</system:String>
47+
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_file_types">Custom File Suffixes</system:String>
4848
<system:String x:Key="flowlauncher_plugin_program_suffixes_tooltip">
49-
Insert file types what you want, Each file type should split by ';'. (ex>bat; py;)
49+
Insert file suffixes you want to index. File types should be separated by ';'. (ex>bat;py)
5050
</system:String>
5151
<system:String x:Key="flowlauncher_plugin_program_protocol_tooltip">
52-
Insert protocol types what you want, Each protocol type should split by ';'. (ex>steam; epic;)
52+
Insert protocols in .url files you want to index. Protocols should be separated by ';'. (ex>ftp;netflix)
5353
</system:String>
5454

5555
<system:String x:Key="flowlauncher_plugin_program_run_as_different_user">Run As Different User</system:String>

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
<CheckBox
174174
Name="CustomFiles"
175175
Margin="10,0,0,0"
176-
IsChecked="{Binding _settings.UseCustomSuffixes}"
176+
IsChecked="{Binding UseCustomSuffixes}"
177177
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_file_types}" />
178178
<TextBox
179179
x:Name="tbSuffixes"
@@ -199,7 +199,7 @@
199199
<CheckBox
200200
Name="CustomProtocol"
201201
Margin="10,0,0,0"
202-
IsChecked="{Binding _settings.UseCustomProtocols}"
202+
IsChecked="{Binding UseCustomProtocols}"
203203
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_urls}" />
204204
<TextBox
205205
x:Name="tbProtocols"

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@ namespace Flow.Launcher.Plugin.Program
77
public partial class ProgramSuffixes
88
{
99
private PluginInitContext context;
10-
public Settings _settings;
11-
public Dictionary<string, bool> SuffixesStatus => _settings.BuiltinSuffixesStatus;
12-
public Dictionary<string, bool> ProtocolsStatus => _settings.BuiltinProtocolsStatus;
10+
private Settings _settings;
11+
public Dictionary<string, bool> SuffixesStatus { get; set; }
12+
public Dictionary<string, bool> ProtocolsStatus { get; set; }
13+
public bool UseCustomSuffixes { get; set; }
14+
public bool UseCustomProtocols { get; set; }
1315

1416
public ProgramSuffixes(PluginInitContext context, Settings settings)
1517
{
1618
this.context = context;
1719
_settings = settings;
20+
SuffixesStatus = new Dictionary<string, bool>(_settings.BuiltinSuffixesStatus);
21+
ProtocolsStatus = new Dictionary<string, bool>(_settings.BuiltinProtocolsStatus);
22+
UseCustomSuffixes = _settings.UseCustomSuffixes;
23+
UseCustomProtocols = _settings.UseCustomProtocols;
1824
InitializeComponent();
19-
tbSuffixes.Text = string.Join(Settings.SuffixSeperator, _settings.CustomSuffixes);
20-
tbProtocols.Text = string.Join(Settings.SuffixSeperator, _settings.CustomProtocols);
25+
tbSuffixes.Text = string.Join(Settings.SuffixSeparator, _settings.CustomSuffixes);
26+
tbProtocols.Text = string.Join(Settings.SuffixSeparator, _settings.CustomProtocols);
2127
}
2228

2329
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
@@ -27,17 +33,17 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
2733

2834
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
2935
{
30-
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
31-
var protocols = tbProtocols.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
36+
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
37+
var protocols = tbProtocols.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
3238

33-
if (suffixes.Length == 0 && _settings.UseCustomSuffixes)
39+
if (suffixes.Length == 0 && UseCustomSuffixes)
3440
{
3541
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
3642
MessageBox.Show(warning);
3743
return;
3844
}
3945

40-
if (protocols.Length == 0 && _settings.UseCustomProtocols)
46+
if (protocols.Length == 0 && UseCustomProtocols)
4147
{
4248
string warning = context.API.GetTranslation("flowlauncher_plugin_protocols_cannot_empty");
4349
MessageBox.Show(warning);
@@ -46,6 +52,10 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
4652

4753
_settings.CustomSuffixes = suffixes;
4854
_settings.CustomProtocols = protocols;
55+
_settings.BuiltinSuffixesStatus = new Dictionary<string, bool>(SuffixesStatus);
56+
_settings.BuiltinProtocolsStatus = new Dictionary<string, bool>(ProtocolsStatus);
57+
_settings.UseCustomSuffixes = UseCustomSuffixes;
58+
_settings.UseCustomProtocols = UseCustomProtocols;
4959

5060
DialogResult = true;
5161
}

Plugins/Flow.Launcher.Plugin.Program/Settings.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public class Settings
2121

2222
[JsonIgnore]
2323
public Dictionary<string, bool> BuiltinProtocolsStatus { get; set; } = new Dictionary<string, bool>{
24-
{ $"steam://run/{SuffixSeperator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeperator}https://", false}
24+
{ $"steam://run/{SuffixSeparator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeparator}https://", false}
2525
};
2626

27-
public bool UseCustomSuffixes = false;
28-
public bool UseCustomProtocols = false;
27+
public bool UseCustomSuffixes { get; set; } = false;
28+
public bool UseCustomProtocols { get; set; } = false;
2929

3030
public string[] GetSuffixes()
3131
{
@@ -60,7 +60,7 @@ public string[] GetProtocols()
6060
{
6161
if (item.Value)
6262
{
63-
var tmp = item.Key.Split(SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
63+
var tmp = item.Key.Split(SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
6464
foreach(var p in tmp)
6565
{
6666
protocols.Add(p);
@@ -85,7 +85,7 @@ public string[] GetProtocols()
8585
public string CustomizedExplorer { get; set; } = Explorer;
8686
public string CustomizedArgs { get; set; } = ExplorerArgs;
8787

88-
internal const char SuffixSeperator = ';';
88+
internal const char SuffixSeparator = ';';
8989

9090
internal const string Explorer = "explorer";
9191

Plugins/Flow.Launcher.Plugin.Program/SuffixesConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
1212
var text = value as string[];
1313
if (text != null)
1414
{
15-
return string.Join(Settings.SuffixSeperator, text);
15+
return string.Join(Settings.SuffixSeparator, text);
1616
}
1717
else
1818
{

0 commit comments

Comments
 (0)