Skip to content

Commit 5f34031

Browse files
committed
Merge branch 'BrowserBookmark-big-bug-fix' of https://github.com/dcog989/Flow.Launcher into BrowserBookmark-big-bug-fix
2 parents e131596 + dec30d0 commit 5f34031

File tree

5 files changed

+51
-14
lines changed

5 files changed

+51
-14
lines changed

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2828
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2929
<PackageReadmeFile>Readme.md</PackageReadmeFile>
30+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3031
</PropertyGroup>
3132

3233
<PropertyGroup Condition="'$(APPVEYOR)' == 'True'">

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public partial class MainWindow : IDisposable
4444

4545
#region Private Fields
4646

47+
// Class Name
48+
private static readonly string ClassName = nameof(MainWindow);
49+
4750
// Dependency Injection
4851
private readonly Settings _settings;
4952
private readonly Theme _theme;
@@ -1256,14 +1259,21 @@ private void QueryTextBox_OnCopy(object sender, ExecutedRoutedEventArgs e)
12561259

12571260
private void QueryTextBox_OnPaste(object sender, DataObjectPastingEventArgs e)
12581261
{
1259-
var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
1260-
if (isText)
1261-
{
1262-
var text = e.SourceDataObject.GetData(DataFormats.UnicodeText) as string;
1263-
text = text.Replace(Environment.NewLine, " ");
1264-
DataObject data = new DataObject();
1265-
data.SetData(DataFormats.UnicodeText, text);
1266-
e.DataObject = data;
1262+
try
1263+
{
1264+
var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
1265+
if (isText)
1266+
{
1267+
var text = e.SourceDataObject.GetData(DataFormats.UnicodeText) as string;
1268+
text = text.Replace(Environment.NewLine, " ");
1269+
DataObject data = new DataObject();
1270+
data.SetData(DataFormats.UnicodeText, text);
1271+
e.DataObject = data;
1272+
}
1273+
}
1274+
catch (Exception ex)
1275+
{
1276+
App.API.LogException(ClassName, "Failed to paste text", ex);
12671277
}
12681278
}
12691279

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Threading.Tasks;
77
using Flow.Launcher.Plugin.BrowserBookmark.Helper;
88
using Flow.Launcher.Plugin.BrowserBookmark.Models;
9-
using Microsoft.Data.Sqlite;
109

1110
namespace Flow.Launcher.Plugin.BrowserBookmark;
1211

@@ -121,7 +120,7 @@ private static void EnumerateFolderBookmark(JsonElement folderElement, ICollecti
121120
}
122121
else
123122
{
124-
Main._context.API.LogError(ClassName, $"type property not found for {subElement.ToString()}");
123+
Main._context.API.LogError(ClassName, $"type property not found for {subElement.GetString() ?? string.Empty}");
125124
}
126125
}
127126
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ protected List<Bookmark> GetBookmarksFromPath(string placesPath)
6161
using var command = new SqliteCommand(QueryAllBookmarks, dbConnection);
6262
using var reader = command.ExecuteReader();
6363

64+
// Put results in list
6465
while (reader.Read())
6566
{
6667
bookmarks.Add(new Bookmark(
@@ -70,7 +71,6 @@ protected List<Bookmark> GetBookmarksFromPath(string placesPath)
7071
));
7172
}
7273

73-
7474
// Load favicons after loading bookmarks
7575
if (Main._settings.EnableFavicons)
7676
{
@@ -238,6 +238,33 @@ public static string MsixPlacesPath
238238
}
239239
}
240240

241+
/*
242+
Current profiles.ini structure example as of Firefox version 69.0.1
243+
244+
[Install736426B0AF4A39CB]
245+
Default=Profiles/7789f565.default-release <== this is the default profile this plugin will get the bookmarks from. When opened Firefox will load the default profile
246+
Locked=1
247+
248+
[Profile2]
249+
Name=dummyprofile
250+
IsRelative=0
251+
Path=C:\t6h2yuq8.dummyprofile <== Note this is a custom location path for the profile user can set, we need to cater for this in code.
252+
253+
[Profile1]
254+
Name=default
255+
IsRelative=1
256+
Path=Profiles/cydum7q4.default
257+
Default=1
258+
259+
[Profile0]
260+
Name=default-release
261+
IsRelative=1
262+
Path=Profiles/7789f565.default-release
263+
264+
[General]
265+
StartWithLastProfile=1
266+
Version=2
267+
*/
241268
private static string GetProfileIniPath(string profileFolderPath)
242269
{
243270
var profileIni = Path.Combine(profileFolderPath, @"profiles.ini");

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using System.Windows;
2-
using System.Windows.Controls;
32
using System.Windows.Input;
43
using CommunityToolkit.Mvvm.ComponentModel;
54
using Flow.Launcher.Plugin.BrowserBookmark.Models;
65

76
namespace Flow.Launcher.Plugin.BrowserBookmark.Views;
87

98
[INotifyPropertyChanged]
10-
public partial class SettingsControl : UserControl
9+
public partial class SettingsControl
1110
{
1211
public Settings Settings { get; }
1312
public CustomBrowser SelectedCustomBrowser { get; set; }
@@ -73,7 +72,8 @@ private void NewCustomBrowser(object sender, RoutedEventArgs e)
7372
{
7473
var newBrowser = new CustomBrowser();
7574
var window = new CustomBrowserSettingWindow(newBrowser);
76-
if (window.ShowDialog() == true)
75+
var result = window.ShowDialog() ?? false;
76+
if (result)
7777
{
7878
Settings.CustomChromiumBrowsers.Add(newBrowser);
7979
_ = Main.ReloadAllBookmarksAsync();

0 commit comments

Comments
 (0)