diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 1e92ae38..bd4cfc56 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -700,6 +700,8 @@ URL: Logs CLEAR ALL + Copy + Delete Warning Welcome Page Create Group diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 0471285f..7546b3c4 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -704,6 +704,8 @@ 仓库地址 : 日志列表 清空日志 + 复制 + 删除 警告 起始页 新建分组 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index edd8cf8c..61921ea4 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -704,6 +704,8 @@ 存放庫網址: 日誌清單 清除所有日誌 + 複製 + 刪除 警告 起始頁 新增群組 diff --git a/src/Views/ViewLogs.axaml b/src/Views/ViewLogs.axaml index 125caa22..9c1ae435 100644 --- a/src/Views/ViewLogs.axaml +++ b/src/Views/ViewLogs.axaml @@ -67,35 +67,30 @@ - + - + - - + + - - - - diff --git a/src/Views/ViewLogs.axaml.cs b/src/Views/ViewLogs.axaml.cs index 624ff21e..62bf288d 100644 --- a/src/Views/ViewLogs.axaml.cs +++ b/src/Views/ViewLogs.axaml.cs @@ -97,10 +97,33 @@ namespace SourceGit.Views InitializeComponent(); } - private void OnRemoveLog(object sender, RoutedEventArgs e) + private void OnLogContextRequested(object sender, ContextRequestedEventArgs e) { - if (sender is Button { DataContext: ViewModels.CommandLog log } && DataContext is ViewModels.ViewLogs vm) + if (sender is not Grid { DataContext: ViewModels.CommandLog log } grid || DataContext is not ViewModels.ViewLogs vm) + return; + + var copy = new MenuItem(); + copy.Header = App.Text("ViewLogs.CopyLog"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, ev) => + { + App.CopyText(log.Content); + ev.Handled = true; + }; + + var rm = new MenuItem(); + rm.Header = App.Text("ViewLogs.Delete"); + rm.Icon = App.CreateMenuIcon("Icons.Clear"); + rm.Click += (_, ev) => + { vm.Logs.Remove(log); + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(copy); + menu.Items.Add(rm); + menu.Open(grid); e.Handled = true; }