Skip to content

Commit c240f1e

Browse files
committed
- Added Guide Texts in CustomBrowsePopup
- Added 'Edit' Button, It will be disable when non-select situation - Added Browse Button in Path Select Textbox
1 parent 1c95033 commit c240f1e

File tree

6 files changed

+153
-71
lines changed

6 files changed

+153
-71
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@
6464
<Compile Remove="Bookmark.cs" />
6565
</ItemGroup>
6666

67+
<ItemGroup>
68+
<Reference Include="System.Windows.Forms">
69+
<HintPath>..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.dll</HintPath>
70+
</Reference>
71+
</ItemGroup>
72+
6773
<Target Name="CopyDLLs" AfterTargets="Build">
6874
<Message Text="Executing CopyDLLs task" Importance="High" />
69-
<Copy
70-
SourceFiles="$(TargetDir)\runtimes\win-x64\native\SQLite.Interop.dll"
71-
DestinationFolder="$(TargetDir)\x64" />
72-
<Copy
73-
SourceFiles="$(TargetDir)\runtimes\win-x86\native\SQLite.Interop.dll"
74-
DestinationFolder="$(TargetDir)\x86" />
75+
<Copy SourceFiles="$(TargetDir)\runtimes\win-x64\native\SQLite.Interop.dll" DestinationFolder="$(TargetDir)\x64" />
76+
<Copy SourceFiles="$(TargetDir)\runtimes\win-x86\native\SQLite.Interop.dll" DestinationFolder="$(TargetDir)\x86" />
7577
</Target>
7678

7779
<Target Name="DeleteRuntimesFolder" AfterTargets="CopyDLLs">

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserName">Browser Name</system:String>
2121
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory">Data Directory Path</system:String>
2222
<system:String x:Key="flowlauncher_plugin_browserbookmark_addBrowserBookmark">Add</system:String>
23+
<system:String x:Key="flowlauncher_plugin_browserbookmark_editBrowserBookmark">Edit</system:String>
2324
<system:String x:Key="flowlauncher_plugin_browserbookmark_removeBrowserBookmark">Delete</system:String>
25+
<system:String x:Key="flowlauncher_plugin_browserbookmark_browseBrowserBookmark">Browse</system:String>
2426
<system:String x:Key="flowlauncher_plugin_browserbookmark_others">Others</system:String>
2527
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserEngine">Browser Engine</system:String>
28+
<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>
29+
<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>
30+
<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>
2631
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
xmlns:ui="clr-namespace:Flow.Launcher.Infrastructure.UI;assembly=Flow.Launcher.Infrastructure"
99
Title="{DynamicResource flowlauncher_plugin_browserbookmark_bookmarkDataSetting}"
10-
Width="520"
10+
Width="550"
1111
Background="{DynamicResource PopuBGColor}"
1212
Foreground="{DynamicResource PopupTextColor}"
1313
KeyDown="WindowKeyDown"
@@ -71,8 +71,8 @@
7171
TextAlignment="Left" />
7272
</StackPanel>
7373

74-
<StackPanel Margin="0,10,0,20" Orientation="Horizontal">
75-
<Grid Width="444" HorizontalAlignment="Stretch">
74+
<StackPanel Margin="0,0,0,20" Orientation="Horizontal">
75+
<Grid Width="474" HorizontalAlignment="Stretch">
7676
<Grid.ColumnDefinitions>
7777
<ColumnDefinition Width="Auto" />
7878
<ColumnDefinition Width="*" />
@@ -81,17 +81,45 @@
8181
<RowDefinition />
8282
<RowDefinition />
8383
<RowDefinition />
84+
<RowDefinition />
8485
</Grid.RowDefinitions>
85-
<TextBlock
86+
<StackPanel
8687
Grid.Row="0"
8788
Grid.Column="0"
89+
Grid.ColumnSpan="2"
90+
Margin="5,0,0,20">
91+
<TextBlock
92+
Margin="0,0,0,4"
93+
HorizontalAlignment="Left"
94+
VerticalAlignment="Center"
95+
FontSize="14"
96+
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage01}"
97+
TextWrapping="WrapWithOverflow" />
98+
<TextBlock
99+
Margin="0,4,0,4"
100+
HorizontalAlignment="Left"
101+
VerticalAlignment="Center"
102+
FontSize="14"
103+
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage02}"
104+
TextWrapping="WrapWithOverflow" />
105+
<TextBlock
106+
Margin="0,4,0,0"
107+
HorizontalAlignment="Left"
108+
VerticalAlignment="Center"
109+
FontSize="14"
110+
Text="{DynamicResource flowlauncher_plugin_browserbookmark_guideMessage03}"
111+
TextWrapping="WrapWithOverflow" />
112+
</StackPanel>
113+
<TextBlock
114+
Grid.Row="1"
115+
Grid.Column="0"
88116
Margin="5,0,20,0"
89117
HorizontalAlignment="Left"
90118
VerticalAlignment="Center"
91119
FontSize="14"
92120
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}" />
93121
<TextBox
94-
Grid.Row="0"
122+
Grid.Row="1"
95123
Grid.Column="1"
96124
Width="120"
97125
Height="34"
@@ -100,40 +128,51 @@
100128
VerticalAlignment="Center"
101129
Text="{Binding Name}" />
102130
<TextBlock
103-
Grid.Row="1"
131+
Grid.Row="2"
104132
Grid.Column="0"
105133
Margin="5,10,20,0"
106134
HorizontalAlignment="Left"
107135
VerticalAlignment="Center"
108136
FontSize="14"
109137
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}" />
110138
<ComboBox
111-
Grid.Row="1"
139+
Grid.Row="2"
112140
Grid.Column="1"
113141
Width="120"
114142
Height="34"
115143
Margin="5,10,10,0"
116144
HorizontalAlignment="Left"
117145
VerticalAlignment="Center"
118146
ItemsSource="{Binding Source={ui:EnumBindingSource {x:Type local:BrowserType}}}"
119-
SelectedItem="{Binding BrowserType}">
120-
</ComboBox>
147+
SelectedItem="{Binding BrowserType}" />
121148
<TextBlock
122-
Grid.Row="2"
149+
Grid.Row="3"
123150
Grid.Column="0"
124151
Margin="5,10,20,0"
125152
HorizontalAlignment="Left"
126153
VerticalAlignment="Center"
127154
FontSize="14"
128155
Text="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}" />
129-
<TextBox
130-
Grid.Row="2"
156+
<DockPanel
157+
Grid.Row="3"
131158
Grid.Column="1"
132-
Height="34"
133-
Margin="5,10,0,0"
134-
HorizontalAlignment="Stretch"
135-
VerticalAlignment="Center"
136-
Text="{Binding DataDirectoryPath}" />
159+
LastChildFill="True">
160+
<Button
161+
Height="34"
162+
MinWidth="100"
163+
Margin="5,10,0,0"
164+
VerticalContentAlignment="Stretch"
165+
Click="OnSelectPathClick"
166+
Content="{DynamicResource flowlauncher_plugin_browserbookmark_browseBrowserBookmark}"
167+
DockPanel.Dock="Right" />
168+
<TextBox
169+
Name="PathTextBox"
170+
Height="34"
171+
Margin="5,10,0,0"
172+
HorizontalAlignment="Stretch"
173+
VerticalAlignment="Center"
174+
Text="{Binding DataDirectoryPath}" />
175+
</DockPanel>
137176
</Grid>
138177
</StackPanel>
139178
</StackPanel>

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using Flow.Launcher.Plugin.BrowserBookmark.Models;
2+
using Microsoft.Win32;
3+
using System;
24
using System.Windows;
35
using System.Windows.Controls;
46
using System.Windows.Input;
7+
using System.Windows.Forms;
58

69
namespace Flow.Launcher.Plugin.BrowserBookmark.Views
710
{
@@ -25,7 +28,7 @@ public CustomBrowserSettingWindow(CustomBrowser browser)
2528

2629
private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e)
2730
{
28-
if (DataContext is CustomBrowser editBrowser && e.Source is Button button)
31+
if (DataContext is CustomBrowser editBrowser && e.Source is System.Windows.Controls.Button button)
2932
{
3033
if (button.Name == "btnConfirm")
3134
{
@@ -39,12 +42,20 @@ private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e)
3942
Close();
4043
}
4144

42-
private void WindowKeyDown(object sender, KeyEventArgs e)
45+
private void WindowKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
4346
{
4447
if (e.Key == Key.Enter)
4548
{
4649
ConfirmCancelEditCustomBrowser(sender, e);
4750
}
4851
}
52+
53+
private void OnSelectPathClick(object sender, RoutedEventArgs e)
54+
{
55+
var dialog = new FolderBrowserDialog();
56+
dialog.ShowDialog();
57+
PathTextBox.Text = dialog.SelectedPath;
58+
string folder = dialog.SelectedPath;
59+
}
4960
}
5061
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml

