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.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(() =>
{

View file

@ -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; }

View file

@ -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<Result> FolderListMatched(Query query, List<FolderLink> folderLinks)
internal List<Result> FolderListMatched(Query query, List<AccessLink> folderLinks)
{
if (string.IsNullOrEmpty(query.Search))
return new List<Result>();
@ -37,7 +37,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
.ToList();
}
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks)
internal List<Result> FolderListAll(Query query, List<AccessLink> folderLinks)
=> folderLinks
.Where(x => x.Type == ResultType.Folder)
.Select(item =>

View file

@ -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<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.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<FolderLink> QuickFolderAccessLinks { get; set; } = new List<FolderLink>();
public List<AccessLink> QuickFolderAccessLinks { get; set; } = new List<AccessLink>();
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;

View file

@ -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()
{

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 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<FolderLink>();
viewModel.Settings.QuickFolderAccessLinks = new List<AccessLink>();
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<FolderLink>();
viewModel.Settings.QuickFolderAccessLinks = new List<AccessLink>();
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<FolderLink>();
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List<AccessLink>();
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newFolderLink);
}