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)
|
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);
|
return new SearchManager(Settings, Context).Search(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
|
using System;
|
||||||
using Flow.Launcher.Plugin.SharedCommands;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
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)
|
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();
|
string search = query.Search.ToLower();
|
||||||
var userFolderLinks = folderLinks.Where(
|
|
||||||
x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
var queriedFolderLinks = 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 queriedFolderLinks.Select(item =>
|
||||||
return results;
|
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)
|
internal List<Result> Search(Query query)
|
||||||
{
|
{
|
||||||
|
var results = new List<Result>();
|
||||||
|
|
||||||
var querySearch = query.Search;
|
var querySearch = query.Search;
|
||||||
|
|
||||||
var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context);
|
var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context);
|
||||||
|
|
@ -37,23 +39,20 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
if (quickFolderLinks.Count > 0)
|
if (quickFolderLinks.Count > 0)
|
||||||
return quickFolderLinks;
|
return quickFolderLinks;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(query.Search))
|
||||||
|
return results;
|
||||||
|
|
||||||
if (!FilesFolders.IsLocationPathString(querySearch))
|
if (!FilesFolders.IsLocationPathString(querySearch))
|
||||||
return WindowsIndexFilesAndFoldersSearch(query, querySearch);
|
return WindowsIndexFilesAndFoldersSearch(query, querySearch);
|
||||||
|
|
||||||
var locationPath = query.Search;
|
var locationPath = query.Search;
|
||||||
|
|
||||||
if (EnvironmentVariables.IsEnvironmentVariableSearch(locationPath))
|
if (EnvironmentVariables.IsEnvironmentVariableSearch(locationPath))
|
||||||
{
|
|
||||||
return EnvironmentVariables.GetEnvironmentStringPathSuggestions(locationPath, query, context);
|
return EnvironmentVariables.GetEnvironmentStringPathSuggestions(locationPath, query, context);
|
||||||
}
|
|
||||||
|
|
||||||
// Query is a location path with a full environment variable, eg. %appdata%\somefolder\
|
// Query is a location path with a full environment variable, eg. %appdata%\somefolder\
|
||||||
if (locationPath.Substring(1).Contains("%"))
|
if (locationPath.Substring(1).Contains("%"))
|
||||||
{
|
|
||||||
locationPath = EnvironmentVariables.TranslateEnvironmentVariablePath(locationPath);
|
locationPath = EnvironmentVariables.TranslateEnvironmentVariablePath(locationPath);
|
||||||
}
|
|
||||||
|
|
||||||
var results = new List<Result>();
|
|
||||||
|
|
||||||
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
|
if (!FilesFolders.LocationExists(FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
|
||||||
return results;
|
return results;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue