mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
output quick folder access list when no query and only hotkey is pressed
This commit is contained in:
parent
cd27cc1632
commit
e49e0ae2dc
3 changed files with 20 additions and 21 deletions
|
|
@ -37,11 +37,6 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
var results = new List<Result>();
|
||||
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return results;
|
||||
|
||||
return new SearchManager(Settings, Context).Search(query);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
||||
{
|
||||
|
|
@ -12,12 +8,21 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
|||
{
|
||||
internal List<Result> FolderList(Query query, List<FolderLink> folderLinks, PluginInitContext context)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return folderLinks
|
||||
.Select(item =>
|
||||
new ResultManager(context)
|
||||
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
|
||||
.ToList();
|
||||
|
||||
string search = query.Search.ToLower();
|
||||
var userFolderLinks = folderLinks.Where(
|
||||
x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
||||
var results = userFolderLinks.Select(item =>
|
||||
new ResultManager(context).CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query)).ToList();
|
||||
return results;
|
||||
|
||||
var queriedFolderLinks = folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return queriedFolderLinks.Select(item =>
|
||||
new ResultManager(context)
|
||||
.CreateFolderResult(item.Nickname, Constants.DefaultFolderSubtitleString, item.Path, query))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
internal List<Result> Search(Query query)
|
||||
{
|
||||
var results = new List<Result>();
|
||||
|
||||
var querySearch = query.Search;
|
||||
|
||||
var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context);
|
||||
|
|
@ -37,23 +39,20 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
if (quickFolderLinks.Count > 0)
|
||||
return quickFolderLinks;
|
||||
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return results;
|
||||
|
||||
if (!FilesFolders.IsLocationPathString(querySearch))
|
||||
return WindowsIndexFilesAndFoldersSearch(query, querySearch);
|
||||
|
||||
var locationPath = query.Search;
|
||||
|
||||
if (EnvironmentVariables.IsEnvironmentVariableSearch(locationPath))
|
||||
{
|
||||
return EnvironmentVariables.GetEnvironmentStringPathSuggestions(locationPath, query, context);
|
||||
}
|
||||
|
||||
// Query is a location path with a full environment variable, eg. %appdata%\somefolder\
|
||||
if (locationPath.Substring(1).Contains("%"))
|
||||
{
|
||||
locationPath = EnvironmentVariables.TranslateEnvironmentVariablePath(locationPath);
|
||||
}
|
||||
|
||||
var results = new List<Result>();
|
||||
|
||||
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
|
||||
return results;
|
||||
|
|
|
|||
Loading…
Reference in a new issue