Skip to content

Commit d0c240f

Browse files
authored
Merge branch 'dev' into file_tooltip
2 parents 82f3e99 + a2ee428 commit d0c240f

File tree

8 files changed

+988
-796
lines changed

8 files changed

+988
-796
lines changed

Flow.Launcher/Resources/CustomControlTemplate.xaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,6 +2407,79 @@
24072407
</Setter.Value>
24082408
</Setter>
24092409
</Style>
2410+
2411+
<!-- Explorer Plugin Expander -->
2412+
<Style x:Key="ExpanderHeaderRightArrowStyle" TargetType="ToggleButton">
2413+
<Setter Property="Template">
2414+
<Setter.Value>
2415+
<ControlTemplate TargetType="ToggleButton">
2416+
<Border x:Name="RootBorder" Background="Transparent" Padding="16,15,16,15">
2417+
<Grid>
2418+
<Grid.ColumnDefinitions>
2419+
<ColumnDefinition Width="*" />
2420+
<ColumnDefinition Width="Auto" />
2421+
</Grid.ColumnDefinitions>
2422+
2423+
<ContentPresenter
2424+
Grid.Column="0"
2425+
VerticalAlignment="Center"
2426+
HorizontalAlignment="Left"
2427+
RecognizesAccessKey="True"
2428+
SnapsToDevicePixels="True"
2429+
Content="{TemplateBinding Content}"
2430+
Margin="8 0 0 0"
2431+
ContentTemplate="{TemplateBinding ContentTemplate}" />
2432+
2433+
<Grid Grid.Column="1"
2434+
Width="20" Height="20"
2435+
Margin="8 0 4 0"
2436+
VerticalAlignment="Center"
2437+
HorizontalAlignment="Right"
2438+
Background="Transparent"
2439+
RenderTransformOrigin="0.5,0.5"
2440+
x:Name="ChevronGrid">
2441+
<Grid.RenderTransform>
2442+
<RotateTransform Angle="0"/>
2443+
</Grid.RenderTransform>
2444+
<Ellipse
2445+
x:Name="circle"
2446+
Width="19"
2447+
Height="19"
2448+
Stroke="Transparent"
2449+
HorizontalAlignment="Center"
2450+
VerticalAlignment="Center"/>
2451+
<Path
2452+
x:Name="arrow"
2453+
Data="M 1,1.5 L 4.5,5 L 8,1.5"
2454+
Stroke="#666"
2455+
StrokeThickness="1"
2456+
SnapsToDevicePixels="False"
2457+
HorizontalAlignment="Center"
2458+
VerticalAlignment="Center" />
2459+
</Grid>
2460+
</Grid>
2461+
</Border>
2462+
2463+
<ControlTemplate.Triggers>
2464+
<Trigger Property="IsChecked" Value="True">
2465+
<Setter TargetName="arrow" Property="Data" Value="M 1,4.5 L 4.5,1 L 8,4.5" />
2466+
</Trigger>
2467+
<Trigger Property="IsMouseOver" Value="True">
2468+
<Setter TargetName="RootBorder" Property="Background" Value="{DynamicResource CustomExpanderHover}" />
2469+
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
2470+
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color05B}" />
2471+
</Trigger>
2472+
<Trigger Property="IsPressed" Value="True">
2473+
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
2474+
<Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
2475+
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color17B}" />
2476+
</Trigger>
2477+
</ControlTemplate.Triggers>
2478+
</ControlTemplate>
2479+
</Setter.Value>
2480+
</Setter>
2481+
</Style>
2482+
24102483
<Style x:Key="ExpanderStyle1" TargetType="{x:Type Expander}">
24112484
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
24122485
<Setter Property="Background" Value="Transparent" />

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

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public override List<Bookmark> GetBookmarks()
270270
/// <summary>
271271
/// Path to places.sqlite
272272
/// </summary>
273+
/// <remarks></remarks>
273274
private static string PlacesPath
274275
{
275276
get
@@ -295,12 +296,50 @@ private static string PlacesPath
295296

296297
var indexOfDefaultProfileAttributePath = lines.IndexOf("Path=" + defaultProfileFolderName);
297298

299+
/*
300+
Current profiles.ini structure example as of Firefox version 69.0.1
301+
302+
[Install736426B0AF4A39CB]
303+
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
304+
Locked=1
305+
306+
[Profile2]
307+
Name=newblahprofile
308+
IsRelative=0
309+
Path=C:\t6h2yuq8.newblahprofile <== Note this is a custom location path for the profile user can set, we need to cater for this in code.
310+
311+
[Profile1]
312+
Name=default
313+
IsRelative=1
314+
Path=Profiles/cydum7q4.default
315+
Default=1
316+
317+
[Profile0]
318+
Name=default-release
319+
IsRelative=1
320+
Path=Profiles/7789f565.default-release
321+
322+
[General]
323+
StartWithLastProfile=1
324+
Version=2
325+
*/
298326
// Seen in the example above, the IsRelative attribute is always above the Path attribute
327+
328+
var relativePath = Path.Combine(defaultProfileFolderName, "places.sqlite");
329+
var absoluePath = Path.Combine(profileFolderPath, relativePath);
330+
331+
// If the index is out of range, it means that the default profile is in a custom location or the file is malformed
332+
// If the profile is in a custom location, we need to check
333+
if (indexOfDefaultProfileAttributePath - 1 < 0 ||
334+
indexOfDefaultProfileAttributePath - 1 >= lines.Count)
335+
{
336+
return Directory.Exists(absoluePath) ? absoluePath : relativePath;
337+
}
338+
299339
var relativeAttribute = lines[indexOfDefaultProfileAttributePath - 1];
300340

301341
return relativeAttribute == "0" // See above, the profile is located in a custom location, path is not relative, so IsRelative=0
302-
? defaultProfileFolderName + @"\places.sqlite"
303-
: Path.Combine(profileFolderPath, defaultProfileFolderName) + @"\places.sqlite";
342+
? relativePath : absoluePath;
304343
}
305344
}
306345
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@
166166
<system:String x:Key="flowlauncher_plugin_everything_enable_content_search">Do you want to enable content search for Everything?</system:String>
167167
<system:String x:Key="flowlauncher_plugin_everything_enable_content_search_tips">It can be very slow without index (which is only supported in Everything v1.5+)</system:String>
168168

