Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c56c343
Add Checkbox to edit program source window
VictoriousRaptor Oct 18, 2022
6bb3b39
Merge remote-tracking branch 'upstream/dev' into ProgramPluginUI
VictoriousRaptor Oct 18, 2022
3196dc5
Update text
VictoriousRaptor Oct 18, 2022
dcec361
Fix button text issue
VictoriousRaptor Oct 18, 2022
569f69a
bugfix
VictoriousRaptor Oct 18, 2022
bcd2b8d
bugfix
VictoriousRaptor Oct 18, 2022
fac76af
Reindex when disable program from results
VictoriousRaptor Oct 18, 2022
58ad92b
Revert changes in Settings.cs
VictoriousRaptor Oct 18, 2022
81d2954
Move ProgramSource definition
VictoriousRaptor Oct 20, 2022
c85af88
Make UID lowercase
VictoriousRaptor Oct 20, 2022
4f2dc06
fix
VictoriousRaptor Oct 20, 2022
db67d3b
Remove unnecessary Count()
VictoriousRaptor Oct 20, 2022
4da7a5e
Remove DisabledProgramSource()
VictoriousRaptor Oct 20, 2022
bc54b07
manually set win32 uid when construct
VictoriousRaptor Oct 20, 2022
7832ab6
Remove ProgramSource()
VictoriousRaptor Oct 20, 2022
cc1e323
Remove unnecessary Count()
VictoriousRaptor Oct 20, 2022
8a488ad
CA1829
VictoriousRaptor Oct 20, 2022
463f417
bugfix
VictoriousRaptor Oct 20, 2022
cbcae41
bugfix
VictoriousRaptor Oct 20, 2022
e72810c
Temporary fix for sharing violation
VictoriousRaptor Oct 20, 2022
02b2375
set AppxPackageHelper to static
VictoriousRaptor Oct 21, 2022
3362d1c
CA1825
VictoriousRaptor Oct 21, 2022
d92ea58
CA1822
VictoriousRaptor Oct 21, 2022
84b1c26
Fix image file usage
VictoriousRaptor Oct 21, 2022
963c6ea
Merge branch 'dev' into FixProgramUID
VictoriousRaptor Oct 22, 2022
31453e5
Review update
VictoriousRaptor Oct 24, 2022
9bf1645
Use String.Equals
VictoriousRaptor Oct 24, 2022
8a4ff3b
use shallow copy
VictoriousRaptor Oct 24, 2022
cb295bb
Refactor
VictoriousRaptor Oct 24, 2022
d7d8635
comment
VictoriousRaptor Oct 24, 2022
cd6c4dd
revert rename
VictoriousRaptor Oct 24, 2022
440337b
bugfix
VictoriousRaptor Oct 24, 2022
1aa3668
bugfix
VictoriousRaptor Oct 24, 2022
184aa57
Merge branch 'FixProgramPluginSettings' into FixProgramUID
VictoriousRaptor Oct 25, 2022
0a19b02
Fix merge
VictoriousRaptor Oct 25, 2022
2f9b19d
Fix 1356
VictoriousRaptor Oct 25, 2022
874383b
bugfix and refactor
VictoriousRaptor Oct 25, 2022
efece39
Fix var for task.run
VictoriousRaptor Oct 28, 2022
6e19b49
Freeze logo
VictoriousRaptor Oct 28, 2022
3efa0e1
Remove DisabledProgramSource
VictoriousRaptor Oct 28, 2022
cc7d2bc
Fix location setter and uid case
VictoriousRaptor Oct 28, 2022
0b247db
minor changes
VictoriousRaptor Oct 29, 2022
4296652
Time when manually reindex
VictoriousRaptor Oct 29, 2022
a5d7005
refactor foreach
VictoriousRaptor Oct 29, 2022
1348708
revert
VictoriousRaptor Oct 29, 2022
70b0e3b
Fix uid change when editing uwp sources
VictoriousRaptor Oct 30, 2022
f6c842d
Merge dev
VictoriousRaptor Nov 2, 2022
a523584
Fix indexing unwanted protocols in custom sources
VictoriousRaptor Nov 3, 2022
36f67b8
refactor usage of getprotocols
VictoriousRaptor Nov 3, 2022
b0a4ac7
Enable parallel query for custom sources
VictoriousRaptor Nov 3, 2022
32f7c59
Merge remote-tracking branch 'upstream/dev' into FixProgramUID
VictoriousRaptor Nov 3, 2022
4d63895
Formatting and use default for invalid programs
VictoriousRaptor Nov 3, 2022
befa19c
remove unnecessary using
VictoriousRaptor Nov 3, 2022
7d27d73
Delete FileChangeWatcher.cs
VictoriousRaptor Nov 3, 2022
85256ef
Comments
VictoriousRaptor Nov 3, 2022
4725b0d
Implement object.Equals for uwp and win32
VictoriousRaptor Nov 3, 2022
ff430c7
Fix duplicate program sources when editing
VictoriousRaptor Nov 4, 2022
5f6bcde
Comment
VictoriousRaptor Nov 4, 2022
0079a88
minor refactor
VictoriousRaptor Nov 4, 2022
cdde5fa
Update Win32.cs
VictoriousRaptor Nov 4, 2022
1e8cc9a
Slightly speed up uwp index
VictoriousRaptor Nov 5, 2022
59c355e
remove unused property
VictoriousRaptor Nov 5, 2022
76cf5f0
Merge branch 'dev' into FixProgramUID
VictoriousRaptor Nov 5, 2022
c8b80f4
Merge branch 'dev' into FixProgramUID
VictoriousRaptor Nov 13, 2022
2f5789f
Merge remote-tracking branch 'upstream/dev' into FixProgramUID
VictoriousRaptor Nov 14, 2022
225d002
Merge branch 'FixProgramUID' of https://github.com/VictoriousRaptor/F…
VictoriousRaptor Nov 14, 2022
2ea310c
Merge remote-tracking branch 'upstream/dev' into FixProgramUID
VictoriousRaptor Nov 14, 2022
f5701d4
fix merge
VictoriousRaptor Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher.Test/Plugins/ProgramTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void WhenGivenPriReferenceValueShouldReturnCorrectFormat(string packageNa
var app = new UWP.Application();

// Act
var result = app.FormattedPriReferenceValue(packageName, rawPriReferenceValue);
var result = UWP.Application.FormattedPriReferenceValue(packageName, rawPriReferenceValue);

// Assert
Assert.IsTrue(result == expectedFormat,
Expand Down
94 changes: 68 additions & 26 deletions Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource flowlauncher_plugin_program_directory}"
Width="400"
Width="530"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
WindowStartupLocation="CenterScreen">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
Expand All @@ -19,7 +19,6 @@
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>

<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
Expand Down Expand Up @@ -53,53 +52,96 @@
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,12,26,0">
<StackPanel Margin="0,0,0,12">
<StackPanel Margin="26,0,26,0">
<StackPanel Grid.Row="0" Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_program_directory}"
Text="{DynamicResource flowlauncher_plugin_program_edit_program_source_title}"
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
<TextBox
Name="Directory"
Width="268"
Margin="0,7"
VerticalAlignment="Center" />
<Button
Width="70"
Margin="10"
HorizontalAlignment="Right"
Click="BrowseButton_Click"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
<StackPanel>
<TextBlock
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_edit_program_source_tips}"
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
</StackPanel>

