Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Windows;
using Flow.Launcher.Plugin.BrowserBookmark.Models;
using System.Windows.Input;
using System.ComponentModel;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Plugin.BrowserBookmark.Models;

namespace Flow.Launcher.Plugin.BrowserBookmark.Views;

public partial class SettingsControl : INotifyPropertyChanged
[INotifyPropertyChanged]
public partial class SettingsControl
{
public Settings Settings { get; }
public CustomBrowser SelectedCustomBrowser { get; set; }
Expand Down Expand Up @@ -53,12 +54,10 @@ public bool OpenInNewBrowserWindow
set
{
Settings.OpenInNewBrowserWindow = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OpenInNewBrowserWindow)));
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

private void NewCustomBrowser(object sender, RoutedEventArgs e)
{
var newBrowser = new CustomBrowser();
Expand Down
7 changes: 5 additions & 2 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@
<system:String x:Key="plugin_explorer_deletefilefolder">Delete</system:String>
<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_name">Name</system:String>
<system:String x:Key="plugin_explorer_type">Type</system:String>
<system:String x:Key="plugin_explorer_path">Path</system:String>
<system:String x:Key="plugin_explorer_file">File</system:String>
<system:String x:Key="plugin_explorer_folder">Folder</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
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
#nullable enable

#nullable enable

namespace Flow.Launcher.Plugin.Explorer.Views
namespace Flow.Launcher.Plugin.Explorer.ViewModels
{
public class ActionKeywordModel : INotifyPropertyChanged
public partial class ActionKeywordModel : BaseModel
{
private static Settings _settings = null!;

public event PropertyChangedEventHandler? PropertyChanged;

public static void Init(Settings settings)
{
_settings = settings;
Expand All @@ -28,13 +23,7 @@ internal ActionKeywordModel(Settings.ActionKeyword actionKeyword, string descrip

internal Settings.ActionKeyword KeywordProperty { get; }

private void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

private string? keyword;

public string Keyword
{
get => keyword ??= _settings.GetActionKeyword(KeywordProperty);
Expand All @@ -45,8 +34,8 @@ public string Keyword
OnPropertyChanged();
}
}
private bool? enabled;

private bool? enabled;
public bool Enabled
{
get => enabled ??= _settings.GetActionKeywordEnabled(KeywordProperty);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Plugin.Explorer.ViewModels;

namespace Flow.Launcher.Plugin.Explorer.Views
{
/// <summary>
/// Interaction logic for ActionKeywordSetting.xaml
/// </summary>
public partial class ActionKeywordSetting : INotifyPropertyChanged
[INotifyPropertyChanged]
public partial class ActionKeywordSetting
{
private ActionKeywordModel CurrentActionKeyword { get; }

Expand All @@ -21,14 +18,14 @@ public string ActionKeyword
{
// Set Enable to be true if user change ActionKeyword
KeywordEnabled = true;
_ = SetField(ref actionKeyword, value);
_ = SetProperty(ref actionKeyword, value);
}
}

public bool KeywordEnabled
{
get => _keywordEnabled;
set => SetField(ref _keywordEnabled, value);
set => _ = SetProperty(ref _keywordEnabled, value);
}

private string actionKeyword;
Expand Down Expand Up @@ -116,20 +113,5 @@ private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
e.CancelCommand();
}
}

public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

private bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value))
return false;
field = value;
OnPropertyChanged(propertyName);
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
xmlns:qa="clr-namespace:Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels"
xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
d:DataContext="{d:DesignInstance viewModels:SettingsViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
Expand All @@ -18,7 +17,7 @@
<DataTemplate x:Key="ListViewTemplateAccessLinks" DataType="qa:AccessLink">
<TextBlock Margin="0 5 0 5" Text="{Binding Path, Mode=OneTime}" />
</DataTemplate>
<DataTemplate x:Key="ListViewActionKeywords" DataType="{x:Type views:ActionKeywordModel}">
<DataTemplate x:Key="ListViewActionKeywords" DataType="{x:Type viewModels:ActionKeywordModel}">
<Grid>
<TextBlock
Margin="0 5 0 0"
Expand Down Expand Up @@ -512,22 +511,22 @@
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
VerticalAlignment="Center"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource plugin_explorer_previewpanel_file_info_label}" />

Check warning on line 514 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
<WrapPanel
Width="Auto"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_size_checkbox}"

Check warning on line 521 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
IsChecked="{Binding ShowFileSizeInPreviewPanel}" />
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_creation_checkbox}"

Check warning on line 525 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
IsChecked="{Binding ShowCreatedDateInPreviewPanel}" />
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Content="{DynamicResource plugin_explorer_previewpanel_display_file_modification_checkbox}"

Check warning on line 529 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`previewpanel` is not a recognized word. (unrecognized-spelling)
IsChecked="{Binding ShowModifiedDateInPreviewPanel}" />
<CheckBox
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
Expand Down Expand Up @@ -750,12 +749,12 @@
Height="200"
AllowDrop="True"
BorderThickness="1"
DragEnter="lbxAccessLinks_DragEnter"

