public override void EnableProtection(bool bEnable) { PluginDebug.AddInfo(Name + " Protect password display: " + bEnable.ToString()); m_text.TextChanged -= ColorTextChanged; m_text.Name = Name + "_RTB"; base.EnableProtection(bEnable); if (WaitForFormShown()) { RememberProtectionState(bEnable); return; } if (bEnable) { Visible = true; TabStop = true; if (m_bReadOnlySaved) { ReadOnly = m_bReadOnly; m_bReadOnlySaved = false; } Focus(); Select(m_text.SelectionStart, m_text.SelectionLength); m_text.Visible = false; m_text.TabStop = false; if (m_bKeeTheme) { m_text.Parent.Visible = false; } } else { //Was required until default colors could be configured as well //ColorConfig.ForeColorDefault = ForeColor; //ColorConfig.BackColorDefault = BackColor; m_text.RightToLeft = RightToLeft; m_text.Size = Size; AdjustLocation(); m_text.Font = Font; //If password repeat is off and KeeTheme is active => Hide RichTextBox, will not be shown properly otherwise bool bVisible = Enabled || !(Name.Contains("Repeat") && m_bKeeTheme); if (m_bKeeTheme) { m_text.Parent.Visible = bVisible; } m_text.Visible = bVisible; m_text.TabStop = bVisible; m_text.Text = Text; m_text.ReadOnly = ReadOnly; Visible = false; TabStop = false; if (!m_bReadOnlySaved) { m_bReadOnly = ReadOnly; m_bReadOnlySaved = true; } ReadOnly = true; m_text.Select(SelectionStart, SelectionLength); if (m_text.Enabled && !m_text.ReadOnly) { //UIUtil.SetFocus(m_text, GetForm(m_text), true); //Only availabe as of KeePass 2.42 UIUtil.SetFocus(m_text, GetForm(m_text)); if (m_text.CanFocus) { m_text.Focus(); } } m_text.TextChanged += ColorTextChanged; if (m_bKeeTheme) { m_text.Parent.BringToFront(); } else { m_text.BringToFront(); } if (KeePassLib.Native.NativeLib.IsUnix()) { m_text.ColorText(); } } }
public override void EnableProtection(bool bEnable) { PluginDebug.AddInfo(Name + " Protect password display: " + bEnable.ToString()); m_text.TextChanged -= ColorTextChanged; base.EnableProtection(bEnable); if (bEnable) { Visible = true; TabStop = true; if (m_bReadOnlySaved) { ReadOnly = m_bReadOnly; m_bReadOnlySaved = false; } Focus(); Select(m_text.SelectionStart, m_text.SelectionLength); m_text.Visible = false; if (m_bKeeTheme) { m_text.Parent.Visible = false; } } else { //Was required until default colors could be configured as well //ColorConfig.ForeColorDefault = ForeColor; //ColorConfig.BackColorDefault = BackColor; m_text.RightToLeft = RightToLeft; m_text.Size = Size; if (!m_bKeeTheme) { m_text.Location = Location; } m_text.Font = Font; m_text.Visible = true; if (m_bKeeTheme) { m_text.Parent.Visible = true; } m_text.Text = Text; m_text.ReadOnly = ReadOnly; TabStop = false; if (!m_bReadOnlySaved) { m_bReadOnly = ReadOnly; m_bReadOnlySaved = true; } ReadOnly = true; m_text.Select(SelectionStart, SelectionLength); if (m_text.Enabled && !m_text.ReadOnly) { //UIUtil.SetFocus(m_text, GetForm(m_text), true); //Only availabe as of KeePass 2.42 UIUtil.SetFocus(m_text, GetForm(m_text)); if (m_text.CanFocus) { m_text.Focus(); } } m_text.TextChanged += ColorTextChanged; if (m_bKeeTheme) { m_text.Parent.BringToFront(); } else { m_text.BringToFront(); } if (KeePassLib.Native.NativeLib.IsUnix()) { m_text.ColorText(); } } }