<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<Grid Width="470">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_directory}" />
<DockPanel
Grid.Row="0"
Grid.Column="1"
LastChildFill="True">
<Button
Width="70"
HorizontalAlignment="Right"
Click="BrowseButton_Click"
DockPanel.Dock="Right"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
<TextBox
Name="Directory"
Margin="10"
VerticalAlignment="Center"
HorizontalAlignment="Stretch" />
</DockPanel>
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_enabled}" />
<CheckBox x:Name="Chkbox"
Grid.Row="1"
Grid.Column="1"
Margin="10,0"
VerticalAlignment="Center" />
</Grid>
</StackPanel>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Margin="0,14,0,0"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
MinWidth="140"
Margin="0,0,5,0"
Margin="10,0,5,0"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />

<Button
x:Name="btnAdd"
MinWidth="140"
Margin="5,0,0,0"
HorizontalAlignment="Right"
Click="ButtonAdd_OnClick"
Margin="5,0,10,0"
Click="BtnAdd_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_update}"
Style="{DynamicResource AccentButtonStyle}" />
</StackPanel>
</Border>
</Grid>

</Window>
</Window>
64 changes: 45 additions & 19 deletions Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@ namespace Flow.Launcher.Plugin.Program
/// <summary>
/// Interaction logic for AddProgramSource.xaml
/// </summary>
public partial class AddProgramSource
public partial class AddProgramSource : Window
{
private PluginInitContext _context;
private Settings.ProgramSource _editing;
private ProgramSource _editing;
private Settings _settings;
private bool update;

public AddProgramSource(PluginInitContext context, Settings settings)
{
InitializeComponent();
_context = context;
_settings = settings;
Directory.Focus();
Chkbox.IsChecked = true;
update = false;
btnAdd.Content = _context.API.GetTranslation("flowlauncher_plugin_program_add");
}

public AddProgramSource(Settings.ProgramSource edit, Settings settings)
public AddProgramSource(PluginInitContext context, Settings settings, ProgramSource source)
{
_editing = edit;
_settings = settings;

InitializeComponent();
_context = context;
_editing = source;
_settings = settings;
update = true;
Chkbox.IsChecked = _editing.Enabled;
Directory.Text = _editing.Location;
}

Expand All @@ -47,34 +53,54 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
Close();
}

