File tree Expand file tree Collapse file tree 5 files changed +49
-2
lines changed Expand file tree Collapse file tree 5 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 114
114
<x : String x : Key =" Text.Configure.User.Placeholder" xml : space =" preserve" >User name for this repository</x : String >
115
115
<x : String x : Key =" Text.Copy" xml : space =" preserve" >Copy</x : String >
116
116
<x : String x : Key =" Text.CopyPath" xml : space =" preserve" >Copy Path</x : String >
117
+ <x : String x : Key =" Text.CopyFileName" xml : space =" preserve" >Copy File Name</x : String >
117
118
<x : String x : Key =" Text.CreateBranch" xml : space =" preserve" >Create Branch</x : String >
118
119
<x : String x : Key =" Text.CreateBranch.BasedOn" xml : space =" preserve" >Based On :</x : String >
119
120
<x : String x : Key =" Text.CreateBranch.Checkout" xml : space =" preserve" >Check out after created</x : String >
Original file line number Diff line number Diff line change 117
117
<x : String x : Key =" Text.Configure.User.Placeholder" xml : space =" preserve" >应用于本仓库的用户名</x : String >
118
118
<x : String x : Key =" Text.Copy" xml : space =" preserve" >复制</x : String >
119
119
<x : String x : Key =" Text.CopyPath" xml : space =" preserve" >复制路径</x : String >
120
+ <x : String x : Key =" Text.CopyFileName" xml : space =" preserve" >复制文件名</x : String >
120
121
<x : String x : Key =" Text.CreateBranch" xml : space =" preserve" >新建分支</x : String >
121
122
<x : String x : Key =" Text.CreateBranch.BasedOn" xml : space =" preserve" >新分支基于 :</x : String >
122
123
<x : String x : Key =" Text.CreateBranch.Checkout" xml : space =" preserve" >完成后切换到新分支</x : String >
Original file line number Diff line number Diff line change 10
10
using Avalonia . Threading ;
11
11
12
12
using CommunityToolkit . Mvvm . ComponentModel ;
13
+ using SourceGit . Models ;
13
14
14
15
namespace SourceGit . ViewModels
15
16
{
@@ -218,7 +219,17 @@ public ContextMenu CreateChangeContextMenu(Models.Change change)
218
219
ev . Handled = true ;
219
220
} ;
220
221
menu . Items . Add ( copyPath ) ;
221
-
222
+ var copyFileName = new MenuItem ( )
223
+ {
224
+ Header = App . Text ( "CopyFileName" ) ,
225
+ Icon = App . CreateMenuIcon ( "Icon.Copy" ) ,
226
+ } ;
227
+ copyFileName . Click += ( _ , e ) =>
228
+ {
229
+ App . CopyText ( Path . GetFileName ( change . Path ) ) ;
230
+ e . Handled = true ;
231
+ } ;
232
+ menu . Items . Add ( copyFileName ) ;
222
233
return menu ;
223
234
}
224
235
@@ -284,12 +295,24 @@ public ContextMenu CreateRevisionFileContextMenu(Models.Object file)
284
295
ev . Handled = true ;
285
296
} ;
286
297
298
+ var copyFileName = new MenuItem ( )
299
+ {
300
+ Header = App . Text ( "CopyFileName" ) ,
301
+ Icon = App . CreateMenuIcon ( "Icon.Copy" ) ,
302
+ } ;
303
+ copyFileName . Click += ( _ , e ) =>
304
+ {
305
+ App . CopyText ( Path . GetFileName ( file . Path ) ) ;
306
+ e . Handled = true ;
307
+ } ;
308
+
287
309
var menu = new ContextMenu ( ) ;
288
310
menu . Items . Add ( history ) ;
289
311
menu . Items . Add ( blame ) ;
290
312
menu . Items . Add ( explore ) ;
291
313
menu . Items . Add ( saveAs ) ;
292
314
menu . Items . Add ( copyPath ) ;
315
+ menu . Items . Add ( copyFileName ) ;
293
316
return menu ;
294
317
}
295
318
Original file line number Diff line number Diff line change @@ -183,6 +183,17 @@ public ContextMenu CreateChangeContextMenu()
183
183
} ;
184
184
185
185
menu . Items . Add ( copyPath ) ;
186
+ var copyFileName = new MenuItem ( )
187
+ {
188
+ Header = App . Text ( "CopyFileName" ) ,
189
+ Icon = App . CreateMenuIcon ( "Icon.Copy" ) ,
190
+ } ;
191
+ copyFileName . Click += ( _ , e ) =>
192
+ {
193
+ App . CopyText ( Path . GetFileName ( change . Path ) ) ;
194
+ e . Handled = true ;
195
+ } ;
196
+ menu . Items . Add ( copyFileName ) ;
186
197
return menu ;
187
198
}
188
199
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ public void Cleanup()
209
209
_unstaged . Clear ( ) ;
210
210
OnPropertyChanged ( nameof ( Unstaged ) ) ;
211
211
}
212
-
212
+
213
213
if ( _staged != null )
214
214
{
215
215
_staged . Clear ( ) ;
@@ -584,6 +584,17 @@ public ContextMenu CreateContextMenuForUnstagedChanges()
584
584
e . Handled = true ;
585
585
} ;
586
586
menu . Items . Add ( copy ) ;
587
+ var copyFileName = new MenuItem ( )
588
+ {
589
+ Header = App . Text ( "CopyFileName" ) ,
590
+ Icon = App . CreateMenuIcon ( "Icon.Copy" ) ,
591
+ } ;
592
+ copyFileName . Click += ( _ , e ) =>
593
+ {
594
+ App . CopyText ( Path . GetFileName ( change . Path ) ) ;
595
+ e . Handled = true ;
596
+ } ;
597
+ menu . Items . Add ( copyFileName ) ;
587
598
}
588
599
else
589
600
{
You can’t perform that action at this time.
0 commit comments