Exemple #1
0
        private void PCADialog_Load(object sender, EventArgs e)
        {
            //Create input control group for new password
            m_icgNewPassword.Attach(tbPasswordNew, cbToggleNewPassword, m_lblPasswordRepeat, tbPasswordNewRepeat, m_lblQuality,
                                    pbNewPasswordQuality, lNewPasswordQualityInfo, toolTip1, this, cbToggleNewPassword.Checked, false);
            m_icgNewPassword.ContextDatabase = Program.MainForm.DocumentManager.SafeFindContainerOf(PasswordChangeAssistantExt.SelectedEntry);
            m_icgNewPassword.ContextEntry    = PasswordChangeAssistantExt.SelectedEntry;

            bool      bForceHide    = !AppPolicy.Current.UnhidePasswords;
            AceColumn colPw         = Program.Config.MainWindow.FindColumn(AceColumnType.Password);
            bool      bShowPassword = (colPw != null) ? !colPw.HideWithAsterisks : false;

            bShowPassword &= !bForceHide;
            if (Program.Config.UI.Hiding.SeparateHidingSettings)
            {
                cbToggleNewPassword.Checked = (Program.Config.UI.Hiding.HideInEntryWindow || bForceHide);
            }
            else
            {
                cbToggleNewPassword.Checked = !bShowPassword;
            }
            cbToggleOldPassword.Checked = cbToggleNewPassword.Checked;
            tbPasswordOld.EnableProtection(cbToggleOldPassword.Checked);
            cbToggleOldPassword.Image = cbToggleNewPassword.Image;
            cbToggleOldPassword.Text  = string.Empty;
            tbPasswordOld.ReadOnly    = true;
        }
Exemple #2
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey,
                                         m_ioInfo.GetDisplayName());
            this.Icon = Properties.Resources.KeePass;
            this.Text = KPRes.CreateMasterKey;

            FontUtil.SetDefaultFont(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbKeyFile);
            FontUtil.AssignDefaultBold(m_cbUserAccount);

            Bitmap bmpBig = SystemIcons.Warning.ToBitmap();

            m_imgAccWarning = GfxUtil.ScaleImage(bmpBig, DpiUtil.ScaleIntX(16),
                                                 DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon);
            bmpBig.Dispose();
            m_picAccWarning.Image = m_imgAccWarning;

            // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks);
            m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate);
            m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting);
            m_ttRect.SetToolTip(m_tbRepeatPassword, KPRes.PasswordRepeatHint);

            if (!m_bCreatingNew)
            {
                m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort;
            }

            m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblRepeatPassword,
                                 m_tbRepeatPassword, m_lblEstimatedQuality, m_pbPasswordQuality,
                                 m_lblQualityInfo, m_ttRect, this, true, false);

            m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta);
            foreach (KeyProvider prov in Program.KeyProviderPool)
            {
                m_cmbKeyFile.Items.Add(prov.Name);
            }

            m_cmbKeyFile.SelectedIndex = 0;

            m_cbPassword.Checked = true;
            UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags,
                                   m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword);

            if (WinUtil.IsWindows9x || NativeLib.IsUnix())
            {
                UIUtil.SetChecked(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc2, false);
            }

            CustomizeForScreenReader();
            EnableUserControls();
            // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown
        }
        private void OnFormLoad(object sender, EventArgs e)
        {
            // The password text box should not be focused by default
            // in order to avoid a Caps Lock warning tooltip bug;
            // https://sourceforge.net/p/keepass/bugs/1807/
            Debug.Assert((m_tbPassword.TabIndex >= 2) && !m_tbPassword.Focused);

            GlobalWindowManager.AddWindow(this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey,
                                         m_ioInfo.GetDisplayName());
            this.Icon = AppIcons.Default;
            this.Text = KPRes.CreateMasterKey;

            FontUtil.SetDefaultFont(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbKeyFile);
            FontUtil.AssignDefaultBold(m_cbUserAccount);

            using (Bitmap bmp = SystemIcons.Warning.ToBitmap())
            {
                m_imgAccWarning = GfxUtil.ScaleImage(bmp, DpiUtil.ScaleIntX(16),
                                                     DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon);
                m_imgKeyFileWarning = (Image)m_imgAccWarning.Clone();
            }
            m_picKeyFileWarning.Image = m_imgKeyFileWarning;
            m_picAccWarning.Image     = m_imgAccWarning;

            UIUtil.ConfigureToolTip(m_ttRect);
            // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks);
            m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate);
            m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting);
            m_ttRect.SetToolTip(m_tbRepeatPassword, KPRes.PasswordRepeatHint);

            Debug.Assert(!m_lblIntro.AutoSize);             // For RTL support
            if (!m_bCreatingNew)
            {
                m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort;
            }

            m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblRepeatPassword,
                                 m_tbRepeatPassword, m_lblEstimatedQuality, m_pbPasswordQuality,
                                 m_lblQualityInfo, m_ttRect, this, true, false);

            m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta);
            foreach (KeyProvider prov in Program.KeyProviderPool)
            {
                m_cmbKeyFile.Items.Add(prov.Name);
            }

            m_cmbKeyFile.SelectedIndex = 0;

            m_cbPassword.Checked = true;
            UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags,
                                   m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword);

            if (WinUtil.IsWindows9x || NativeLib.IsUnix())
            {
                UIUtil.SetChecked(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_cbUserAccount, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc, false);
                UIUtil.SetEnabled(m_lblWindowsAccDesc2, false);
            }

            CustomizeForScreenReader();
            EnableUserControls();
            // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown
        }
Exemple #4
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            ++m_uUIAutoBlocked;

            // The password text box should not be focused by default
            // in order to avoid a Caps Lock warning tooltip bug;
            // https://sourceforge.net/p/keepass/bugs/1807/
            Debug.Assert((m_tbPassword.TabIndex >= 2) && !m_tbPassword.Focused);

            GlobalWindowManager.AddWindow(this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey,
                                         m_ioInfo.GetDisplayName());
            this.Icon = AppIcons.Default;
            this.Text = KPRes.CreateMasterKey;

            FontUtil.SetDefaultFont(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbPassword);
            FontUtil.AssignDefaultBold(m_cbKeyFile);
            FontUtil.AssignDefaultBold(m_cbUserAccount);

            UIUtil.ConfigureToolTip(m_ttRect);
            UIUtil.SetToolTip(m_ttRect, m_tbRepeatPassword, KPRes.PasswordRepeatHint, false);
            UIUtil.SetToolTip(m_ttRect, m_btnSaveKeyFile, KPRes.KeyFileCreate, false);
            UIUtil.SetToolTip(m_ttRect, m_btnOpenKeyFile, KPRes.KeyFileUseExisting, false);

            UIUtil.AccSetName(m_tbPassword, m_cbPassword);
            UIUtil.AccSetName(m_cmbKeyFile, m_cbKeyFile);
            UIUtil.AccSetName(m_picKeyFileWarning, KPRes.Warning);
            UIUtil.AccSetName(m_picAccWarning, KPRes.Warning);

            Debug.Assert(!m_lblIntro.AutoSize);             // For RTL support
            if (!m_bCreatingNew)
            {
                m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort;
            }

            m_cbPassword.Checked = true;
            m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblRepeatPassword,
                                 m_tbRepeatPassword, m_lblEstimatedQuality, m_pbPasswordQuality,
                                 m_lblQualityInfo, m_ttRect, this, true, m_bSecureDesktop);

            Debug.Assert(!m_cmbKeyFile.Sorted);
            m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta);
            m_cmbKeyFile.SelectedIndex = 0;

            foreach (KeyProvider kp in Program.KeyProviderPool)
            {
                m_cmbKeyFile.Items.Add(kp.Name);
            }

            m_imgKeyFileWarning = UIUtil.IconToBitmap(SystemIcons.Warning,
                                                      DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16));
            m_imgAccWarning           = (Image)m_imgKeyFileWarning.Clone();
            m_picKeyFileWarning.Image = m_imgKeyFileWarning;
            m_picAccWarning.Image     = m_imgAccWarning;

            UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags,
                                   m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword);

            if (!m_cbKeyFile.Enabled && !m_cbKeyFile.Checked)
            {
                UIUtil.SetEnabledFast(false, m_lblKeyFileInfo, m_lblKeyFileWarning);
            }

            if (WinUtil.IsWindows9x || NativeLib.IsUnix() ||
                (!m_cbUserAccount.Enabled && !m_cbUserAccount.Checked))
            {
                UIUtil.SetChecked(m_cbUserAccount, false);
                UIUtil.SetEnabledFast(false, m_cbUserAccount, m_lblWindowsAccDesc,
                                      m_lblWindowsAccDesc2);
            }

            m_cbExpert.Checked = (m_cbKeyFile.Checked || m_cbUserAccount.Checked);

            --m_uUIAutoBlocked;
            UpdateUIState();
            // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown
        }