Lines changed: 62 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,83 @@
11
<UserControl
2-
x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.SettingsControl"
3-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7-
d:DesignHeight="300"
8-
d:DesignWidth="500"
9-
DataContext="{Binding RelativeSource={RelativeSource Self}}"
10-
mc:Ignorable="d">
2+
x:Class="Flow.Launcher.Plugin.BrowserBookmark.Views.SettingsControl"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
d:DesignHeight="300"
8+
d:DesignWidth="500"
9+
DataContext="{Binding RelativeSource={RelativeSource Self}}"
10+
mc:Ignorable="d">
1111
<Grid Margin="60,0,10,0">
1212
<Grid.RowDefinitions>
13-
<RowDefinition Height="auto"/>
13+
<RowDefinition Height="auto" />
1414
</Grid.RowDefinitions>
1515
<StackPanel Margin="0,10,0,10" Orientation="Vertical">
1616
<StackPanel Orientation="Horizontal">
17-
<TextBlock Margin="10" Text="{DynamicResource flowlauncher_plugin_browserbookmark_loadBrowserFrom}"/>
18-
<CheckBox Margin="0,0,15,0"
19-
Content="Chrome"
20-
IsChecked="{Binding Settings.LoadChromeBookmark}"/>
21-
<CheckBox Margin="0,0,15,0"
22-
Content="Edge"
23-
IsChecked="{Binding Settings.LoadEdgeBookmark}"/>
24-
<CheckBox Margin="0,0,15,0"
25-
Content="Firefox"
26-
IsChecked="{Binding Settings.LoadFirefoxBookmark}"/>
17+
<TextBlock Margin="10" Text="{DynamicResource flowlauncher_plugin_browserbookmark_loadBrowserFrom}" />
18+
<CheckBox
19+
Margin="0,0,15,0"
20+
Content="Chrome"
21+
IsChecked="{Binding Settings.LoadChromeBookmark}" />
22+
<CheckBox
23+
Margin="0,0,15,0"
24+
Content="Edge"
25+
IsChecked="{Binding Settings.LoadEdgeBookmark}" />
26+
<CheckBox
27+
Margin="0,0,15,0"
28+
Content="Firefox"
29+
IsChecked="{Binding Settings.LoadFirefoxBookmark}" />
2730
<Button
28-
Margin="0,0,15,0"
29-
Click="Others_Click"
30-
Content="{DynamicResource flowlauncher_plugin_browserbookmark_others}"/>
31+
Margin="0,0,15,0"
32+
Click="Others_Click"
33+
Content="{DynamicResource flowlauncher_plugin_browserbookmark_others}" />
3134
</StackPanel>
3235
<StackPanel Name="CustomBrowsersList" Visibility="Collapsed">
3336
<ListView
34-
Name="CustomBrowsers"
35-
Height="auto"
36-
Margin="10"
37-
BorderBrush="DarkGray"
38-
BorderThickness="1"
39-
ItemsSource="{Binding Settings.CustomChromiumBrowsers}"
40-
MouseDoubleClick="MouseDoubleClickOnSelectedCustomBrowser"
41-
SelectedItem="{Binding SelectedCustomBrowser}"
42-
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
37+
Name="CustomBrowsers"
38+
Height="auto"
39+
Margin="10"
40+
BorderBrush="DarkGray"
41+
BorderThickness="1"
42+
ItemsSource="{Binding Settings.CustomChromiumBrowsers}"
43+
MouseDoubleClick="MouseDoubleClickOnSelectedCustomBrowser"
44+
SelectedItem="{Binding SelectedCustomBrowser}"
45+
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
4346
<ListView.View>
4447
<GridView>
45-
<GridViewColumn DisplayMemberBinding="{Binding Name, Mode=OneWay}"
46-
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}"/>
47-
<GridViewColumn DisplayMemberBinding="{Binding DataDirectoryPath, Mode=OneWay}"
48-
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}"/>
49-
<GridViewColumn DisplayMemberBinding="{Binding BrowserType, Mode=OneWay}"
50-
Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}"/>
48+
<GridViewColumn DisplayMemberBinding="{Binding Name, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserName}" />
49+
<GridViewColumn DisplayMemberBinding="{Binding DataDirectoryPath, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory}" />
50+
<GridViewColumn DisplayMemberBinding="{Binding BrowserType, Mode=OneWay}" Header="{DynamicResource flowlauncher_plugin_browserbookmark_browserEngine}" />
5151
</GridView>
5252
</ListView.View>
5353
</ListView>
5454
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
5555
<Button
56-
MinWidth="130"
57-
Margin="10"
58-
Click="NewCustomBrowser"
59-
Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}"/>
56+
MinWidth="130"
57+
Margin="10"
58+
Click="NewCustomBrowser"
59+
Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}" />
6060
<Button
61-
MinWidth="120"
62-
Margin="10"
63-
Click="DeleteCustomBrowser"
64-
Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}"/>
61+
MinWidth="130"
62+
Margin="10"
63+
Click="EditCustomBrowser"
64+
Content="{DynamicResource flowlauncher_plugin_browserbookmark_editBrowserBookmark}">
65+
<Button.Style>
66+
<Style BasedOn="{StaticResource DefaultButtonStyle}" TargetType="Button">
67+
<Setter Property="IsEnabled" Value="true" />
68+
<Style.Triggers>
69+
<DataTrigger Binding="{Binding ElementName=CustomBrowsers, Path=SelectedItems.Count}" Value="0">
70+
<Setter Property="IsEnabled" Value="false" />
71+
</DataTrigger>
72+
</Style.Triggers>
73+
</Style>
74+
</Button.Style>
75+
</Button>
76+
<Button
77+
MinWidth="120"
78+
Margin="10"
79+
Click="DeleteCustomBrowser"
80+
Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}" />
6581
</StackPanel>
6682
</StackPanel>
6783
</StackPanel>

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,14 @@ private void Others_Click(object sender, RoutedEventArgs e)
7070
else
7171
CustomBrowsersList.Visibility = Visibility.Collapsed;
7272
}
73+
74+
private void EditCustomBrowser(object sender, RoutedEventArgs e)
75+
{
76+
if (SelectedCustomBrowser is null)
77+
return;
78+
79+
var window = new CustomBrowserSettingWindow(SelectedCustomBrowser);
80+
window.ShowDialog();
81+
}
7382
}
7483
}

0 commit comments

Comments
 (0)