Commits

Devin Martin committed 0fad92c

Add menu item outside of the context menu.

Comments (0)

Files changed (1)

-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 otpDialogToolStripItem;
         private ToolStripItem otpCopyToolStripItem;
 
+        private ToolStripItem otpTopDialogToolStripItem;
+        private ToolStripItem otpTopSeperatorToolStripItem;
+
         public override bool Initialize(IPluginHost host)
         {
             if (host == null)
 
             SprEngine.FilterCompile += new EventHandler<SprEventArgs>(SprEngine_FilterCompile);
 
+            this.otpTopSeperatorToolStripItem = new ToolStripSeparator();
+            host.MainWindow.ToolsMenu.DropDownItems.Add(this.otpTopSeperatorToolStripItem);
+            this.otpTopDialogToolStripItem = host.MainWindow.ToolsMenu.DropDownItems.Add("Timed One Time Password",
+                null,
+                otpDialogToolStripItem_Click);
+
             return true; // Initialization successful
         }
 
             menu.Remove(otpSeperatorToolStripItem);
             menu.Remove(otpDialogToolStripItem);
             menu.Remove(otpCopyToolStripItem);
+
+            var toolsMenu = host.MainWindow.ToolsMenu;
+            toolsMenu.DropDownItems.Remove(this.otpTopSeperatorToolStripItem);
+            toolsMenu.DropDownItems.Remove(this.otpTopDialogToolStripItem);
         }
 
         void otpDialogToolStripItem_Click(object sender, EventArgs e)