Skip to content
Merged
7 changes: 5 additions & 2 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 />
Expand Down Expand Up @@ -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
Expand All @@ -118,20 +155,20 @@
<Button
x:Name="btnCancel"
Width="145"
Height="30"
Margin="0 0 5 0"
Height="34"
Margin="0 0 5 1"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
Name="DownButton"
Width="145"
Height="30"
Margin="5 0 0 0"
Height="34"
Margin="5 0 0 1"
Click="OnDoneButtonClick"
Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
</Button>
</StackPanel>
</Border>
</Grid>
</Window>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public string SelectedName

private bool IsEdit { get; }
private AccessLink SelectedAccessLink { get; }

public ObservableCollection<AccessLink> QuickAccessLinks { get; }

public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks)
{
IsEdit = false;
Expand Down Expand Up @@ -96,7 +96,7 @@ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
}

// If editing, update the existing link
if (IsEdit)
if (IsEdit)
{
if (SelectedAccessLink == null) return;

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

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;
Expand All @@ -144,4 +162,14 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
{
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