- Added Guide Texts in CustomBrowsePopup

- Added 'Edit' Button, It will be disable when non-select situation
- Added Browse Button in Path Select Textbox
This commit is contained in:
DB p 2023-02-11 07:37:18 +09:00
parent 1c95033d6c
commit c240f1e2e0
6 changed files with 153 additions and 71 deletions

View file

@ -64,14 +64,16 @@
<Compile Remove="Bookmark.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms">
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="CopyDLLs" AfterTargets="Build">
<Message Text="Executing CopyDLLs task" Importance="High" />
<Copy
SourceFiles="$(TargetDir)\runtimes\win-x64\native\SQLite.Interop.dll"
DestinationFolder="$(TargetDir)\x64" />
<Copy
SourceFiles="$(TargetDir)\runtimes\win-x86\native\SQLite.Interop.dll"
DestinationFolder="$(TargetDir)\x86" />
<Copy SourceFiles="$(TargetDir)\runtimes\win-x64\native\SQLite.Interop.dll" DestinationFolder="$(TargetDir)\x64" />
<Copy SourceFiles="$(TargetDir)\runtimes\win-x86\native\SQLite.Interop.dll" DestinationFolder="$(TargetDir)\x86" />
</Target>
<Target Name="DeleteRuntimesFolder" AfterTargets="CopyDLLs">

View file

@ -20,7 +20,12 @@
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserName">Browser Name</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory">Data Directory Path</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_addBrowserBookmark">Add</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_editBrowserBookmark">Edit</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_removeBrowserBookmark">Delete</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browseBrowserBookmark">Browse</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_others">Others</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserEngine">Browser Engine</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_guideMessage01">If you are using a special browser such as Brave or Librewolf, or a portable version, you must add the bookmarks data directory (not file) and engine type in order for this plugin to work.</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_guideMessage02">For example: Brave's engine is Chromium; and its default bookmark data location is: "C:\Users\username\AppData\Local\BraveSoftware\Brave-Browser\UserData".</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_guideMessage03">After changing these values, close all setting windows and press F5 when Flow Launcher is open to reload the plug-in.</system:String>
</ResourceDictionary>

View file

@ -7,7 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="clr-namespace:Flow.Launcher.Infrastructure.UI;assembly=Flow.Launcher.Infrastructure"
Title="{DynamicResource flowlauncher_plugin_browserbookmark_bookmarkDataSetting}"
Width="520"
Width="550"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
KeyDown="WindowKeyDown"
@ -71,8 +71,8 @@
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0,10,0,20" Orientation="Horizontal">
<Grid Width="444" HorizontalAlignment="Stretch">
<StackPanel Margin="0,0,0,20" Orientation="Horizontal">
<Grid Width="474" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@ -81,17 +81,45 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
<StackPanel
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="5,0,0,20">
<TextBlock
Margin="0,0,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage01}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage02}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,4,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage03}"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="5,0,20,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}" />
<TextBox
Grid.Row="0"
Grid.Row="1"
Grid.Column="1"
Width="120"
Height="34"
@ -100,7 +128,7 @@
VerticalAlignment="Center"
Text="{Binding Name}" />
<TextBlock
Grid.Row="1"
Grid.Row="2"
Grid.Column="0"
Margin="5,10,20,0"
HorizontalAlignment="Left"
@ -108,7 +136,7 @@
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}" />
<ComboBox
Grid.Row="1"
Grid.Row="2"
Grid.Column="1"
Width="120"
Height="34"
@ -116,24 +144,35 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={ui:EnumBindingSource {x:Type local:BrowserType}}}"
SelectedItem="{Binding BrowserType}">
</ComboBox>
SelectedItem="{Binding BrowserType}" />
<TextBlock
Grid.Row="2"
Grid.Row="3"
Grid.Column="0"
Margin="5,10,20,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}" />
<TextBox
Grid.Row="2"
<DockPanel
Grid.Row="3"
Grid.Column="1"
Height="34"
Margin="5,10,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Text="{Binding DataDirectoryPath}" />
LastChildFill="True">
<Button
Height="34"
MinWidth="100"
Margin="5,10,0,0"
VerticalContentAlignment="Stretch"
Click="OnSelectPathClick"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_browseBrowserBookmark}"
DockPanel.Dock="Right" />
<TextBox
Name="PathTextBox"
Height="34"
Margin="5,10,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Text="{Binding DataDirectoryPath}" />
</DockPanel>
</Grid>
</StackPanel>
</StackPanel>

View file

@ -1,7 +1,10 @@
using Flow.Launcher.Plugin.BrowserBookmark.Models;
using Microsoft.Win32;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Forms;
namespace Flow.Launcher.Plugin.BrowserBookmark.Views
{
@ -25,7 +28,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views
private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e)
{
if (DataContext is CustomBrowser editBrowser && e.Source is Button button)
if (DataContext is CustomBrowser editBrowser && e.Source is System.Windows.Controls.Button button)
{
if (button.Name == "btnConfirm")
{
@ -39,12 +42,20 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views
Close();
}
private void WindowKeyDown(object sender, KeyEventArgs e)
private void WindowKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ConfirmCancelEditCustomBrowser(sender, e);
}
}
private void OnSelectPathClick(object sender, RoutedEventArgs e)
{
var dialog = new FolderBrowserDialog();
dialog.ShowDialog();
PathTextBox.Text = dialog.SelectedPath;
string folder = dialog.SelectedPath;
}
}
}

View file

@ -1,67 +1,83 @@
<UserControl
x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.SettingsControl"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.SettingsControl"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="500"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Grid Margin="60,0,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Margin="0,10,0,10" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10" Text="{DynamicResource flowlauncher_plugin_browserbookmark_loadBrowserFrom}"/>
<CheckBox Margin="0,0,15,0"
Content="Chrome"
IsChecked="{Binding Settings.LoadChromeBookmark}"/>
<CheckBox Margin="0,0,15,0"
Content="Edge"
IsChecked="{Binding Settings.LoadEdgeBookmark}"/>
<CheckBox Margin="0,0,15,0"
Content="Firefox"
IsChecked="{Binding Settings.LoadFirefoxBookmark}"/>
<TextBlock Margin="10" Text="{DynamicResource flowlauncher_plugin_browserbookmark_loadBrowserFrom}" />
<CheckBox
Margin="0,0,15,0"
Content="Chrome"
IsChecked="{Binding Settings.LoadChromeBookmark}" />
<CheckBox
Margin="0,0,15,0"
Content="Edge"
IsChecked="{Binding Settings.LoadEdgeBookmark}" />
<CheckBox
Margin="0,0,15,0"
Content="Firefox"
IsChecked="{Binding Settings.LoadFirefoxBookmark}" />
<Button
Margin="0,0,15,0"
Click="Others_Click"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_others}"/>
Margin="0,0,15,0"
Click="Others_Click"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_others}" />
</StackPanel>
<StackPanel Name="CustomBrowsersList" Visibility="Collapsed">
<ListView
Name="CustomBrowsers"
Height="auto"
Margin="10"
BorderBrush="DarkGray"
BorderThickness="1"
ItemsSource="{Binding Settings.CustomChromiumBrowsers}"
MouseDoubleClick="MouseDoubleClickOnSelectedCustomBrowser"
SelectedItem="{Binding SelectedCustomBrowser}"
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
Name="CustomBrowsers"
Height="auto"
Margin="10"
BorderBrush="DarkGray"
BorderThickness="1"
ItemsSource="{Binding Settings.CustomChromiumBrowsers}"
MouseDoubleClick="MouseDoubleClickOnSelectedCustomBrowser"
SelectedItem="{Binding SelectedCustomBrowser}"
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Name, Mode=OneWay}"
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}"/>
<GridViewColumn DisplayMemberBinding="{Binding DataDirectoryPath, Mode=OneWay}"
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}"/>
<GridViewColumn DisplayMemberBinding="{Binding BrowserType, Mode=OneWay}"
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}"/>
<GridViewColumn DisplayMemberBinding="{Binding Name, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}" />
<GridViewColumn DisplayMemberBinding="{Binding DataDirectoryPath, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}" />
<GridViewColumn DisplayMemberBinding="{Binding BrowserType, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}" />
</GridView>
</ListView.View>
</ListView>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
MinWidth="130"
Margin="10"
Click="NewCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}"/>
MinWidth="130"
Margin="10"
Click="NewCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}" />
<Button
MinWidth="120"
Margin="10"
Click="DeleteCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}"/>
MinWidth="130"
Margin="10"
Click="EditCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_editBrowserBookmark}">
<Button.Style>
<Style BasedOn="{StaticResource DefaultButtonStyle}" TargetType="Button">
<Setter Property="IsEnabled" Value="true" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=CustomBrowsers, Path=SelectedItems.Count}" Value="0">
<Setter Property="IsEnabled" Value="false" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button
MinWidth="120"
Margin="10"
Click="DeleteCustomBrowser"
Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}" />
</StackPanel>
</StackPanel>
</StackPanel>

View file

@ -70,5 +70,14 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views
else
CustomBrowsersList.Visibility = Visibility.Collapsed;
}
private void EditCustomBrowser(object sender, RoutedEventArgs e)
{
if (SelectedCustomBrowser is null)
return;
var window = new CustomBrowserSettingWindow(SelectedCustomBrowser);
window.ShowDialog();
}
}
}