Merge branch 'AcronymFuzzy' of github.com:taooceros/Flow.Launcher into AcronymFuzzy

This commit is contained in:
弘韬 张 2021-01-29 18:09:21 +08:00
commit efdfd064ed
27 changed files with 259 additions and 146 deletions

View file

@ -5,7 +5,6 @@ using System.Linq;
using System.Text; using System.Text;
using JetBrains.Annotations; using JetBrains.Annotations;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Microsoft.AspNetCore.Localization;
using ToolGood.Words.Pinyin; using ToolGood.Words.Pinyin;
namespace Flow.Launcher.Infrastructure namespace Flow.Launcher.Infrastructure
@ -46,7 +45,6 @@ namespace Flow.Launcher.Infrastructure
int count = 0; int count = 0;
// Corner case handle // Corner case handle
if (translatedIndex < translatedIndexs[0]) if (translatedIndex < translatedIndexs[0])
return translatedIndex; return translatedIndex;
@ -114,7 +112,6 @@ namespace Flow.Launcher.Infrastructure
private ConcurrentDictionary<string, (string translation, TranslationMapping map)> _pinyinCache = private ConcurrentDictionary<string, (string translation, TranslationMapping map)> _pinyinCache =
new ConcurrentDictionary<string, (string translation, TranslationMapping map)>(); new ConcurrentDictionary<string, (string translation, TranslationMapping map)>();
private Settings _settings; private Settings _settings;
public void Initialize([NotNull] Settings settings) public void Initialize([NotNull] Settings settings)

View file

@ -60,18 +60,17 @@ namespace Flow.Launcher.Infrastructure
return new MatchResult(false, UserSettingSearchPrecision); return new MatchResult(false, UserSettingSearchPrecision);
query = query.Trim(); query = query.Trim();
TranslationMapping map; TranslationMapping translationMapping;
(stringToCompare, map) = _alphabet?.Translate(stringToCompare) ?? (stringToCompare, null); (stringToCompare, translationMapping) = _alphabet?.Translate(stringToCompare) ?? (stringToCompare, null);
var currentAcronymQueryIndex = 0; var currentAcronymQueryIndex = 0;
var acronymMatchData = new List<int>(); var acronymMatchData = new List<int>();
var queryWithoutCase = opt.IgnoreCase ? query.ToLower() : query;
// preset acronymScore // preset acronymScore
int acronymScore = 100; int acronymScore = 100;
var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare; var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
var queryWithoutCase = opt.IgnoreCase ? query.ToLower() : query;
var querySubstrings = queryWithoutCase.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries); var querySubstrings = queryWithoutCase.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
int currentQuerySubstringIndex = 0; int currentQuerySubstringIndex = 0;
@ -90,21 +89,16 @@ namespace Flow.Launcher.Infrastructure
bool spaceMet = false; bool spaceMet = false;
for (var compareStringIndex = 0; for (var compareStringIndex = 0; compareStringIndex < fullStringToCompareWithoutCase.Length; compareStringIndex++)
compareStringIndex < fullStringToCompareWithoutCase.Length;
compareStringIndex++)
{ {
if (currentAcronymQueryIndex >= queryWithoutCase.Length if (currentAcronymQueryIndex >= queryWithoutCase.Length
|| allQuerySubstringsMatched && acronymScore < (int) UserSettingSearchPrecision) || allQuerySubstringsMatched && acronymScore < (int) UserSettingSearchPrecision)
break; break;
// To maintain a list of indices which correspond to spaces in the string to compare // To maintain a list of indices which correspond to spaces in the string to compare
// To populate the list only for the first query substring // To populate the list only for the first query substring
if (fullStringToCompareWithoutCase[compareStringIndex] == ' ' && currentQuerySubstringIndex == 0) if (fullStringToCompareWithoutCase[compareStringIndex] == ' ' && currentQuerySubstringIndex == 0)
{
spaceIndices.Add(compareStringIndex); spaceIndices.Add(compareStringIndex);
}
// Acronym check // Acronym check
if (char.IsUpper(stringToCompare[compareStringIndex]) || if (char.IsUpper(stringToCompare[compareStringIndex]) ||
@ -153,7 +147,6 @@ namespace Flow.Launcher.Infrastructure
continue; continue;
} }
if (firstMatchIndex < 0) if (firstMatchIndex < 0)
{ {
// first matched char will become the start of the compared string // first matched char will become the start of the compared string
@ -214,7 +207,7 @@ namespace Flow.Launcher.Infrastructure
// return acronym Match if possible // return acronym Match if possible
if (acronymMatchData.Count == query.Length && acronymScore >= (int) UserSettingSearchPrecision) if (acronymMatchData.Count == query.Length && acronymScore >= (int) UserSettingSearchPrecision)
{ {
acronymMatchData = acronymMatchData.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList(); acronymMatchData = acronymMatchData.Select(x => translationMapping?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
return new MatchResult(true, UserSettingSearchPrecision, acronymMatchData, acronymScore); return new MatchResult(true, UserSettingSearchPrecision, acronymMatchData, acronymScore);
} }
@ -225,7 +218,7 @@ namespace Flow.Launcher.Infrastructure
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1, var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1,
lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString); lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString);
var resultList = indexList.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList(); var resultList = indexList.Select(x => translationMapping?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
return new MatchResult(true, UserSettingSearchPrecision, resultList, score); return new MatchResult(true, UserSettingSearchPrecision, resultList, score);
} }
@ -328,4 +321,4 @@ namespace Flow.Launcher.Infrastructure
{ {
public bool IgnoreCase { get; set; } = true; public bool IgnoreCase { get; set; } = true;
} }
} }

