rename project items to quick access link naming

This commit is contained in:
Jeremy Wu 2021-01-26 20:31:55 +11:00
parent cab7f94c6b
commit 3a1d40893e
7 changed files with 28 additions and 29 deletions

View file

@ -7,7 +7,7 @@ using System.Windows;
using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink;
using System.Linq; using System.Linq;
using MessageBox = System.Windows.Forms.MessageBox; using MessageBox = System.Windows.Forms.MessageBox;
using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
@ -61,7 +61,7 @@ namespace Flow.Launcher.Plugin.Explorer
{ {
try 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"), Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
string.Format( string.Format(
@ -260,7 +260,7 @@ namespace Flow.Launcher.Plugin.Explorer
Action = _ => Action = _ =>
{ {
if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath)) 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(() => Task.Run(() =>
{ {

View file

@ -1,11 +1,10 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization; 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; } public string Path { get; set; }

View file

@ -2,18 +2,18 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; 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; private readonly ResultManager resultManager;
public QuickFolderAccess(PluginInitContext context) public QuickAccess(PluginInitContext context)
{ {
resultManager = new ResultManager(context); resultManager = new ResultManager(context);
} }
internal List<Result> FolderListMatched(Query query, List<FolderLink> folderLinks) internal List<Result> FolderListMatched(Query query, List<AccessLink> folderLinks)
{ {
if (string.IsNullOrEmpty(query.Search)) if (string.IsNullOrEmpty(query.Search))
return new List<Result>(); return new List<Result>();
@ -37,7 +37,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
.ToList(); .ToList();
} }
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks) internal List<Result> FolderListAll(Query query, List<AccessLink> folderLinks)
=> folderLinks => folderLinks
.Where(x => x.Type == ResultType.Folder) .Where(x => x.Type == ResultType.Folder)
.Select(item => .Select(item =>

View file

@ -1,5 +1,5 @@
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo; 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.Explorer.Search.WindowsIndex;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using System; using System;
@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
private readonly IndexSearch indexSearch; private readonly IndexSearch indexSearch;
private readonly QuickFolderAccess quickFolderAccess; private readonly QuickAccess quickFolderAccess;
private readonly ResultManager resultManager; private readonly ResultManager resultManager;
@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
indexSearch = new IndexSearch(context); indexSearch = new IndexSearch(context);
resultManager = new ResultManager(context); resultManager = new ResultManager(context);
this.settings = settings; this.settings = settings;
quickFolderAccess = new QuickFolderAccess(context); quickFolderAccess = new QuickAccess(context);
} }
internal async Task<List<Result>> SearchAsync(Query query, CancellationToken token) internal async Task<List<Result>> SearchAsync(Query query, CancellationToken token)

View file

@ -1,5 +1,5 @@
using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLink;
using System.Collections.Generic; using System.Collections.Generic;
namespace Flow.Launcher.Plugin.Explorer namespace Flow.Launcher.Plugin.Explorer
@ -8,11 +8,11 @@ namespace Flow.Launcher.Plugin.Explorer
{ {
public int MaxResult { get; set; } = 100; public int MaxResult { get; set; } = 100;
public List<FolderLink> QuickFolderAccessLinks { get; set; } = new List<FolderLink>(); public List<AccessLink> QuickFolderAccessLinks { get; set; } = new List<AccessLink>();
public bool UseWindowsIndexForDirectorySearch { get; set; } = true; public bool UseWindowsIndexForDirectorySearch { get; set; } = true;
public List<FolderLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<FolderLink>(); public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>();
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;

View file

@ -1,7 +1,7 @@
using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Plugin.Explorer.Search; 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.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -32,9 +32,9 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
storage.Save(); 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() internal void OpenWindowsIndexingOptions()
{ {

View file

@ -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 Flow.Launcher.Plugin.Explorer.ViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -161,7 +161,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
private void btnDelete_Click(object sender, RoutedEventArgs e) 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) if (selectedRow != null)
{ {
@ -199,7 +199,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
} }
else else
{ {
var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink; var selectedRow = lbxFolderLinks.SelectedItem as AccessLink ?? lbxExcludedPaths.SelectedItem as AccessLink;
if (selectedRow != null) if (selectedRow != null)
{ {
@ -235,7 +235,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
var folderBrowserDialog = new FolderBrowserDialog(); var folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
var newFolderLink = new FolderLink var newFolderLink = new AccessLink
{ {
Path = folderBrowserDialog.SelectedPath Path = folderBrowserDialog.SelectedPath
}; };
@ -253,13 +253,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views
if (files != null && files.Count() > 0) if (files != null && files.Count() > 0)
{ {
if (expFolderLinks.IsExpanded && viewModel.Settings.QuickFolderAccessLinks == null) if (expFolderLinks.IsExpanded && viewModel.Settings.QuickFolderAccessLinks == null)
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>(); viewModel.Settings.QuickFolderAccessLinks = new List<AccessLink>();
foreach (string s in files) foreach (string s in files)
{ {
if (Directory.Exists(s)) if (Directory.Exists(s))
{ {
var newFolderLink = new FolderLink var newFolderLink = new AccessLink
{ {
Path = s 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 if (expFolderLinks.IsExpanded
&& !viewModel.Settings.QuickFolderAccessLinks.Any(x => x.Path == newFolderLink.Path)) && !viewModel.Settings.QuickFolderAccessLinks.Any(x => x.Path == newFolderLink.Path))
{ {
if (viewModel.Settings.QuickFolderAccessLinks == null) if (viewModel.Settings.QuickFolderAccessLinks == null)
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>(); viewModel.Settings.QuickFolderAccessLinks = new List<AccessLink>();
viewModel.Settings.QuickFolderAccessLinks.Add(newFolderLink); viewModel.Settings.QuickFolderAccessLinks.Add(newFolderLink);
} }
@ -287,7 +287,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
&& !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newFolderLink.Path)) && !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newFolderLink.Path))
{ {
if (viewModel.Settings.IndexSearchExcludedSubdirectoryPaths == null) if (viewModel.Settings.IndexSearchExcludedSubdirectoryPaths == null)
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List<FolderLink>(); viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List<AccessLink>();
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newFolderLink); viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newFolderLink);
} }