Skip to content

Enhancement: Rename Quick Access Links #3586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5bae202
Columns - Path and Name
01Dri May 25, 2025
59d5cd6
AccessLink Refactor
01Dri May 25, 2025
179babe
New window to add/edit quick access link
01Dri May 25, 2025
3777e2b
Changing QuickAccessLinks property to static
01Dri May 25, 2025
61aca74
Separating add commands between QuickAccessLink and IndexSearchExclud…
01Dri May 25, 2025
74167a9
Strings translations and warning box
01Dri May 25, 2025
3b42541
Edit access link
01Dri May 25, 2025
4b15add
Code quality
01Dri May 25, 2025
287f3f8
Settings
01Dri May 25, 2025
a6a544a
Translations
01Dri May 25, 2025
fdeec11
FixLegacyQuickAccessLinkNames
01Dri May 25, 2025
589e37a
Action QuickAccessLinks
01Dri May 25, 2025
bc2648c
Code quality
01Dri May 25, 2025
cd62e7b
uP
01Dri May 25, 2025
29831d6
AI Review Refactor suggestion
01Dri May 25, 2025
65eb648
Merge branch 'dev' into rename-quick-access-links
01Dri May 27, 2025
6693cb1
Revert changes in ExplorerSettings.xaml
Jack251970 Jun 7, 2025
37cab1b
Merge branch 'dev' into rename-quick-access-links
Jack251970 Jun 7, 2025
29b7462
Add setting ui
Jack251970 Jun 7, 2025
4218b63
Add size changed event
Jack251970 Jun 7, 2025
fd2952b
Improve code quality
Jack251970 Jun 7, 2025
d429304
Improve code quality
Jack251970 Jun 7, 2025
ab1fe67
Remove command parameter
Jack251970 Jun 7, 2025
fdb0cf5
Fix null check
Jack251970 Jun 7, 2025
74d6016
Revert to original style
Jack251970 Jun 7, 2025
c19e9ad
Fix format
Jack251970 Jun 7, 2025
16371af
Mark static
Jack251970 Jun 7, 2025
201d373
Add blank line
Jack251970 Jun 7, 2025
9d3d3c8
Save when editing
Jack251970 Jun 7, 2025
ae9a755
Explictly add isEdit
Jack251970 Jun 7, 2025
bdbd1e7
Remove blank lines
Jack251970 Jun 7, 2025
6d206c5
Adjust columns
Jack251970 Jun 7, 2025
a6b6076
Set IsEdit get only & Add type & Improve code quality
Jack251970 Jun 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
SubTitle = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"),

Check warning on line 73 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`quickaccess` is not a recognized word. (unrecognized-spelling)
Action = (context) =>
{
Settings.QuickAccessLinks.Add(new AccessLink
{
Path = record.FullPath, Type = record.Type
Name = record.FullPath.GetPathName(),
Path = record.FullPath,
Type = record.Type
});

Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),

Check warning on line 84 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`addfilefoldersuccess` is not a recognized word. (unrecognized-spelling)
Constants.ExplorerIconImageFullPath);

ViewModel.Save();
Expand All @@ -87,7 +89,7 @@
return true;
},
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),

Check warning on line 92 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`titletooltip` is not a recognized word. (unrecognized-spelling)

Check warning on line 92 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`contextmenu` is not a recognized word. (unrecognized-spelling)
IcoPath = Constants.QuickAccessImagePath,
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue718"),
});
Expand All @@ -96,22 +98,22 @@
{
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_title"),

Check warning on line 101 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`quickaccess` is not a recognized word. (unrecognized-spelling)
SubTitle = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"),

Check warning on line 102 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`quickaccess` is not a recognized word. (unrecognized-spelling)
Action = (context) =>
{
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)));

Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),

Check warning on line 108 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`removefilefoldersuccess` is not a recognized word. (unrecognized-spelling)
Constants.ExplorerIconImageFullPath);

ViewModel.Save();

return true;
},
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),

Check warning on line 115 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`titletooltip` is not a recognized word. (unrecognized-spelling)

Check warning on line 115 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`contextmenu` is not a recognized word. (unrecognized-spelling)
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),

Check warning on line 116 in Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`contextmenu` is not a recognized word. (unrecognized-spelling)
IcoPath = Constants.RemoveQuickAccessImagePath,
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uecc9")
});
Expand Down
21 changes: 21 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.IO;
using System.Linq;
using Flow.Launcher.Plugin.Explorer.Search;

namespace Flow.Launcher.Plugin.Explorer.Helper;

public static class PathHelper
{
public static string GetPathName(this string selectedPath)
{
if (string.IsNullOrEmpty(selectedPath)) return string.Empty;
var path = selectedPath.EndsWith(Constants.DirectorySeparator) ? selectedPath[0..^1] : selectedPath;

if (path.EndsWith(':'))
return path[0..^1] + " Drive";

return path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();
}
}
4 changes: 4 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

<!-- Dialogues -->
<system:String x:Key="plugin_explorer_make_selection_warning">Please make a selection first</system:String>
<system:String x:Key="plugin_explorer_quick_access_link_no_folder_selected">Please select a folder path.</system:String>
<system:String x:Key="plugin_explorer_quick_access_link_path_already_exists">Please choose a different name or folder path.</system:String>
<system:String x:Key="plugin_explorer_select_folder_link_warning">Please select a folder link</system:String>
<system:String x:Key="plugin_explorer_delete_folder_link">Are you sure you want to delete {0}?</system:String>
<system:String x:Key="plugin_explorer_deletefileconfirm">Are you sure you want to permanently delete this file?</system:String>
Expand All @@ -27,6 +29,7 @@
<system:String x:Key="plugin_explorer_add">Add</system:String>
<system:String x:Key="plugin_explorer_generalsetting_header">General Setting</system:String>
<system:String x:Key="plugin_explorer_manageactionkeywords_header">Customise Action Keywords</system:String>
<system:String x:Key="plugin_explorer_manage_quick_access_links_header">Customise Quick Access</system:String>
<system:String x:Key="plugin_explorer_quickaccesslinks_header">Quick Access Links</system:String>
<system:String x:Key="plugin_explorer_everything_setting_header">Everything Setting</system:String>
<system:String x:Key="plugin_explorer_previewpanel_setting_header">Preview Panel</system:String>
Expand Down Expand Up @@ -92,6 +95,7 @@
<system:String x:Key="plugin_explorer_deletefile_subtitle">Permanently delete current file</system:String>
<system:String x:Key="plugin_explorer_deletefolder_subtitle">Permanently delete current folder</system:String>
<system:String x:Key="plugin_explorer_path">Path:</system:String>
<system:String x:Key="plugin_explorer_name">Name:</system:String>
<system:String x:Key="plugin_explorer_deletefilefolder_subtitle">Delete the selected</system:String>
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
Expand Down
13 changes: 13 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public Task InitAsync(PluginInitContext context)
Context = context;

Settings = context.API.LoadSettingJsonStorage<Settings>();
FillQuickAccessLinkNames();

viewModel = new SettingsViewModel(context, Settings);

Expand Down Expand Up @@ -95,5 +96,17 @@ public string GetTranslatedPluginDescription()
{
return Context.API.GetTranslation("plugin_explorer_plugin_description");
}

