Skip to content

Commit c5dfb68

Browse files
committed
Adds option to force using entry Title as key Comment
1 parent 8c8865b commit c5dfb68

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

KeeAgent/KeeAgentExt.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public sealed partial class KeeAgentExt : Plugin
6464
pluginNamespace + ".UserPicksKeyOnRequestIdentities";
6565
const string ignoreMissingExternalKeyFilesName = pluginNamespace + ".IgnoreMissingExternalKeyFilesName";
6666
const string disableKeyDecryptionProgressBarName = pluginNamespace + ".DisableKeyDecryptionProgressBar";
67+
const string useTitleAsComment = pluginNamespace + ".UseTitleAsComment";
6768
const string keyFilePathSprPlaceholder = @"{KEEAGENT:KEYFILEPATH}";
6869
const string identFileOptSprPlaceholder = @"{KEEAGENT:IDENTFILEOPT}";
6970
const string groupMenuItemName = "KeeAgentGroupMenuItem";
@@ -672,6 +673,7 @@ private void LoadOptions()
672673
config.GetBool(userPicksKeyOnRequestIdentitiesOptionName, false);
673674
Options.IgnoreMissingExternalKeyFiles = config.GetBool(ignoreMissingExternalKeyFilesName, false);
674675
Options.DisableKeyDecryptionProgressBar = config.GetBool(disableKeyDecryptionProgressBarName, false);
676+
Options.UseTitleAsComment = config.GetBool(useTitleAsComment, false);
675677

676678
string defaultLogFileNameValue = Path.Combine(
677679
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
@@ -1084,7 +1086,7 @@ public ISshKey AddEntry(PwEntry entry,
10841086
try {
10851087
var key = entry.GetSshKey(this.Options.DisableKeyDecryptionProgressBar);
10861088

1087-
if (String.IsNullOrEmpty(key.Comment)) {
1089+
if (Options.UseTitleAsComment || String.IsNullOrEmpty(key.Comment)) {
10881090
key.Comment = entry.Strings.GetSafe("Title").ReadString();
10891091
}
10901092

KeeAgent/Options.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,10 @@ public Options()
112112
/// When <c>true</c>, we will not display a progress bar during SSH key decryption.
113113
/// </summary>
114114
public bool DisableKeyDecryptionProgressBar { get; set; }
115+
116+
/// <summary>
117+
/// When <c>true</c>, use the entry's title as the key's comment.
118+
/// </summary>
119+
public static bool UseTitleAsComment { get; set; }
115120
}
116121
}

KeeAgent/Translatable.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

KeeAgent/Translatable.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,7 @@
221221
<data name="OptionUseWindowsOpenSshPipe" xml:space="preserve">
222222
<value>Enable agent for Windows OpenSSH</value>
223223
</data>
224+
<data name="OptionUseTitleAsComment" xml:space="preserve">
225+
<value>Use entry Title as key Comment</value>
226+
</data>
224227
</root>

KeeAgent/UI/OptionsPanel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public OptionsPanel(KeeAgentExt ext)
6565
optionsList.CreateItem(ext.Options, "DisableKeyDecryptionProgressBar",
6666
optionsGroup, Translatable.OptionDisableKeyDecryptionProgressBar);
6767

68+
optionsList.CreateItem(ext.Options, "UseTitleAsComment",
69+
optionsGroup, Translatable.OptionUseTitleAsComment);
70+
6871
var agentModeOptionsGroup = new ListViewGroup("agentMode",
6972
"Agent Mode Options (no effect in Client Mode)");
7073
customListViewEx.Groups.Add(agentModeOptionsGroup);

0 commit comments

Comments
 (0)