Skip to content

Commit 98056ad

Browse files
Jack251970TBM13
authored andcommitted
Merge pull request Flow-Launcher#3848 from Flow-Launcher/sys_plugin_improvement
Improve Sys plugin
1 parent 064180d commit 98056ad

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,5 +502,11 @@ public interface IPublicAPI
502502
/// Invoked when the actual theme of the application has changed. Currently, the plugin will continue to be subscribed even if it is turned off.
503503
/// </summary>
504504
event ActualApplicationThemeChangedEventHandler ActualApplicationThemeChanged;
505+
506+
/// <summary>
507+
/// Get the user data directory of Flow Launcher.
508+
/// </summary>
509+
/// <returns></returns>
510+
string GetDataDirectory();
505511
}
506512
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,8 @@ public event ActualApplicationThemeChangedEventHandler ActualApplicationThemeCha
552552
remove => _mainVM.ActualApplicationThemeChanged -= value;
553553
}
554554

555+
public string GetDataDirectory() => DataLocation.DataDirectory();
556+
555557
#endregion
556558

557559
#region Private Methods

Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
</PropertyGroup>
3838

3939
<ItemGroup>
40-
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
4140
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
4241
</ItemGroup>
4342

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_restart_computer">Are you sure you want to restart the computer?</system:String>
4040
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_restart_computer_advanced">Are you sure you want to restart the computer with Advanced Boot Options?</system:String>
4141
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_logoff_computer">Are you sure you want to log off?</system:String>
42+
<system:String x:Key="flowlauncher_plugin_sys_dlgtitle_error">Error</system:String>
43+
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_empty_recycle_bin_failed">Failed to empty the recycle bin. This might happen if:{0}- Some items are currently in use{0}- Some items can't be deleted due to permissions{0}Please close any applications that might be using these files and try again.</system:String>
4244

4345
<system:String x:Key="flowlauncher_plugin_sys_command_keyword_setting_window_title">Command Keyword Setting</system:String>
4446
<system:String x:Key="flowlauncher_plugin_sys_custom_command_keyword">Custom Command Keyword</system:String>

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,9 @@ private List<Result> Commands(Query query)
298298
var result = PInvoke.SHEmptyRecycleBin(new(), string.Empty, 0);
299299
if (result != HRESULT.S_OK && result != HRESULT.E_UNEXPECTED)
300300
{
301-
_context.API.ShowMsgBox("Failed to empty the recycle bin. This might happen if:\n" +
302-
"- A file in the recycle bin is in use\n" +
303-
"- You don't have permission to delete some items\n" +
304-
"Please close any applications that might be using these files and try again.",
305-
"Error",
301+
_context.API.ShowMsgBox(
302+
string.Format(_context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_empty_recycle_bin_failed"), Environment.NewLine),
303+
_context.API.GetTranslation("flowlauncher_plugin_sys_dlgtitle_error"),
306304
MessageBoxButton.OK, MessageBoxImage.Error);
307305
}
308306

0 commit comments

Comments
 (0)