From 7a5fc1c534e90e7af1e3a3cdbb5696c5fb31766a Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 25 Jun 2024 16:35:32 +0900 Subject: [PATCH 1/5] Add Exception handling for qttabbar --- .../UserSettings/Settings.cs | 9 +++- Flow.Launcher/PublicAPIInstance.cs | 45 +++++++++++++------ 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 0c7de10fd78..5e66eaff90b 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -91,7 +91,6 @@ public string Theme public double? SettingWindowTop { get; set; } = null; public double? SettingWindowLeft { get; set; } = null; public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal; - public int CustomExplorerIndex { get; set; } = 0; [JsonIgnore] @@ -132,6 +131,14 @@ public CustomExplorerViewModel CustomExplorer Path = "Files", DirectoryArgument = "-select \"%d\"", FileArgument = "-select \"%f\"" + }, + new() + { + Name = "QTTabBar", + Path = "Explorer", + DirectoryArgument = "\"%d\"", + FileArgument = "\"%f\"", + Editable = false } }; diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index b49bf39d3c5..c35dcc2babe 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -25,6 +25,7 @@ using System.Collections.Concurrent; using System.Diagnostics; using System.Collections.Specialized; +using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher { @@ -228,21 +229,39 @@ public void SavePluginSettings() public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null) { - using var explorer = new Process(); + var customExplorerList = _settingsVM.Settings.CustomExplorerList; var explorerInfo = _settingsVM.Settings.CustomExplorer; - explorer.StartInfo = new ProcessStartInfo + + var qttabbarIndex = customExplorerList.FindIndex(e => e.Name.Equals("QTTABBAR", StringComparison.OrdinalIgnoreCase)); + var isQttabbarSelected = qttabbarIndex >= 0 && _settingsVM.Settings.CustomExplorerIndex == qttabbarIndex; + + if (isQttabbarSelected) { - FileName = explorerInfo.Path, - UseShellExecute = true, - Arguments = FileNameOrFilePath is null - ? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) - : explorerInfo.FileArgument - .Replace("%d", DirectoryPath) - .Replace("%f", - Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath) - ) - }; - explorer.Start(); + Process.Start(new ProcessStartInfo + { + FileName = DirectoryPath, + UseShellExecute = true, + Verb = "open", + Arguments = FileNameOrFilePath + }); + } + else + { + using var explorer = new Process(); + explorer.StartInfo = new ProcessStartInfo + { + FileName = explorerInfo.Path, + UseShellExecute = true, + Arguments = FileNameOrFilePath is null + ? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) + : explorerInfo.FileArgument + .Replace("%d", DirectoryPath) + .Replace("%f", + Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath) + ) + }; + explorer.Start(); + } } private void OpenUri(Uri uri, bool? inPrivate = null) From 6223d3a570ef265a82ae2fba082d34d37b2ffdd2 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 25 Jun 2024 17:05:11 +0900 Subject: [PATCH 2/5] Simplify compare selected indexe part --- Flow.Launcher/PublicAPIInstance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index c35dcc2babe..5470c2ddd65 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -233,7 +233,7 @@ public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null var explorerInfo = _settingsVM.Settings.CustomExplorer; var qttabbarIndex = customExplorerList.FindIndex(e => e.Name.Equals("QTTABBAR", StringComparison.OrdinalIgnoreCase)); - var isQttabbarSelected = qttabbarIndex >= 0 && _settingsVM.Settings.CustomExplorerIndex == qttabbarIndex; + var isQttabbarSelected = qttabbarIndex == _settingsVM.Settings.CustomExplorerIndex; if (isQttabbarSelected) { From c0afb197c21866008a2df16b6209f2f28c695aa9 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 1 Jul 2024 21:02:07 +1000 Subject: [PATCH 3/5] allow custom explorer profile's File Manager Path to replace with path greater flexibility with custom explorer profile --- .../UserSettings/Settings.cs | 9 +--- Flow.Launcher/PublicAPIInstance.cs | 44 ++++++------------- 2 files changed, 14 insertions(+), 39 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7291017fb58..125447d8398 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -91,6 +91,7 @@ public string Theme public double? SettingWindowTop { get; set; } = null; public double? SettingWindowLeft { get; set; } = null; public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal; + public int CustomExplorerIndex { get; set; } = 0; [JsonIgnore] @@ -131,14 +132,6 @@ public CustomExplorerViewModel CustomExplorer Path = "Files", DirectoryArgument = "-select \"%d\"", FileArgument = "-select \"%f\"" - }, - new() - { - Name = "QTTabBar", - Path = "Explorer", - DirectoryArgument = "\"%d\"", - FileArgument = "\"%f\"", - Editable = false } }; diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 5470c2ddd65..20b02ddee8b 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -25,7 +25,6 @@ using System.Collections.Concurrent; using System.Diagnostics; using System.Collections.Specialized; -using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher { @@ -229,39 +228,22 @@ public void SavePluginSettings() public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null) { - var customExplorerList = _settingsVM.Settings.CustomExplorerList; + using var explorer = new Process(); var explorerInfo = _settingsVM.Settings.CustomExplorer; - var qttabbarIndex = customExplorerList.FindIndex(e => e.Name.Equals("QTTABBAR", StringComparison.OrdinalIgnoreCase)); - var isQttabbarSelected = qttabbarIndex == _settingsVM.Settings.CustomExplorerIndex; - - if (isQttabbarSelected) - { - Process.Start(new ProcessStartInfo - { - FileName = DirectoryPath, - UseShellExecute = true, - Verb = "open", - Arguments = FileNameOrFilePath - }); - } - else + explorer.StartInfo = new ProcessStartInfo { - using var explorer = new Process(); - explorer.StartInfo = new ProcessStartInfo - { - FileName = explorerInfo.Path, - UseShellExecute = true, - Arguments = FileNameOrFilePath is null - ? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) - : explorerInfo.FileArgument - .Replace("%d", DirectoryPath) - .Replace("%f", - Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath) - ) - }; - explorer.Start(); - } + FileName = explorerInfo.Path.Replace("%d", DirectoryPath), + UseShellExecute = true, + Arguments = FileNameOrFilePath is null + ? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) + : explorerInfo.FileArgument + .Replace("%d", DirectoryPath) + .Replace("%f", + Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath) + ) + }; + explorer.Start(); } private void OpenUri(Uri uri, bool? inPrivate = null) From bdbde14355d15595852fbf5d1ec52a9d9e782443 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 2 Jul 2024 11:14:30 +0900 Subject: [PATCH 4/5] Change 'Arg For Folder' and 'Arg For File' inputs to not be required --- Flow.Launcher/SelectFileManagerWindow.xaml | 50 ++++++++++------------ 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/Flow.Launcher/SelectFileManagerWindow.xaml b/Flow.Launcher/SelectFileManagerWindow.xaml index 776cf66e1b5..399ef679b0a 100644 --- a/Flow.Launcher/SelectFileManagerWindow.xaml +++ b/Flow.Launcher/SelectFileManagerWindow.xaml @@ -57,11 +57,11 @@ - - + + - + - +