Flow.Launcher/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

68 lines
2.1 KiB
C#
Raw Normal View History

using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Plugin.Explorer.Search;
2021-01-26 09:48:06 +00:00
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using System.Diagnostics;
2021-01-02 14:01:15 +00:00
using System.Threading.Tasks;
namespace Flow.Launcher.Plugin.Explorer.ViewModels
{
public class SettingsViewModel
{
internal Settings Settings { get; set; }
internal PluginInitContext Context { get; set; }
public SettingsViewModel(PluginInitContext context, Settings settings)
{
Context = context;
Settings = settings;
}
2021-01-02 14:01:15 +00:00
public void Save()
{
Context.API.SaveSettingJsonStorage<Settings>();
}
2021-01-26 10:29:56 +00:00
internal void RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);
2021-01-26 10:29:56 +00:00
internal void RemoveAccessLinkFromExcludedIndexPaths(AccessLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
internal void OpenWindowsIndexingOptions()
{
var psi = new ProcessStartInfo
{
FileName = "control.exe",
UseShellExecute = true,
Arguments = Constants.WindowsIndexingOptions
};
Process.Start(psi);
}
internal void UpdateActionKeyword(Settings.ActionKeyword modifiedActionKeyword, string newActionKeyword, string oldActionKeyword)
{
2021-05-29 12:00:10 +00:00
PluginManager.ReplaceActionKeyword(Context.CurrentPluginMetadata.ID, oldActionKeyword, newActionKeyword);
}
internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword)
2021-06-05 08:44:16 +00:00
{
return PluginManager.ActionKeywordRegistered(newActionKeyword);
}
internal bool IsNewActionKeywordGlobal(string newActionKeyword) => newActionKeyword == Query.GlobalPluginWildcardSign;
Release 1.9.4 (#1287) * Merge pull request #1205 from Flow-Launcher/fix_cmd_command_with_blank Fix shell cmd command with quote and space * Bump NuGet.CommandLine from 5.4.0 to 5.7.2 (#1241) * Merge pull request #1098 from Flow-Launcher/ScrollToSelectedPlugin Scroll to selected item when expanded or size changed * fix RemoveOldQueryResults NullPointerException (#1204) * Merge pull request #1005 from Flow-Launcher/KillProcess Use Cancellation Token to avoid potential race tracing issue * Merge pull request #1187 from Flow-Launcher/update_python_download_mirrors Update Python download mirrors * Merge pull request #1108 from Flow-Launcher/CalculatorDecimalSeparator Respect Decimal Separator for query not just result * Merge pull request #1087 from Flow-Launcher/turnoff_replace_win_r_shell Set Shell plugin's default replace Win R hotkey to off * Merge pull request #1077 from Flow-Launcher/fix_explorer_button_visibility Fix incorrect button visibility in Explorer's expander control * Merge pull request #1076 from Flow-Launcher/fix_path_search_with_index Fix the use of index in path search * Merge pull request #1071 from medlir/fix-browser-bookmarks-plugin-exception avoid exception in ChromiumBookmarkLoader.cs * Merge pull request #1056 from Flow-Launcher/fix_context_menu_typo Fix typo for plugin title in context menu and WindowsSettings name * Merge pull request #1119 from onesounds/antialising Remove All Cleartype Rendering * Version bump * Remove Calculator plugin CopyText feature for 1.9.4 release
2022-07-24 01:39:31 +00:00
public bool UseWindowsIndexForDirectorySearch {
get
{
return Settings.UseWindowsIndexForDirectorySearch;
}
set
{
Settings.UseWindowsIndexForDirectorySearch = value;
}
}
}
}