From 3a1d40893ee0e979bab4decc391bcd12c296e1eb Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 26 Jan 2021 20:31:55 +1100 Subject: [PATCH] rename project items to quick access link naming --- .../ContextMenu.cs | 6 +++--- .../AccessLink.cs} | 5 ++--- .../QuickAccess.cs} | 10 +++++----- .../Search/SearchManager.cs | 6 +++--- .../Flow.Launcher.Plugin.Explorer/Settings.cs | 6 +++--- .../ViewModels/SettingsViewModel.cs | 6 +++--- .../Views/ExplorerSettings.xaml.cs | 18 +++++++++--------- 7 files changed, 28 insertions(+), 29 deletions(-) rename Plugins/Flow.Launcher.Plugin.Explorer/Search/{FolderLinks/FolderLink.cs => QuickAccessLink/AccessLink.cs} (86%) rename Plugins/Flow.Launcher.Plugin.Explorer/Search/{FolderLinks/QuickFolderAccess.cs => QuickAccessLink/QuickAccess.cs} (86%) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs index b5d756d3d..ac69d9b57 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs @@ -7,7 +7,7 @@ using System.Windows; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.Explorer.Search; -using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink; using System.Linq; using MessageBox = System.Windows.Forms.MessageBox; using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; @@ -61,7 +61,7 @@ namespace Flow.Launcher.Plugin.Explorer { try { - Settings.QuickFolderAccessLinks.Add(new FolderLink { Path = record.FullPath, Type = record.Type }); + Settings.QuickFolderAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type }); Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"), string.Format( @@ -260,7 +260,7 @@ namespace Flow.Launcher.Plugin.Explorer Action = _ => { if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath)) - Settings.IndexSearchExcludedSubdirectoryPaths.Add(new FolderLink { Path = record.FullPath }); + Settings.IndexSearchExcludedSubdirectoryPaths.Add(new AccessLink { Path = record.FullPath }); Task.Run(() => { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/FolderLink.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/AccessLink.cs similarity index 86% rename from Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/FolderLink.cs rename to Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/AccessLink.cs index 02ad837d3..bc7e86700 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/FolderLink.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/AccessLink.cs @@ -1,11 +1,10 @@ using System; using System.Linq; -using System.Text.Json; using System.Text.Json.Serialization; -namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks +namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink { - public class FolderLink + public class AccessLink { public string Path { get; set; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/QuickAccess.cs similarity index 86% rename from Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs rename to Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/QuickAccess.cs index 84e036c94..b83ee8ebd 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLink/QuickAccess.cs @@ -2,18 +2,18 @@ using System.Collections.Generic; using System.Linq; -namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks +namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink { - public class QuickFolderAccess + public class QuickAccess { private readonly ResultManager resultManager; - public QuickFolderAccess(PluginInitContext context) + public QuickAccess(PluginInitContext context) { resultManager = new ResultManager(context); } - internal List FolderListMatched(Query query, List folderLinks) + internal List FolderListMatched(Query query, List folderLinks) { if (string.IsNullOrEmpty(query.Search)) return new List(); @@ -37,7 +37,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks .ToList(); } - internal List FolderListAll(Query query, List folderLinks) + internal List FolderListAll(Query query, List folderLinks) => folderLinks .Where(x => x.Type == ResultType.Folder) .Select(item => diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 14aefeb19..2bf77e95f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -1,5 +1,5 @@ using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo; -using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink; using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex; using Flow.Launcher.Plugin.SharedCommands; using System; @@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search private readonly IndexSearch indexSearch; - private readonly QuickFolderAccess quickFolderAccess; + private readonly QuickAccess quickFolderAccess; private readonly ResultManager resultManager; @@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search indexSearch = new IndexSearch(context); resultManager = new ResultManager(context); this.settings = settings; - quickFolderAccess = new QuickFolderAccess(context); + quickFolderAccess = new QuickAccess(context); } internal async Task> SearchAsync(Query query, CancellationToken token) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index e62637896..589785ce8 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -1,5 +1,5 @@ using Flow.Launcher.Plugin.Explorer.Search; -using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink; using System.Collections.Generic; namespace Flow.Launcher.Plugin.Explorer @@ -8,11 +8,11 @@ namespace Flow.Launcher.Plugin.Explorer { public int MaxResult { get; set; } = 100; - public List QuickFolderAccessLinks { get; set; } = new List(); + public List QuickFolderAccessLinks { get; set; } = new List(); public bool UseWindowsIndexForDirectorySearch { get; set; } = true; - public List IndexSearchExcludedSubdirectoryPaths { get; set; } = new List(); + public List IndexSearchExcludedSubdirectoryPaths { get; set; } = new List(); public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 21bc49741..6ce740171 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -1,7 +1,7 @@ using Flow.Launcher.Core.Plugin; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Plugin.Explorer.Search; -using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink; using System.Diagnostics; using System.Threading.Tasks; @@ -32,9 +32,9 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels storage.Save(); } - internal void RemoveFolderLinkFromQuickFolders(FolderLink selectedRow) => Settings.QuickFolderAccessLinks.Remove(selectedRow); + internal void RemoveFolderLinkFromQuickFolders(AccessLink selectedRow) => Settings.QuickFolderAccessLinks.Remove(selectedRow); - internal void RemoveFolderLinkFromExcludedIndexPaths(FolderLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow); + internal void RemoveFolderLinkFromExcludedIndexPaths(AccessLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow); internal void OpenWindowsIndexingOptions() { diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index 3b67b408d..1fa8e5920 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink; using Flow.Launcher.Plugin.Explorer.ViewModels; using System; using System.Collections.Generic; @@ -161,7 +161,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views private void btnDelete_Click(object sender, RoutedEventArgs e) { - var selectedRow = lbxFolderLinks.SelectedItem as FolderLink?? lbxExcludedPaths.SelectedItem as FolderLink; + var selectedRow = lbxFolderLinks.SelectedItem as AccessLink?? lbxExcludedPaths.SelectedItem as AccessLink; if (selectedRow != null) { @@ -199,7 +199,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views } else { - var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink; + var selectedRow = lbxFolderLinks.SelectedItem as AccessLink ?? lbxExcludedPaths.SelectedItem as AccessLink; if (selectedRow != null) { @@ -235,7 +235,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views var folderBrowserDialog = new FolderBrowserDialog(); if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { - var newFolderLink = new FolderLink + var newFolderLink = new AccessLink { Path = folderBrowserDialog.SelectedPath }; @@ -253,13 +253,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views if (files != null && files.Count() > 0) { if (expFolderLinks.IsExpanded && viewModel.Settings.QuickFolderAccessLinks == null) - viewModel.Settings.QuickFolderAccessLinks = new List(); + viewModel.Settings.QuickFolderAccessLinks = new List(); foreach (string s in files) { if (Directory.Exists(s)) { - var newFolderLink = new FolderLink + var newFolderLink = new AccessLink { Path = s }; @@ -272,13 +272,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views } } - private void AddFolderLink(FolderLink newFolderLink) + private void AddFolderLink(AccessLink newFolderLink) { if (expFolderLinks.IsExpanded && !viewModel.Settings.QuickFolderAccessLinks.Any(x => x.Path == newFolderLink.Path)) { if (viewModel.Settings.QuickFolderAccessLinks == null) - viewModel.Settings.QuickFolderAccessLinks = new List(); + viewModel.Settings.QuickFolderAccessLinks = new List(); viewModel.Settings.QuickFolderAccessLinks.Add(newFolderLink); } @@ -287,7 +287,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views && !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newFolderLink.Path)) { if (viewModel.Settings.IndexSearchExcludedSubdirectoryPaths == null) - viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List(); + viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List(); viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newFolderLink); }