(MainWindow): [Ctrl+Ins] copies selected filenames to clipboard.

This commit is contained in:
morkt 2017-01-04 21:43:42 +04:00
parent b3973db7f0
commit 2f4d258694
2 changed files with 12 additions and 0 deletions

View File

@ -277,6 +277,7 @@
<KeyBinding Gesture="Ctrl+E" Command="{x:Static local:Commands.ExploreItem}"/>
<KeyBinding Gesture="F2" Command="{x:Static local:Commands.RenameItem}"/>
<KeyBinding Gesture="Space" Command="{x:Static local:Commands.NextItem}"/>
<KeyBinding Gesture="Ctrl+Insert" Command="{x:Static local:Commands.CopyNames}"/>
<MouseBinding Gesture="LeftDoubleClick" Command="{x:Static local:Commands.OpenItem}" />
</ListView.InputBindings>
<ListView.ItemContainerStyle>
@ -380,6 +381,7 @@
<CommandBinding Command="{x:Static local:Commands.OpenRecent}" Executed="OpenRecentExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.AddSelection}" Executed="AddSelectionExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.SelectAll}" Executed="SelectAllExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.CopyNames}" Executed="CopyNamesExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.NextItem}" Executed="NextItemExec" CanExecute="CanExecuteAlways"/>
<CommandBinding Command="{x:Static local:Commands.ExtractItem}" Executed="ExtractItemExec" CanExecute="CanExecuteExtract"/>
<CommandBinding Command="{x:Static local:Commands.CreateArchive}" Executed="CreateArchiveExec" CanExecute="CanExecuteCreateArchive"/>

View File

@ -1194,6 +1194,15 @@ namespace GARbro.GUI
CurrentDirectory.SelectAll();
}
void CopyNamesExec (object sender, ExecutedRoutedEventArgs e)
{
var names = CurrentDirectory.SelectedItems.Cast<EntryViewModel>().Select (f => f.Name);
if (names.Any())
{
Clipboard.SetText (string.Join ("\r\n", names));
}
}
void NextItemExec (object sender, ExecutedRoutedEventArgs e)
{
if (LookupActive)
@ -1442,5 +1451,6 @@ namespace GARbro.GUI
public static readonly RoutedCommand SelectAll = new RoutedCommand();
public static readonly RoutedCommand SetFileType = new RoutedCommand();
public static readonly RoutedCommand NextItem = new RoutedCommand();
public static readonly RoutedCommand CopyNames = new RoutedCommand();
}
}