Skip to content

Commit 4dd7833

Browse files
committed
UI improvements and file/folder selection feature added
- Updated "Name" and "Path" keys and added new keys in en.xaml. - Modified QuickAccessLinkSettings.xaml: increased Window height and improved layout using Grid structure. - Added new UI elements: implemented radio buttons for file/folder selection. - Added and initialized QuickAccessLinks property in QuickAccessLinkSettings.xaml.cs. - Added file selection dialog in SelectPath_OnClick method. - Added IsFileSelected and IsFolderSelected properties to implement selection functionality.
1 parent 00a80ae commit 4dd7833

File tree

3 files changed

+126
-58
lines changed

3 files changed

+126
-58
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@
9898
<system:String x:Key="plugin_explorer_deletefilefolder">Delete</system:String>
9999
<system:String x:Key="plugin_explorer_deletefile_subtitle">Permanently delete current file</system:String>
100100
<system:String x:Key="plugin_explorer_deletefolder_subtitle">Permanently delete current folder</system:String>
101-
<system:String x:Key="plugin_explorer_path">Path:</system:String>
102-
<system:String x:Key="plugin_explorer_name">Name:</system:String>
101+
<system:String x:Key="plugin_explorer_name">Name</system:String>
102+
<system:String x:Key="plugin_explorer_type">Type</system:String>
103+
<system:String x:Key="plugin_explorer_path">Path</system:String>
104+
<system:String x:Key="plugin_explorer_file">File</system:String>
105+
<system:String x:Key="plugin_explorer_folder">Folder</system:String>
103106
<system:String x:Key="plugin_explorer_deletefilefolder_subtitle">Delete the selected</system:String>
104107
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
105108
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
Lines changed: 86 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
<Window x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
6-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7-
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
8-
Width="Auto"
9-
Height="255"
10-
Background="{DynamicResource PopuBGColor}"
11-
DataContext="{Binding RelativeSource={RelativeSource Self}}"
12-
Foreground="{DynamicResource PopupTextColor}"
13-
ResizeMode="NoResize"
14-
SizeToContent="Width"
15-
WindowStartupLocation="CenterScreen"
16-
mc:Ignorable="d">
17-
<WindowChrome.WindowChrome>
18-
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
19-
</WindowChrome.WindowChrome>
1+
<Window
2+
x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
9+
Width="Auto"
10+
Height="300"
11+
Background="{DynamicResource PopuBGColor}"
12+
DataContext="{Binding RelativeSource={RelativeSource Self}}"
13+
Foreground="{DynamicResource PopupTextColor}"
14+
ResizeMode="NoResize"
15+
SizeToContent="Width"
16+
WindowStartupLocation="CenterScreen"
17+
mc:Ignorable="d">
18+
<WindowChrome.WindowChrome>
19+
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
20+
</WindowChrome.WindowChrome>
2021
<Grid>
2122
<Grid.RowDefinitions>
2223
<RowDefinition />
@@ -58,55 +59,91 @@
5859
<StackPanel Margin="26 0 26 0">
5960
<StackPanel Margin="0 0 0 12">
6061
<TextBlock
61-
Margin="0 0 0 0"
6262
FontSize="20"
6363
FontWeight="SemiBold"
6464
Text="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
6565
TextAlignment="Left" />
6666
</StackPanel>
67-
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
67+
68+
<Grid>
69+
<Grid.ColumnDefinitions>
70+
<ColumnDefinition Width="Auto" MinWidth="100" />
71+
<ColumnDefinition Width="*" />
72+
<ColumnDefinition Width="Auto" />
73+
</Grid.ColumnDefinitions>
74+
<Grid.RowDefinitions>
75+
<RowDefinition Height="Auto" />
76+
<RowDefinition Height="Auto" />
77+
<RowDefinition Height="Auto" />
78+
</Grid.RowDefinitions>
79+
80+
<!-- Name -->
6881
<TextBlock
69-
MinWidth="150"
70-
Margin="0 10 15 10"
71-
HorizontalAlignment="Left"
82+
Grid.Row="0"
83+
Grid.Column="0"
84+
Margin="0 10 0 0"
7285
VerticalAlignment="Center"
7386
FontSize="14"
7487
Text="{DynamicResource plugin_explorer_name}" />
7588
<TextBox
76-
Margin="10 0 0 0"
89+
Grid.Row="0"
90+
Grid.Column="1"
91+
Margin="10 10 0 0"
7792
VerticalAlignment="Center"
7893
FontSize="12"
79-
Width="250"
8094
Text="{Binding SelectedName, Mode=TwoWay}" />
81-
</StackPanel>
82-
83-
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
95+
96+
<!-- Type -->
8497
<TextBlock
85-
MinWidth="150"
86-
Margin="0 10 15 10"
87-
HorizontalAlignment="Left"
98+
Grid.Row="1"
99+
Grid.Column="0"
100+
Margin="0 10 0 0"
101+
VerticalAlignment="Center"
102+
FontSize="14"
103+
Text="{DynamicResource plugin_explorer_type}" />
104+
<StackPanel
105+
Grid.Row="1"
106+
Grid.Column="1"
107+
Orientation="Horizontal">
108+
<RadioButton
109+
Margin="10 10 0 0"
110+
Content="{DynamicResource plugin_explorer_file}"
111+
GroupName="PathType"
112+
IsChecked="{Binding IsFileSelected}" />
113+
<RadioButton
114+
Margin="10 10 0 0"
115+
Content="{DynamicResource plugin_explorer_folder}"
116+
GroupName="PathType"
117+
IsChecked="{Binding IsFolderSelected}" />
118+
</StackPanel>
119+
<!-- Path -->
120+
<TextBlock
121+
Grid.Row="2"
122+
Grid.Column="0"
123+
Margin="0 10 0 0"
88124
VerticalAlignment="Center"
89125
FontSize="14"
90126
Text="{DynamicResource plugin_explorer_path}" />
91-
92-
93127
<TextBox
94-
Margin="10 0 0 0"
128+
Grid.Row="2"
129+
Grid.Column="1"
130+
Width="250"
131+
Margin="10 10 0 0"
95132
VerticalAlignment="Center"
96133
FontSize="12"
97-
Width="250"
98-
Text="{Binding SelectedPath, Mode=TwoWay}"
99-
IsReadOnly="True" />
134+
IsReadOnly="True"
135+
Text="{Binding SelectedPath, Mode=TwoWay}" />
100136
<Button
101-
Width="80"
137+
Grid.Row="2"
138+
Grid.Column="2"
102139
Height="Auto"
103-
Margin="10 0 0 0"
140+
MinWidth="80"
141+
Margin="10 10 0 0"
104142
HorizontalAlignment="Left"
105143
VerticalAlignment="Center"
106-
Content="{DynamicResource select}"
107-
Click="SelectPath_OnClick" />
108-
</StackPanel>
109-
144+
Click="SelectPath_OnClick"
145+
Content="{DynamicResource select}" />
146+
</Grid>
110147
</StackPanel>
111148
</StackPanel>
112149
<Border
@@ -118,20 +155,20 @@
118155
<Button
119156
x:Name="btnCancel"
120157
Width="145"
121-
Height="30"
122-
Margin="0 0 5 0"
158+
Height="38"
159+
Margin="0 0 5 1"
123160
Click="BtnCancel_OnClick"
124161
Content="{DynamicResource cancel}" />
125162
<Button
126163
Name="DownButton"
127164
Width="145"
128-
Height="30"
129-
Margin="5 0 0 0"
165+
Height="38"
166+
Margin="5 0 0 1"
130167
Click="OnDoneButtonClick"
131168
Style="{StaticResource AccentButtonStyle}">
132169
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
133170
</Button>
134171
</StackPanel>
135172
</Border>
136173
</Grid>
137-
</Window>
174+
</Window>

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public string SelectedName
4949

