mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
add option to open Indexing Options in context menu and settings page
This commit is contained in:
parent
6befd6cbb1
commit
407864beb7
7 changed files with 76 additions and 10 deletions
|
|
@ -38,6 +38,8 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(CreateOpenContainingFolderResult(record));
|
||||
|
||||
contextMenus.Add(CreateOpenWindowsIndexingOptions(record));
|
||||
|
||||
if (record.ShowIndexState)
|
||||
contextMenus.Add(new Result {Title = "From index search: " + (record.WindowsIndexed ? "Yes" : "No"),
|
||||
SubTitle = "Location: " + record.FullPath,
|
||||
|
|
@ -186,13 +188,13 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var message = $"Fail to editor for file at {record.FullPath}";
|
||||
var message = $"Failed to open editor for file at {record.FullPath}";
|
||||
LogException(message, e);
|
||||
Context.API.ShowMsg(message);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
IcoPath = editorPath
|
||||
IcoPath = Constants.FileImagePath
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -225,6 +227,38 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
};
|
||||
}
|
||||
|
||||
private Result CreateOpenWindowsIndexingOptions(SearchResult record)
|
||||
{
|
||||
return new Result
|
||||
{
|
||||
Title = "Open Windows Indexing Options",
|
||||
SubTitle = "Manage indexed files and folders",
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "control.exe",
|
||||
UseShellExecute = true,
|
||||
Arguments = "srchadmin.dll"
|
||||
};
|
||||
|
||||
Process.Start(psi);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var message = $"Failed to open Windows Indexing Options";
|
||||
LogException(message, e);
|
||||
Context.API.ShowMsg(message);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
IcoPath = Constants.IndexingOptionsIconImagePath
|
||||
};
|
||||
}
|
||||
|
||||
public void LogException(string message, Exception e)
|
||||
{
|
||||
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@
|
|||
<None Include="Images\user.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
<None Include="Images\windowsindexingoptions.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
|
|
@ -14,11 +14,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
internal const string ExcludeFromIndexImagePath = "Images\\excludeindexpath.png";
|
||||
internal const string ExplorerIconImagePath = "Images\\explorer.png";
|
||||
internal const string DifferentUserIconImagePath = "Images\\user.png";
|
||||
internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png";
|
||||
|
||||
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
||||
|
||||
internal const char AllFilesFolderSearchWildcard = '>';
|
||||
|
||||
internal const char DirectorySeperator = '\\';
|
||||
|
||||
internal const string WindowsIndexingOptions = "srchadmin.dll";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
||||
{
|
||||
|
|
@ -29,5 +28,17 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
internal void RemoveFolderLinkFromQuickFolders(FolderLink selectedRow) => Settings.QuickFolderAccessLinks.Remove(selectedRow);
|
||||
|
||||
internal void RemoveFolderLinkFromExcludedIndexPaths(FolderLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
|
||||
|
||||
internal void OpenWindowsIndexingOptions()
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "control.exe",
|
||||
UseShellExecute = true,
|
||||
Arguments = Constants.WindowsIndexingOptions
|
||||
};
|
||||
|
||||
Process.Start(psi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,10 +44,19 @@
|
|||
</Expander>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_delete}"/>
|
||||
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_edit}"/>
|
||||
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_add}"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="350"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<Button x:Name="btnIndexingOptions" Click="btnOpenIndexingOptions_Click" Width="130" Margin="10" Content="Indexing Options"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_delete}"/>
|
||||
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_edit}"/>
|
||||
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_folder_add}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -236,5 +236,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOpenIndexingOptions_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.OpenWindowsIndexingOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue