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 @@ -17,7 +17,7 @@ public override List<Bookmark> GetBookmarks()
private List<Bookmark> LoadChromeBookmarks()
{
var bookmarks = new List<Bookmark>();
String platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome\User Data"), "Google Chrome"));
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome SxS\User Data"), "Google Chrome Canary"));
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Chromium\User Data"), "Chromium"));
Expand Down
21 changes: 8 additions & 13 deletions Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,17 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
{
public class EdgeBookmarkLoader : ChromiumBookmarkLoader
{

private readonly List<Bookmark> _bookmarks = new();

private void LoadEdgeBookmarks()
private List<Bookmark> LoadEdgeBookmarks()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, if that's the case, chrome plugin will not be loaded as well.
I use this way to let the children only provide the path toward the data path, so that it may be abstracted.

{
var bookmarks = new List<Bookmark>();
var platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge\User Data"), "Microsoft Edge");
LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge Dev\User Data"), "Microsoft Edge Dev");
LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge SxS\User Data"), "Microsoft Edge Canary");
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge\User Data"), "Microsoft Edge"));
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge Dev\User Data"), "Microsoft Edge Dev"));
bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge SxS\User Data"), "Microsoft Edge Canary"));

return bookmarks;
Comment on lines -19 to +21
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edge bookmark is not loaded due to this, they are not been added, just loaded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣🤣🤣 Silly mistake

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no probs. good to go?

}

public override List<Bookmark> GetBookmarks()
{
_bookmarks.Clear();
LoadEdgeBookmarks();
return _bookmarks;
}
public override List<Bookmark> GetBookmarks() => LoadEdgeBookmarks();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<system:String x:Key="flowlauncher_plugin_browserbookmark_loadBrowserFrom">Load Browser From:</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserName">Browser Name</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_browserBookmarkDataDirectory">DataDirectoryPath</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_addBrowserBookmark">Add Custom Browser Bookmark</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_removeBrowserBookmark">Delete Custom Browser Bookmark</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_addBrowserBookmark">Add</system:String>
<system:String x:Key="flowlauncher_plugin_browserbookmark_removeBrowserBookmark">Delete</system:String>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,34 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.BrowserBookmark.Models"
mc:Ignorable="d"
Title="CustomBrowserSetting" Height="450" Width="600"
WindowStartupLocation="CenterScreen"
Title="CustomBrowserSetting" Height="350" Width="600"
KeyDown="WindowKeyDown"
>
<Window.DataContext>
<local:CustomBrowser/>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Browser Name" FontSize="15"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="80 0 0 0"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Browser Data Directory Path" FontSize="15"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="80 0 0 0"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Name}"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" Height="30"/>
HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" Height="30" Margin="50 0 0 0"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding DataDirectoryPath}"
HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Height="30"/>
<StackPanel HorizontalAlignment="Right" Grid.Row="2" Orientation="Horizontal" Grid.Column="1" Height="60">
<Button Content="Confirm" Margin="15" Click="ConfirmEditCustomBrowser"/>
<Button Content="Cancel" Margin="15"/>
HorizontalAlignment="Left" VerticalAlignment="Center" Width="200" Height="30" Margin="50 0 0 0"/>
<StackPanel HorizontalAlignment="Center" Grid.Row="2" Orientation="Horizontal" Grid.Column="1" Height="70">
<Button Name="btnConfirm" Content="Confirm" Margin="15" Click="ConfirmCancelEditCustomBrowser"/>
<Button Content="Cancel" Margin="15" Click="ConfirmCancelEditCustomBrowser"/>
</StackPanel>
</Grid>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,26 @@ public CustomBrowserSettingWindow(CustomBrowser browser)
};
}

private void ConfirmEditCustomBrowser(object sender, RoutedEventArgs e)
private void ConfirmCancelEditCustomBrowser(object sender, RoutedEventArgs e)
{
if (DataContext is CustomBrowser editedBrowser)
if (DataContext is CustomBrowser editBrowser && e.Source is Button button)
{
currentCustomBrowser.Name = editedBrowser.Name;
currentCustomBrowser.DataDirectoryPath = editedBrowser.DataDirectoryPath;
if (button.Name == "btnConfirm")
{
currentCustomBrowser.Name = editBrowser.Name;
currentCustomBrowser.DataDirectoryPath = editBrowser.DataDirectoryPath;
Close();
}
}

Close();
}

private void WindowKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ConfirmEditCustomBrowser(sender, e);
ConfirmCancelEditCustomBrowser(sender, e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@
</ListView.View>
</ListView>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}" Margin="10" Click="NewCustomBrowser"/>
<Button Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}" Margin="10" Click="DeleteCustomBrowser"/>
<Button Content="{DynamicResource flowlauncher_plugin_browserbookmark_addBrowserBookmark}"
Margin="10" Click="NewCustomBrowser" Width="80" />
<Button Content="{DynamicResource flowlauncher_plugin_browserbookmark_removeBrowserBookmark}"
Margin="10" Click="DeleteCustomBrowser" Width="80"/>
</StackPanel>
</StackPanel>
</Grid>
Expand Down