169+
<system:String x:Key="flowlauncher_plugin_everything_not_found">Unable to find Everything.exe</system:String>
170+
<system:String x:Key="flowlauncher_plugin_everything_install_issue">Failed to install Everything, please install it manually</system:String>
171+
169172
<!-- Native Context Menu -->
170173
<system:String x:Key="plugin_explorer_native_context_menu_header">Native Context Menu</system:String>
171174
<system:String x:Key="plugin_explorer_native_context_menu_display_context_menu">Display native context menu (experimental)</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
1111
{
1212
public class EverythingSearchManager : IIndexProvider, IContentIndexProvider, IPathIndexProvider
1313
{
14+
private static readonly string ClassName = nameof(EverythingSearchManager);
15+
1416
private Settings Settings { get; }
1517

1618
public EverythingSearchManager(Settings settings)
@@ -42,19 +44,32 @@ private async ValueTask ThrowIfEverythingNotAvailableAsync(CancellationToken tok
4244

4345
private async ValueTask<bool> ClickToInstallEverythingAsync(ActionContext _)
4446
{
45-
var installedPath = await EverythingDownloadHelper.PromptDownloadIfNotInstallAsync(Settings.EverythingInstalledPath, Main.Context.API);
47+
try
48+
{
49+
var installedPath = await EverythingDownloadHelper.PromptDownloadIfNotInstallAsync(Settings.EverythingInstalledPath, Main.Context.API);
50+
51+
if (installedPath == null)
52+
{
53+
Main.Context.API.ShowMsgError(Main.Context.API.GetTranslation("flowlauncher_plugin_everything_not_found"));
54+
Main.Context.API.LogError(ClassName, "Unable to find Everything.exe");
55+
56+
return false;
57+
}
4658

47-
if (installedPath == null)
59+
Settings.EverythingInstalledPath = installedPath;
60+
Process.Start(installedPath, "-startup");
61+
62+
return true;
63+
}
64+
// Sometimes Everything installation will fail because of permission issues or file not found issues
65+
// Just let the user know that Everything is not installed properly and ask them to install it manually
66+
catch (Exception e)
4867
{
49-
Main.Context.API.ShowMsgError("Unable to find Everything.exe");
68+
Main.Context.API.ShowMsgError(Main.Context.API.GetTranslation("flowlauncher_plugin_everything_install_issue"));
69+
Main.Context.API.LogException(ClassName, "Failed to install Everything", e);
5070

5171
return false;
5272
}
53-
54-
Settings.EverythingInstalledPath = installedPath;
55-
Process.Start(installedPath, "-startup");
56-
57-
return true;
5873
}
5974

6075
public async IAsyncEnumerable<SearchResult> SearchAsync(string search, [EnumeratorCancellation] CancellationToken token)

0 commit comments

Comments
 (0)