mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix per comment
This commit is contained in:
parent
889c853e33
commit
ccc677fd8f
3 changed files with 21 additions and 25 deletions
|
|
@ -63,27 +63,17 @@ namespace Flow.Launcher.Plugin.Explorer
|
||||||
SubTitle = $"Add the current {fileOrFolder} to Quick Access",
|
SubTitle = $"Add the current {fileOrFolder} to Quick Access",
|
||||||
Action = (context) =>
|
Action = (context) =>
|
||||||
{
|
{
|
||||||
try
|
Settings.QuickAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type });
|
||||||
{
|
|
||||||
Settings.QuickAccessLinks.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(
|
||||||
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
|
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
|
||||||
fileOrFolder),
|
fileOrFolder),
|
||||||
Constants.ExplorerIconImageFullPath);
|
Constants.ExplorerIconImageFullPath);
|
||||||
|
|
||||||
ViewModel.Save();
|
ViewModel.Save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
var message = "Fail to add to Quick Access";
|
|
||||||
LogException(message, e);
|
|
||||||
Context.API.ShowMsg(message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
IcoPath = Constants.QuickAccessImagePath
|
IcoPath = Constants.QuickAccessImagePath
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,10 @@ namespace Flow.Launcher.Plugin.Explorer
|
||||||
|
|
||||||
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
||||||
if (Settings.QuickFolderAccessLinks.Any())
|
if (Settings.QuickFolderAccessLinks.Any())
|
||||||
|
{
|
||||||
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
|
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
|
||||||
|
Settings.QuickFolderAccessLinks = null;
|
||||||
|
}
|
||||||
|
|
||||||
contextMenu = new ContextMenu(Context, Settings, viewModel);
|
contextMenu = new ContextMenu(Context, Settings, viewModel);
|
||||||
searchManager = new SearchManager(Settings, Context);
|
searchManager = new SearchManager(Settings, Context);
|
||||||
|
|
|
||||||
|
|
@ -21,34 +21,37 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
||||||
string search = query.Search.ToLower();
|
string search = query.Search.ToLower();
|
||||||
|
|
||||||
var queriedAccessLinks =
|
var queriedAccessLinks =
|
||||||
accessLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
accessLinks
|
||||||
|
.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.OrderBy(x => x.Type)
|
||||||
|
.ThenBy(x => x.Nickname);
|
||||||
|
|
||||||
return queriedAccessLinks
|
return queriedAccessLinks
|
||||||
.Where(x => x.Type == ResultType.Folder)
|
.Where(x => x.Type == ResultType.Folder)
|
||||||
.Select(item =>
|
.Select(item =>
|
||||||
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||||
.OrderBy(x => x.Title)
|
|
||||||
.Concat(
|
.Concat(
|
||||||
queriedAccessLinks
|
queriedAccessLinks
|
||||||
.Where(x => x.Type == ResultType.File)
|
.Where(x => x.Type == ResultType.File)
|
||||||
.Select(item =>
|
.Select(item =>
|
||||||
resultManager.CreateFileResult(item.Path, query))
|
resultManager.CreateFileResult(item.Path, query)))
|
||||||
.OrderBy(x => x.Title))
|
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal List<Result> AccessLinkListAll(Query query, List<AccessLink> accessLinks)
|
internal List<Result> AccessLinkListAll(Query query, List<AccessLink> accessLinks)
|
||||||
=> accessLinks
|
=> accessLinks
|
||||||
|
.OrderBy(x => x.Type)
|
||||||
|
.ThenBy(x => x.Nickname)
|
||||||
.Where(x => x.Type == ResultType.Folder)
|
.Where(x => x.Type == ResultType.Folder)
|
||||||
.Select(item =>
|
.Select(item =>
|
||||||
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||||
.OrderBy(x => x.Title)
|
|
||||||
.Concat(
|
.Concat(
|
||||||
accessLinks
|
accessLinks
|
||||||
|
.OrderBy(x => x.Type)
|
||||||
|
.ThenBy(x => x.Nickname)
|
||||||
.Where(x => x.Type == ResultType.File)
|
.Where(x => x.Type == ResultType.File)
|
||||||
.Select(item =>
|
.Select(item =>
|
||||||
resultManager.CreateFileResult(item.Path, query))
|
resultManager.CreateFileResult(item.Path, query)))
|
||||||
.OrderBy(x => x.Title))
|
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue