Skip to content

Commit 72159d4

Browse files
committed
Adjust priority to command and open directory to command
1 parent 21ba7bf commit 72159d4

File tree

5 files changed

+31
-14
lines changed

5 files changed

+31
-14
lines changed

Flow.Launcher/PriorityChangeWindow.xaml.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Flow.Launcher.Core.Plugin;
22
using Flow.Launcher.Core.Resource;
3-
using Flow.Launcher.Infrastructure.UserSettings;
43
using Flow.Launcher.Plugin;
54
using Flow.Launcher.ViewModel;
65
using System;
@@ -23,14 +22,12 @@ namespace Flow.Launcher
2322
public partial class PriorityChangeWindow : Window
2423
{
2524
private readonly PluginPair plugin;
26-
private Settings settings;
2725
private readonly Internationalization translater = InternationalizationManager.Instance;
2826
private readonly PluginViewModel pluginViewModel;
29-
public PriorityChangeWindow(string pluginId, Settings settings, PluginViewModel pluginViewModel)
27+
public PriorityChangeWindow(string pluginId, PluginViewModel pluginViewModel)
3028
{
3129
InitializeComponent();
3230
plugin = PluginManager.GetPluginForId(pluginId);
33-
this.settings = settings;
3431
this.pluginViewModel = pluginViewModel;
3532
if (plugin == null)
3633
{
@@ -74,4 +71,4 @@ private void PriorityChangeWindow_Loaded(object sender, RoutedEventArgs e)
7471
}
7572
}
7673
}
77-
}
74+
}

Flow.Launcher/SettingWindow.xaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,9 +1355,14 @@
13551355
Cursor="Hand"
13561356
FontSize="11"
13571357
Foreground="{DynamicResource PluginInfoColor}"
1358-
MouseUp="OnPluginDirecotyClick"
13591358
Text="{DynamicResource pluginDirectory}"
1360-
TextDecorations="Underline" />
1359+
TextDecorations="Underline" >
1360+
<TextBlock.InputBindings>
1361+
<MouseBinding
1362+
Command="{Binding OpenPluginDirectoryCommand}"
1363+
MouseAction="LeftClick"/>
1364+
</TextBlock.InputBindings>
1365+
</TextBlock>
13611366
</StackPanel>
13621367

13631368
</ItemsControl>

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private void OnPluginPriorityClick(object sender, RoutedEventArgs e)
189189
{
190190
if (sender is Control { DataContext: PluginViewModel pluginViewModel })
191191
{
192-
PriorityChangeWindow priorityChangeWindow = new PriorityChangeWindow(pluginViewModel.PluginPair.Metadata.ID, settings, pluginViewModel);
192+
PriorityChangeWindow priorityChangeWindow = new PriorityChangeWindow(pluginViewModel.PluginPair.Metadata.ID, pluginViewModel);
193193
priorityChangeWindow.ShowDialog();
194194
}
195195
}
@@ -328,8 +328,6 @@ private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs
328328
var name = viewModel.SelectedPlugin.PluginPair.Metadata.Name;
329329
viewModel.DisplayPluginQuery($"uninstall {name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
330330
}
331-
332-
333331
}
334332

335333
private void OnExternalPluginUninstallClick(object sender, RoutedEventArgs e)

Flow.Launcher/ViewModel/PluginViewModel.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ public bool IsExpanded
5454
set
5555
{
5656
_isExpanded = value;
57-
57+
5858
OnPropertyChanged();
5959
OnPropertyChanged(nameof(SettingControl));
6060
}
6161
}
6262

6363
private Control _settingControl;
6464
private bool _isExpanded;
65-
public Control SettingControl
65+
public Control SettingControl
6666
=> IsExpanded
6767
? _settingControl
6868
??= PluginPair.Plugin is not ISettingProvider settingProvider
69-
? new Control()
70-
: settingProvider.CreateSettingPanel()
69+
? new Control()
70+
: settingProvider.CreateSettingPanel()
7171
: null;
7272
private ImageSource _image = ImageLoader.DefaultImage;
7373

@@ -89,6 +89,21 @@ public void ChangePriority(int newPriority)
8989
OnPropertyChanged(nameof(Priority));
9090
}
9191

92+
[RelayCommand]
93+
private void EditPluginPriority()
94+
{
95+
PriorityChangeWindow priorityChangeWindow = new PriorityChangeWindow(PluginPair.Metadata.ID, this);
96+
priorityChangeWindow.ShowDialog();
97+
}
98+
99+
[RelayCommand]
100+
private void OpenPluginDirectory()
101+
{
102+
var directory = PluginPair.Metadata.PluginDirectory;
103+
if (!string.IsNullOrEmpty(directory))
104+
PluginManager.API.OpenDirectory(directory);
105+
}
106+
92107
public static bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
93108

94109
[RelayCommand]

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ private async Task RefreshExternalPluginsAsync()
356356
await PluginsManifest.UpdateManifestAsync();
357357
OnPropertyChanged(nameof(ExternalPlugins));
358358
}
359+
360+
359361

360362
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
361363
{

0 commit comments

Comments
 (0)