2025-04-15 05:21:00 +00:00
|
|
|
|
using System.ComponentModel;
|
2020-06-06 12:13:22 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
using System.Windows;
|
2022-07-04 00:50:02 +00:00
|
|
|
|
using System.Windows.Controls;
|
2025-04-15 05:21:00 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
|
|
|
|
|
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
2020-06-06 12:13:22 +00:00
|
|
|
|
using DataFormats = System.Windows.DataFormats;
|
|
|
|
|
|
using DragDropEffects = System.Windows.DragDropEffects;
|
|
|
|
|
|
using DragEventArgs = System.Windows.DragEventArgs;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer.Views
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interaction logic for ExplorerSettings.xaml
|
|
|
|
|
|
/// </summary>
|
2020-06-06 12:13:22 +00:00
|
|
|
|
public partial class ExplorerSettings
|
2020-05-11 13:15:15 +00:00
|
|
|
|
{
|
2020-06-08 04:20:22 +00:00
|
|
|
|
private readonly SettingsViewModel viewModel;
|
2020-07-18 14:12:11 +00:00
|
|
|
|
|
2020-06-08 04:20:22 +00:00
|
|
|
|
public ExplorerSettings(SettingsViewModel viewModel)
|
2020-05-11 13:15:15 +00:00
|
|
|
|
{
|
2022-03-25 21:19:00 +00:00
|
|
|
|
DataContext = viewModel;
|
2022-07-01 04:56:15 +00:00
|
|
|
|
|
2020-05-11 13:15:15 +00:00
|
|
|
|
InitializeComponent();
|
2020-06-06 12:13:22 +00:00
|
|
|
|
|
2020-06-08 04:20:22 +00:00
|
|
|
|
this.viewModel = viewModel;
|
2020-06-06 12:13:22 +00:00
|
|
|
|
|
2022-03-13 03:27:46 +00:00
|
|
|
|
DataContext = viewModel;
|
|
|
|
|
|
|
2022-07-01 04:56:15 +00:00
|
|
|
|
ActionKeywordModel.Init(viewModel.Settings);
|
2020-06-06 12:13:22 +00:00
|
|
|
|
|
2021-01-26 09:46:05 +00:00
|
|
|
|
lbxAccessLinks.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
2020-06-06 12:13:22 +00:00
|
|
|
|
|
|
|
|
|
|
lbxExcludedPaths.Items.SortDescriptions.Add(new SortDescription("Path", ListSortDirection.Ascending));
|
2020-07-16 11:45:08 +00:00
|
|
|
|
}
|
2020-06-06 12:13:22 +00:00
|
|
|
|
|
2022-07-04 00:50:02 +00:00
|
|
|
|
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
|
2020-06-06 12:13:22 +00:00
|
|
|
|
{
|
2022-07-04 00:50:02 +00:00
|
|
|
|
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
2020-07-17 11:14:15 +00:00
|
|
|
|
|
2022-07-04 00:50:02 +00:00
|
|
|
|
if (files == null || !files.Any())
|
2020-06-06 12:13:22 +00:00
|
|
|
|
{
|
2022-07-04 00:50:02 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
foreach (var s in files)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Directory.Exists(s))
|
2020-06-06 12:13:22 +00:00
|
|
|
|
{
|
2022-07-04 00:50:02 +00:00
|
|
|
|
var newFolderLink = new AccessLink
|
2020-06-06 12:13:22 +00:00
|
|
|
|
{
|
2022-07-04 00:50:02 +00:00
|
|
|
|
Path = s
|
|
|
|
|
|
};
|
|
|
|
|
|
viewModel.AppendLink(containerName, newFolderLink);
|
2020-06-06 12:13:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-01-26 09:46:05 +00:00
|
|
|
|
private void lbxAccessLinks_DragEnter(object sender, DragEventArgs e)
|
2020-06-06 12:13:22 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Effects = DragDropEffects.Link;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Effects = DragDropEffects.None;
|
|
|
|
|
|
}
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
2020-06-08 08:41:59 +00:00
|
|
|
|
|
|
|
|
|
|
private void btnOpenIndexingOptions_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2022-03-25 21:19:00 +00:00
|
|
|
|
SettingsViewModel.OpenWindowsIndexingOptions();
|
2020-06-08 08:41:59 +00:00
|
|
|
|
}
|
2022-07-04 00:50:02 +00:00
|
|
|
|
private void EverythingSortOptionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (tbFastSortWarning is not null)
|
|
|
|
|
|
{
|
|
|
|
|
|
tbFastSortWarning.Visibility = viewModel.FastSortWarningVisibility;
|
|
|
|
|
|
tbFastSortWarning.Text = viewModel.SortOptionWarningMessage;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void LbxAccessLinks_OnDrop(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
AccessLinkDragDrop("QuickAccessLink", e);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void LbxExcludedPaths_OnDrop(object sender, DragEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
AccessLinkDragDrop("IndexSearchExcludedPath", e);
|
|
|
|
|
|
}
|
2024-08-10 11:24:48 +00:00
|
|
|
|
|
|
|
|
|
|
private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
|
|
|
|
|
|
}
|
2020-07-16 11:45:08 +00:00
|
|
|
|
}
|
2022-11-29 03:38:17 +00:00
|
|
|
|
}
|