private void FillQuickAccessLinkNames()
{
// Legacy version does not have names for quick access links, so we fill them with the path name.
foreach (var link in Settings.QuickAccessLinks)
{
if (string.IsNullOrWhiteSpace(link.Name))
{
link.Name = link.Path.GetPathName();
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
using System;
using System.Linq;
using System.Text.Json.Serialization;

namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
{
public class AccessLink
{
public string Path { get; set; }

public ResultType Type { get; set; } = ResultType.Folder;

[JsonIgnore]
public string Name
{
get
{
var path = Path.EndsWith(Constants.DirectorySeparator) ? Path[0..^1] : Path;

if (path.EndsWith(':'))
return path[0..^1] + " Drive";

return path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None)
.Last();
}
}
public string Name { get; set; }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows;
using System.Windows.Forms;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Plugin.Explorer.Helper;
using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.Everything;
using Flow.Launcher.Plugin.Explorer.Search.Everything.Exceptions;
Expand Down Expand Up @@ -328,14 +329,10 @@ public void AppendLink(string containerName, AccessLink link)
}

[RelayCommand]
private void EditLink(object commandParameter)
private void EditIndexSearchExcludePaths()
{
var (selectedLink, collection) = commandParameter switch
{
"QuickAccessLink" => (SelectedQuickAccessLink, Settings.QuickAccessLinks),
"IndexSearchExcludedPaths" => (SelectedIndexSearchExcludedPath, Settings.IndexSearchExcludedSubdirectoryPaths),
_ => throw new ArgumentOutOfRangeException(nameof(commandParameter))
};
var selectedLink = SelectedIndexSearchExcludedPath;
var collection = Settings.IndexSearchExcludedSubdirectoryPaths;

if (selectedLink is null)
{
Expand All @@ -354,45 +351,66 @@ private void EditLink(object commandParameter)
collection.Remove(selectedLink);
collection.Add(new AccessLink
{
Path = path, Type = selectedLink.Type,
Path = path, Type = selectedLink.Type, Name = path.GetPathName()
});
}

private void ShowUnselectedMessage()
{
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
Context.API.ShowMsgBox(warning);
Save();
}

[RelayCommand]
private void AddLink(object commandParameter)
private void AddIndexSearchExcludePaths()
{
var container = commandParameter switch
{
"QuickAccessLink" => Settings.QuickAccessLinks,
"IndexSearchExcludedPaths" => Settings.IndexSearchExcludedSubdirectoryPaths,
_ => throw new ArgumentOutOfRangeException(nameof(commandParameter))
};

ArgumentNullException.ThrowIfNull(container);
var container = Settings.IndexSearchExcludedSubdirectoryPaths;

if (container is null) return;

var folderBrowserDialog = new FolderBrowserDialog();

if (folderBrowserDialog.ShowDialog() != DialogResult.OK)
return;

var newAccessLink = new AccessLink
{
Name = folderBrowserDialog.SelectedPath.GetPathName(),
Path = folderBrowserDialog.SelectedPath
};

container.Add(newAccessLink);
Save();
}

[RelayCommand]
private void EditQuickAccessLink()
{
var selectedLink = SelectedQuickAccessLink;
var collection = Settings.QuickAccessLinks;

if (selectedLink is null)
{
ShowUnselectedMessage();
return;
}

var quickAccessLinkSettings = new QuickAccessLinkSettings(collection, SelectedQuickAccessLink);
if (quickAccessLinkSettings.ShowDialog() == true)
{
Save();
}
}

[RelayCommand]
private void AddQuickAccessLink()
{
var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks);
if (quickAccessLinkSettings.ShowDialog() == true)
{
Save();
}
}

[RelayCommand]
private void RemoveLink(object obj)
private void RemoveLink(object commandParameter)
{
if (obj is not string container) return;
if (commandParameter is not string container) return;

switch (container)
{
Expand All @@ -407,10 +425,16 @@ private void RemoveLink(object obj)
}
Save();
}

private void ShowUnselectedMessage()
{
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
Context.API.ShowMsgBox(warning);
}

#endregion

private string? PromptUserSelectPath(ResultType type, string? initialDirectory = null)
private static string? PromptUserSelectPath(ResultType type, string? initialDirectory = null)
{
string? path = null;

Expand Down
Loading
Loading