Commits

Devin Martin committed 66635fa

KeePass 2.21 added plugin specified placeholder hints. Take advantage of this in KeeOtp.

Comments (0)

Files changed (1)

KeeOtp/KeeOtpExt.cs

+using System;
+using System.Windows.Forms;
 using KeePass.Plugins;
 using KeePass.Util;
 using KeePass.Util.Spr;
 using KeePassLib;
 using KeePassLib.Utility;
 using OtpSharp;
-using System;
-using System.Windows.Forms;
 
 namespace KeeOtp
 {
 
         private ToolStripItem otpTopDialogToolStripItem;
         private ToolStripItem otpTopSeperatorToolStripItem;
+        private const string totpPlaceHolderHint = "{TOTP}";
 
         public override bool Initialize(IPluginHost host)
         {
                 Resources.clock,
                 otpDialogToolStripItem_Click);
 
+            // this adds a hint on the placeholder form under the "plugin provided" section of placeholders
+            SprEngine.FilterPlaceholderHints.Add(totpPlaceHolderHint);
+
             return true; // Initialization successful
         }
 
             var toolsMenu = host.MainWindow.ToolsMenu;
             toolsMenu.DropDownItems.Remove(this.otpTopSeperatorToolStripItem);
             toolsMenu.DropDownItems.Remove(this.otpTopDialogToolStripItem);
+
+            SprEngine.FilterPlaceholderHints.Remove(totpPlaceHolderHint);
         }
 
         void otpDialogToolStripItem_Click(object sender, EventArgs e)