From c56c343ed6c7fbfae717dc6cce7a55e8f2a952a3 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 14:51:13 +0800
Subject: [PATCH 01/10] Add Checkbox to edit program source window
1. Add Checkbox to edit program source window
2. Double click item to edit
---
.../AddProgramSource.xaml | 93 ++++++++++++++-----
.../AddProgramSource.xaml.cs | 38 ++++----
.../Views/ProgramSetting.xaml | 1 +
.../Views/ProgramSetting.xaml.cs | 19 +++-
4 files changed, 107 insertions(+), 44 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
index 9230eb06254..b1e21a3e3b0 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
@@ -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">
@@ -19,7 +19,6 @@
-
@@ -53,8 +52,8 @@
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -87,19 +132,17 @@
-
-
-
+
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
index 045d363b3fe..3442a1a22e6 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
@@ -9,27 +9,31 @@ namespace Flow.Launcher.Plugin.Program
///
/// Interaction logic for AddProgramSource.xaml
///
- public partial class AddProgramSource
+ public partial class AddProgramSource : Window
{
private PluginInitContext _context;
- private Settings.ProgramSource _editing;
+ private Settings.ProgramSource _updating;
private Settings _settings;
+ private bool update;
public AddProgramSource(PluginInitContext context, Settings settings)
{
InitializeComponent();
_context = context;
_settings = settings;
- Directory.Focus();
+ tbDirectory.Focus();
+ Chkbox.IsChecked = true;
+ update = false;
}
- public AddProgramSource(Settings.ProgramSource edit, Settings settings)
+ public AddProgramSource(Settings.ProgramSource source, Settings settings)
{
- _editing = edit;
+ _updating = source;
_settings = settings;
-
+ update = true;
InitializeComponent();
- Directory.Text = _editing.Location;
+ Chkbox.IsChecked = _updating.Enabled;
+ tbDirectory.Text = _updating.Location;
}
private void BrowseButton_Click(object sender, RoutedEventArgs e)
@@ -38,7 +42,7 @@ private void BrowseButton_Click(object sender, RoutedEventArgs e)
DialogResult result = dialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
- Directory.Text = dialog.SelectedPath;
+ tbDirectory.Text = dialog.SelectedPath;
}
}
@@ -47,22 +51,23 @@ 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 = tbDirectory.Text;
+ 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 == path))
{
var source = new ProgramSource
{
- Location = Directory.Text,
- UniqueIdentifier = Directory.Text
+ Location = path,
+ UniqueIdentifier = path,
+ Enabled = Chkbox.IsChecked ?? true
};
_settings.ProgramSources.Insert(0, source);
@@ -71,7 +76,8 @@ private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
}
else
{
- _editing.Location = Directory.Text;
+ _updating.Location = path;
+ _updating.Enabled = Chkbox.IsChecked ?? true;
}
DialogResult = true;
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
index f078794654b..fa2d4551f3e 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
@@ -116,6 +116,7 @@
Drop="programSourceView_Drop"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
+ MouseDoubleClick="ProgramSourceView_MouseDoubleClick"
SelectionMode="Extended">
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index 1a31e8c2833..dcfdd118559 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -352,12 +352,25 @@ private void Row_OnClick(object sender, RoutedEventArgs e)
if (IsSelectedRowStatusEnabledMoreOrEqualThanDisabled(selectedItems))
{
- btnProgramSourceStatus.Content = "Disable";
+ btnProgramSourceStatus.Content = "Disable"; // todo
}
else
{
btnProgramSourceStatus.Content = "Enable";
}
}
+
+ private void ProgramSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ var selectedProgramSource = programSourceView.SelectedItem as Settings.ProgramSource;
+ if (selectedProgramSource != null)
+ {
+ var add = new AddProgramSource(selectedProgramSource, _settings);
+ if (add.ShowDialog() ?? false)
+ {
+ ReIndexing();
+ }
+ }
+ }
}
-}
\ No newline at end of file
+}
From 6bb3b39e371715aa63041946be1539ff46fc7dbc Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 14:51:24 +0800
Subject: [PATCH 02/10] Merge remote-tracking branch 'upstream/dev' into
ProgramPluginUI
From 3196dc559ab74b2979e439fbd40cec3af8e2d1cb Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 15:10:16 +0800
Subject: [PATCH 03/10] Update text
---
Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml | 4 ++--
Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
index b1e21a3e3b0..a286eb48547 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
@@ -59,13 +59,13 @@
Margin="0,0,0,0"
FontSize="20"
FontWeight="SemiBold"
- Text="{DynamicResource flowlauncher_plugin_program_directory}"
+ Text="{DynamicResource flowlauncher_plugin_program_edit_program_source}"
TextAlignment="Left" />
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
index 8d8cae02c9f..101f75bc917 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
@@ -34,6 +34,9 @@
Please select a program source
Are you sure you want to delete the selected program sources?
+ Edit Program Source
+ Edit directory and status of this program source.
+
OK
Flow Launcher will only index files that end with the following suffixes. (Each suffix should split by ';' )
Successfully updated file suffixes
From dcec3611de87e4845ab6ec32be220b7aff6960df Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 19:28:12 +0800
Subject: [PATCH 04/10] Fix button text issue
---
.../AddProgramSource.xaml | 2 +-
.../AddProgramSource.xaml.cs | 3 +-
.../Languages/en.xaml | 4 +-
.../Flow.Launcher.Plugin.Program/Settings.cs | 11 ++++++
.../Views/ProgramSetting.xaml | 3 +-
.../Views/ProgramSetting.xaml.cs | 39 ++++++++-----------
6 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
index a286eb48547..af62a8f6427 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
@@ -59,7 +59,7 @@
Margin="0,0,0,0"
FontSize="20"
FontWeight="SemiBold"
- Text="{DynamicResource flowlauncher_plugin_program_edit_program_source}"
+ Text="{DynamicResource flowlauncher_plugin_program_edit_program_source_title}"
TextAlignment="Left" />
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
index 3442a1a22e6..49e066754b2 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
@@ -24,14 +24,15 @@ public AddProgramSource(PluginInitContext context, Settings settings)
tbDirectory.Focus();
Chkbox.IsChecked = true;
update = false;
+ btnAdd.Content = _context.API.GetTranslation("flowlauncher_plugin_program_add");
}
public AddProgramSource(Settings.ProgramSource source, Settings settings)
{
+ InitializeComponent();
_updating = source;
_settings = settings;
update = true;
- InitializeComponent();
Chkbox.IsChecked = _updating.Enabled;
tbDirectory.Text = _updating.Location;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
index 101f75bc917..0da7e83b32d 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml
@@ -34,10 +34,10 @@
Please select a program source
Are you sure you want to delete the selected program sources?
- Edit Program Source
+ Program Source
Edit directory and status of this program source.
- OK
+ Update
Flow Launcher will only index files that end with the following suffixes. (Each suffix should split by ';' )
Successfully updated file suffixes
File suffixes can't be empty
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index d97ddd9932a..3fd6a22061a 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Windows.Input;
namespace Flow.Launcher.Plugin.Program
{
@@ -41,6 +42,16 @@ public class ProgramSource
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public bool Enabled { get; set; } = true;
public string UniqueIdentifier { get; set; }
+
+ public override bool Equals(object obj)
+ {
+ return obj is ProgramSource other && other.UniqueIdentifier.ToLower() == this.UniqueIdentifier.ToLower();
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(UniqueIdentifier.ToLower());
+ }
}
public class DisabledProgramSource : ProgramSource { }
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
index fa2d4551f3e..b3c17be28cf 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
@@ -116,7 +116,8 @@
Drop="programSourceView_Drop"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
- MouseDoubleClick="ProgramSourceView_MouseDoubleClick"
+ MouseDoubleClick="programSourceView_MouseDoubleClick"
+ SelectionChanged="programSourceView_SelectionChanged"
SelectionMode="Extended">
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index dcfdd118559..79082da567b 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -235,18 +235,14 @@ private void btnProgramSourceStatus_OnClick(object sender, RoutedEventArgs e)
.SelectedItems.Cast()
.ToList();
- if (selectedItems.Count() == 0)
+ if (selectedItems.Count == 0)
{
string msg = context.API.GetTranslation("flowlauncher_plugin_program_pls_select_program_source");
MessageBox.Show(msg);
return;
}
- if (selectedItems
- .Where(t1 => !_settings
- .ProgramSources
- .Any(x => t1.UniqueIdentifier == x.UniqueIdentifier))
- .Count() == 0)
+ if (IsAllItemsUserAdded(selectedItems))
{
var msg = string.Format(context.API.GetTranslation("flowlauncher_plugin_program_delete_program_source"));
@@ -257,7 +253,7 @@ private void btnProgramSourceStatus_OnClick(object sender, RoutedEventArgs e)
DeleteProgramSources(selectedItems);
}
- else if (IsSelectedRowStatusEnabledMoreOrEqualThanDisabled(selectedItems))
+ else if (HasMoreOrEqualEnabledItems(selectedItems))
{
ProgramSettingDisplayList.SetProgramSourcesStatus(selectedItems, false);
@@ -329,42 +325,36 @@ private void Sort(string sortBy, ListSortDirection direction)
dataView.Refresh();
}
- private bool IsSelectedRowStatusEnabledMoreOrEqualThanDisabled(List selectedItems)
+ private static bool HasMoreOrEqualEnabledItems(List items)
{
- return selectedItems.Where(x => x.Enabled).Count() >= selectedItems.Where(x => !x.Enabled).Count();
+ return items.Where(x => x.Enabled).Count() >= items.Count / 2;
}
- private void Row_OnClick(object sender, RoutedEventArgs e)
+ private void programSourceView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selectedItems = programSourceView
.SelectedItems.Cast()
.ToList();
- if (selectedItems
- .Where(t1 => !_settings
- .ProgramSources
- .Any(x => t1.UniqueIdentifier == x.UniqueIdentifier))
- .Count() == 0)
+ if (IsAllItemsUserAdded(selectedItems))
{
btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_delete");
- return;
}
-
- if (IsSelectedRowStatusEnabledMoreOrEqualThanDisabled(selectedItems))
+ else if (HasMoreOrEqualEnabledItems(selectedItems))
{
- btnProgramSourceStatus.Content = "Disable"; // todo
+ btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_disable");
}
else
{
- btnProgramSourceStatus.Content = "Enable";
+ btnProgramSourceStatus.Content = context.API.GetTranslation("flowlauncher_plugin_program_enable");
}
}
- private void ProgramSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ private void programSourceView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var selectedProgramSource = programSourceView.SelectedItem as Settings.ProgramSource;
if (selectedProgramSource != null)
- {
+ {
var add = new AddProgramSource(selectedProgramSource, _settings);
if (add.ShowDialog() ?? false)
{
@@ -372,5 +362,10 @@ private void ProgramSourceView_MouseDoubleClick(object sender, MouseButtonEventA
}
}
}
+
+ private bool IsAllItemsUserAdded(List items)
+ {
+ return items.All(x => _settings.ProgramSources.Any(y => y == x));
+ }
}
}
From 569f69a2708b602c849eb7bdf568c2666ef6d924 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 20:07:43 +0800
Subject: [PATCH 05/10] bugfix
---
.../Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
index 79082da567b..b1ced189ec2 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs
@@ -365,7 +365,7 @@ private void programSourceView_MouseDoubleClick(object sender, MouseButtonEventA
private bool IsAllItemsUserAdded(List items)
{
- return items.All(x => _settings.ProgramSources.Any(y => y == x));
+ return items.All(x => _settings.ProgramSources.Any(y => y.UniqueIdentifier == x.UniqueIdentifier));
}
}
}
From bcd2b8d658da3fc0040b5c0e8abf24bc994bd963 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 20:25:43 +0800
Subject: [PATCH 06/10] bugfix
---
Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml | 3 +--
Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml | 1 +
Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml | 2 +-
.../Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs | 1 +
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
index af62a8f6427..f349a3a38a5 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
@@ -94,7 +94,6 @@
LastChildFill="True">
+ Text="{DynamicResource flowlauncher_plugin_program_enabled}" />
Add
Name
Enable
+ Enabled
Disable
Location
All Programs
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
index b3c17be28cf..171f6081bab 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml
@@ -128,7 +128,7 @@
-
+
_settings.HideAppsPath;
From fac76af685c2bb865f208a1abad39c5f89652fa2 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 21:30:55 +0800
Subject: [PATCH 07/10] Reindex when disable program from results
---
Plugins/Flow.Launcher.Plugin.Program/Main.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
index f0a53ed7758..ed7cc627f38 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
@@ -196,12 +196,17 @@ private void DisableProgram(IProgram programToDelete)
return;
if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
+ {
_uwps.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.Enabled = false;
-
- if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
+ Task.Run(IndexUwpPrograms);
+ }
+ else if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
+ {
_win32s.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.Enabled = false;
+ Task.Run(IndexWin32Programs);
+ }
_settings.DisabledProgramSources
.Add(
@@ -213,6 +218,7 @@ private void DisableProgram(IProgram programToDelete)
Enabled = false
}
);
+ _settings.LastIndexTime = DateTime.Today;
}
public static void StartProcess(Func runProcess, ProcessStartInfo info)
From 58ad92b812992d9db12a7cf7351ff58afa4f05ca Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 18 Oct 2022 21:46:28 +0800
Subject: [PATCH 08/10] Revert changes in Settings.cs
---
Plugins/Flow.Launcher.Plugin.Program/Settings.cs | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
index 3fd6a22061a..d61ecd2a3f9 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Windows.Input;
namespace Flow.Launcher.Plugin.Program
{
@@ -10,7 +9,7 @@ public class Settings
public DateTime LastIndexTime { get; set; }
public List ProgramSources { get; set; } = new List();
public List DisabledProgramSources { get; set; } = new List();
- public string[] ProgramSuffixes { get; set; } = {"appref-ms", "exe", "lnk"};
+ public string[] ProgramSuffixes { get; set; } = { "appref-ms", "exe", "lnk" };
public bool EnableStartMenuSource { get; set; } = true;
@@ -42,16 +41,6 @@ public class ProgramSource
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public bool Enabled { get; set; } = true;
public string UniqueIdentifier { get; set; }
-
- public override bool Equals(object obj)
- {
- return obj is ProgramSource other && other.UniqueIdentifier.ToLower() == this.UniqueIdentifier.ToLower();
- }
-
- public override int GetHashCode()
- {
- return HashCode.Combine(UniqueIdentifier.ToLower());
- }
}
public class DisabledProgramSource : ProgramSource { }
From d7d863547c1b103b4f91ae4ba399305bde16cc3b Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Mon, 24 Oct 2022 23:31:02 +0800
Subject: [PATCH 09/10] comment
---
Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
index 49e066754b2..8b934528e3e 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
@@ -78,7 +78,7 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
else
{
_updating.Location = path;
- _updating.Enabled = Chkbox.IsChecked ?? true;
+ _updating.Enabled = Chkbox.IsChecked ?? true; // Fixme, need to add to disabled source if not custom source
}
DialogResult = true;
From cd6c4ddb5e7a5702a05b97d83f8cd3d65444ad3e Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Mon, 24 Oct 2022 23:31:53 +0800
Subject: [PATCH 10/10] revert rename
---
.../Flow.Launcher.Plugin.Program/AddProgramSource.xaml | 2 +-
.../Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
index f349a3a38a5..39d5f8a4e19 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
@@ -99,7 +99,7 @@
DockPanel.Dock="Right"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
diff --git a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
index 8b934528e3e..e5ea2eda267 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs
@@ -21,7 +21,7 @@ public AddProgramSource(PluginInitContext context, Settings settings)
InitializeComponent();
_context = context;
_settings = settings;
- tbDirectory.Focus();
+ Directory.Focus();
Chkbox.IsChecked = true;
update = false;
btnAdd.Content = _context.API.GetTranslation("flowlauncher_plugin_program_add");
@@ -34,7 +34,7 @@ public AddProgramSource(Settings.ProgramSource source, Settings settings)
_settings = settings;
update = true;
Chkbox.IsChecked = _updating.Enabled;
- tbDirectory.Text = _updating.Location;
+ Directory.Text = _updating.Location;
}
private void BrowseButton_Click(object sender, RoutedEventArgs e)
@@ -43,7 +43,7 @@ private void BrowseButton_Click(object sender, RoutedEventArgs e)
DialogResult result = dialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
- tbDirectory.Text = dialog.SelectedPath;
+ Directory.Text = dialog.SelectedPath;
}
}
@@ -54,7 +54,7 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
{
- string path = tbDirectory.Text;
+ string path = Directory.Text;
if (!System.IO.Directory.Exists(path))
{
System.Windows.MessageBox.Show(_context.API.GetTranslation("flowlauncher_plugin_program_invalid_path"));