mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Expose index suffix setting
This commit is contained in:
parent
5d1006f05b
commit
4fb0279f9a
5 changed files with 27 additions and 48 deletions
|
|
@ -68,7 +68,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||
public double Opacity { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public List<string> ProgramSuffixes { get; set; }
|
||||
public string ProgramSuffixes { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public OpacityMode OpacityMode { get; set; }
|
||||
|
|
@ -165,16 +165,10 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||
{
|
||||
storage.CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
||||
}
|
||||
if (storage.ProgramSuffixes == null || storage.ProgramSuffixes.Count == 0)
|
||||
if (string.IsNullOrEmpty(storage.ProgramSuffixes))
|
||||
{
|
||||
storage.ProgramSuffixes = new List<string>()
|
||||
{
|
||||
"lnk",
|
||||
"exe",
|
||||
"appref-ms",
|
||||
"bat"
|
||||
};
|
||||
}
|
||||
storage.ProgramSuffixes = "lnk;exe;appref-ms;bat";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick">Index File Type</Button>
|
||||
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick">Index file suffixes</Button>
|
||||
<Button Height="30" HorizontalAlignment="Right" Margin="10 0 0 0" x:Name="btnReindex" Width="100" Click="btnReindex_Click">Re-Index</Button>
|
||||
</StackPanel>
|
||||
<ListView x:Name="programSourceView" Grid.Row="1">
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources
|
|||
{
|
||||
foreach (string file in Directory.GetFiles(path))
|
||||
{
|
||||
if (UserSettingStorage.Instance.ProgramSuffixes.Any(o => file.EndsWith("." + o)))
|
||||
if (UserSettingStorage.Instance.ProgramSuffixes.Split(';').Any(o => file.EndsWith("." + o)))
|
||||
{
|
||||
Program p = CreateEntry(file);
|
||||
list.Add(p);
|
||||
|
|
|
|||
|
|
@ -4,29 +4,14 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListView x:Name="lvProgramSuffixes" Grid.Row="0" ItemsSource="{Binding UserSettingStorage.Instance.ProgramSuffixes}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Suffixes" Width="200">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button x:Name="btnDelete" Click="btnDelete_OnClick" Width="100" Margin="10" Content="Delete"/>
|
||||
<Button x:Name="btnEdit" Click="btnEdit_OnClick" Width="100" Margin="10" Content="Edit"/>
|
||||
<Button x:Name="btnAdd" Click="btnAdd_OnClick" Width="100" Margin="10" Content="Add"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
Width="400"
|
||||
Height="170"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
d:DesignHeight="400" d:DesignWidth="300">
|
||||
<StackPanel>
|
||||
<TextBlock Margin="10 10 0 0" Foreground="Gray">Wox will only index files that end with following suffixes.</TextBlock>
|
||||
<TextBlock Margin="10 0 0 0" Foreground="Gray">Each suffix should split by ;</TextBlock>
|
||||
<TextBox x:Name="tbSuffixes" Margin="10"/>
|
||||
<Button HorizontalAlignment="Right" Height="30" Width="80" Click="ButtonBase_OnClick" Margin="10">Update</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using System.Windows.Media;
|
|||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
|
||||
namespace Wox.Plugin.SystemPlugins.Program
|
||||
{
|
||||
|
|
@ -22,21 +23,20 @@ namespace Wox.Plugin.SystemPlugins.Program
|
|||
public ProgramSuffixes()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tbSuffixes.Text = UserSettingStorage.Instance.ProgramSuffixes;
|
||||
}
|
||||
|
||||
private void btnDelete_OnClick(object sender, RoutedEventArgs e)
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
if (string.IsNullOrEmpty(tbSuffixes.Text))
|
||||
{
|
||||
MessageBox.Show("File suffixes can't be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
private void btnEdit_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnAdd_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
UserSettingStorage.Instance.ProgramSuffixes = tbSuffixes.Text;
|
||||
MessageBox.Show("Sucessfully update file suffixes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue