Skip to content

Commit c7eb4e2

Browse files
committed
Merge Dev
2 parents 7d769c5 + e2427ce commit c7eb4e2

22 files changed

+586
-552
lines changed

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5959
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
6060
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
61-
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
61+
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
6262
<!--ToolGood.Words.Pinyin v3.0.2.6 results in high memory usage when search with pinyin is enabled-->
6363
<!--Bumping to it or higher needs to test and ensure this is no longer a problem-->
6464
<PackageReference Include="ToolGood.Words.Pinyin" Version="3.0.1.4" />

Flow.Launcher.Test/Plugins/ProgramTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void WhenGivenPriReferenceValueShouldReturnCorrectFormat(string packageNa
1919
var app = new UWP.Application();
2020

2121
// Act
22-
var result = app.FormattedPriReferenceValue(packageName, rawPriReferenceValue);
22+
var result = UWP.Application.FormattedPriReferenceValue(packageName, rawPriReferenceValue);
2323

2424
// Assert
2525
Assert.IsTrue(result == expectedFormat,

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
22
using System;
33
using System.Collections.Generic;
44
using System.Data.SQLite;
@@ -130,4 +130,4 @@ public static IEnumerable<T> Select<T>(this SQLiteDataReader reader, Func<SQLite
130130
}
131131
}
132132
}
133-
}
133+
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<PropertyGroup>
44
<OutputType>Library</OutputType>
55
<TargetFramework>net6.0-windows</TargetFramework>
6-
<UseWPF>true</UseWPF>
6+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
7+
<UseWPF>true</UseWPF>
78
<ProjectGuid>{9B130CC5-14FB-41FF-B310-0A95B6894C37}</ProjectGuid>
89
<AppDesignerFolder>Properties</AppDesignerFolder>
910
<RootNamespace>Flow.Launcher.Plugin.BrowserBookmark</RootNamespace>
@@ -23,7 +24,7 @@
2324
<WarningLevel>4</WarningLevel>
2425
<Prefer32Bit>false</Prefer32Bit>
2526
</PropertyGroup>
26-
27+
2728
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2829
<DebugType>pdbonly</DebugType>
2930
<Optimize>true</Optimize>
@@ -39,15 +40,6 @@
3940
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4041
</None>
4142
</ItemGroup>
42-
43-
<ItemGroup>
44-
<Content Include="x64\SQLite.Interop.dll">
45-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
46-
</Content>
47-
<Content Include="x86\SQLite.Interop.dll">
48-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
49-
</Content>
50-
</ItemGroup>
5143

5244
<ItemGroup>
5345
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
@@ -64,8 +56,8 @@
6456
</ItemGroup>
6557

6658
<ItemGroup>
67-
<PackageReference Include="System.Data.SQLite" Version="1.0.114.4" />
68-
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.114.3" />
59+
<PackageReference Include="System.Data.SQLite" Version="1.0.116" />
60+
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.116" />
6961
<PackageReference Include="UnidecodeSharp" Version="1.0.0" />
7062
</ItemGroup>
7163

