Skip to content

Commit ccc677f

Browse files
committed
fix per comment
1 parent 889c853 commit ccc677f

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,17 @@ public List<Result> LoadContextMenus(Result selectedResult)
6363
SubTitle = $"Add the current {fileOrFolder} to Quick Access",
6464
Action = (context) =>
6565
{
66-
try
67-
{
68-
Settings.QuickAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type });
66+
Settings.QuickAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type });
6967

70-
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
71-
string.Format(
72-
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
73-
fileOrFolder),
74-
Constants.ExplorerIconImageFullPath);
68+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
69+
string.Format(
70+
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
71+
fileOrFolder),
72+
Constants.ExplorerIconImageFullPath);
7573

76-
ViewModel.Save();
74+
ViewModel.Save();
7775

78-
return true;
79-
}
80-
catch (Exception e)
81-
{
82-
var message = "Fail to add to Quick Access";
83-
LogException(message, e);
84-
Context.API.ShowMsg(message);
85-
return false;
86-
}
76+
return true;
8777
},
8878
IcoPath = Constants.QuickAccessImagePath
8979
});

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ public async Task InitAsync(PluginInitContext context)
3636

3737
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
3838
if (Settings.QuickFolderAccessLinks.Any())
39+
{
3940
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
41+
Settings.QuickFolderAccessLinks = null;
42+
}
4043

4144
contextMenu = new ContextMenu(Context, Settings, viewModel);
4245
searchManager = new SearchManager(Settings, Context);

Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,37 @@ internal List<Result> AccessLinkListMatched(Query query, List<AccessLink> access
2121
string search = query.Search.ToLower();
2222

2323
var queriedAccessLinks =
24-
accessLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
24+
accessLinks
25+
.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase))
26+
.OrderBy(x => x.Type)
27+
.ThenBy(x => x.Nickname);
2528

2629
return queriedAccessLinks
2730
.Where(x => x.Type == ResultType.Folder)
2831
.Select(item =>
2932
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
30-
.OrderBy(x => x.Title)
3133
.Concat(
3234
queriedAccessLinks
3335
.Where(x => x.Type == ResultType.File)
3436
.Select(item =>
35-
resultManager.CreateFileResult(item.Path, query))
36-
.OrderBy(x => x.Title))
37+
resultManager.CreateFileResult(item.Path, query)))
3738
.ToList();
3839
}
3940

4041
internal List<Result> AccessLinkListAll(Query query, List<AccessLink> accessLinks)
4142
=> accessLinks
43+
.OrderBy(x => x.Type)
44+
.ThenBy(x => x.Nickname)
4245
.Where(x => x.Type == ResultType.Folder)
4346
.Select(item =>
4447
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
45-
.OrderBy(x => x.Title)
4648
.Concat(
4749
accessLinks
50+
.OrderBy(x => x.Type)
51+
.ThenBy(x => x.Nickname)
4852
.Where(x => x.Type == ResultType.File)
4953
.Select(item =>
50-
resultManager.CreateFileResult(item.Path, query))
51-
.OrderBy(x => x.Title))
54+
resultManager.CreateFileResult(item.Path, query)))
5255
.ToList();
5356
}
5457
}

0 commit comments

Comments
 (0)