mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
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.
This commit is contained in:
parent
00a80ae7a7
commit
4dd7833603
3 changed files with 126 additions and 58 deletions
|
|
@ -98,8 +98,11 @@
|
|||
<system:String x:Key="plugin_explorer_deletefilefolder">Delete</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefile_subtitle">Permanently delete current file</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefolder_subtitle">Permanently delete current folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_path">Path:</system:String>
|
||||
<system:String x:Key="plugin_explorer_name">Name:</system:String>
|
||||
<system:String x:Key="plugin_explorer_name">Name</system:String>
|
||||
<system:String x:Key="plugin_explorer_type">Type</system:String>
|
||||
<system:String x:Key="plugin_explorer_path">Path</system:String>
|
||||
<system:String x:Key="plugin_explorer_file">File</system:String>
|
||||
<system:String x:Key="plugin_explorer_folder">Folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefilefolder_subtitle">Delete the selected</system:String>
|
||||
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
|
||||
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<Window x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
Width="Auto"
|
||||
Height="255"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Width"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window
|
||||
x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
Width="Auto"
|
||||
Height="300"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Width"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
|
|
@ -58,55 +59,91 @@
|
|||
<StackPanel Margin="26 0 26 0">
|
||||
<StackPanel Margin="0 0 0 12">
|
||||
<TextBlock
|
||||
Margin="0 0 0 0"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
TextAlignment="Left" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Name -->
|
||||
<TextBlock
|
||||
MinWidth="150"
|
||||
Margin="0 10 15 10"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_name}" />
|
||||
<TextBox
|
||||
Margin="10 0 0 0"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="10 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Width="250"
|
||||
Text="{Binding SelectedName, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
|
||||
|
||||
<!-- Type -->
|
||||
<TextBlock
|
||||
MinWidth="150"
|
||||
Margin="0 10 15 10"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_type}" />
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<RadioButton
|
||||
Margin="10 10 0 0"
|
||||
Content="{DynamicResource plugin_explorer_file}"
|
||||
GroupName="PathType"
|
||||
IsChecked="{Binding IsFileSelected}" />
|
||||
<RadioButton
|
||||
Margin="10 10 0 0"
|
||||
Content="{DynamicResource plugin_explorer_folder}"
|
||||
GroupName="PathType"
|
||||
IsChecked="{Binding IsFolderSelected}" />
|
||||
</StackPanel>
|
||||
<!-- Path -->
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_path}" />
|
||||
|
||||
|
||||
<TextBox
|
||||
Margin="10 0 0 0"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Margin="10 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Width="250"
|
||||
Text="{Binding SelectedPath, Mode=TwoWay}"
|
||||
IsReadOnly="True" />
|
||||
IsReadOnly="True"
|
||||
Text="{Binding SelectedPath, Mode=TwoWay}" />
|
||||
<Button
|
||||
Width="80"
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Height="Auto"
|
||||
Margin="10 0 0 0"
|
||||
MinWidth="80"
|
||||
Margin="10 10 0 0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource select}"
|
||||
Click="SelectPath_OnClick" />
|
||||
</StackPanel>
|
||||
|
||||
Click="SelectPath_OnClick"
|
||||
Content="{DynamicResource select}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Border
|
||||
|
|
@ -118,15 +155,15 @@
|
|||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="145"
|
||||
Height="30"
|
||||
Margin="0 0 5 0"
|
||||
Height="38"
|
||||
Margin="0 0 5 1"
|
||||
Click="BtnCancel_OnClick"
|
||||
Content="{DynamicResource cancel}" />
|
||||
<Button
|
||||
Name="DownButton"
|
||||
Width="145"
|
||||
Height="30"
|
||||
Margin="5 0 0 0"
|
||||
Height="38"
|
||||
Margin="5 0 0 1"
|
||||
Click="OnDoneButtonClick"
|
||||
Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
|
||||
|
|
@ -134,4 +171,4 @@
|
|||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
|
|
@ -49,9 +49,9 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
|
||||
private bool IsEdit { get; }
|
||||
private AccessLink SelectedAccessLink { get; }
|
||||
|
||||
|
||||
public ObservableCollection<AccessLink> QuickAccessLinks { get; }
|
||||
|
||||
|
||||
public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks)
|
||||
{
|
||||
IsEdit = false;
|
||||
|
|
@ -96,7 +96,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
}
|
||||
|
||||
// If editing, update the existing link
|
||||
if (IsEdit)
|
||||
if (IsEdit)
|
||||
{
|
||||
if (SelectedAccessLink == null) return;
|
||||
|
||||
|
|
@ -130,12 +130,30 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
|
||||
private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
|
||||
{
|
||||
var folderBrowserDialog = new FolderBrowserDialog();
|
||||
// Open file or folder selection dialog based on the selected radio button
|
||||
if (IsFileSelected)
|
||||
{
|
||||
var openFileDialog = new Microsoft.Win32.OpenFileDialog
|
||||
{
|
||||
Multiselect = false,
|
||||
CheckFileExists = true,
|
||||
CheckPathExists = true
|
||||
};
|
||||
|
||||
if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
return;
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
SelectedPath = openFileDialog.FileName;
|
||||
}
|
||||
}
|
||||
else // Folder selection
|
||||
{
|
||||
var folderBrowserDialog = new FolderBrowserDialog();
|
||||
|
||||
SelectedPath = folderBrowserDialog.SelectedPath;
|
||||
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
SelectedPath = folderBrowserDialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
|
@ -144,4 +162,14 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public bool IsFileSelected { get; set; }
|
||||
public bool IsFolderSelected { get; set; }
|
||||
|
||||
public QuickAccessLinkSettings()
|
||||
{
|
||||
IsFolderSelected = true; // Default to folder selection
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue