From 12134ca47802182c15661ab7b5da2bd5161056dd Mon Sep 17 00:00:00 2001 From: rookiestyle Date: Sun, 19 Sep 2021 09:53:32 +0200 Subject: [PATCH] Set HotKeys in Alternate Auto-Type's options You can now define all hotkeys related to Auto-Type in Alternate Auto-Type's options: * Global Auto-Type * Global Auto-Type - password only * Alternate Auto-Type hotkey It's no longer required to switch to the Integration tab to set these hotkeys --- src/AlternateAutoType.cs | 6 +- src/Options.Designer.cs | 441 +++++++++++++++++---------------- src/Options.cs | 80 +++--- src/Properties/AssemblyInfo.cs | 11 +- version.info | 2 +- 5 files changed, 279 insertions(+), 261 deletions(-) diff --git a/src/AlternateAutoType.cs b/src/AlternateAutoType.cs index 2f0b911..34f0340 100644 --- a/src/AlternateAutoType.cs +++ b/src/AlternateAutoType.cs @@ -67,7 +67,7 @@ public override bool Initialize(IPluginHost host) GlobalWindowManager.WindowRemoved += OnWindowRemoved; Tools.OptionsFormShown += OptionsFormShown; - Tools.OptionsFormClosed += ConfigWrite; + Tools.OptionsFormClosed += OptionsForm_Closed; if (Config.PWEnter) WndProcHook.AddHandler(m_host.MainWindow, WndProcHandler); @@ -98,7 +98,7 @@ public override void Terminate() m_host.MainWindow.ToolsMenu.DropDownItems.Remove(m_menuItem); Tools.OptionsFormShown -= OptionsFormShown; - Tools.OptionsFormClosed -= ConfigWrite; + Tools.OptionsFormClosed -= OptionsForm_Closed; GlobalWindowManager.WindowAdded -= OnWindowAdded; GlobalWindowManager.WindowRemoved -= OnWindowRemoved; @@ -597,7 +597,7 @@ private void OptionsFormShown(object sender, Tools.OptionsFormsEventArgs e) Tools.AddPluginToOptionsForm(this, options); } - private void ConfigWrite(object sender, Tools.OptionsFormsEventArgs e) + private void OptionsForm_Closed(object sender, Tools.OptionsFormsEventArgs e) { if (e.form.DialogResult != DialogResult.OK) return; bool shown; diff --git a/src/Options.Designer.cs b/src/Options.Designer.cs index 1706e5f..0dd46c8 100644 --- a/src/Options.Designer.cs +++ b/src/Options.Designer.cs @@ -30,219 +30,238 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.gHotkeys = new System.Windows.Forms.GroupBox(); - this.cbPWEnter = new System.Windows.Forms.CheckBox(); - this.lGATP = new System.Windows.Forms.Label(); - this.tbGAT = new KeePass.UI.HotKeyControlEx(); - this.cbPWHotkey = new System.Windows.Forms.ComboBox(); - this.tbPWOnly = new KeePass.UI.HotKeyControlEx(); - this.lGAT = new System.Windows.Forms.Label(); - this.lAAT = new System.Windows.Forms.Label(); - this.tbAAT = new KeePass.UI.HotKeyControlEx(); - this.gIntegration = new System.Windows.Forms.GroupBox(); - this.cbColumnsRememberSort = new System.Windows.Forms.CheckBox(); - this.cbExcludeExpiredGroups = new System.Windows.Forms.CheckBox(); - this.cbKeepATOpen = new System.Windows.Forms.CheckBox(); - this.cbSpecialColumns = new System.Windows.Forms.CheckBox(); - this.cbDBColumn = new System.Windows.Forms.CheckBox(); - this.cbColumnsSortable = new System.Windows.Forms.CheckBox(); - this.gHotkeys.SuspendLayout(); - this.gIntegration.SuspendLayout(); - this.SuspendLayout(); - // - // gHotkeys - // - this.gHotkeys.Controls.Add(this.cbPWEnter); - this.gHotkeys.Controls.Add(this.lGATP); - this.gHotkeys.Controls.Add(this.tbGAT); - this.gHotkeys.Controls.Add(this.cbPWHotkey); - this.gHotkeys.Controls.Add(this.tbPWOnly); - this.gHotkeys.Controls.Add(this.lGAT); - this.gHotkeys.Controls.Add(this.lAAT); - this.gHotkeys.Controls.Add(this.tbAAT); - this.gHotkeys.Dock = System.Windows.Forms.DockStyle.Top; - this.gHotkeys.Location = new System.Drawing.Point(15, 5); - this.gHotkeys.Name = "gHotkeys"; - this.gHotkeys.Padding = new System.Windows.Forms.Padding(18); - this.gHotkeys.Size = new System.Drawing.Size(525, 180); - this.gHotkeys.TabIndex = 6; - this.gHotkeys.TabStop = false; - this.gHotkeys.Text = "Hotkeys"; - // - // cbPWEnter - // - this.cbPWEnter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.cbPWEnter.AutoSize = true; - this.cbPWEnter.Location = new System.Drawing.Point(260, 102); - this.cbPWEnter.Name = "cbPWEnter"; - this.cbPWEnter.Size = new System.Drawing.Size(108, 24); - this.cbPWEnter.TabIndex = 4; - this.cbPWEnter.Text = "PW+Enter"; - this.cbPWEnter.UseVisualStyleBackColor = true; - this.cbPWEnter.CheckedChanged += new System.EventHandler(this.cbPWEnter_CheckedChanged); - // - // lGATP - // - this.lGATP.AutoSize = true; - this.lGATP.Location = new System.Drawing.Point(15, 70); - this.lGATP.Name = "lGATP"; - this.lGATP.Size = new System.Drawing.Size(150, 20); - this.lGATP.TabIndex = 13; - this.lGATP.Text = "Autotype Password:"; - // - // tbGAT - // - this.tbGAT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.tbGAT.Location = new System.Drawing.Point(260, 28); - this.tbGAT.Name = "tbGAT"; - this.tbGAT.ReadOnly = true; - this.tbGAT.Size = new System.Drawing.Size(248, 26); - this.tbGAT.TabIndex = 1; - this.tbGAT.TabStop = false; - // - // cbPWHotkey - // - this.cbPWHotkey.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbPWHotkey.FormattingEnabled = true; - this.cbPWHotkey.Items.AddRange(new object[] { + this.gHotkeys = new System.Windows.Forms.GroupBox(); + this.cbPWEnter = new System.Windows.Forms.CheckBox(); + this.lGATP = new System.Windows.Forms.Label(); + this.tbGAT = new KeePass.UI.HotKeyControlEx(); + this.cbPWHotkey = new System.Windows.Forms.ComboBox(); + this.tbPWOnly = new KeePass.UI.HotKeyControlEx(); + this.lGAT = new System.Windows.Forms.Label(); + this.lAAT = new System.Windows.Forms.Label(); + this.tbAAT = new KeePass.UI.HotKeyControlEx(); + this.gIntegration = new System.Windows.Forms.GroupBox(); + this.cbColumnsRememberSort = new System.Windows.Forms.CheckBox(); + this.cbExcludeExpiredGroups = new System.Windows.Forms.CheckBox(); + this.cbKeepATOpen = new System.Windows.Forms.CheckBox(); + this.cbSpecialColumns = new System.Windows.Forms.CheckBox(); + this.cbDBColumn = new System.Windows.Forms.CheckBox(); + this.cbColumnsSortable = new System.Windows.Forms.CheckBox(); + this.gHotkeys.SuspendLayout(); + this.gIntegration.SuspendLayout(); + this.SuspendLayout(); + // + // gHotkeys + // + this.gHotkeys.Controls.Add(this.cbPWEnter); + this.gHotkeys.Controls.Add(this.lGATP); + this.gHotkeys.Controls.Add(this.tbGAT); + this.gHotkeys.Controls.Add(this.cbPWHotkey); + this.gHotkeys.Controls.Add(this.tbPWOnly); + this.gHotkeys.Controls.Add(this.lGAT); + this.gHotkeys.Controls.Add(this.lAAT); + this.gHotkeys.Controls.Add(this.tbAAT); + this.gHotkeys.Dock = System.Windows.Forms.DockStyle.Top; + this.gHotkeys.Location = new System.Drawing.Point(27, 8); + this.gHotkeys.Margin = new System.Windows.Forms.Padding(5); + this.gHotkeys.Name = "gHotkeys"; + this.gHotkeys.Padding = new System.Windows.Forms.Padding(32, 28, 32, 28); + this.gHotkeys.Size = new System.Drawing.Size(933, 279); + this.gHotkeys.TabIndex = 6; + this.gHotkeys.TabStop = false; + this.gHotkeys.Text = "Hotkeys"; + // + // cbPWEnter + // + this.cbPWEnter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cbPWEnter.AutoSize = true; + this.cbPWEnter.Location = new System.Drawing.Point(473, 158); + this.cbPWEnter.Margin = new System.Windows.Forms.Padding(5); + this.cbPWEnter.Name = "cbPWEnter"; + this.cbPWEnter.Size = new System.Drawing.Size(182, 36); + this.cbPWEnter.TabIndex = 4; + this.cbPWEnter.Text = "PW+Enter"; + this.cbPWEnter.UseVisualStyleBackColor = true; + this.cbPWEnter.CheckedChanged += new System.EventHandler(this.cbPWEnter_CheckedChanged); + // + // lGATP + // + this.lGATP.AutoSize = true; + this.lGATP.Location = new System.Drawing.Point(27, 108); + this.lGATP.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lGATP.Name = "lGATP"; + this.lGATP.Size = new System.Drawing.Size(267, 32); + this.lGATP.TabIndex = 13; + this.lGATP.Text = "Autotype Password:"; + // + // tbGAT + // + this.tbGAT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.tbGAT.Location = new System.Drawing.Point(462, 43); + this.tbGAT.Margin = new System.Windows.Forms.Padding(5); + this.tbGAT.Name = "tbGAT"; + this.tbGAT.Size = new System.Drawing.Size(438, 38); + this.tbGAT.TabIndex = 1; + this.tbGAT.TabStop = false; + this.tbGAT.TextChanged += new System.EventHandler(this.OnPropagateHotKeys); + // + // cbPWHotkey + // + this.cbPWHotkey.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbPWHotkey.FormattingEnabled = true; + this.cbPWHotkey.Items.AddRange(new object[] { "Password Only Hotkey", "Password+Enter Hotkey"}); - this.cbPWHotkey.Location = new System.Drawing.Point(15, 70); - this.cbPWHotkey.Name = "cbPWHotkey"; - this.cbPWHotkey.Size = new System.Drawing.Size(210, 28); - this.cbPWHotkey.TabIndex = 1; - // - // tbPWOnly - // - this.tbPWOnly.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.tbPWOnly.Location = new System.Drawing.Point(260, 70); - this.tbPWOnly.Name = "tbPWOnly"; - this.tbPWOnly.Size = new System.Drawing.Size(248, 26); - this.tbPWOnly.TabIndex = 3; - // - // lGAT - // - this.lGAT.AutoSize = true; - this.lGAT.Location = new System.Drawing.Point(15, 30); - this.lGAT.Name = "lGAT"; - this.lGAT.Size = new System.Drawing.Size(185, 20); - this.lGAT.TabIndex = 11; - this.lGAT.Text = "Global AutoType &Hotkey:"; - // - // lAAT - // - this.lAAT.AutoSize = true; - this.lAAT.Location = new System.Drawing.Point(15, 140); - this.lAAT.Name = "lAAT"; - this.lAAT.Size = new System.Drawing.Size(204, 20); - this.lAAT.TabIndex = 9; - this.lAAT.Text = "Alternate AutoType Hotkey:"; - // - // tbAAT - // - this.tbAAT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.tbAAT.Location = new System.Drawing.Point(260, 140); - this.tbAAT.Name = "tbAAT"; - this.tbAAT.Size = new System.Drawing.Size(248, 26); - this.tbAAT.TabIndex = 5; - // - // gIntegration - // - this.gIntegration.AutoSize = true; - this.gIntegration.Controls.Add(this.cbColumnsRememberSort); - this.gIntegration.Controls.Add(this.cbExcludeExpiredGroups); - this.gIntegration.Controls.Add(this.cbKeepATOpen); - this.gIntegration.Controls.Add(this.cbSpecialColumns); - this.gIntegration.Controls.Add(this.cbDBColumn); - this.gIntegration.Controls.Add(this.cbColumnsSortable); - this.gIntegration.Dock = System.Windows.Forms.DockStyle.Top; - this.gIntegration.Location = new System.Drawing.Point(15, 185); - this.gIntegration.Name = "gIntegration"; - this.gIntegration.Size = new System.Drawing.Size(525, 229); - this.gIntegration.TabIndex = 7; - this.gIntegration.TabStop = false; - this.gIntegration.Text = "Integration"; - // - // cbColumnsRememberSort - // - this.cbColumnsRememberSort.AutoSize = true; - this.cbColumnsRememberSort.Location = new System.Drawing.Point(35, 60); - this.cbColumnsRememberSort.Name = "cbColumnsRememberSort"; - this.cbColumnsRememberSort.Size = new System.Drawing.Size(205, 24); - this.cbColumnsRememberSort.TabIndex = 95; - this.cbColumnsRememberSort.Text = "Remember sort settings"; - this.cbColumnsRememberSort.UseVisualStyleBackColor = true; - // - // cbExcludeExpiredGroups - // - this.cbExcludeExpiredGroups.AutoSize = true; - this.cbExcludeExpiredGroups.Location = new System.Drawing.Point(15, 180); - this.cbExcludeExpiredGroups.Name = "cbExcludeExpiredGroups"; - this.cbExcludeExpiredGroups.Size = new System.Drawing.Size(199, 24); - this.cbExcludeExpiredGroups.TabIndex = 9; - this.cbExcludeExpiredGroups.Text = "Exclude expired groups"; - this.cbExcludeExpiredGroups.UseVisualStyleBackColor = true; - // - // cbKeepATOpen - // - this.cbKeepATOpen.AutoSize = true; - this.cbKeepATOpen.Location = new System.Drawing.Point(35, 150); - this.cbKeepATOpen.Name = "cbKeepATOpen"; - this.cbKeepATOpen.Size = new System.Drawing.Size(168, 24); - this.cbKeepATOpen.TabIndex = 8; - this.cbKeepATOpen.Text = "Keep window open"; - this.cbKeepATOpen.UseVisualStyleBackColor = true; - this.cbKeepATOpen.CheckedChanged += new System.EventHandler(this.cbKeepATOpen_CheckedChanged); - // - // cbSpecialColumns - // - this.cbSpecialColumns.AutoSize = true; - this.cbSpecialColumns.Location = new System.Drawing.Point(15, 120); - this.cbSpecialColumns.Name = "cbSpecialColumns"; - this.cbSpecialColumns.Size = new System.Drawing.Size(338, 24); - this.cbSpecialColumns.TabIndex = 7; - this.cbSpecialColumns.Text = "Special columns (username and password)"; - this.cbSpecialColumns.UseVisualStyleBackColor = true; - this.cbSpecialColumns.CheckedChanged += new System.EventHandler(this.cbSpecialColumns_CheckedChanged); - // - // cbDBColumn - // - this.cbDBColumn.AutoSize = true; - this.cbDBColumn.Location = new System.Drawing.Point(15, 90); - this.cbDBColumn.Name = "cbDBColumn"; - this.cbDBColumn.Size = new System.Drawing.Size(113, 24); - this.cbDBColumn.TabIndex = 6; - this.cbDBColumn.Text = "DB column"; - this.cbDBColumn.UseVisualStyleBackColor = true; - // - // cbColumnsSortable - // - this.cbColumnsSortable.AutoSize = true; - this.cbColumnsSortable.Location = new System.Drawing.Point(15, 30); - this.cbColumnsSortable.Name = "cbColumnsSortable"; - this.cbColumnsSortable.Size = new System.Drawing.Size(158, 24); - this.cbColumnsSortable.TabIndex = 4; - this.cbColumnsSortable.Text = "Columns sortable"; - this.cbColumnsSortable.UseVisualStyleBackColor = true; - // - // Options - // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.BackColor = System.Drawing.Color.Transparent; - this.Controls.Add(this.gIntegration); - this.Controls.Add(this.gHotkeys); - this.Name = "Options"; - this.Padding = new System.Windows.Forms.Padding(15, 5, 15, 5); - this.Size = new System.Drawing.Size(555, 419); - this.Load += new System.EventHandler(this.Options_Load); - this.gHotkeys.ResumeLayout(false); - this.gHotkeys.PerformLayout(); - this.gIntegration.ResumeLayout(false); - this.gIntegration.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.cbPWHotkey.Location = new System.Drawing.Point(27, 108); + this.cbPWHotkey.Margin = new System.Windows.Forms.Padding(5); + this.cbPWHotkey.Name = "cbPWHotkey"; + this.cbPWHotkey.Size = new System.Drawing.Size(370, 39); + this.cbPWHotkey.TabIndex = 1; + // + // tbPWOnly + // + this.tbPWOnly.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.tbPWOnly.Location = new System.Drawing.Point(462, 108); + this.tbPWOnly.Margin = new System.Windows.Forms.Padding(5); + this.tbPWOnly.Name = "tbPWOnly"; + this.tbPWOnly.Size = new System.Drawing.Size(438, 38); + this.tbPWOnly.TabIndex = 3; + this.tbPWOnly.TextChanged += new System.EventHandler(this.OnPropagateHotKeys); + // + // lGAT + // + this.lGAT.AutoSize = true; + this.lGAT.Location = new System.Drawing.Point(27, 46); + this.lGAT.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lGAT.Name = "lGAT"; + this.lGAT.Size = new System.Drawing.Size(331, 32); + this.lGAT.TabIndex = 11; + this.lGAT.Text = "Global AutoType &Hotkey:"; + // + // lAAT + // + this.lAAT.AutoSize = true; + this.lAAT.Location = new System.Drawing.Point(27, 217); + this.lAAT.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.lAAT.Name = "lAAT"; + this.lAAT.Size = new System.Drawing.Size(362, 32); + this.lAAT.TabIndex = 9; + this.lAAT.Text = "Alternate AutoType Hotkey:"; + // + // tbAAT + // + this.tbAAT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.tbAAT.Location = new System.Drawing.Point(462, 217); + this.tbAAT.Margin = new System.Windows.Forms.Padding(5); + this.tbAAT.Name = "tbAAT"; + this.tbAAT.Size = new System.Drawing.Size(438, 38); + this.tbAAT.TabIndex = 5; + // + // gIntegration + // + this.gIntegration.AutoSize = true; + this.gIntegration.Controls.Add(this.cbColumnsRememberSort); + this.gIntegration.Controls.Add(this.cbExcludeExpiredGroups); + this.gIntegration.Controls.Add(this.cbKeepATOpen); + this.gIntegration.Controls.Add(this.cbSpecialColumns); + this.gIntegration.Controls.Add(this.cbDBColumn); + this.gIntegration.Controls.Add(this.cbColumnsSortable); + this.gIntegration.Dock = System.Windows.Forms.DockStyle.Top; + this.gIntegration.Location = new System.Drawing.Point(27, 287); + this.gIntegration.Margin = new System.Windows.Forms.Padding(5); + this.gIntegration.Name = "gIntegration"; + this.gIntegration.Padding = new System.Windows.Forms.Padding(5); + this.gIntegration.Size = new System.Drawing.Size(933, 356); + this.gIntegration.TabIndex = 7; + this.gIntegration.TabStop = false; + this.gIntegration.Text = "Integration"; + // + // cbColumnsRememberSort + // + this.cbColumnsRememberSort.AutoSize = true; + this.cbColumnsRememberSort.Location = new System.Drawing.Point(62, 93); + this.cbColumnsRememberSort.Margin = new System.Windows.Forms.Padding(5); + this.cbColumnsRememberSort.Name = "cbColumnsRememberSort"; + this.cbColumnsRememberSort.Size = new System.Drawing.Size(352, 36); + this.cbColumnsRememberSort.TabIndex = 95; + this.cbColumnsRememberSort.Text = "Remember sort settings"; + this.cbColumnsRememberSort.UseVisualStyleBackColor = true; + // + // cbExcludeExpiredGroups + // + this.cbExcludeExpiredGroups.AutoSize = true; + this.cbExcludeExpiredGroups.Location = new System.Drawing.Point(27, 279); + this.cbExcludeExpiredGroups.Margin = new System.Windows.Forms.Padding(5); + this.cbExcludeExpiredGroups.Name = "cbExcludeExpiredGroups"; + this.cbExcludeExpiredGroups.Size = new System.Drawing.Size(350, 36); + this.cbExcludeExpiredGroups.TabIndex = 9; + this.cbExcludeExpiredGroups.Text = "Exclude expired groups"; + this.cbExcludeExpiredGroups.UseVisualStyleBackColor = true; + // + // cbKeepATOpen + // + this.cbKeepATOpen.AutoSize = true; + this.cbKeepATOpen.Location = new System.Drawing.Point(62, 232); + this.cbKeepATOpen.Margin = new System.Windows.Forms.Padding(5); + this.cbKeepATOpen.Name = "cbKeepATOpen"; + this.cbKeepATOpen.Size = new System.Drawing.Size(293, 36); + this.cbKeepATOpen.TabIndex = 8; + this.cbKeepATOpen.Text = "Keep window open"; + this.cbKeepATOpen.UseVisualStyleBackColor = true; + this.cbKeepATOpen.CheckedChanged += new System.EventHandler(this.cbKeepATOpen_CheckedChanged); + // + // cbSpecialColumns + // + this.cbSpecialColumns.AutoSize = true; + this.cbSpecialColumns.Location = new System.Drawing.Point(27, 186); + this.cbSpecialColumns.Margin = new System.Windows.Forms.Padding(5); + this.cbSpecialColumns.Name = "cbSpecialColumns"; + this.cbSpecialColumns.Size = new System.Drawing.Size(595, 36); + this.cbSpecialColumns.TabIndex = 7; + this.cbSpecialColumns.Text = "Special columns (username and password)"; + this.cbSpecialColumns.UseVisualStyleBackColor = true; + this.cbSpecialColumns.CheckedChanged += new System.EventHandler(this.cbSpecialColumns_CheckedChanged); + // + // cbDBColumn + // + this.cbDBColumn.AutoSize = true; + this.cbDBColumn.Location = new System.Drawing.Point(27, 139); + this.cbDBColumn.Margin = new System.Windows.Forms.Padding(5); + this.cbDBColumn.Name = "cbDBColumn"; + this.cbDBColumn.Size = new System.Drawing.Size(191, 36); + this.cbDBColumn.TabIndex = 6; + this.cbDBColumn.Text = "DB column"; + this.cbDBColumn.UseVisualStyleBackColor = true; + // + // cbColumnsSortable + // + this.cbColumnsSortable.AutoSize = true; + this.cbColumnsSortable.Location = new System.Drawing.Point(27, 46); + this.cbColumnsSortable.Margin = new System.Windows.Forms.Padding(5); + this.cbColumnsSortable.Name = "cbColumnsSortable"; + this.cbColumnsSortable.Size = new System.Drawing.Size(274, 36); + this.cbColumnsSortable.TabIndex = 4; + this.cbColumnsSortable.Text = "Columns sortable"; + this.cbColumnsSortable.UseVisualStyleBackColor = true; + // + // Options + // + this.AutoScaleDimensions = new System.Drawing.SizeF(16F, 31F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.gIntegration); + this.Controls.Add(this.gHotkeys); + this.Margin = new System.Windows.Forms.Padding(5); + this.Name = "Options"; + this.Padding = new System.Windows.Forms.Padding(27, 8, 27, 8); + this.Size = new System.Drawing.Size(987, 687); + this.Load += new System.EventHandler(this.Options_Load); + this.gHotkeys.ResumeLayout(false); + this.gHotkeys.PerformLayout(); + this.gIntegration.ResumeLayout(false); + this.gIntegration.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/src/Options.cs b/src/Options.cs index 5c4a931..2845255 100644 --- a/src/Options.cs +++ b/src/Options.cs @@ -4,11 +4,13 @@ using PluginTranslation; using PluginTools; using System; +using System.Linq; namespace AlternateAutoType { public partial class Options : UserControl { + private Form m_ParentForm = null; public Options() { InitializeComponent(); @@ -30,12 +32,23 @@ public Options() cbColumnsRememberSort.Text = PluginTranslate.ColumnsSortRemember; SetHotKey(tbGAT, (Keys)KeePass.Program.Config.Integration.HotKeyGlobalAutoType); - tbGAT.Enabled = false; lAAT.Enabled = tbAAT.Enabled = !KeePassLib.Native.NativeLib.IsUnix(); cbSpecialColumns.Enabled = cbKeepATOpen.Enabled = !KeePassLib.Native.NativeLib.IsUnix(); } + private void OnPropagateHotKeys(object sender, EventArgs e) + { + string sControl = sender == tbGAT ? "m_hkAutotype" : "m_hkAutotypePassword"; + var c = Tools.GetControl(sControl, m_ParentForm) as HotKeyControlEx; + if (c == null) return; + c.Text = (sender as HotKeyControlEx).Text; + var st = new System.Diagnostics.StackTrace().GetFrames(); + var sfPluginOptionsEntered = st.Where(x => x.GetMethod().Name.ToLowerInvariant().Contains("pluginoptionsenter")).FirstOrDefault(); + if (sfPluginOptionsEntered == null) SetHotKey(c, GetHotKey(sender as HotKeyControlEx)); + else SetHotKey(sender as HotKeyControlEx, GetHotKey(c)); + } + public Keys AATHotkey { get { return GetHotKey(tbAAT); } @@ -50,43 +63,12 @@ public Keys PWOnlyHotkey private void SetHotKey(HotKeyControlEx hkBox, Keys hk) { - if ((hkBox == tbPWOnly) && Config.KPAutoTypePWPossible) - { - hkBox.TabStop = hkBox.Enabled = false; - hkBox.ReadOnly = true; - } - try - { - var check = hkBox.GetType().GetProperty("HotKeyModifiers"); - if (check == null) - { - // only available with KeePass versions > 2.41 - hkBox.HotKey = hk; - return; - } - hkBox.HotKey = hk & Keys.KeyCode; - check.SetValue(hkBox, hk & Keys.Modifiers, null); - var render = hkBox.GetType().GetMethod("RenderHotKey"); - if (render == null) return; - render.Invoke(hkBox, null); - } - catch { } + hkBox.HotKey = hk; } private Keys GetHotKey(HotKeyControlEx hkBox) { - try - { - var check = hkBox.GetType().GetProperty("HotKeyModifiers"); - if (check == null) - { - // only available with KeePass versions > 2.41 - return hkBox.HotKey; - } - return hkBox.HotKey | (Keys)check.GetValue(hkBox, null); - } - catch { } - return Keys.None; + return hkBox.HotKey; } private void cbSpecialColumns_CheckedChanged(object sender, System.EventArgs e) @@ -101,6 +83,17 @@ private void Options_Load(object sender, System.EventArgs e) internal void OptionsForm_Shown(object sender, EventArgs e) { + //HotKey cannot be set in our controls if they are place inside the UserControl + //Reason: HotKeyManager.HandleHotKeyIntoSelf + // This checks for OptionsForm.ActiveControl which will be the UserControl + // but neds to be HotKeyControlEx + // + //Move all controls from UserControl in TabPage to TabPage + //Make UserControl invisible (do NOT remove: OptionsForm_Closed won't work otherwise) + m_ParentForm = ParentForm; + while (Controls.Count > 0) Parent.Controls.Add(Controls[0]); + Height = Width = 0; + Visible = false; lGATP.Visible = cbPWEnter.Visible = Config.KPAutoTypePWPossible; cbPWHotkey.Visible = cbPWHotkey.TabStop = !Config.KPAutoTypePWPossible; cbPWEnter.Checked = Config.PWEnter; @@ -110,16 +103,19 @@ internal void OptionsForm_Shown(object sender, EventArgs e) if (c != null) lGAT.Text = c.Text; c = Tools.GetControl("m_lblAutotypePassword", sender as Form); if (c != null) lGATP.Text = c.Text; - c = Tools.GetControl("m_tabIntegration", sender as Form); - if (c == null) return; - (c as TabPage).Leave += IntegrationTab_Leave; + TabPage tpPluginOptions = Parent.Parent.Parent as TabPage; //TabPage AlternateAutoType - TabControl - TabPage Plugin Options + if (tpPluginOptions != null) tpPluginOptions.Enter += PluginOptionsEnter; } - private void IntegrationTab_Leave(object sender, EventArgs e) + private void PluginOptionsEnter(object sender, EventArgs e) { - Control c = Tools.GetControl("m_hkAutotype", ParentForm); - if (c != null) tbGAT.Text = c.Text; - c = Tools.GetControl("m_hkAutotypePassword", ParentForm); + Control c = Tools.GetControl("m_hkAutotype", m_ParentForm); + if (c != null) + { + tbGAT.Text = c.Text; + SetHotKey(tbGAT, GetHotKey(c as HotKeyControlEx)); + } + c = Tools.GetControl("m_hkAutotypePassword", m_ParentForm); if (c != null) { tbPWOnly.Text = c.Text; @@ -136,5 +132,5 @@ private void cbKeepATOpen_CheckedChanged(object sender, EventArgs e) { if (cbKeepATOpen.Checked) cbSpecialColumns.Checked = true; } - } + } } \ No newline at end of file diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index e18bba1..9ea6b5a 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -8,11 +8,14 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AlternateAutoType")] -[assembly: AssemblyDescription("Adds a hotkey for typing only the password. Adds an alternate hotkey for a second autotype sequence, KeePass types EITHER everything before OR everything after {AAT}")] +[assembly: AssemblyDescription(@"Hotkeys for typing only the password and an alternative autotype sequence. +KeePass types EITHER everything before OR everything after {AAT}. + +Various other enhancements, check the options")] [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("rookiestyle")] [assembly: AssemblyProduct ("KeePass Plugin")] -[assembly: AssemblyCopyright("Copyright 2021")] +[assembly: AssemblyCopyright("Copyright 2020-2021")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // This sets the default COM visibility of types in the assembly to invisible. @@ -24,7 +27,7 @@ // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.15")] -[assembly: AssemblyFileVersion("1.15")] +[assembly: AssemblyVersion("1.16")] +[assembly: AssemblyFileVersion("1.16")] [assembly: Guid("78C152F3-EAF8-4FFC-9BE3-F5DC0CD66E5D")] diff --git a/version.info b/version.info index 790bb60..9e419dc 100644 --- a/version.info +++ b/version.info @@ -1,5 +1,5 @@ : -AlternateAutoType:1.15 +AlternateAutoType:1.16 AlternateAutoType!de:5 AlternateAutoType!pt:1 AlternateAutoType!ru:4