Check warning on line 752 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`lbx` is not a recognized word. (unrecognized-spelling)
Drop="LbxAccessLinks_OnDrop"
ItemsSource="{Binding Settings.QuickAccessLinks}"
Loaded="lbxAccessLinks_Loaded"

Check warning on line 755 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`lbx` is not a recognized word. (unrecognized-spelling)
SelectedItem="{Binding SelectedQuickAccessLink}"
SizeChanged="lbxAccessLinks_SizeChanged">

Check warning on line 757 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`lbx` is not a recognized word. (unrecognized-spelling)
<ListView.View>
<GridView>
<GridViewColumn Width="600" Header="{DynamicResource plugin_explorer_name}">
Expand Down Expand Up @@ -831,11 +830,11 @@
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="1">
<ListView
Name="lbxExcludedPaths"

Check warning on line 833 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`lbx` is not a recognized word. (unrecognized-spelling)
Height="200"
AllowDrop="True"
DragEnter="lbxAccessLinks_DragEnter"
Drop="LbxExcludedPaths_OnDrop"

Check warning on line 837 in Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`Lbx` is not a recognized word. (unrecognized-spelling)
ItemTemplate="{StaticResource ListViewTemplateAccessLinks}"
ItemsSource="{Binding Settings.IndexSearchExcludedSubdirectoryPaths}"
Loaded="lbxExcludedPaths_Loaded"
Expand Down
12 changes: 3 additions & 9 deletions Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Flow.Launcher.Plugin.Explorer.Search;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Flow.Launcher.Plugin.Explorer.Views;

#nullable enable

public partial class PreviewPanel : UserControl, INotifyPropertyChanged
[INotifyPropertyChanged]
public partial class PreviewPanel : UserControl
{
private static readonly string ClassName = nameof(PreviewPanel);

Expand Down Expand Up @@ -327,11 +328,4 @@ private static string GetFileAge(DateTime fileDateTime)
return yearsDiff == 1 ? Main.Context.API.GetTranslation("OneYearAgo") :
string.Format(Main.Context.API.GetTranslation("YearsAgo"), yearsDiff);
}

public event PropertyChangedEventHandler? PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Window x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
Width="Auto"
Height="255"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Width"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Window
x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
Width="Auto"
Height="300"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Width"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
Expand Down Expand Up @@ -58,55 +59,91 @@
<StackPanel Margin="26 0 26 0">
<StackPanel Margin="0 0 0 12">
<TextBlock
Margin="0 0 0 0"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<!-- Name -->
<TextBlock
MinWidth="150"
Margin="0 10 15 10"
HorizontalAlignment="Left"
Grid.Row="0"
Grid.Column="0"
Margin="0 10 0 0"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource plugin_explorer_name}" />
<TextBox
Margin="10 0 0 0"
Grid.Row="0"
Grid.Column="1"
Margin="10 10 0 0"
VerticalAlignment="Center"
FontSize="12"
Width="250"
Text="{Binding SelectedName, Mode=TwoWay}" />
</StackPanel>

<StackPanel Margin="0 10 0 0" Orientation="Horizontal">

<!-- Type -->
<TextBlock
MinWidth="150"
Margin="0 10 15 10"
HorizontalAlignment="Left"
Grid.Row="1"
Grid.Column="0"
Margin="0 10 0 0"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource plugin_explorer_type}" />
<StackPanel
Grid.Row="1"
Grid.Column="1"
Orientation="Horizontal">
<RadioButton
Margin="10 10 0 0"
Content="{DynamicResource plugin_explorer_file}"
GroupName="PathType"
IsChecked="{Binding IsFileSelected}" />
<RadioButton
Margin="10 10 0 0"
Content="{DynamicResource plugin_explorer_folder}"
GroupName="PathType"
IsChecked="{Binding IsFolderSelected}" />
</StackPanel>
<!-- Path -->
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="0 10 0 0"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource plugin_explorer_path}" />


<TextBox
Margin="10 0 0 0"
Grid.Row="2"
Grid.Column="1"
Width="250"
Margin="10 10 0 0"
VerticalAlignment="Center"
FontSize="12"
Width="250"
Text="{Binding SelectedPath, Mode=TwoWay}"
IsReadOnly="True" />
IsReadOnly="True"
Text="{Binding SelectedPath, Mode=TwoWay}" />
<Button
Width="80"
Grid.Row="2"
Grid.Column="2"
Height="Auto"
Margin="10 0 0 0"
MinWidth="80"
Margin="10 10 0 0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="{DynamicResource select}"
Click="SelectPath_OnClick" />
</StackPanel>

Click="SelectPath_OnClick"
Content="{DynamicResource select}" />
</Grid>
</StackPanel>
</StackPanel>
<Border
Expand All @@ -118,20 +155,20 @@
<Button
x:Name="btnCancel"
Width="145"
Height="30"
Margin="0 0 5 0"
Height="34"
Margin="0 0 5 1"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
Name="DownButton"
Width="145"
Height="30"
Margin="5 0 0 0"
Height="34"
Margin="5 0 0 1"
Click="OnDoneButtonClick"
Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
</Button>
</StackPanel>
</Border>
</Grid>
</Window>
</Window>
Loading
Loading