mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #315 from Flow-Launcher/add_file_quick_access
Add save file with Explorer for quick access
This commit is contained in:
commit
d509b11491
16 changed files with 207 additions and 111 deletions
|
|
@ -7,12 +7,13 @@ using System.Windows;
|
|||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using System.Linq;
|
||||
using MessageBox = System.Windows.Forms.MessageBox;
|
||||
using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
|
||||
using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
|
||||
using DialogResult = System.Windows.Forms.DialogResult;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer
|
||||
{
|
||||
|
|
@ -22,10 +23,13 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
private Settings Settings { get; set; }
|
||||
|
||||
public ContextMenu(PluginInitContext context, Settings settings)
|
||||
private SettingsViewModel ViewModel { get; set; }
|
||||
|
||||
public ContextMenu(PluginInitContext context, Settings settings, SettingsViewModel vm)
|
||||
{
|
||||
Context = context;
|
||||
Settings = settings;
|
||||
ViewModel = vm;
|
||||
}
|
||||
|
||||
public List<Result> LoadContextMenus(Result selectedResult)
|
||||
|
|
@ -50,6 +54,58 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath;
|
||||
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
|
||||
|
||||
if (!Settings.QuickAccessLinks.Any(x => x.Path == record.FullPath))
|
||||
{
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
|
||||
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"), fileOrFolder),
|
||||
Action = (context) =>
|
||||
{
|
||||
Settings.QuickAccessLinks.Add(new AccessLink { Path = record.FullPath, Type = record.Type });
|
||||
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
|
||||
string.Format(
|
||||
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
|
||||
fileOrFolder),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
ViewModel.Save();
|
||||
|
||||
return true;
|
||||
},
|
||||
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
|
||||
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_titletooltip"),
|
||||
IcoPath = Constants.QuickAccessImagePath
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_title"),
|
||||
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"), fileOrFolder),
|
||||
Action = (context) =>
|
||||
{
|
||||
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => x.Path == record.FullPath));
|
||||
|
||||
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
|
||||
string.Format(
|
||||
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
|
||||
fileOrFolder),
|
||||
Constants.ExplorerIconImageFullPath);
|
||||
|
||||
ViewModel.Save();
|
||||
|
||||
return true;
|
||||
},
|
||||
SubTitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
|
||||
TitleToolTip = Context.API.GetTranslation("plugin_explorer_contextmenu_remove_titletooltip"),
|
||||
IcoPath = Constants.RemoveQuickAccessImagePath
|
||||
});
|
||||
}
|
||||
|
||||
contextMenus.Add(new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_copypath"),
|
||||
|
|
@ -228,7 +284,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
Action = _ =>
|
||||
{
|
||||
if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
|
||||
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new FolderLink { Path = record.FullPath });
|
||||
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new AccessLink { Path = record.FullPath });
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
|
|
|||
BIN
Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png
Normal file
BIN
Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -16,7 +16,7 @@
|
|||
<system:String x:Key="plugin_explorer_edit">Edit</system:String>
|
||||
<system:String x:Key="plugin_explorer_add">Add</system:String>
|
||||
<system:String x:Key="plugin_explorer_manageactionkeywords_header">Customise Action Keywords</system:String>
|
||||
<system:String x:Key="plugin_explorer_quickfolderaccess_header">Quick Folder Access Paths</system:String>
|
||||
<system:String x:Key="plugin_explorer_quickaccesslinks_header">Quick Access Links</system:String>
|
||||
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
|
||||
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
|
||||
<system:String x:Key="plugin_explorer_actionkeywordview_search">Search Activation:</system:String>
|
||||
|
|
@ -42,5 +42,15 @@
|
|||
<system:String x:Key="plugin_explorer_openindexingoptions">Open Windows Indexing Options</system:String>
|
||||
<system:String x:Key="plugin_explorer_openindexingoptions_subtitle">Manage indexed files and folders</system:String>
|
||||
<system:String x:Key="plugin_explorer_openindexingoptions_errormsg">Failed to open Windows Indexing Options</system:String>
|
||||
<system:String x:Key="plugin_explorer_add_to_quickaccess_title">Add to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_add_to_quickaccess_subtitle">Add the current {0} to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_addfilefoldersuccess">Successfully Added</system:String>
|
||||
<system:String x:Key="plugin_explorer_addfilefoldersuccess_detail">Successfully added to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_removefilefoldersuccess">Successfully Removed</system:String>
|
||||
<system:String x:Key="plugin_explorer_removefilefoldersuccess_detail">Successfully removed from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_contextmenu_titletooltip">Add to Quick Access so it can be opened with Explorer's Search Activation action keyword</system:String>
|
||||
<system:String x:Key="plugin_explorer_contextmenu_remove_titletooltip">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove the current {0} from Quick Access</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
using Flow.Launcher.Plugin.Explorer.Views;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
|
@ -32,7 +34,15 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
viewModel = new SettingsViewModel(context);
|
||||
await viewModel.LoadStorage();
|
||||
Settings = viewModel.Settings;
|
||||
contextMenu = new ContextMenu(Context, Settings);
|
||||
|
||||
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
||||
if (Settings.QuickFolderAccessLinks.Any())
|
||||
{
|
||||
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
|
||||
Settings.QuickFolderAccessLinks = new List<AccessLink>();
|
||||
}
|
||||
|
||||
contextMenu = new ContextMenu(Context, Settings, viewModel);
|
||||
searchManager = new SearchManager(Settings, Context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
internal const string ExplorerIconImagePath = "Images\\explorer.png";
|
||||
internal const string DifferentUserIconImagePath = "Images\\user.png";
|
||||
internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png";
|
||||
internal const string QuickAccessImagePath = "Images\\quickaccess.png";
|
||||
internal const string RemoveQuickAccessImagePath = "Images\\removequickaccess.png";
|
||||
|
||||
internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
||||
{
|
||||
public class QuickFolderAccess
|
||||
{
|
||||
private readonly ResultManager resultManager;
|
||||
|
||||
public QuickFolderAccess(PluginInitContext context)
|
||||
{
|
||||
resultManager = new ResultManager(context);
|
||||
}
|
||||
|
||||
internal List<Result> FolderListMatched(Query query, List<FolderLink> folderLinks)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return new List<Result>();
|
||||
|
||||
string search = query.Search.ToLower();
|
||||
|
||||
var queriedFolderLinks =
|
||||
folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return queriedFolderLinks.Select(item =>
|
||||
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks)
|
||||
=> folderLinks
|
||||
.Select(item => resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
||||
{
|
||||
public class FolderLink
|
||||
public class AccessLink
|
||||
{
|
||||
public string Path { get; set; }
|
||||
|
||||
public ResultType Type { get; set; } = ResultType.Folder;
|
||||
|
||||
[JsonIgnore]
|
||||
public string Nickname
|
||||
{
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
||||
{
|
||||
public class QuickAccess
|
||||
{
|
||||
private readonly ResultManager resultManager;
|
||||
|
||||
public QuickAccess(PluginInitContext context)
|
||||
{
|
||||
resultManager = new ResultManager(context);
|
||||
}
|
||||
|
||||
internal List<Result> AccessLinkListMatched(Query query, List<AccessLink> accessLinks)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return new List<Result>();
|
||||
|
||||
string search = query.Search.ToLower();
|
||||
|
||||
var queriedAccessLinks =
|
||||
accessLinks
|
||||
.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderBy(x => x.Type)
|
||||
.ThenBy(x => x.Nickname);
|
||||
|
||||
return queriedAccessLinks.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => resultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
|
||||
ResultType.File => resultManager.CreateFileResult(l.Path, query),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
internal List<Result> AccessLinkListAll(Query query, List<AccessLink> accessLinks)
|
||||
=> accessLinks
|
||||
.OrderBy(x => x.Type)
|
||||
.ThenBy(x => x.Nickname)
|
||||
.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => resultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query),
|
||||
ResultType.File => resultManager.CreateFileResult(l.Path, query),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
public bool ShowIndexState { get; set; }
|
||||
}
|
||||
|
||||
internal enum ResultType
|
||||
public enum ResultType
|
||||
{
|
||||
Volume,
|
||||
Folder,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using System;
|
||||
|
|
@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
private readonly IndexSearch indexSearch;
|
||||
|
||||
private readonly QuickFolderAccess quickFolderAccess;
|
||||
private readonly QuickAccess quickAccess;
|
||||
|
||||
private readonly ResultManager resultManager;
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
indexSearch = new IndexSearch(context);
|
||||
resultManager = new ResultManager(context);
|
||||
this.settings = settings;
|
||||
quickFolderAccess = new QuickFolderAccess(context);
|
||||
quickAccess = new QuickAccess(context);
|
||||
}
|
||||
|
||||
internal async Task<List<Result>> SearchAsync(Query query, CancellationToken token)
|
||||
|
|
@ -42,12 +42,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
// This allows the user to type the assigned action keyword and only see the list of quick folder links
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return quickFolderAccess.FolderListAll(query, settings.QuickFolderAccessLinks);
|
||||
return quickAccess.AccessLinkListAll(query, settings.QuickAccessLinks);
|
||||
|
||||
var quickFolderLinks = quickFolderAccess.FolderListMatched(query, settings.QuickFolderAccessLinks);
|
||||
var quickaccessLinks = quickAccess.AccessLinkListMatched(query, settings.QuickAccessLinks);
|
||||
|
||||
if (quickFolderLinks.Count > 0)
|
||||
results.AddRange(quickFolderLinks);
|
||||
if (quickaccessLinks.Count > 0)
|
||||
results.AddRange(quickaccessLinks);
|
||||
|
||||
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer
|
||||
|
|
@ -8,11 +8,14 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
public int MaxResult { get; set; } = 100;
|
||||
|
||||
public List<FolderLink> QuickFolderAccessLinks { get; set; } = new List<FolderLink>();
|
||||
public List<AccessLink> QuickAccessLinks { get; set; } = new List<AccessLink>();
|
||||
|
||||
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
||||
public List<AccessLink> QuickFolderAccessLinks { get; set; } = new List<AccessLink>();
|
||||
|
||||
public bool UseWindowsIndexForDirectorySearch { get; set; } = true;
|
||||
|
||||
public List<FolderLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<FolderLink>();
|
||||
public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>();
|
||||
|
||||
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -32,9 +32,9 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
storage.Save();
|
||||
}
|
||||
|
||||
internal void RemoveFolderLinkFromQuickFolders(FolderLink selectedRow) => Settings.QuickFolderAccessLinks.Remove(selectedRow);
|
||||
internal void RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);
|
||||
|
||||
internal void RemoveFolderLinkFromExcludedIndexPaths(FolderLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
|
||||
internal void RemoveAccessLinkFromExcludedIndexPaths(AccessLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
|
||||
|
||||
internal void OpenWindowsIndexingOptions()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<DataTemplate x:Key="ListViewTemplateFolderLinks">
|
||||
<DataTemplate x:Key="ListViewTemplateAccessLinks">
|
||||
<TextBlock
|
||||
Text="{Binding Nickname, Mode=OneTime}"
|
||||
Margin="0,5,0,5" />
|
||||
|
|
@ -40,22 +40,22 @@
|
|||
<ListView x:Name="lbxActionKeywords"
|
||||
ItemTemplate="{StaticResource ListViewActionKeywords}"/>
|
||||
</Expander>
|
||||
<Expander Name="expFolderLinks" Header="{DynamicResource plugin_explorer_quickfolderaccess_header}"
|
||||
Expanded="expFolderLinks_Click" Collapsed="expFolderLinks_Collapsed"
|
||||
<Expander Name="expAccessLinks" Header="{DynamicResource plugin_explorer_quickaccesslinks_header}"
|
||||
Expanded="expAccessLinks_Click" Collapsed="expAccessLinks_Collapsed"
|
||||
Margin="0 10 0 0">
|
||||
<ListView
|
||||
x:Name="lbxFolderLinks" AllowDrop="True"
|
||||
Drop="lbxFolders_Drop"
|
||||
DragEnter="lbxFolders_DragEnter"
|
||||
ItemTemplate="{StaticResource ListViewTemplateFolderLinks}"/>
|
||||
x:Name="lbxAccessLinks" AllowDrop="True"
|
||||
Drop="lbxAccessLinks_Drop"
|
||||
DragEnter="lbxAccessLinks_DragEnter"
|
||||
ItemTemplate="{StaticResource ListViewTemplateAccessLinks}"/>
|
||||
</Expander>
|
||||
<Expander x:Name="expExcludedPaths" Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}"
|
||||
Expanded="expExcludedPaths_Click"
|
||||
Margin="0 10 0 0">
|
||||
<ListView
|
||||
x:Name="lbxExcludedPaths" AllowDrop="True"
|
||||
Drop="lbxFolders_Drop"
|
||||
DragEnter="lbxFolders_DragEnter"
|
||||
Drop="lbxAccessLinks_Drop"
|
||||
DragEnter="lbxAccessLinks_DragEnter"
|
||||
ItemTemplate="{StaticResource ListViewTemplateExcludedPaths}"/>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
|
||||
this.viewModel = viewModel;
|
||||
|
||||
lbxFolderLinks.ItemsSource = this.viewModel.Settings.QuickFolderAccessLinks;
|
||||
lbxAccessLinks.ItemsSource = this.viewModel.Settings.QuickAccessLinks;
|
||||
|
||||
lbxExcludedPaths.ItemsSource = this.viewModel.Settings.IndexSearchExcludedSubdirectoryPaths;
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
|
||||
public void RefreshView()
|
||||
{
|
||||
lbxFolderLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
||||
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
||||
|
||||
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
btnEdit.Visibility = Visibility.Hidden;
|
||||
btnAdd.Visibility = Visibility.Hidden;
|
||||
|
||||
if (expFolderLinks.IsExpanded || expExcludedPaths.IsExpanded || expActionKeywords.IsExpanded)
|
||||
if (expAccessLinks.IsExpanded || expExcludedPaths.IsExpanded || expActionKeywords.IsExpanded)
|
||||
{
|
||||
if (!expActionKeywords.IsExpanded)
|
||||
btnAdd.Visibility = Visibility.Visible;
|
||||
|
|
@ -71,7 +71,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
&& btnEdit.Visibility == Visibility.Hidden)
|
||||
btnEdit.Visibility = Visibility.Visible;
|
||||
|
||||
if ((lbxFolderLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0)
|
||||
if ((lbxAccessLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0)
|
||||
&& btnDelete.Visibility == Visibility.Visible
|
||||
&& btnEdit.Visibility == Visibility.Visible)
|
||||
{
|
||||
|
|
@ -79,8 +79,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
btnEdit.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
if (expFolderLinks.IsExpanded
|
||||
&& lbxFolderLinks.Items.Count > 0
|
||||
if (expAccessLinks.IsExpanded
|
||||
&& lbxAccessLinks.Items.Count > 0
|
||||
&& btnDelete.Visibility == Visibility.Hidden
|
||||
&& btnEdit.Visibility == Visibility.Hidden)
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
}
|
||||
|
||||
lbxFolderLinks.Items.Refresh();
|
||||
lbxAccessLinks.Items.Refresh();
|
||||
|
||||
lbxExcludedPaths.Items.Refresh();
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
if (expExcludedPaths.IsExpanded)
|
||||
expExcludedPaths.IsExpanded = false;
|
||||
|
||||
if (expFolderLinks.IsExpanded)
|
||||
expFolderLinks.IsExpanded = false;
|
||||
if (expAccessLinks.IsExpanded)
|
||||
expAccessLinks.IsExpanded = false;
|
||||
|
||||
RefreshView();
|
||||
}
|
||||
|
|
@ -125,10 +125,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
expActionKeywords.Height = Double.NaN;
|
||||
}
|
||||
|
||||
private void expFolderLinks_Click(object sender, RoutedEventArgs e)
|
||||
private void expAccessLinks_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (expFolderLinks.IsExpanded)
|
||||
expFolderLinks.Height = 215;
|
||||
if (expAccessLinks.IsExpanded)
|
||||
expAccessLinks.Height = 215;
|
||||
|
||||
if (expExcludedPaths.IsExpanded)
|
||||
expExcludedPaths.IsExpanded = false;
|
||||
|
|
@ -139,19 +139,19 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
RefreshView();
|
||||
}
|
||||
|
||||
private void expFolderLinks_Collapsed(object sender, RoutedEventArgs e)
|
||||
private void expAccessLinks_Collapsed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!expFolderLinks.IsExpanded)
|
||||
expFolderLinks.Height = Double.NaN;
|
||||
if (!expAccessLinks.IsExpanded)
|
||||
expAccessLinks.Height = Double.NaN;
|
||||
}
|
||||
|
||||
private void expExcludedPaths_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (expExcludedPaths.IsExpanded)
|
||||
expFolderLinks.Height = Double.NaN;
|
||||
expAccessLinks.Height = Double.NaN;
|
||||
|
||||
if (expFolderLinks.IsExpanded)
|
||||
expFolderLinks.IsExpanded = false;
|
||||
if (expAccessLinks.IsExpanded)
|
||||
expAccessLinks.IsExpanded = false;
|
||||
|
||||
if (expActionKeywords.IsExpanded)
|
||||
expActionKeywords.IsExpanded = false;
|
||||
|
|
@ -161,7 +161,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
|
||||
private void btnDelete_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var selectedRow = lbxFolderLinks.SelectedItem as FolderLink?? lbxExcludedPaths.SelectedItem as FolderLink;
|
||||
var selectedRow = lbxAccessLinks.SelectedItem as AccessLink?? lbxExcludedPaths.SelectedItem as AccessLink;
|
||||
|
||||
if (selectedRow != null)
|
||||
{
|
||||
|
|
@ -169,11 +169,11 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
|
||||
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
if (expFolderLinks.IsExpanded)
|
||||
viewModel.RemoveFolderLinkFromQuickFolders(selectedRow);
|
||||
if (expAccessLinks.IsExpanded)
|
||||
viewModel.RemoveLinkFromQuickAccess(selectedRow);
|
||||
|
||||
if (expExcludedPaths.IsExpanded)
|
||||
viewModel.RemoveFolderLinkFromExcludedIndexPaths(selectedRow);
|
||||
viewModel.RemoveAccessLinkFromExcludedIndexPaths(selectedRow);
|
||||
|
||||
RefreshView();
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
else
|
||||
{
|
||||
var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink;
|
||||
var selectedRow = lbxAccessLinks.SelectedItem as AccessLink ?? lbxExcludedPaths.SelectedItem as AccessLink;
|
||||
|
||||
if (selectedRow != null)
|
||||
{
|
||||
|
|
@ -207,9 +207,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
folderBrowserDialog.SelectedPath = selectedRow.Path;
|
||||
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (expFolderLinks.IsExpanded)
|
||||
if (expAccessLinks.IsExpanded)
|
||||
{
|
||||
var link = viewModel.Settings.QuickFolderAccessLinks.First(x => x.Path == selectedRow.Path);
|
||||
var link = viewModel.Settings.QuickAccessLinks.First(x => x.Path == selectedRow.Path);
|
||||
link.Path = folderBrowserDialog.SelectedPath;
|
||||
}
|
||||
|
||||
|
|
@ -235,36 +235,36 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
var folderBrowserDialog = new FolderBrowserDialog();
|
||||
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var newFolderLink = new FolderLink
|
||||
var newAccessLink = new AccessLink
|
||||
{
|
||||
Path = folderBrowserDialog.SelectedPath
|
||||
};
|
||||
|
||||
AddFolderLink(newFolderLink);
|
||||
AddAccessLink(newAccessLink);
|
||||
}
|
||||
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void lbxFolders_Drop(object sender, DragEventArgs e)
|
||||
private void lbxAccessLinks_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
||||
if (files != null && files.Count() > 0)
|
||||
{
|
||||
if (expFolderLinks.IsExpanded && viewModel.Settings.QuickFolderAccessLinks == null)
|
||||
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>();
|
||||
if (expAccessLinks.IsExpanded && viewModel.Settings.QuickAccessLinks == null)
|
||||
viewModel.Settings.QuickAccessLinks = new List<AccessLink>();
|
||||
|
||||
foreach (string s in files)
|
||||
{
|
||||
if (Directory.Exists(s))
|
||||
{
|
||||
var newFolderLink = new FolderLink
|
||||
var newFolderLink = new AccessLink
|
||||
{
|
||||
Path = s
|
||||
};
|
||||
|
||||
AddFolderLink(newFolderLink);
|
||||
AddAccessLink(newFolderLink);
|
||||
}
|
||||
|
||||
RefreshView();
|
||||
|
|
@ -272,28 +272,28 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
}
|
||||
|
||||
private void AddFolderLink(FolderLink newFolderLink)
|
||||
private void AddAccessLink(AccessLink newAccessLink)
|
||||
{
|
||||
if (expFolderLinks.IsExpanded
|
||||
&& !viewModel.Settings.QuickFolderAccessLinks.Any(x => x.Path == newFolderLink.Path))
|
||||
if (expAccessLinks.IsExpanded
|
||||
&& !viewModel.Settings.QuickAccessLinks.Any(x => x.Path == newAccessLink.Path))
|
||||
{
|
||||
if (viewModel.Settings.QuickFolderAccessLinks == null)
|
||||
viewModel.Settings.QuickFolderAccessLinks = new List<FolderLink>();
|
||||
if (viewModel.Settings.QuickAccessLinks == null)
|
||||
viewModel.Settings.QuickAccessLinks = new List<AccessLink>();
|
||||
|
||||
viewModel.Settings.QuickFolderAccessLinks.Add(newFolderLink);
|
||||
viewModel.Settings.QuickAccessLinks.Add(newAccessLink);
|
||||
}
|
||||
|
||||
if (expExcludedPaths.IsExpanded
|
||||
&& !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newFolderLink.Path))
|
||||
&& !viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == newAccessLink.Path))
|
||||
{
|
||||
if (viewModel.Settings.IndexSearchExcludedSubdirectoryPaths == null)
|
||||
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List<FolderLink>();
|
||||
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths = new List<AccessLink>();
|
||||
|
||||
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newFolderLink);
|
||||
viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.Add(newAccessLink);
|
||||
}
|
||||
}
|
||||
|
||||
private void lbxFolders_DragEnter(object sender, DragEventArgs e)
|
||||
private void lbxAccessLinks_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"Name": "Explorer",
|
||||
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
|
||||
"Author": "Jeremy Wu",
|
||||
"Version": "1.5.0",
|
||||
"Version": "1.6.0",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
||||
|
|
|
|||
Loading…
Reference in a new issue