ux: tooltip of commit signing status icon

* do NOT show signer if it is not available
* new tooltip style

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-10-30 15:01:08 +08:00
parent 4e87b25765
commit 195325187d
No known key found for this signature in database
3 changed files with 23 additions and 10 deletions

View file

@ -26,7 +26,7 @@
return new Models.CommitSignInfo() return new Models.CommitSignInfo()
{ {
VerifyResult = lines[0][0], VerifyResult = lines[0][0],
Signer = string.IsNullOrEmpty(lines[1]) ? "<UnKnown>" : lines[1], Signer = lines[1],
Key = lines[2] Key = lines[2]
}; };

View file

@ -37,19 +37,19 @@ namespace SourceGit.Models
switch (VerifyResult) switch (VerifyResult)
{ {
case 'G': case 'G':
return $"Good signature.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Good signature.";
case 'B':
return $"Bad signature.\n\nSigner: {Signer}\n\nKey: {Key}";
case 'U': case 'U':
return $"Good signature with unknown validity.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Good signature with unknown validity.";
case 'X': case 'X':
return $"Good signature but has expired.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Good signature but has expired.";
case 'Y': case 'Y':
return $"Good signature made by expired key.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Good signature made by expired key.";
case 'R': case 'R':
return $"Good signature made by a revoked key.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Good signature made by a revoked key.";
case 'B':
return "Bad signature.";
case 'E': case 'E':
return $"Signature cannot be checked.\n\nSigner: {Signer}\n\nKey: {Key}"; return "Signature cannot be checked.";
default: default:
return "No signature."; return "No signature.";
} }

View file

@ -81,7 +81,20 @@
<ContentControl.DataTemplates> <ContentControl.DataTemplates>
<DataTemplate DataType="m:CommitSignInfo"> <DataTemplate DataType="m:CommitSignInfo">
<Border Width="24" Background="Transparent" ToolTip.Tip="{Binding ToolTip}"> <Border Width="24" Background="Transparent">
<ToolTip.Tip>
<StackPanel Orientation="Vertical">
<TextBlock Margin="0,0,0,12" Text="{Binding ToolTip}"/>
<TextBlock Margin="0,0,0,2" IsVisible="{Binding Signer, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
<Run Text="Signer:"/>
<Run Text="{Binding Signer}"/>
</TextBlock>
<TextBlock>
<Run Text="KEY:"/>
<Run Text="{Binding Key}"/>
</TextBlock>
</StackPanel>
</ToolTip.Tip>
<Path Width="14" Height="14" Data="{StaticResource Icons.Verified}" Fill="{Binding Brush}"/> <Path Width="14" Height="14" Data="{StaticResource Icons.Verified}" Fill="{Binding Brush}"/>
</Border> </Border>
</DataTemplate> </DataTemplate>