Skip to content

Commit 02c559f

Browse files
committed
Adds option to force using entry Title as key Comment
1 parent 7e7f032 commit 02c559f

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

KeeAgent/KeeAgentExt.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public sealed partial class KeeAgentExt : Plugin
6363
const string userPicksKeyOnRequestIdentitiesOptionName =
6464
pluginNamespace + ".UserPicksKeyOnRequestIdentities";
6565
const string ignoreMissingExternalKeyFilesName = pluginNamespace + ".IgnoreMissingExternalKeyFilesName";
66+
const string useTitleAsComment = pluginNamespace + ".UseTitleAsComment";
6667
const string keyFilePathSprPlaceholder = @"{KEEAGENT:KEYFILEPATH}";
6768
const string identFileOptSprPlaceholder = @"{KEEAGENT:IDENTFILEOPT}";
6869
const string groupMenuItemName = "KeeAgentGroupMenuItem";
@@ -639,6 +640,7 @@ private void LoadOptions()
639640
Options.UserPicksKeyOnRequestIdentities =
640641
config.GetBool(userPicksKeyOnRequestIdentitiesOptionName, false);
641642
Options.IgnoreMissingExternalKeyFiles = config.GetBool(ignoreMissingExternalKeyFilesName, false);
643+
Options.UseTitleAsComment = config.GetBool(useTitleAsComment, false);
642644

643645
string defaultLogFileNameValue = Path.Combine(
644646
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
@@ -1050,7 +1052,7 @@ public ISshKey AddEntry(PwEntry entry,
10501052
try {
10511053
var key = entry.GetSshKey();
10521054

1053-
if (String.IsNullOrEmpty(key.Comment)) {
1055+
if (Options.UseTitleAsComment || String.IsNullOrEmpty(key.Comment)) {
10541056
key.Comment = entry.Strings.GetSafe("Title").ReadString();
10551057
}
10561058

KeeAgent/Options.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,7 @@ public Options()
107107
/// in the filesystem.
108108
/// </summary>
109109
public static bool IgnoreMissingExternalKeyFiles { get; set; }
110+
111+
public static bool UseTitleAsComment { get; set; }
110112
}
111113
}

KeeAgent/Translatable.Designer.cs

Lines changed: 9 additions & 1 deletion
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
@@ -218,4 +218,7 @@
218218
<data name="OptionUseWindowsOpenSshPipe" xml:space="preserve">
219219
<value>Enable agent for Windows OpenSSH</value>
220220
</data>
221+
<data name="OptionUseTitleAsComment" xml:space="preserve">
222+
<value>Use entry Title as key Comment</value>
223+
</data>
221224
</root>

KeeAgent/UI/OptionsPanel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public OptionsPanel(KeeAgentExt ext)
6363
optionsList.CreateItem(ext.Options, "IgnoreMissingExternalKeyFiles",
6464
optionsGroup, Translatable.OptionIgnoreMissingExternalKeyFiles);
6565

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

0 commit comments

Comments
 (0)