Devin Martin avatar 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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.