View file

@ -41,7 +41,7 @@ namespace Flow.Launcher.Test
Enum.GetValues(typeof(SearchPrecisionScore)) Enum.GetValues(typeof(SearchPrecisionScore))
.Cast<SearchPrecisionScore>() .Cast<SearchPrecisionScore>()
.ToList() .ToList()
.ForEach(x => listToReturn.Add((int) x)); .ForEach(x => listToReturn.Add((int)x));
return listToReturn; return listToReturn;
} }
@ -183,7 +183,7 @@ namespace Flow.Launcher.Test
$"Query:{queryString}{Environment.NewLine} " + $"Query:{queryString}{Environment.NewLine} " +
$"Compare:{compareString}{Environment.NewLine}" + $"Compare:{compareString}{Environment.NewLine}" +
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" + $"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
$"Precision Score: {(int) expectedPrecisionScore}"); $"Precision Score: {(int)expectedPrecisionScore}");
} }
[TestCase("exce", "OverLeaf-Latex: An online LaTeX editor", SearchPrecisionScore.Regular, false)] [TestCase("exce", "OverLeaf-Latex: An online LaTeX editor", SearchPrecisionScore.Regular, false)]
@ -241,7 +241,7 @@ namespace Flow.Launcher.Test
$"Query:{queryString}{Environment.NewLine} " + $"Query:{queryString}{Environment.NewLine} " +
$"Compare:{compareString}{Environment.NewLine}" + $"Compare:{compareString}{Environment.NewLine}" +
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" + $"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
$"Precision Score: {(int) expectedPrecisionScore}"); $"Precision Score: {(int)expectedPrecisionScore}");
} }
[TestCase("man", "Task Manager", "eManual")] [TestCase("man", "Task Manager", "eManual")]
@ -309,7 +309,6 @@ namespace Flow.Launcher.Test
[TestCase("vsp","Visual Studio Preview",100)] [TestCase("vsp","Visual Studio Preview",100)]
[TestCase("vsp","Visual Studio",0)] [TestCase("vsp","Visual Studio",0)]
[TestCase("pc","Postman Canary",100)] [TestCase("pc","Postman Canary",100)]
public void WhenGivenAnAcronymQuery_ShouldReturnAcronymScore(string queryString, string compareString, public void WhenGivenAnAcronymQuery_ShouldReturnAcronymScore(string queryString, string compareString,
int desiredScore) int desiredScore)
{ {
@ -322,4 +321,4 @@ namespace Flow.Launcher.Test
Desired Score: {desiredScore}"); Desired Score: {desiredScore}");
} }
} }
} }

View file

