diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index ef55a4088..cc6b58e42 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -6,7 +6,7 @@
Please make a selection first
Please select a folder path.
- Please choose a different name or folder path.
+ Please choose a different name or folder path.
Please select a folder link
Are you sure you want to delete {0}?
Are you sure you want to permanently delete this file?
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
index 6237deabb..d6effb4e2 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
@@ -9,6 +9,7 @@ using System.Linq;
using System.Windows;
using System.Windows.Forms;
using CommunityToolkit.Mvvm.Input;
+using Flow.Launcher.Plugin.Explorer.Helper;
using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.Everything;
using Flow.Launcher.Plugin.Explorer.Search.Everything.Exceptions;
@@ -352,7 +353,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
collection.Remove(SelectedIndexSearchExcludedPath);
collection.Add(new AccessLink
{
- Path = path, Type = selectedType,
+ Path = path, Type = selectedType, Name = path.GetPathName()
});
}
@@ -368,10 +369,12 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
var newAccessLink = new AccessLink
{
+ Name = folderBrowserDialog.SelectedPath.GetPathName(),
Path = folderBrowserDialog.SelectedPath
};
container.Add(newAccessLink);
+ Save();
}
[RelayCommand]
@@ -382,16 +385,15 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
ShowUnselectedMessage();
return;
}
-
var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks,SelectedQuickAccessLink);
- quickAccessLinkSettings.ShowDialog();
+ if (quickAccessLinkSettings.ShowDialog() == true) Save();
}
[RelayCommand]
private void AddQuickAccessLink(object commandParameter)
{
var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks);
- quickAccessLinkSettings.ShowDialog();
+ if (quickAccessLinkSettings.ShowDialog() == true) Save();
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
index 28cd68bad..388fc2c91 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
@@ -52,9 +52,9 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
}
private bool IsEdit { get; set; }
- [CanBeNull] private AccessLink SelectedAccessLink { get; set; }
+ [CanBeNull] private AccessLink SelectedAccessLink { get; }
- public ObservableCollection QuickAccessLinks { get; set; }
+ public ObservableCollection QuickAccessLinks { get; }
public QuickAccessLinkSettings(ObservableCollection quickAccessLinks)
{
@@ -89,10 +89,12 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
Main.Context.API.ShowMsgBox(warning);
return;
}
-
- if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName))
+
+ if (QuickAccessLinks.Any(x =>
+ x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase) &&
+ x.Name.Equals(SelectedName, StringComparison.OrdinalIgnoreCase)))
{
- var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder");
+ var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_path_already_exists");
Main.Context.API.ShowMsgBox(warning);
return;
}
@@ -103,7 +105,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
}
var newAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath };
QuickAccessLinks.Add(newAccessLink);
- DialogResult = false;
+ DialogResult = true;
Close();
}
@@ -121,14 +123,13 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
{
if (SelectedAccessLink == null)throw new ArgumentException("Access Link object is null");
- var obj = QuickAccessLinks.FirstOrDefault(x => x.GetHashCode() == SelectedAccessLink.GetHashCode());
- int index = QuickAccessLinks.IndexOf(obj);
+ var index = QuickAccessLinks.IndexOf(SelectedAccessLink);
if (index >= 0)
{
- SelectedAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath };
- QuickAccessLinks[index] = SelectedAccessLink;
+ var updatedLink = new AccessLink { Name = SelectedName, Path = SelectedPath };
+ QuickAccessLinks[index] = updatedLink;
}
- DialogResult = false;
+ DialogResult = true;
IsEdit = false;
Close();
}