Binary file not shown.
Binary file not shown.

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

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
Foreground="{DynamicResource PopupTextColor}"
1111
ResizeMode="NoResize"
1212
SizeToContent="WidthAndHeight"
13-
WindowStartupLocation="CenterScreen"
14-
mc:Ignorable="d">
13+
WindowStartupLocation="CenterScreen">
1514
<WindowChrome.WindowChrome>
1615
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
1716
</WindowChrome.WindowChrome>
@@ -20,7 +19,6 @@
2019
<RowDefinition />
2120
<RowDefinition Height="80" />
2221
</Grid.RowDefinitions>
23-
2422
<StackPanel Grid.Row="0">
2523
<StackPanel>
2624
<Grid>
@@ -54,62 +52,96 @@
5452
</Button>
5553
</Grid>
5654
</StackPanel>
57-
<StackPanel Margin="26,12,26,0">
58-
<StackPanel Margin="0,0,0,12">
55+
<StackPanel Margin="26,0,26,0">
56+
<StackPanel Grid.Row="0" Margin="0,0,0,12">
5957
<TextBlock
6058
Grid.Column="0"
6159
Margin="0,0,0,0"
6260
FontSize="20"
6361
FontWeight="SemiBold"
64-
Text="{DynamicResource flowlauncher_plugin_program_directory}"
62+
Text="{DynamicResource flowlauncher_plugin_program_edit_program_source_title}"
6563
TextAlignment="Left" />
6664
</StackPanel>
67-
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
68-
<Grid>
65+
<StackPanel>
66+
<TextBlock
67+
FontSize="14"
68+
Text="{DynamicResource flowlauncher_plugin_program_edit_program_source_tips}"
69+
TextAlignment="Left"
70+
TextWrapping="WrapWithOverflow" />
71+
</StackPanel>
72+
73+
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
74+
<Grid Width="470">
75+
<Grid.RowDefinitions>
76+
<RowDefinition />
77+
<RowDefinition />
78+
</Grid.RowDefinitions>
6979
<Grid.ColumnDefinitions>
70-
<ColumnDefinition Width="*" />
7180
<ColumnDefinition Width="Auto" />
81+
<ColumnDefinition Width="*" />
7282
</Grid.ColumnDefinitions>
73-
<TextBox
74-
Name="Directory"
83+
<TextBlock
84+
Grid.Row="0"
7585
Grid.Column="0"
76-
MinWidth="248"
77-
Margin="0,7"
78-
VerticalAlignment="Center" />
79-
<Button
86+
Margin="10"
87+
HorizontalAlignment="Left"
88+
VerticalAlignment="Center"
89+
FontSize="14"
90+
Text="{DynamicResource flowlauncher_plugin_program_directory}" />
91+
<DockPanel
92+
Grid.Row="0"
93+
Grid.Column="1"
94+
LastChildFill="True">
95+
<Button
96+
Width="70"
97+
HorizontalAlignment="Right"
98+
Click="BrowseButton_Click"
99+
DockPanel.Dock="Right"
100+
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
101+
<TextBox
102+
Name="Directory"
103+
Margin="10"
104+
VerticalAlignment="Center"
105+
HorizontalAlignment="Stretch" />
106+
</DockPanel>
107+
<TextBlock
108+
Grid.Row="1"
109+
Grid.Column="0"
110+
Margin="10"
111+
HorizontalAlignment="Left"
112+
VerticalAlignment="Center"
113+
FontSize="14"
114+
Text="{DynamicResource flowlauncher_plugin_program_enabled}" />
115+
<CheckBox x:Name="Chkbox"
116+
Grid.Row="1"
80117
Grid.Column="1"
81-
MinWidth="80"
82-
Margin="10,10,0,10"
83-
Padding="14,6,14,6"
84-
HorizontalAlignment="Right"
85-
Click="BrowseButton_Click"
86-
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
118+
Margin="10,0"
119+
VerticalAlignment="Center" />
87120
</Grid>
88121
</StackPanel>
89122
</StackPanel>
90123
</StackPanel>
91124
<Border
92125
Grid.Row="1"
126+
Margin="0,14,0,0"
93127
Background="{DynamicResource PopupButtonAreaBGColor}"
94128
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
95129
BorderThickness="0,1,0,0">
96130
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
97131
<Button
98132
x:Name="btnCancel"
99133
MinWidth="140"
100-
Margin="0,0,5,0"
134+
Margin="10,0,5,0"
101135
Click="BtnCancel_OnClick"
102136
Content="{DynamicResource cancel}" />
103-
104137
<Button
138+
x:Name="btnAdd"
105139
MinWidth="140"
106-
Margin="5,0,0,0"
107-
HorizontalAlignment="Right"
108-
Click="ButtonAdd_OnClick"
140+
Margin="5,0,10,0"
141+
Click="BtnAdd_OnClick"
109142
Content="{DynamicResource flowlauncher_plugin_program_update}"
110143
Style="{DynamicResource AccentButtonStyle}" />
111144
</StackPanel>
112145
</Border>
113146
</Grid>
114-
115-
</Window>
147+
</Window>

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

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,32 @@ namespace Flow.Launcher.Plugin.Program
99
/// <summary>
1010
/// Interaction logic for AddProgramSource.xaml
1111
/// </summary>
12-
public partial class AddProgramSource
12+
public partial class AddProgramSource : Window
1313
{
1414
private PluginInitContext _context;
15-
private Settings.ProgramSource _editing;
15+
private ProgramSource _editing;
1616
private Settings _settings;
17+
private bool update;
1718

1819
public AddProgramSource(PluginInitContext context, Settings settings)
1920
{
2021
InitializeComponent();
2122
_context = context;
2223
_settings = settings;
2324
Directory.Focus();
25+
Chkbox.IsChecked = true;
26+
update = false;
27+
btnAdd.Content = _context.API.GetTranslation("flowlauncher_plugin_program_add");
2428
}
2529

26-
public AddProgramSource(Settings.ProgramSource edit, Settings settings)
30+
public AddProgramSource(PluginInitContext context, Settings settings, ProgramSource source)
2731
{
28-
_editing = edit;
29-
_settings = settings;
30-
3132
InitializeComponent();
33+
_context = context;
34+
_editing = source;
35+
_settings = settings;
36+
update = true;
37+
Chkbox.IsChecked = _editing.Enabled;
3238
Directory.Text = _editing.Location;
3339
}
3440

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

50-
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
56+
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
5157
{
52-
string s = Directory.Text;
53-
if (!System.IO.Directory.Exists(s))
58+
string path = Directory.Text;
59+
bool modified = false;
60+
if (!System.IO.Directory.Exists(path))
5461
{
5562
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_invalid_path"));
5663
return;
5764
}
58-
if (_editing == null)
65+
if (!update)
5966
{
60-
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == Directory.Text))
67+
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.OrdinalIgnoreCase)))
6168
{
62-
var source = new ProgramSource
63-
{
64-
Location = Directory.Text,
65-
UniqueIdentifier = Directory.Text
66-
};
67-
69+
var source = new ProgramSource(path);
70+
modified = true;
6871
_settings.ProgramSources.Insert(0, source);
6972
ProgramSetting.ProgramSettingDisplayList.Add(source);
7073
}
74+
else
75+
{
76+
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_duplicate_program_source"));
77+
return;
78+
}
7179
}
7280
else
7381
{
74-
_editing.Location = Directory.Text;
82+
// Separate checks to avoid changing UniqueIdentifier of UWP
83+
if (!_editing.Location.Equals(path, System.StringComparison.OrdinalIgnoreCase))
84+
{
85+
if (ProgramSetting.ProgramSettingDisplayList
86+
.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.OrdinalIgnoreCase)))
87+
{
88+
// Check if the new location is used
89+
// No need to check win32 or uwp, just override them
90+
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_duplicate_program_source"));
91+
return;
92+
}
93+
modified = true;
94+
_editing.Location = path; // Changes UniqueIdentifier internally
95+
}
96+
if (_editing.Enabled != Chkbox.IsChecked)
97+
{
98+
modified = true;
99+
_editing.Enabled = Chkbox.IsChecked ?? true;
100+
}
75101
}
76102

77-
DialogResult = true;
103+
DialogResult = modified;
78104
Close();
79105
}
80106
}

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

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)