Clarified the two ways of copying a chat

This commit is contained in:
Thorsten Sommer 2026-09-23 10:24:14 +02:00
parent d3ee7dbbec
commit 5d83e50c72
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 12 additions and 2 deletions

View File

@ -82,7 +82,7 @@ else
</MudTooltip>
<MudTooltip Text="@T("Copy chat")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Size="Size.Medium" Color="Color.Inherit" Disabled="@this.IsChatTreeItemBusy(treeItem)" OnClick="@(() => this.CopyChatAsync(treeItem.Path))"/>
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Size="Size.Medium" Color="Color.Inherit" Disabled="@this.IsChatTreeItemBusy(treeItem)" OnClick="@(() => this.CopyChatFromTreeAsync(treeItem.Path))"/>
</MudTooltip>
<MudTooltip Text="@T("Rename")" Placement="@WORKSPACE_ITEM_TOOLTIP_PLACEMENT">

View File

@ -799,7 +799,17 @@ public partial class Workspaces : MSGComponentBase
await this.LoadTreeItemsAsync(startPrefetch: false);
}
private async Task CopyChatAsync(string? chatPath)
/// <summary>
/// Copies the chat behind the copy button of a tree item and opens the copy.
/// </summary>
/// <param name="chatPath">The directory of the chat to copy.</param>
/// <remarks>
/// The copy itself is done by CopyChatAsync, which the chat toolbar uses as well. What this
/// handler adds is what only the tree needs: it finds the chat by its directory, and because it
/// opens the copy afterward, it asks first when the chat open right now has unsaved changes.
/// The chat toolbar asks nothing, since it copies the chat on the screen and keeps working in it.
/// </remarks>
private async Task CopyChatFromTreeAsync(string? chatPath)
{
var chat = await this.LoadChatAsync(chatPath, false);
if (chat is null)