private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
{
string s = Directory.Text;
if (!System.IO.Directory.Exists(s))
string path = Directory.Text;
bool modified = false;
if (!System.IO.Directory.Exists(path))
{
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_invalid_path"));
return;
}
if (_editing == null)
if (!update)
{
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == Directory.Text))
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.OrdinalIgnoreCase)))
{
var source = new ProgramSource
{
Location = Directory.Text,
UniqueIdentifier = Directory.Text
};

var source = new ProgramSource(path);
modified = true;
_settings.ProgramSources.Insert(0, source);
ProgramSetting.ProgramSettingDisplayList.Add(source);
}
else
{
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_duplicate_program_source"));
return;
}
}
else
{
_editing.Location = Directory.Text;
// Separate checks to avoid changing UniqueIdentifier of UWP
if (!_editing.Location.Equals(path, System.StringComparison.OrdinalIgnoreCase))
{
if (ProgramSetting.ProgramSettingDisplayList
.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.OrdinalIgnoreCase)))
{
// Check if the new location is used
// No need to check win32 or uwp, just override them
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_duplicate_program_source"));
return;
}
modified = true;
_editing.Location = path; // Changes UniqueIdentifier internally
}
if (_editing.Enabled != Chkbox.IsChecked)
{
modified = true;
_editing.Enabled = Chkbox.IsChecked ?? true;
}
}

DialogResult = true;
DialogResult = modified;
Close();
}
}
Expand Down
58 changes: 0 additions & 58 deletions Plugins/Flow.Launcher.Plugin.Program/FileChangeWatcher.cs

This file was deleted.

7 changes: 6 additions & 1 deletion Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<system:String x:Key="flowlauncher_plugin_program_add">Add</system:String>
<system:String x:Key="flowlauncher_plugin_program_name">Name</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable">Enable</system:String>
<system:String x:Key="flowlauncher_plugin_program_enabled">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable">Disable</system:String>
<system:String x:Key="flowlauncher_plugin_program_location">Location</system:String>
<system:String x:Key="flowlauncher_plugin_program_all_programs">All Programs</system:String>
Expand Down Expand Up @@ -38,8 +39,12 @@

<system:String x:Key="flowlauncher_plugin_program_pls_select_program_source">Please select a program source</system:String>
<system:String x:Key="flowlauncher_plugin_program_delete_program_source">Are you sure you want to delete the selected program sources?</system:String>
<system:String x:Key="flowlauncher_plugin_program_duplicate_program_source">Another program source with the same location alreaday exists.</system:String>

<system:String x:Key="flowlauncher_plugin_program_update">OK</system:String>
<system:String x:Key="flowlauncher_plugin_program_edit_program_source_title">Program Source</system:String>
<system:String x:Key="flowlauncher_plugin_program_edit_program_source_tips">Edit directory and status of this program source.</system:String>

<system:String x:Key="flowlauncher_plugin_program_update">Update</system:String>
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Program Plugin will only index files with selected suffixes and .url files with selected protocols.</system:String>
<system:String x:Key="flowlauncher_plugin_program_update_file_suffixes">Successfully updated file suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
Expand Down
5 changes: 0 additions & 5 deletions Plugins/Flow.Launcher.Plugin.Program/Logger/ProgramLogger.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.UserSettings;

namespace Flow.Launcher.Plugin.Program.Logger
{
Expand Down
Loading