Skip to content

Commit aadfde0

Browse files
committed
Add tips for file manager usage and improve error messages
1 parent 2c7fb93 commit aadfde0

File tree

3 files changed

+66
-5
lines changed

3 files changed

+66
-5
lines changed

Flow.Launcher/Languages/en.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,16 @@
366366

367367
<!-- FileManager Setting Dialog -->
368368
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
369+
<system:String x:Key="fileManager_files_btn">Do you use Files?</system:String>
370+
<system:String x:Key="fileManager_files_tips">Depending on the version, Files may use either "Files" or "Files-stable" as its path. (This can vary depending on which version you're using.) For more details, see:</system:String>
369371
<system:String x:Key="fileManager_tips">Please specify the file location of the file manager you using and add arguments as required. The &quot;%d&quot; represents the directory path to open for, used by the Arg for Folder field and for commands opening specific directories. The &quot;%f&quot; represents the file path to open for, used by the Arg for File field and for commands opening specific files.</system:String>
370372
<system:String x:Key="fileManager_tips2">For example, if the file manager uses a command such as &quot;totalcmd.exe /A c:\windows&quot; to open the c:\windows directory, the File Manager Path will be totalcmd.exe, and the Arg For Folder will be /A &quot;%d&quot;. Certain file managers like QTTabBar may just require a path to be supplied, in this instance use &quot;%d&quot; as the File Manager Path and leave the rest of the fileds blank.</system:String>
371373
<system:String x:Key="fileManager_name">File Manager</system:String>
372374
<system:String x:Key="fileManager_profile_name">Profile Name</system:String>
373375
<system:String x:Key="fileManager_path">File Manager Path</system:String>
374376
<system:String x:Key="fileManager_directory_arg">Arg For Folder</system:String>
375377
<system:String x:Key="fileManager_file_arg">Arg For File</system:String>
376-
<system:String x:Key="fileManagerPathNotFound">The path for the file manager '{0}' could not be found: {1}\n\nDo you want to continue?</system:String>
378+
<system:String x:Key="fileManagerPathNotFound">The path for the file manager '{0}' could not be found: '{1}' Do you want to continue?</system:String>
377379
<system:String x:Key="fileManagerPathError">File Manager Path Error</system:String>
378380

379381
<!-- DefaultBrowser Setting Dialog -->
@@ -465,8 +467,12 @@
465467
<system:String x:Key="reportWindow_copy_below">2. Copy below exception message</system:String>
466468

467469
<!-- File Open Error -->
468-
<system:String x:Key="folderOpenError">An error occurred while opening the folder.:\n{0}</system:String>
470+
<system:String x:Key="fileManagerNotFoundTitle">File Manager Error</system:String>
471+
<system:String x:Key="fileManagerNotFound">
472+
The specified file manager could not be found. Please check the Custom File Manager setting under Settings >General.
473+
</system:String>
469474
<system:String x:Key="errorTitle">Error</system:String>
475+
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
470476

471477
<!-- General Notice -->
472478
<system:String x:Key="pleaseWait">Please wait...</system:String>

Flow.Launcher/SelectFileManagerWindow.xaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,18 @@
7373
<TextBlock Margin="0 14 0 0" FontSize="14">
7474
<TextBlock Text="{DynamicResource fileManager_tips2}" TextWrapping="WrapWithOverflow" />
7575
</TextBlock>
76+
<Button
77+
x:Name="btnTips"
78+
Margin="0 14 0 0"
79+
HorizontalAlignment="Left"
80+
Click="btnTips_Click"
81+
Content="{DynamicResource fileManager_files_btn}" />
7682
</StackPanel>
77-
78-
<StackPanel Margin="14 28 0 0" Orientation="Horizontal">
83+
<Rectangle
84+
Height="1"
85+
Margin="0 20 0 20"
86+
Fill="{StaticResource SeparatorForeground}" />
87+
<StackPanel Margin="14 0 0 0" Orientation="Horizontal">
7988
<TextBlock
8089
Grid.Column="1"
8190
HorizontalAlignment="Left"
@@ -111,7 +120,7 @@
111120
<Rectangle
112121
Height="1"
113122
Margin="0 20 0 12"
114-
Fill="{StaticResource Color03B}" />
123+
Fill="{StaticResource SeparatorForeground}" />
115124
<StackPanel
116125
Margin="0 0 0 0"
117126
HorizontalAlignment="Stretch"

Flow.Launcher/SelectFileManagerWindow.xaml.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
using System.Linq;
77
using System.Windows;
88
using System.Windows.Controls;
9+
using System.Windows.Documents;
910
using CommunityToolkit.Mvvm.ComponentModel;
1011
using Flow.Launcher.Infrastructure.UserSettings;
1112
using Flow.Launcher.ViewModel;
13+
using ModernWpf.Controls;
1214

1315
namespace Flow.Launcher
1416
{
@@ -102,6 +104,50 @@ private bool IsFileManagerValid(string path)
102104
}
103105
}
104106

107+
private async void btnTips_Click(object sender, RoutedEventArgs e)
108+
{
109+
string tipText = (string)Application.Current.Resources["fileManager_files_tips"];
110+
string url = "https://files.community/docs/contributing/updates";
111+
112+
var textBlock = new TextBlock
113+
{
114+
FontSize = 14,
115+
TextWrapping = TextWrapping.Wrap,
116+
Margin = new Thickness(0, 0, 0, 0)
117+
};
118+
119+
textBlock.Inlines.Add(tipText);
120+
121+
Hyperlink hyperlink = new Hyperlink
122+
{
123+
NavigateUri = new Uri(url)
124+
};
125+
hyperlink.Inlines.Add(url);
126+
hyperlink.RequestNavigate += (s, args) =>
127+
{
128+
Process.Start(new ProcessStartInfo
129+
{
130+
FileName = args.Uri.AbsoluteUri,
131+
UseShellExecute = true
132+
});
133+
args.Handled = true;
134+
};
135+
136+
textBlock.Inlines.Add(hyperlink);
137+
138+
var tipsDialog = new ContentDialog()
139+
{
140+
Owner = Window.GetWindow(sender as DependencyObject),
141+
Title = (string)Application.Current.Resources["fileManager_files_btn"],
142+
Content = textBlock,
143+
PrimaryButtonText = (string)Application.Current.Resources["commonOK"],
144+
CornerRadius = new CornerRadius(8),
145+
Style = (Style)Application.Current.Resources["ContentDialog"]
146+
};
147+
148+
await tipsDialog.ShowAsync();
149+
}
150+
105151
private void btnAdd_Click(object sender, RoutedEventArgs e)
106152
{
107153
CustomExplorers.Add(new()

0 commit comments

Comments
 (0)