From c240f1e2e03fcb1eedc5ae6d8a7266184b21d40d Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 11 Feb 2023 07:37:18 +0900 Subject: [PATCH 1/6] - Added Guide Texts in CustomBrowsePopup - Added 'Edit' Button, It will be disable when non-select situation - Added Browse Button in Path Select Textbox --- ...low.Launcher.Plugin.BrowserBookmark.csproj | 14 ++- .../Languages/en.xaml | 5 + .../Views/CustomBrowserSetting.xaml | 73 +++++++++--- .../Views/CustomBrowserSetting.xaml.cs | 15 ++- .../Views/SettingsControl.xaml | 108 ++++++++++-------- .../Views/SettingsControl.xaml.cs | 9 ++ 6 files changed, 153 insertions(+), 71 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj index c42378a9a36..253a53f1e56 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -64,14 +64,16 @@ + + + ..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\System.Windows.Forms.dll + + + - - + + diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml index 5dbe925c1cd..427b538ffc0 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml @@ -20,7 +20,12 @@ Browser Name Data Directory Path Add + Edit Delete + Browse Others Browser Engine + 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. + For example: Brave's engine is Chromium; and its default bookmark data location is: "C:\Users\username\AppData\Local\BraveSoftware\Brave-Browser\UserData". + After changing these values, close all setting windows and press F5 when Flow Launcher is open to reload the plug-in. \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml index 499d2283449..a8ecb54f9b8 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml @@ -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" /> - - + + @@ -81,17 +81,45 @@ + - + + + + + - + SelectedItem="{Binding BrowserType}" /> - + LastChildFill="True"> + + diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs index 0ac2199625a..81602918274 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs @@ -1,10 +1,8 @@ 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; +using System.Threading.Tasks; namespace Flow.Launcher.Plugin.BrowserBookmark.Views { @@ -25,20 +23,19 @@ public CustomBrowserSettingWindow(CustomBrowser browser) BrowserType = browser.BrowserType, }; } - - private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e) + + private void ConfirmEditCustomBrowser(object sender, RoutedEventArgs e) { - if (DataContext is CustomBrowser editBrowser && e.Source is System.Windows.Controls.Button button) - { - if (button.Name == "btnConfirm") - { - currentCustomBrowser.Name = editBrowser.Name; - currentCustomBrowser.DataDirectoryPath = editBrowser.DataDirectoryPath; - currentCustomBrowser.BrowserType = editBrowser.BrowserType; - Close(); - } - } + CustomBrowser editBrowser = (CustomBrowser)DataContext; + currentCustomBrowser.Name = editBrowser.Name; + currentCustomBrowser.DataDirectoryPath = editBrowser.DataDirectoryPath; + currentCustomBrowser.BrowserType = editBrowser.BrowserType; + _ = Task.Run(() => Main.ReloadAllBookmarks()); + Close(); + } + private void CancelEditCustomBrowser(object sender, RoutedEventArgs e) + { Close(); } @@ -46,7 +43,7 @@ private void WindowKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { - ConfirmCancelEditCustomBrowser(sender, e); + ConfirmEditCustomBrowser(sender, e); } } @@ -54,8 +51,8 @@ private void OnSelectPathClick(object sender, RoutedEventArgs e) { var dialog = new FolderBrowserDialog(); dialog.ShowDialog(); - PathTextBox.Text = dialog.SelectedPath; - string folder = dialog.SelectedPath; + CustomBrowser editBrowser = (CustomBrowser)DataContext; + editBrowser.DataDirectoryPath = dialog.SelectedPath; } } } From 39c4a2be2ea4bf55e2e2b8aa42058e4b8709e434 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:35:06 +0800 Subject: [PATCH 5/6] Auto reload bookmarks when editing checkboxes --- .../Views/CustomBrowserSetting.xaml.cs | 3 +- .../Views/SettingsControl.xaml | 6 +- .../Views/SettingsControl.xaml.cs | 57 ++++++++++++++++--- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs index 81602918274..bdef5bf0fc0 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs @@ -2,7 +2,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Forms; -using System.Threading.Tasks; namespace Flow.Launcher.Plugin.BrowserBookmark.Views { @@ -30,7 +29,7 @@ private void ConfirmEditCustomBrowser(object sender, RoutedEventArgs e) currentCustomBrowser.Name = editBrowser.Name; currentCustomBrowser.DataDirectoryPath = editBrowser.DataDirectoryPath; currentCustomBrowser.BrowserType = editBrowser.BrowserType; - _ = Task.Run(() => Main.ReloadAllBookmarks()); + DialogResult = true; Close(); } diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml index 408256f4560..014deff03b6 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml @@ -18,15 +18,15 @@ + IsChecked="{Binding LoadChromeBookmark}" /> + IsChecked="{Binding LoadEdgeBookmark}" /> + IsChecked="{Binding LoadFirefoxBookmark}" />