feature: add context menu to copy message of an annotated tag (#567)

This commit is contained in:
leo 2024-10-17 17:38:29 +08:00
parent fa2eb0cd26
commit 9e14327f3c
No known key found for this signature in database
4 changed files with 14 additions and 0 deletions

View file

@ -595,6 +595,7 @@
<x:String x:Key="Text.Submodule.Remove" xml:space="preserve">Delete Submodule</x:String> <x:String x:Key="Text.Submodule.Remove" xml:space="preserve">Delete Submodule</x:String>
<x:String x:Key="Text.Sure" xml:space="preserve">OK</x:String> <x:String x:Key="Text.Sure" xml:space="preserve">OK</x:String>
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copy Tag Name</x:String> <x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copy Tag Name</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Copy Tag Message</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Delete ${0}$...</x:String> <x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Delete ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Push ${0}$...</x:String> <x:String x:Key="Text.TagCM.Push" xml:space="preserve">Push ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String> <x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>

View file

@ -593,6 +593,7 @@
<x:String x:Key="Text.Submodule.Remove" xml:space="preserve">删除子模块</x:String> <x:String x:Key="Text.Submodule.Remove" xml:space="preserve">删除子模块</x:String>
<x:String x:Key="Text.Sure" xml:space="preserve">确 定</x:String> <x:String x:Key="Text.Sure" xml:space="preserve">确 定</x:String>
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">复制标签名</x:String> <x:String x:Key="Text.TagCM.Copy" xml:space="preserve">复制标签名</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">复制标签信息</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">删除 ${0}$...</x:String> <x:String x:Key="Text.TagCM.Delete" xml:space="preserve">删除 ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String> <x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">仓库地址 </x:String> <x:String x:Key="Text.URL" xml:space="preserve">仓库地址 </x:String>

View file

@ -598,6 +598,7 @@
<x:String x:Key="Text.Submodule.Remove" xml:space="preserve">刪除子模組</x:String> <x:String x:Key="Text.Submodule.Remove" xml:space="preserve">刪除子模組</x:String>
<x:String x:Key="Text.Sure" xml:space="preserve">確 定</x:String> <x:String x:Key="Text.Sure" xml:space="preserve">確 定</x:String>
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">複製標籤名稱</x:String> <x:String x:Key="Text.TagCM.Copy" xml:space="preserve">複製標籤名稱</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">複製標籤訊息</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">刪除 ${0}$...</x:String> <x:String x:Key="Text.TagCM.Delete" xml:space="preserve">刪除 ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String> <x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">存放庫網址:</x:String> <x:String x:Key="Text.URL" xml:space="preserve">存放庫網址:</x:String>

View file

@ -1829,6 +1829,16 @@ namespace SourceGit.ViewModels
ev.Handled = true; ev.Handled = true;
}; };
var copyMessage = new MenuItem();
copyMessage.Header = App.Text("TagCM.CopyMessage");
copyMessage.Icon = App.CreateMenuIcon("Icons.Copy");
copyMessage.IsEnabled = !string.IsNullOrEmpty(tag.Message);
copyMessage.Click += (_, ev) =>
{
App.CopyText(tag.Message);
ev.Handled = true;
};
var menu = new ContextMenu(); var menu = new ContextMenu();
menu.Items.Add(createBranch); menu.Items.Add(createBranch);
menu.Items.Add(new MenuItem() { Header = "-" }); menu.Items.Add(new MenuItem() { Header = "-" });
@ -1838,6 +1848,7 @@ namespace SourceGit.ViewModels
menu.Items.Add(archive); menu.Items.Add(archive);
menu.Items.Add(new MenuItem() { Header = "-" }); menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(copy); menu.Items.Add(copy);
menu.Items.Add(copyMessage);
return menu; return menu;
} }