File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change 20
20
using System . Windows . Media ;
21
21
using Flow . Launcher . Infrastructure . Hotkey ;
22
22
using Flow . Launcher . Plugin . SharedCommands ;
23
+ using System . IO ;
23
24
24
25
namespace Flow . Launcher
25
26
{
@@ -59,18 +60,31 @@ private void OnCopy(object sender, ExecutedRoutedEventArgs e)
59
60
{
60
61
var results = _viewModel . Results ;
61
62
var result = results . SelectedItem ? . Result ;
62
- if ( result != null ) // SelectedItem returns null if selection is empty.
63
+ if ( result != null )
63
64
{
64
- string _copyText = String . IsNullOrEmpty ( result . CopyText ) ? result . Title : result . CopyText ;
65
- System . Windows . Clipboard . SetDataObject ( _copyText . ToString ( ) ) ;
65
+ string copyText = String . IsNullOrEmpty ( result . CopyText ) ? result . SubTitle : result . CopyText ;
66
+ if ( File . Exists ( copyText ) || Directory . Exists ( copyText ) )
67
+ {
68
+
69
+ System . Collections . Specialized . StringCollection paths = new System . Collections . Specialized . StringCollection ( ) ;
70
+ paths . Add ( copyText ) ;
71
+
72
+ System . Windows . Clipboard . SetFileDropList ( paths ) ;
73
+
74
+ }
75
+ else
76
+ {
77
+ System . Windows . Clipboard . SetDataObject ( copyText . ToString ( ) ) ;
78
+ }
79
+
66
80
e . Handled = true ;
67
81
}
68
82
69
83
}
70
- // else if (!String.IsNullOrEmpty(QueryTextBox.Text))
71
- // {
72
- // System.Windows.Clipboard.SetDataObject(QueryTextBox.SelectedText);
73
- // }
84
+ else if ( ! String . IsNullOrEmpty ( QueryTextBox . Text ) )
85
+ {
86
+ System . Windows . Clipboard . SetDataObject ( QueryTextBox . SelectedText ) ;
87
+ }
74
88
e . Handled = false ;
75
89
}
76
90
private async void OnClosing ( object sender , CancelEventArgs e )
You can’t perform that action at this time.
0 commit comments