@ -17,6 +17,7 @@
<!--Setting General--> <!--Setting General-->
<system:String x:Key="flowlauncher_settings">Nastavenia Flow Launchera</system:String> <system:String x:Key="flowlauncher_settings">Nastavenia Flow Launchera</system:String>
<system:String x:Key="general">Všeobecné</system:String> <system:String x:Key="general">Všeobecné</system:String>
<system:String x:Key="portableMode">Prenosný režim</system:String>
<system:String x:Key="startFlowLauncherOnSystemStartup">Spustiť Flow Launcher po štarte systému</system:String> <system:String x:Key="startFlowLauncherOnSystemStartup">Spustiť Flow Launcher po štarte systému</system:String>
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Schovať Flow Launcher po strate fokusu</system:String> <system:String x:Key="hideFlowLauncherWhenLoseFocus">Schovať Flow Launcher po strate fokusu</system:String>
<system:String x:Key="dontPromptUpdateMsg">Nezobrazovať upozornenia na novú verziu</system:String> <system:String x:Key="dontPromptUpdateMsg">Nezobrazovať upozornenia na novú verziu</system:String>
@ -39,10 +40,13 @@
<!--Setting Plugin--> <!--Setting Plugin-->
<system:String x:Key="plugin">Plugin</system:String> <system:String x:Key="plugin">Plugin</system:String>
<system:String x:Key="browserMorePlugins">Nájsť ďalšie pluginy</system:String> <system:String x:Key="browserMorePlugins">Nájsť ďalšie pluginy</system:String>
<system:String x:Key="enable">Povoliť</system:String>
<system:String x:Key="disable">Zakázať</system:String> <system:String x:Key="disable">Zakázať</system:String>
<system:String x:Key="actionKeywords">Skratka akcie</system:String> <system:String x:Key="actionKeywords">Skratka akcie</system:String>
<system:String x:Key="currentActionKeywords">Aktuálna akcia skratky:</system:String> <system:String x:Key="currentActionKeywords">Aktuálna akcia skratky:</system:String>
<system:String x:Key="newActionKeyword">Nová akcia skratky:</system:String> <system:String x:Key="newActionKeyword">Nová akcia skratky:</system:String>
<system:String x:Key="currentPriority">Aktuálna priorita:</system:String>
<system:String x:Key="newPriority">Nová priorita:</system:String>
<system:String x:Key="pluginDirectory">Priečinok s pluginmi</system:String> <system:String x:Key="pluginDirectory">Priečinok s pluginmi</system:String>
<system:String x:Key="author">Autor</system:String> <system:String x:Key="author">Autor</system:String>
<system:String x:Key="plugin_init_time">Príprava:</system:String> <system:String x:Key="plugin_init_time">Príprava:</system:String>
@ -104,6 +108,10 @@
</system:String> </system:String>
<system:String x:Key="releaseNotes">Poznámky k vydaniu</system:String> <system:String x:Key="releaseNotes">Poznámky k vydaniu</system:String>
<!--Priority Setting Dialog-->
<system:String x:Key="priority_tips">Vyššie číslo znamená, že výsledok bude vyššie. Skúste nastaviť napr. 5. Ak chcete, aby boli výsledky nižšie ako ktorékoľvek iné doplnky, zadajte záporné číslo</system:String>
<system:String x:Key="invalidPriority">Prosím, zadajte platné číslo pre prioritu!</system:String>
<!--Action Keyword Setting Dialog--> <!--Action Keyword Setting Dialog-->
<system:String x:Key="oldActionKeywords">Stará skratka akcie</system:String> <system:String x:Key="oldActionKeywords">Stará skratka akcie</system:String>
<system:String x:Key="newActionKeywords">Nová skratka akcie</system:String> <system:String x:Key="newActionKeywords">Nová skratka akcie</system:String>
@ -116,6 +124,7 @@
<system:String x:Key="actionkeyword_tips">Použite * ak nechcete určiť skratku pre akciu</system:String> <system:String x:Key="actionkeyword_tips">Použite * ak nechcete určiť skratku pre akciu</system:String>
<!--Custom Query Hotkey Dialog--> <!--Custom Query Hotkey Dialog-->
<system:String x:Key="customeQueryHotkeyTitle">Vlastná klávesová skratka pre plugin</system:String>
<system:String x:Key="preview">Náhľad</system:String> <system:String x:Key="preview">Náhľad</system:String>
<system:String x:Key="hotkeyIsNotUnavailable">Klávesová skratka je nedostupná, prosím, zadajte novú</system:String> <system:String x:Key="hotkeyIsNotUnavailable">Klávesová skratka je nedostupná, prosím, zadajte novú</system:String>
<system:String x:Key="invalidPluginHotkey">Neplatná klávesová skratka pluginu</system:String> <system:String x:Key="invalidPluginHotkey">Neplatná klávesová skratka pluginu</system:String>
@ -140,11 +149,23 @@
<system:String x:Key="reportWindow_report_failed">Odoslanie hlásenia zlyhalo</system:String> <system:String x:Key="reportWindow_report_failed">Odoslanie hlásenia zlyhalo</system:String>
<system:String x:Key="reportWindow_flowlauncher_got_an_error">Flow Launcher zaznamenal chybu</system:String> <system:String x:Key="reportWindow_flowlauncher_got_an_error">Flow Launcher zaznamenal chybu</system:String>
<!--General Notice-->
<system:String x:Key="pleaseWait">Čakajte, prosím…</system:String>
<!--update--> <!--update-->
<system:String x:Key="update_flowlauncher_update_new_version_available">Je dostupná nová verzia Flow Launcher {0}</system:String> <system:String x:Key="update_flowlauncher_update_check">Kontrolujú sa akutalizácie</system:String>
<system:String x:Key="update_flowlauncher_already_on_latest">Už máte najnovšiu verizu Flow Launchera</system:String>
<system:String x:Key="update_flowlauncher_update_found">Bola nájdená aktualizácia</system:String>
<system:String x:Key="update_flowlauncher_updating">Aktualizuje sa…</system:String>
<system:String x:Key="update_flowlauncher_fail_moving_portable_user_profile_data">Flow Launcher nedokázal presunúť používateľské údaje do aktualizovanej verzie.
Prosím, presuňte profilový priečinok „data“ z {0} do {1}</system:String>
<system:String x:Key="update_flowlauncher_new_update">Nová aktualizácia</system:String>
<system:String x:Key="update_flowlauncher_update_new_version_available">Je dostupná nová verzia Flow Launchera {0}</system:String>
<system:String x:Key="update_flowlauncher_update_error">Počas inštalácie aktualizácií došlo k chybe</system:String> <system:String x:Key="update_flowlauncher_update_error">Počas inštalácie aktualizácií došlo k chybe</system:String>
<system:String x:Key="update_flowlauncher_update">Aktualizovať</system:String> <system:String x:Key="update_flowlauncher_update">Aktualizovať</system:String>
<system:String x:Key="update_flowlauncher_update_cancel">Zrušiť</system:String> <system:String x:Key="update_flowlauncher_update_cancel">Zrušiť</system:String>
<system:String x:Key="update_flowlauncher_fail">Aktualizácia zlyhala</system:String>
<system:String x:Key="update_flowlauncher_check_connection">Skontrolujte pripojenie a skúste aktualizovať nastavenia servera proxy na github-cloud.s3.amazonaws.com.</system:String>
<system:String x:Key="update_flowlauncher_update_restart_flowlauncher_tip">Tento upgrade reštartuje Flow Launcher</system:String> <system:String x:Key="update_flowlauncher_update_restart_flowlauncher_tip">Tento upgrade reštartuje Flow Launcher</system:String>
<system:String x:Key="update_flowlauncher_update_upadte_files">Nasledujúce súbory budú aktualizované</system:String> <system:String x:Key="update_flowlauncher_update_upadte_files">Nasledujúce súbory budú aktualizované</system:String>
<system:String x:Key="update_flowlauncher_update_files">Aktualizovať súbory</system:String> <system:String x:Key="update_flowlauncher_update_files">Aktualizovať súbory</system:String>

View file

@ -19,7 +19,6 @@ using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage; using Flow.Launcher.Storage;
using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Logger;
using System.Threading.Tasks.Dataflow;
namespace Flow.Launcher.ViewModel namespace Flow.Launcher.ViewModel
{ {

View file

@ -7,12 +7,13 @@ 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.QuickAccessLinks;
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;
using MessageBoxButton = System.Windows.Forms.MessageBoxButtons; using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
using DialogResult = System.Windows.Forms.DialogResult; using DialogResult = System.Windows.Forms.DialogResult;
using Flow.Launcher.Plugin.Explorer.ViewModels;
namespace Flow.Launcher.Plugin.Explorer namespace Flow.Launcher.Plugin.Explorer
{ {
@ -22,10 +23,13 @@ namespace Flow.Launcher.Plugin.Explorer
private Settings Settings { get; set; } private Settings Settings { get; set; }
public ContextMenu(PluginInitContext context, Settings settings) private SettingsViewModel ViewModel { get; set; }
public ContextMenu(PluginInitContext context, Settings settings, SettingsViewModel vm)
{ {
Context = context; Context = context;
Settings = settings; Settings = settings;
ViewModel = vm;
} }
public List<Result> LoadContextMenus(Result selectedResult) public List<Result> LoadContextMenus(Result selectedResult)
@ -50,6 +54,58 @@ namespace Flow.Launcher.Plugin.Explorer
var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath; var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath;
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder"; var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
if (!Settings.QuickAccessLinks.Any(x => x.Path == record.FullPath))
{
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"), fileOrFolder),
Action = (context) =>
{
Settings.QuickAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type });
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
string.Format(
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
fileOrFolder),
Constants.ExplorerIconImageFullPath);
ViewModel.Save();
return true;
},
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
IcoPath = Constants.QuickAccessImagePath
});
}
else
{
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_title"),
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"), fileOrFolder),
Action = (context) =>
{
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => x.Path == record.FullPath));
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
string.Format(
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
fileOrFolder),
Constants.ExplorerIconImageFullPath);
ViewModel.Save();
return true;
},
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
IcoPath = Constants.RemoveQuickAccessImagePath
});
}
contextMenus.Add(new Result contextMenus.Add(new Result
{ {
Title = Context.API.GetTranslation("plugin_explorer_copypath"), Title = Context.API.GetTranslation("plugin_explorer_copypath"),
@ -228,7 +284,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(() =>
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -16,7 +16,7 @@
<system:String x:Key="plugin_explorer_edit">Edit</system:String> <system:String x:Key="plugin_explorer_edit">Edit</system:String>
<system:String x:Key="plugin_explorer_add">Add</system:String> <system:String x:Key="plugin_explorer_add">Add</system:String>
<system:String x:Key="plugin_explorer_manageactionkeywords_header">Customise Action Keywords</system:String> <system:String x:Key="plugin_explorer_manageactionkeywords_header">Customise Action Keywords</system:String>
<system:String x:Key="plugin_explorer_quickfolderaccess_header">Quick Folder Access Paths</system:String> <system:String x:Key="plugin_explorer_quickaccesslinks_header">Quick Access Links</system:String>
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String> <system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String> <system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_search">Search Activation:</system:String> <system:String x:Key="plugin_explorer_actionkeywordview_search">Search Activation:</system:String>
@ -42,5 +42,15 @@
<system:String x:Key="plugin_explorer_openindexingoptions">Open Windows Indexing Options</system:String> <system:String x:Key="plugin_explorer_openindexingoptions">Open Windows Indexing Options</system:String>
<system:String x:Key="plugin_explorer_openindexingoptions_subtitle">Manage indexed files and folders</system:String> <system:String x:Key="plugin_explorer_openindexingoptions_subtitle">Manage indexed files and folders</system:String>
<system:String x:Key="plugin_explorer_openindexingoptions_errormsg">Failed to open Windows Indexing Options</system:String> <system:String x:Key="plugin_explorer_openindexingoptions_errormsg">Failed to open Windows Indexing Options</system:String>
<system:String x:Key="plugin_explorer_add_to_quickaccess_title">Add to Quick Access</system:String>
<system:String x:Key="plugin_explorer_add_to_quickaccess_subtitle">Add the current {0} to Quick Access</system:String>
<system:String x:Key="plugin_explorer_addfilefoldersuccess">Successfully Added</system:String>
<system:String x:Key="plugin_explorer_addfilefoldersuccess_detail">Successfully added to Quick Access</system:String>
<system:String x:Key="plugin_explorer_removefilefoldersuccess">Successfully Removed</system:String>
<system:String x:Key="plugin_explorer_removefilefoldersuccess_detail">Successfully removed from Quick Access</system:String>
<system:String x:Key="plugin_explorer_contextmenu_titletooltip">Add to Quick Access so it can be opened with Explorer's Search Activation action keyword</system:String>
<system:String x:Key="plugin_explorer_contextmenu_remove_titletooltip">Remove from Quick Access</system:String>
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove the current {0} from Quick Access</system:String>
</ResourceDictionary> </ResourceDictionary>

View file

@ -1,8 +1,10 @@
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.QuickAccessLinks;
using Flow.Launcher.Plugin.Explorer.ViewModels; using Flow.Launcher.Plugin.Explorer.ViewModels;
using Flow.Launcher.Plugin.Explorer.Views; using Flow.Launcher.Plugin.Explorer.Views;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Controls; using System.Windows.Controls;
@ -32,7 +34,15 @@ namespace Flow.Launcher.Plugin.Explorer
viewModel = new SettingsViewModel(context); viewModel = new SettingsViewModel(context);
await viewModel.LoadStorage(); await viewModel.LoadStorage();
Settings = viewModel.Settings; Settings = viewModel.Settings;
contextMenu = new ContextMenu(Context, Settings);
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
if (Settings.QuickFolderAccessLinks.Any())
{
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
Settings.QuickFolderAccessLinks = new List<AccessLink>();
}
contextMenu = new ContextMenu(Context, Settings, viewModel);
searchManager = new SearchManager(Settings, Context); searchManager = new SearchManager(Settings, Context);
} }

View file

@ -15,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal const string ExplorerIconImagePath = "Images\\explorer.png"; internal const string ExplorerIconImagePath = "Images\\explorer.png";
internal const string DifferentUserIconImagePath = "Images\\user.png"; internal const string DifferentUserIconImagePath = "Images\\user.png";
internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png"; internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png";
internal const string QuickAccessImagePath = "Images\\quickaccess.png";
internal const string RemoveQuickAccessImagePath = "Images\\removequickaccess.png";
internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory"; internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory";

View file

@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
{
public class QuickFolderAccess
{
private readonly ResultManager resultManager;
public QuickFolderAccess(PluginInitContext context)
{
resultManager = new ResultManager(context);
}
internal List<Result> FolderListMatched(Query query, List<FolderLink> folderLinks)
{
if (string.IsNullOrEmpty(query.Search))
return new List<Result>();
string search = query.Search.ToLower();
var queriedFolderLinks =
folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
return queriedFolderLinks.Select(item =>
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.ToList();
}
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks)
=> folderLinks
.Select(item => resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.ToList();
}
}

View file

@ -1,14 +1,15 @@
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.QuickAccessLinks
{ {
public class FolderLink public class AccessLink
{ {
public string Path { get; set; } public string Path { get; set; }
public ResultType Type { get; set; } = ResultType.Folder;
[JsonIgnore] [JsonIgnore]
public string Nickname public string Nickname
{ {

View file

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
{
public class QuickAccess
{
private readonly ResultManager resultManager;
public QuickAccess(PluginInitContext context)
{
resultManager = new ResultManager(context);
}
internal List<Result> AccessLinkListMatched(Query query, List<AccessLink> accessLinks)
{
if (string.IsNullOrEmpty(query.Search))
return new List<Result>();
string search = query.Search.ToLower();
var queriedAccessLinks =
accessLinks
.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase))
.OrderBy(x => x.Type)
.ThenBy(x => x.Nickname);
return queriedAccessLinks.Select(l => l.Type switch
{
ResultType.Folder => resultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
ResultType.File => resultManager.CreateFileResult(l.Path, query),
_ => throw new ArgumentOutOfRangeException()
}).ToList();
}
internal List<Result> AccessLinkListAll(Query query, List<AccessLink> accessLinks)
=> accessLinks
.OrderBy(x => x.Type)
.ThenBy(x => x.Nickname)
.Select(l => l.Type switch
{
ResultType.Folder => resultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
ResultType.File => resultManager.CreateFileResult(l.Path, query),
_ => throw new ArgumentOutOfRangeException()
}).ToList();
}
}

View file

@ -140,7 +140,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
public bool ShowIndexState { get; set; } public bool ShowIndexState { get; set; }
} }
internal enum ResultType public enum ResultType
{ {
Volume, Volume,
Folder, Folder,

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.QuickAccessLinks;
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 quickAccess;
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); quickAccess = new QuickAccess(context);
} }
internal async Task<List<Result>> SearchAsync(Query query, CancellationToken token) internal async Task<List<Result>> SearchAsync(Query query, CancellationToken token)
@ -42,12 +42,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
// This allows the user to type the assigned action keyword and only see the list of quick folder links // This allows the user to type the assigned action keyword and only see the list of quick folder links
if (string.IsNullOrEmpty(query.Search)) if (string.IsNullOrEmpty(query.Search))
return quickFolderAccess.FolderListAll(query, settings.QuickFolderAccessLinks); return quickAccess.AccessLinkListAll(query, settings.QuickAccessLinks);
var quickFolderLinks = quickFolderAccess.FolderListMatched(query, settings.QuickFolderAccessLinks); var quickaccessLinks = quickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
if (quickFolderLinks.Count > 0) if (quickaccessLinks.Count > 0)
results.AddRange(quickFolderLinks); results.AddRange(quickaccessLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch); var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);

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.QuickAccessLinks;
using System.Collections.Generic; using System.Collections.Generic;
namespace Flow.Launcher.Plugin.Explorer namespace Flow.Launcher.Plugin.Explorer
@ -8,11 +8,14 @@ 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> QuickAccessLinks { get; set; } = new List<AccessLink>();
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
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.QuickAccessLinks;
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 RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);
internal void RemoveFolderLinkFromExcludedIndexPaths(FolderLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow); internal void RemoveAccessLinkFromExcludedIndexPaths(AccessLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
internal void OpenWindowsIndexingOptions() internal void OpenWindowsIndexingOptions()
{ {

View file

@ -7,7 +7,7 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources> <UserControl.Resources>
<DataTemplate x:Key="ListViewTemplateFolderLinks"> <DataTemplate x:Key="ListViewTemplateAccessLinks">
<TextBlock <TextBlock
Text="{Binding Nickname, Mode=OneTime}" Text="{Binding Nickname, Mode=OneTime}"
Margin="0,5,0,5" /> Margin="0,5,0,5" />
@ -40,22 +40,22 @@
<ListView x:Name="lbxActionKeywords" <ListView x:Name="lbxActionKeywords"
ItemTemplate="{StaticResource ListViewActionKeywords}"/> ItemTemplate="{StaticResource ListViewActionKeywords}"/>
</Expander> </Expander>
<Expander Name="expFolderLinks" Header="{DynamicResource plugin_explorer_quickfolderaccess_header}" <Expander Name="expAccessLinks" Header="{DynamicResource plugin_explorer_quickaccesslinks_header}"
Expanded="expFolderLinks_Click" Collapsed="expFolderLinks_Collapsed" Expanded="expAccessLinks_Click" Collapsed="expAccessLinks_Collapsed"
Margin="0 10 0 0"> Margin="0 10 0 0">
<ListView <ListView
x:Name="lbxFolderLinks" AllowDrop="True" x:Name="lbxAccessLinks" AllowDrop="True"
Drop="lbxFolders_Drop" Drop="lbxAccessLinks_Drop"
DragEnter="lbxFolders_DragEnter" DragEnter="lbxAccessLinks_DragEnter"
ItemTemplate="{StaticResource ListViewTemplateFolderLinks}"/> ItemTemplate="{StaticResource ListViewTemplateAccessLinks}"/>
</Expander> </Expander>
<Expander x:Name="expExcludedPaths" Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}" <Expander x:Name="expExcludedPaths" Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}"
Expanded="expExcludedPaths_Click" Expanded="expExcludedPaths_Click"
Margin="0 10 0 0"> Margin="0 10 0 0">
<ListView <ListView
x:Name="lbxExcludedPaths" AllowDrop="True" x:Name="lbxExcludedPaths" AllowDrop="True"
Drop="lbxFolders_Drop" Drop="lbxAccessLinks_Drop"
DragEnter="lbxFolders_DragEnter" DragEnter="lbxAccessLinks_DragEnter"
ItemTemplate="{StaticResource ListViewTemplateExcludedPaths}"/> ItemTemplate="{StaticResource ListViewTemplateExcludedPaths}"/>
</Expander> </Expander>
</StackPanel> </StackPanel>

View file

@ -1,4 +1,4 @@
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using Flow.Launcher.Plugin.Explorer.ViewModels; using Flow.Launcher.Plugin.Explorer.ViewModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
this.viewModel = viewModel; this.viewModel = viewModel;
lbxFolderLinks.ItemsSource = this.viewModel.Settings.QuickFolderAccessLinks; lbxAccessLinks.ItemsSource = this.viewModel.Settings.QuickAccessLinks;
lbxExcludedPaths.ItemsSource = this.viewModel.Settings.IndexSearchExcludedSubdirectoryPaths; lbxExcludedPaths.ItemsSource = this.viewModel.Settings.IndexSearchExcludedSubdirectoryPaths;
@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public void RefreshView() public void RefreshView()
{ {
lbxFolderLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending)); lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending)); lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
btnEdit.Visibility = Visibility.Hidden; btnEdit.Visibility = Visibility.Hidden;
btnAdd.Visibility = Visibility.Hidden; btnAdd.Visibility = Visibility.Hidden;
if (expFolderLinks.IsExpanded || expExcludedPaths.IsExpanded || expActionKeywords.IsExpanded) if (expAccessLinks.IsExpanded || expExcludedPaths.IsExpanded || expActionKeywords.IsExpanded)
{ {
if (!expActionKeywords.IsExpanded) if (!expActionKeywords.IsExpanded)
btnAdd.Visibility = Visibility.Visible; btnAdd.Visibility = Visibility.Visible;
@ -71,7 +71,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
&& btnEdit.Visibility == Visibility.Hidden) && btnEdit.Visibility == Visibility.Hidden)
btnEdit.Visibility = Visibility.Visible; btnEdit.Visibility = Visibility.Visible;
if ((lbxFolderLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0) if ((lbxAccessLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0)
&& btnDelete.Visibility == Visibility.Visible && btnDelete.Visibility == Visibility.Visible
&& btnEdit.Visibility == Visibility.Visible) && btnEdit.Visibility == Visibility.Visible)
{ {
@ -79,8 +79,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
btnEdit.Visibility = Visibility.Hidden; btnEdit.Visibility = Visibility.Hidden;
} }
if (expFolderLinks.IsExpanded if (expAccessLinks.IsExpanded
&& lbxFolderLinks.Items.Count > 0 && lbxAccessLinks.Items.Count > 0
&& btnDelete.Visibility == Visibility.Hidden && btnDelete.Visibility == Visibility.Hidden
&& btnEdit.Visibility == Visibility.Hidden) && btnEdit.Visibility == Visibility.Hidden)
{ {
@ -98,7 +98,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
} }
} }
lbxFolderLinks.Items.Refresh(); lbxAccessLinks.Items.Refresh();
lbxExcludedPaths.Items.Refresh(); lbxExcludedPaths.Items.Refresh();
@ -113,8 +113,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
if (expExcludedPaths.IsExpanded) if (expExcludedPaths.IsExpanded)
expExcludedPaths.IsExpanded = false; expExcludedPaths.IsExpanded = false;
if (expFolderLinks.IsExpanded) if (expAccessLinks.IsExpanded)
expFolderLinks.IsExpanded = false; expAccessLinks.IsExpanded = false;
RefreshView(); RefreshView();
} }
@ -125,10 +125,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
expActionKeywords.Height = Double.NaN; expActionKeywords.Height = Double.NaN;
} }
private void expFolderLinks_Click(object sender, RoutedEventArgs e) private void expAccessLinks_Click(object sender, RoutedEventArgs e)
{ {
if (expFolderLinks.IsExpanded) if (expAccessLinks.IsExpanded)
expFolderLinks.Height = 215; expAccessLinks.Height = 215;
if (expExcludedPaths.IsExpanded) if (expExcludedPaths.IsExpanded)
expExcludedPaths.IsExpanded = false; expExcludedPaths.IsExpanded = false;
@ -139,19 +139,19 @@ namespace Flow.Launcher.Plugin.Explorer.Views
RefreshView(); RefreshView();
} }
private void expFolderLinks_Collapsed(object sender, RoutedEventArgs e) private void expAccessLinks_Collapsed(object sender, RoutedEventArgs e)
{ {
if (!expFolderLinks.IsExpanded) if (!expAccessLinks.IsExpanded)
expFolderLinks.Height = Double.NaN; expAccessLinks.Height = Double.NaN;
} }
private void expExcludedPaths_Click(object sender, RoutedEventArgs e) private void expExcludedPaths_Click(object sender, RoutedEventArgs e)
{ {
if (expExcludedPaths.IsExpanded) if (expExcludedPaths.IsExpanded)
expFolderLinks.Height = Double.NaN; expAccessLinks.Height = Double.NaN;
if (expFolderLinks.IsExpanded) if (expAccessLinks.IsExpanded)
expFolderLinks.IsExpanded = false; expAccessLinks.IsExpanded = false;
if (expActionKeywords.IsExpanded) if (expActionKeywords.IsExpanded)
expActionKeywords.IsExpanded = false; expActionKeywords.IsExpanded = false;
@ -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 = lbxAccessLinks.SelectedItem as AccessLink?? lbxExcludedPaths.SelectedItem as AccessLink;
if (selectedRow != null) if (selectedRow != null)
{ {
@ -169,11 +169,11 @@ namespace Flow.Launcher.Plugin.Explorer.Views
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes) if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{ {
if (expFolderLinks.IsExpanded) if (expAccessLinks.IsExpanded)
viewModel.RemoveFolderLinkFromQuickFolders(selectedRow); viewModel.RemoveLinkFromQuickAccess(selectedRow);
if (expExcludedPaths.IsExpanded) if (expExcludedPaths.IsExpanded)
viewModel.RemoveFolderLinkFromExcludedIndexPaths(selectedRow); viewModel.RemoveAccessLinkFromExcludedIndexPaths(selectedRow);
RefreshView(); RefreshView();
} }
@ -199,7 +199,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
} }
else else
{ {
var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink; var selectedRow = lbxAccessLinks.SelectedItem as AccessLink ?? lbxExcludedPaths.SelectedItem as AccessLink;
if (selectedRow != null) if (selectedRow != null)
{ {
@ -207,9 +207,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views
folderBrowserDialog.SelectedPath = selectedRow.Path; folderBrowserDialog.SelectedPath = selectedRow.Path;
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{ {
if (expFolderLinks.IsExpanded) if (expAccessLinks.IsExpanded)
{ {
var link = viewModel.Settings.QuickFolderAccessLinks.First(x => x.Path == selectedRow.Path); var link = viewModel.Settings.QuickAccessLinks.First(x => x.Path == selectedRow.Path);
link.Path = folderBrowserDialog.SelectedPath; link.Path = folderBrowserDialog.SelectedPath;
} }
@ -235,36 +235,36 @@ 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 newAccessLink = new AccessLink
{ {
Path = folderBrowserDialog.SelectedPath Path = folderBrowserDialog.SelectedPath
}; };
AddFolderLink(newFolderLink); AddAccessLink(newAccessLink);
} }
RefreshView(); RefreshView();
} }
private void lbxFolders_Drop(object sender, DragEventArgs e) private void lbxAccessLinks_Drop(object sender, DragEventArgs e)
{ {
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files != null && files.Count() > 0) if (files != null && files.Count() > 0)
{ {
if (expFolderLinks.IsExpanded && viewModel.Settings.QuickFolderAccessLinks == null) if (expAccessLinks.IsExpanded && viewModel.Settings.QuickAccessLinks == null)
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>(); viewModel.Settings.QuickAccessLinks = 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
}; };
AddFolderLink(newFolderLink); AddAccessLink(newFolderLink);
} }
RefreshView(); RefreshView();
@ -272,28 +272,28 @@ namespace Flow.Launcher.Plugin.Explorer.Views
} }
} }
private void AddFolderLink(FolderLink newFolderLink) private void AddAccessLink(AccessLink newAccessLink)
{ {
if (expFolderLinks.IsExpanded if (expAccessLinks.IsExpanded
&& !viewModel.Settings.QuickFolderAccessLinks.Any(x => x.Path == newFolderLink.Path)) && !viewModel.Settings.QuickAccessLinks.Any(x => x.Path == newAccessLink.Path))
{ {
if (viewModel.Settings.QuickFolderAccessLinks == null) if (viewModel.Settings.QuickAccessLinks == null)
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>(); viewModel.Settings.QuickAccessLinks = new List<AccessLink>();
viewModel.Settings.QuickFolderAccessLinks.Add(newFolderLink); viewModel.Settings.QuickAccessLinks.Add(newAccessLink);
} }
if (expExcludedPaths.IsExpanded if (expExcludedPaths.IsExpanded
&& !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newFolderLink.Path)) && !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newAccessLink.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(newAccessLink);
} }
} }
private void lbxFolders_DragEnter(object sender, DragEventArgs e) private void lbxAccessLinks_DragEnter(object sender, DragEventArgs e)
{ {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) if (e.Data.GetDataPresent(DataFormats.FileDrop))
{ {

View file

@ -7,7 +7,7 @@
"Name": "Explorer", "Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
"Author": "Jeremy Wu", "Author": "Jeremy Wu",
"Version": "1.5.0", "Version": "1.6.0",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

View file

@ -54,10 +54,10 @@
<Content Include="Images\*.png"> <Content Include="Images\*.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Page Include="ShellSetting.xaml"> <Page Include="ShellSetting.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -48,10 +48,10 @@
<Content Include="Images\*.png"> <Content Include="Images\*.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Page Include="SysSettings.xaml"> <Page Include="SysSettings.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,6 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"> xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_url_open_search_in">Otvoriť vyhľadávanie v:</system:String>
<system:String x:Key="flowlauncher_plugin_new_window">Nové okno</system:String>
<system:String x:Key="flowlauncher_plugin_new_tab">Nová karta</system:String>
<system:String x:Key="flowlauncher_plugin_url_open_url">Otvoriť url:{0}</system:String> <system:String x:Key="flowlauncher_plugin_url_open_url">Otvoriť url:{0}</system:String>
<system:String x:Key="flowlauncher_plugin_url_canot_open_url">Adresa URL sa nedá otvoriť: {0}</system:String> <system:String x:Key="flowlauncher_plugin_url_canot_open_url">Adresa URL sa nedá otvoriť: {0}</system:String>

View file

@ -4,7 +4,7 @@
"Name": "URL", "Name": "URL",
"Description": "Open the typed URL from Flow Launcher", "Description": "Open the typed URL from Flow Launcher",
"Author": "qianlifeng", "Author": "qianlifeng",
"Version": "1.1.3", "Version": "1.1.4",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Url.dll", "ExecuteFileName": "Flow.Launcher.Plugin.Url.dll",

View file

@ -1,7 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib"> xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_websearch_open_search_in">Otvoriť vyhľadávanie v:</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_new_window">Nové okno</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_new_tab">Nová karta</system:String>
<system:String x:Key="flowlaucnher_plugin_websearch_set_browser_path">Zadajte cestu k prehliadaču:</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_choose">Vybrať</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_delete">Odstrániť</system:String> <system:String x:Key="flowlauncher_plugin_websearch_delete">Odstrániť</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_edit">Upraviť</system:String> <system:String x:Key="flowlauncher_plugin_websearch_edit">Upraviť</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_add">Pridať</system:String> <system:String x:Key="flowlauncher_plugin_websearch_add">Pridať</system:String>

View file

@ -25,7 +25,7 @@
"Name": "Web Searches", "Name": "Web Searches",
"Description": "Provide the web search ability", "Description": "Provide the web search ability",
"Author": "qianlifeng", "Author": "qianlifeng",
"Version": "1.3.1", "Version": "1.3.2",
"Language": "csharp", "Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher", "Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll", "ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",