5050
private bool IsEdit { get; }
5151
private AccessLink SelectedAccessLink { get; }
52-
52+
5353
public ObservableCollection<AccessLink> QuickAccessLinks { get; }
54-
54+
5555
public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks)
5656
{
5757
IsEdit = false;
@@ -96,7 +96,7 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
9696
}
9797

9898
// If editing, update the existing link
99-
if (IsEdit)
99+
if (IsEdit)
100100
{
101101
if (SelectedAccessLink == null) return;
102102

@@ -130,12 +130,30 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
130130

131131
private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
132132
{
133-
var folderBrowserDialog = new FolderBrowserDialog();
133+
// Open file or folder selection dialog based on the selected radio button
134+
if (IsFileSelected)
135+
{
136+
var openFileDialog = new Microsoft.Win32.OpenFileDialog
137+
{
138+
Multiselect = false,
139+
CheckFileExists = true,
140+
CheckPathExists = true
141+
};
134142

135-
if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
136-
return;
143+
if (openFileDialog.ShowDialog() == true)
144+
{
145+
SelectedPath = openFileDialog.FileName;
146+
}
147+
}
148+
else // Folder selection
149+
{
150+
var folderBrowserDialog = new FolderBrowserDialog();
137151

138-
SelectedPath = folderBrowserDialog.SelectedPath;
152+
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
153+
{
154+
SelectedPath = folderBrowserDialog.SelectedPath;
155+
}
156+
}
139157
}
140158

141159
public event PropertyChangedEventHandler PropertyChanged;
@@ -144,4 +162,14 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
144162
{
145163
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
146164
}
165+
166+
public bool IsFileSelected { get; set; }
167+
public bool IsFolderSelected { get; set; }
168+
169+
public QuickAccessLinkSettings()
170+
{
171+
IsFolderSelected = true; // Default to folder selection
172+
InitializeComponent();
173+
DataContext = this;
174+
}
147175
}

0 commit comments

Comments
 (0)