private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); try { if (this.Owner == null) { this.Owner = Program.MainForm; } } catch (Exception) { Debug.Assert(false); } BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Download, KPRes.ImportBehavior, KPRes.ImportBehaviorDesc); this.Icon = AppIcons.Default; this.Text = KPRes.ImportBehavior; m_radioCreateNew.Text = KPRes.CreateNewIDs; m_radioKeepExisting.Text = KPRes.KeepExisting; m_radioOverwrite.Text = KPRes.OverwriteExisting; m_radioOverwriteIfNewer.Text = KPRes.OverwriteIfNewer; m_radioSynchronize.Text = KPRes.OverwriteIfNewerAndApplyDel; FontUtil.AssignDefaultBold(m_radioCreateNew); FontUtil.AssignDefaultBold(m_radioKeepExisting); FontUtil.AssignDefaultBold(m_radioOverwrite); FontUtil.AssignDefaultBold(m_radioOverwriteIfNewer); FontUtil.AssignDefaultBold(m_radioSynchronize); m_radioCreateNew.Checked = true; }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); try { if (this.Owner == null) { this.Owner = Program.MainForm; } } catch (Exception) { Debug.Assert(false); } m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width, m_bannerImage.Height, BannerStyle.Default, Properties.Resources.B48x48_Folder_Download, KPRes.ImportBehavior, KPRes.ImportBehaviorDesc); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.ImportBehavior; FontUtil.AssignDefaultBold(m_radioCreateNew); FontUtil.AssignDefaultBold(m_radioKeepExisting); FontUtil.AssignDefaultBold(m_radioOverwrite); FontUtil.AssignDefaultBold(m_radioOverwriteIfNewer); FontUtil.AssignDefaultBold(m_radioSynchronize); m_radioCreateNew.Checked = true; }
private void OnFormLoad(object sender, EventArgs e) { // Must work without a parent window Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); // 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); InitAdvancedTab(); // After translation, before resize GlobalWindowManager.AddWindow(this); string strTitle = (m_bSave ? KPRes.UrlSaveTitle : KPRes.UrlOpenTitle); string strDesc = (m_bSave ? KPRes.UrlSaveDesc : KPRes.UrlOpenDesc); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc); this.Icon = AppIcons.Default; this.Text = strTitle; FontUtil.AssignDefaultBold(m_lblUrl); FontUtil.AssignDefaultBold(m_lblUserName); FontUtil.AssignDefaultBold(m_lblPassword); FontUtil.AssignDefaultBold(m_lblRemember); m_tbUrl.Text = (m_ioc.IsLocalFile() ? string.Empty : m_ioc.Path); m_tbUserName.Text = m_ioc.UserName; m_tbPassword.Text = m_ioc.Password; m_cmbCredSaveMode.Items.Add(KPRes.CredSaveNone); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveUserOnly); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveAll); if (m_ioc.CredSaveMode == IOCredSaveMode.UserNameOnly) { m_cmbCredSaveMode.SelectedIndex = 1; } else if (m_ioc.CredSaveMode == IOCredSaveMode.SaveCred) { m_cmbCredSaveMode.SelectedIndex = 2; } else { m_cmbCredSaveMode.SelectedIndex = 0; } if (!m_bCanRememberCred) { m_cmbCredSaveMode.SelectedIndex = 0; m_cmbCredSaveMode.Enabled = false; } ThreadPool.QueueUserWorkItem(delegate(object state) { try { InitAutoCompletions(); } catch (Exception) { Debug.Assert(false); } }); }
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) { GlobalWindowManager.AddWindow(this); m_bInitializing = true; this.Icon = AppIcons.Default; FontUtil.AssignDefaultBold(m_lblContext); Debug.Assert(!m_lblContext.AutoSize); // For RTL support m_lblContext.Text = m_strContext; m_cmbEnc.Items.Add(KPRes.BinaryNoConv); foreach (StrEncodingInfo sei in StrUtil.Encodings) { m_cmbEnc.Items.Add(sei.Name); } StrEncodingInfo seiGuess = BinaryDataClassifier.GetStringEncoding( m_pbData, out m_uStartOffset); int iSel = 0; if (seiGuess != null) { iSel = Math.Max(m_cmbEnc.FindStringExact(seiGuess.Name), 0); } m_cmbEnc.SelectedIndex = iSel; m_bInitializing = false; UpdateTextPreview(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); m_bInitializing = true; FontUtil.AssignDefaultBold(m_lblContext); m_lblContext.Text = m_strContext; foreach (string strEnc in m_vEncText) { m_cmbEnc.Items.Add(strEnc); } string strDet; uint uStartOffset; BinaryDataClassifier.GetStringEncoding(m_pbData, false, out strDet, out uStartOffset); int iDet = Array.IndexOf <string>(m_vEncText, strDet); m_cmbEnc.SelectedIndex = ((iDet >= 0) ? iDet : 0); m_bInitializing = false; UpdateTextPreview(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this, this); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Download, KPRes.HelpSourceSelection, KPRes.HelpSourceSelectionDesc); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.HelpSourceSelection; FontUtil.AssignDefaultBold(m_radioLocal); FontUtil.AssignDefaultBold(m_radioOnline); if (AppHelp.LocalHelpAvailable == false) { m_radioLocal.Enabled = false; m_lblLocal.Text = KPRes.HelpSourceNoLocalOption; AppHelp.PreferredHelpSource = AppHelpSource.Online; } if (AppHelp.PreferredHelpSource == AppHelpSource.Local) { m_radioLocal.Checked = true; } else { m_radioOnline.Checked = true; } }
private void OnFormLoad(object sender, EventArgs e) { if (m_pd == null) { Debug.Assert(false); throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_Binary, KPRes.XmlReplace, KPRes.XmlReplaceDesc); this.Icon = AppIcons.Default; this.Text = KPRes.XmlReplace; Bitmap bmpBig = SystemIcons.Warning.ToBitmap(); m_imgWarning = GfxUtil.ScaleImage(bmpBig, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon); bmpBig.Dispose(); m_picWarning.Image = m_imgWarning; FontUtil.AssignDefaultBold(m_rbRemove); FontUtil.AssignDefaultBold(m_rbReplace); m_rbReplace.Checked = true; m_rbInnerText.Checked = true; EnableControlsEx(); }
private void OnFormLoad(object sender, EventArgs e) { // Must work without a parent window Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); GlobalWindowManager.AddWindow(this); string strTitle = (m_bSave ? KPRes.UrlSaveTitle : KPRes.UrlOpenTitle); string strDesc = (m_bSave ? KPRes.UrlSaveDesc : KPRes.UrlOpenDesc); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_WWW, strTitle, strDesc); this.Icon = Properties.Resources.KeePass; this.Text = strTitle; FontUtil.AssignDefaultBold(m_lblUrl); FontUtil.AssignDefaultBold(m_lblUserName); FontUtil.AssignDefaultBold(m_lblPassword); FontUtil.AssignDefaultBold(m_lblRemember); m_tbUrl.Text = (m_ioc.IsLocalFile() ? string.Empty : m_ioc.Path); m_tbUserName.Text = m_ioc.UserName; m_tbPassword.Text = m_ioc.Password; m_cmbCredSaveMode.Items.Add(KPRes.CredSaveNone); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveUserOnly); m_cmbCredSaveMode.Items.Add(KPRes.CredSaveAll); if (m_ioc.CredSaveMode == IOCredSaveMode.UserNameOnly) { m_cmbCredSaveMode.SelectedIndex = 1; } else if (m_ioc.CredSaveMode == IOCredSaveMode.SaveCred) { m_cmbCredSaveMode.SelectedIndex = 2; } else { m_cmbCredSaveMode.SelectedIndex = 0; } if (m_bCanRememberCred == false) { m_cmbCredSaveMode.SelectedIndex = 0; m_cmbCredSaveMode.Enabled = false; } UIUtil.SetFocus(m_tbUrl, this); if ((m_tbUrl.TextLength > 0) && (m_tbUserName.TextLength > 0)) { UIUtil.SetFocus(m_tbPassword, this); } else if (m_tbUrl.TextLength > 0) { UIUtil.SetFocus(m_tbUserName, this); } }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width, m_bannerImage.Height, BannerStyle.Default, Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey, m_ioInfo.GetDisplayName()); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.CreateMasterKey; FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting); if (!m_bCreatingNew) { m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort; } m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); m_secRepeat.Attach(m_tbRepeatPassword, null, true); m_cbHidePassword.Checked = true; m_cbPassword.Checked = true; ProcessTextChangedPassword(sender, e); // Update quality estimation m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta); foreach (KeyProvider prov in Program.KeyProviderPool) { m_cmbKeyFile.Items.Add(prov.Name); } m_cmbKeyFile.SelectedIndex = 0; 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(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); this.Icon = Properties.Resources.KeePass; FontUtil.AssignDefaultBold(m_cbAppendCopy); FontUtil.AssignDefaultBold(m_cbFieldRefs); m_cbAppendCopy.Checked = m_bAppendCopy; m_cbFieldRefs.Checked = m_bFieldRefs; }
private void OnFormLoad(object sender, EventArgs e) { ++m_cBlockUIUpdate; GlobalWindowManager.AddWindow(this); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_KGPG_Gen, KPRes.KeyFileCreateTitle, KPRes.KeyFileCreate + "."); this.Icon = AppIcons.Default; this.Text = KPRes.KeyFileCreateTitle; FontUtil.AssignDefaultBold(m_rbCreate); FontUtil.AssignDefaultBold(m_rbRecreate); FontUtil.AssignDefaultMono(m_tbRecKeyHash, false); FontUtil.AssignDefaultMono(m_tbRecKey, false); if (m_bRecreateOnly) { m_rbRecreate.Checked = true; m_rbCreate.Enabled = false; } else { m_rbCreate.Checked = true; } m_cbNewEntropy.Checked = true; Debug.Assert(!m_cmbNewFormat.Sorted); foreach (KfcfInfo kfi in m_vNewFormat) { m_cmbNewFormat.Items.Add(kfi.Name); } m_cmbNewFormat.SelectedIndex = 0; Debug.Assert(!m_cmbRecFormat.Sorted); foreach (KfcfInfo kfi in m_vRecFormat) { m_cmbRecFormat.Items.Add(kfi.Name); } m_cmbRecFormat.SelectedIndex = 0; m_rbCreate.CheckedChanged += this.OnShouldUpdateUIState; m_rbRecreate.CheckedChanged += this.OnShouldUpdateUIState; m_cmbRecFormat.SelectedIndexChanged += this.OnShouldUpdateUIState; m_tbRecKey.TextChanged += this.OnShouldUpdateUIState; --m_cBlockUIUpdate; UpdateUIState(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); this.Icon = AppIcons.Default; FontUtil.AssignDefaultBold(m_cbAppendCopy); FontUtil.AssignDefaultBold(m_cbFieldRefs); FontUtil.AssignDefaultBold(m_cbCopyHistory); m_cbAppendCopy.Checked = m_bAppendCopy; m_cbFieldRefs.Checked = m_bFieldRefs; m_cbCopyHistory.Checked = m_bCopyHistory; }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_ilIcons != null); if (m_ilIcons == null) { throw new InvalidOperationException(); } Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); this.Icon = Properties.Resources.KeePass; FontUtil.AssignDefaultBold(m_radioStandard); FontUtil.AssignDefaultBold(m_radioCustom); m_lvIcons.SmallImageList = m_ilIcons; for (uint i = 0; i < m_uNumberOfStandardIcons; ++i) { m_lvIcons.Items.Add(i.ToString(), (int)i); } int iFoundCustom = RecreateCustomIconList(false); if (!m_pwDefaultCustomIcon.Equals(PwUuid.Zero) && (iFoundCustom >= 0)) { m_radioCustom.Checked = true; m_lvCustomIcons.Items[iFoundCustom].Selected = true; m_lvCustomIcons.EnsureVisible(iFoundCustom); UIUtil.SetFocus(m_lvCustomIcons, this); } else if (m_uDefaultIcon < m_uNumberOfStandardIcons) { m_radioStandard.Checked = true; m_lvIcons.Items[(int)m_uDefaultIcon].Selected = true; m_lvIcons.EnsureVisible((int)m_uDefaultIcon); UIUtil.SetFocus(m_lvIcons, this); } else { Debug.Assert(false); m_radioStandard.Checked = true; } EnableControlsEx(); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this, this); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Download, KPRes.HelpSourceSelection, KPRes.HelpSourceSelectionDesc); this.Icon = AppIcons.Default; this.Text = KPRes.HelpSourceSelection; FontUtil.AssignDefaultBold(m_radioLocal); FontUtil.AssignDefaultBold(m_radioOnline); Debug.Assert(!m_lblLocal.AutoSize); // For RTL support if (!AppHelp.LocalHelpAvailable) { UIUtil.SetEnabledFast(false, m_radioLocal, m_lblLocal); m_lblLocal.Text = KPRes.HelpSourceNoLocalOption; AppHelp.PreferredHelpSource = AppHelpSource.Online; } bool bOverride = !string.IsNullOrEmpty(Program.Config.Application.HelpUrl); bool bEnforced = AppConfigEx.IsOptionEnforced(Program.Config.Application, "HelpUseLocal"); if (!bOverride) { if (AppHelp.PreferredHelpSource == AppHelpSource.Local) { m_radioLocal.Checked = true; } else { m_radioOnline.Checked = true; } } if (bOverride || bEnforced) { UIUtil.SetEnabledFast(false, m_radioLocal, m_lblLocal, m_radioOnline, m_lblOnline, m_btnOK); UIUtil.SetFocus(m_btnCancel, this); } }
private void OnFormLoad(object sender, EventArgs e) { if (m_pgDataSource == null) { Debug.Assert(false); throw new InvalidOperationException(); } ++m_iBlockPreviewRefresh; GlobalWindowManager.AddWindow(this); this.Icon = AppIcons.Default; CreateDialogBanner(); List <Image> lTabImg = new List <Image>(); lTabImg.Add(Properties.Resources.B16x16_XMag); lTabImg.Add(Properties.Resources.B16x16_Configure); m_ilTabIcons = UIUtil.BuildImageListUnscaled(lTabImg, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16)); m_tabMain.ImageList = m_ilTabIcons; m_tabPreview.ImageIndex = 0; m_tabDataLayout.ImageIndex = 1; UIUtil.SetButtonImage(m_btnConfigPrinter, Properties.Resources.B16x16_EditCopy, true); UIUtil.SetButtonImage(m_btnPrintPreview, Properties.Resources.B16x16_FileQuickPrint, true); FontUtil.AssignDefaultBold(m_rbTabular); FontUtil.AssignDefaultBold(m_rbDetails); Debug.Assert(!m_cmbSpr.Sorted); m_cmbSpr.Items.Add(KPRes.ReplaceNo); m_cmbSpr.Items.Add(KPRes.Replace + " (" + KPRes.Slow + ")"); m_cmbSpr.Items.Add(KPRes.BothForms + " (" + KPRes.Slow + ")"); m_cmbSpr.SelectedIndex = 0; if (!m_bPrintMode) { m_btnOK.Text = KPRes.Export; } m_rbTabular.Checked = true; m_cmbSortEntries.Items.Add("(" + KPRes.None + ")"); m_cmbSortEntries.Items.Add(KPRes.Title); m_cmbSortEntries.Items.Add(KPRes.UserName); m_cmbSortEntries.Items.Add(KPRes.Password); m_cmbSortEntries.Items.Add(KPRes.Url); m_cmbSortEntries.Items.Add(KPRes.Notes); AceColumnType colType = AceColumnType.Count; List <AceColumn> vCols = Program.Config.MainWindow.EntryListColumns; if ((m_nDefaultSortColumn >= 0) && (m_nDefaultSortColumn < vCols.Count)) { colType = vCols[m_nDefaultSortColumn].Type; } int nSortSel = 0; if (colType == AceColumnType.Title) { nSortSel = 1; } else if (colType == AceColumnType.UserName) { nSortSel = 2; } else if (colType == AceColumnType.Password) { nSortSel = 3; } else if (colType == AceColumnType.Url) { nSortSel = 4; } else if (colType == AceColumnType.Notes) { nSortSel = 5; } m_cmbSortEntries.SelectedIndex = nSortSel; if (!m_bPrintMode) // Export to HTML { m_btnConfigPrinter.Visible = m_btnPrintPreview.Visible = false; m_lblPreviewHint.Visible = false; } Program.TempFilesPool.AddWebBrowserPrintContent(); --m_iBlockPreviewRefresh; UpdateWebBrowser(true); UpdateUIState(); }
private void OnFormLoad(object sender, EventArgs e) { m_bInitializing = true; GlobalWindowManager.AddWindow(this); // if(m_bRedirectActivation) Program.MainForm.RedirectActivationPush(this); string strBannerTitle = (!string.IsNullOrEmpty(m_strCustomTitle) ? m_strCustomTitle : KPRes.EnterCompositeKey); string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Key2, strBannerTitle, strBannerDesc); this.Icon = AppIcons.Default; FontUtil.SetDefaultFont(m_cbPassword); FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); UIUtil.ConfigureToolTip(m_ttRect); // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileSelect); PwInputControlGroup.ConfigureHideButton(m_cbHidePassword, m_ttRect); string strStart = (!string.IsNullOrEmpty(m_strCustomTitle) ? m_strCustomTitle : KPRes.OpenDatabase); string strNameEx = UrlUtil.GetFileName(m_ioInfo.Path); if (!string.IsNullOrEmpty(strNameEx)) { this.Text = strStart + " - " + strNameEx; } else { this.Text = strStart; } // Must be set manually due to possible object override m_tbPassword.TextChanged += this.ProcessTextChangedPassword; // m_cmbKeyFile.OrderedImageList = m_lKeyFileImages; AddKeyFileSuggPriv(KPRes.NoKeyFileSpecifiedMeta, true); // Do not directly compare with Program.CommandLineArgs.FileName, // because this may be a relative path instead of an absolute one string strCmdLineFile = Program.CommandLineArgs.FileName; if ((strCmdLineFile != null) && (Program.MainForm != null)) { strCmdLineFile = Program.MainForm.IocFromCommandLine().Path; } if ((strCmdLineFile != null) && strCmdLineFile.Equals(m_ioInfo.Path, StrUtil.CaseIgnoreCmp)) { string str; str = Program.CommandLineArgs[AppDefs.CommandLineOptions.Password]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = str; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordEncrypted]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = StrUtil.DecryptString(str); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordStdIn]; if (str != null) { ProtectedString ps = KeyUtil.ReadPasswordStdIn(true); if (ps != null) { m_cbPassword.Checked = true; m_tbPassword.TextEx = ps; } } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.KeyFile]; if (str != null) { m_cbKeyFile.Checked = true; AddKeyFileSuggPriv(str, true); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PreSelect]; if (str != null) { m_cbKeyFile.Checked = true; AddKeyFileSuggPriv(str, true); } } m_cbHidePassword.Checked = true; OnCheckedHidePassword(sender, e); Debug.Assert(m_cmbKeyFile.Text.Length != 0); m_btnExit.Enabled = m_bCanExit; m_btnExit.Visible = m_bCanExit; ulong uKpf = Program.Config.UI.KeyPromptFlags; UIUtil.ApplyKeyUIFlags(uKpf, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if ((uKpf & (ulong)AceKeyUIFlags.DisableKeyFile) != 0) { UIUtil.SetEnabled(m_cmbKeyFile, m_cbKeyFile.Checked); UIUtil.SetEnabled(m_btnOpenKeyFile, m_cbKeyFile.Checked); } if (((uKpf & (ulong)AceKeyUIFlags.CheckPassword) != 0) || ((uKpf & (ulong)AceKeyUIFlags.UncheckPassword) != 0)) { m_bPwStatePreset = true; } if (((uKpf & (ulong)AceKeyUIFlags.CheckUserAccount) != 0) || ((uKpf & (ulong)AceKeyUIFlags.UncheckUserAccount) != 0)) { m_bUaStatePreset = true; } CustomizeForScreenReader(); EnableUserControls(); m_bInitializing = false; // E.g. command line options have higher priority m_bCanModKeyFile = (m_cmbKeyFile.SelectedIndex == 0); m_aKeyAssoc = Program.Config.Defaults.GetKeySources(m_ioInfo); if (m_aKeyAssoc != null) { if (m_aKeyAssoc.Password && !m_bPwStatePreset) { m_cbPassword.Checked = true; } if (m_aKeyAssoc.KeyFilePath.Length > 0) { AddKeyFileSuggPriv(m_aKeyAssoc.KeyFilePath, null); } if (m_aKeyAssoc.UserAccount && !m_bUaStatePreset) { m_cbUserAccount.Checked = true; } } foreach (KeyProvider prov in Program.KeyProviderPool) { AddKeyFileSuggPriv(prov.Name, null); } // Local, but thread will continue to run anyway Thread th = new Thread(new ThreadStart(this.AsyncFormLoad)); th.Start(); // ThreadPool.QueueUserWorkItem(new WaitCallback(this.AsyncFormLoad)); this.BringToFront(); this.Activate(); // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown }
//private int ScaleX(int i) { // return DpiUtil.ScaleIntX(i); //} //private int ScaleY(int i) { // return DpiUtil.ScaleIntY(i); //} private bool InitializeChildView(TabPage page, String uuid) { if (et_to_label != null) { add_child_items_to_tab(page); return(true); } init_pwgen_button(); et_to_label = new Dictionary <EntryTemplate, Label>(); et_to_control = new Dictionary <EntryTemplate, Control>(); et_to_secure_edit = new Dictionary <EntryTemplate, SecureEdit>(); et_to_control2 = new Dictionary <EntryTemplate, Control>(); SecureEdit entry_pass = null; SecureEdit entry_pass_confirm = null; int control_offset_y = 10; PwUuid par_uuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(uuid)); PwEntry par_template = m_host.Database.RootGroup.FindEntry(par_uuid, true); if (par_template == null) { return(false); } if (par_template.Strings.Get("_etm_template") == null) { return(false); } List <EntryTemplate> cur = parse_entry(par_template.Strings); const int LABEL_WIDTH = 130; const int LEFT_CONTROL_OFFSET = LABEL_WIDTH + 5; int CONTROL_WIDTH = TAB_WIDTH - LABEL_WIDTH - 55; foreach (EntryTemplate t in cur) { Label label = new Label(); label.Text = t.title + ":"; //label.AutoSize = false; label.Top = control_offset_y; label.Left = 0; label.AutoSize = false; label.Width = LABEL_WIDTH; label.AutoEllipsis = true; label.TextAlign = ContentAlignment.MiddleRight; FontUtil.AssignDefaultBold(label); et_to_label[t] = label; if (t.type == "Divider") { label.Font = new Font(label.Font.FontFamily, label.Font.Size * 1.1f, FontStyle.Bold | FontStyle.Underline); label.TextAlign = ContentAlignment.BottomLeft; label.Width = CONTROL_WIDTH + LABEL_WIDTH; label.Text = t.title; //remove : et_to_control[t] = null; } else if (t.type == "Checkbox") { CheckBox checkbox = new CheckBox(); checkbox.Top = control_offset_y; checkbox.Left = LEFT_CONTROL_OFFSET; et_to_control[t] = checkbox; } else if (t.type == "Listbox") { ComboBox combobox = new ComboBox(); combobox.Top = control_offset_y; combobox.Left = LEFT_CONTROL_OFFSET; combobox.Width = CONTROL_WIDTH; et_to_control[t] = combobox; if (!String.IsNullOrEmpty(t.options)) { String[] opts = t.options.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (String opt in opts) { combobox.Items.Add(opt.Trim()); } } } else if (t.type == "Date" || t.type == "Time" || t.type == "Date Time") { DateTimePicker picker = new DateTimePicker(); picker.Top = control_offset_y; picker.Left = LEFT_CONTROL_OFFSET; picker.CustomFormat = ""; picker.Width = CONTROL_WIDTH; picker.Format = DateTimePickerFormat.Custom; if (t.type == "Date" || t.type == "Date Time") { picker.CustomFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern; } if (t.type == "Date Time") { picker.CustomFormat += " "; } if (t.type == "Time" || t.type == "Date Time") { picker.CustomFormat += System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern; } if (t.fieldName == "@exp_date") { picker.ShowCheckBox = true; } et_to_control[t] = picker; } else if (t.type == "Inline" || t.type == "Protected Inline" || t.type == "Inline URL") { TextBox box = new TextBox(); box.Top = control_offset_y; box.Left = LEFT_CONTROL_OFFSET; box.Width = t.type == "Inline URL" ? CONTROL_WIDTH - 30 : CONTROL_WIDTH; int lines = LinesFromOption(t.options); if (t.type == "Inline URL") { lines = 1; } if (lines > 1) { box.Multiline = true; box.AcceptsReturn = true; box.Height = 13 * lines + 10; box.ScrollBars = ScrollBars.Both; control_offset_y += 13 * (lines - 1); } et_to_control[t] = box; if (t.type == "Protected Inline") { SecureEdit sedit = new SecureEdit(); sedit.Attach(box, null, true); et_to_secure_edit[t] = sedit; if (t.fieldName != "@confirm") { CheckBox chk = new CheckBox(); chk.Appearance = Appearance.Button; chk.Image = Resources.Resources.B17x05_3BlackDots; chk.Location = new Point(box.Left + box.Width + 10, control_offset_y); chk.Size = new Size(32, 23); chk.TextAlign = ContentAlignment.MiddleCenter; chk.UseVisualStyleBackColor = true; chk.Tag = t; chk.Checked = true; chk.CheckedChanged += chk_CheckedChanged; et_to_control2[t] = chk; } else { et_to_control2[t] = m_btnGenPw; et_to_control2[t].Location = new Point(box.Left + box.Width + 10, control_offset_y); current_password_confirm_field = sedit; current_password_confirm_field_txt = box; entry_pass_confirm = sedit; } if (t.fieldName == PwDefs.PasswordField) { entry_pass = current_password_field = sedit; } } else if (t.type == "Inline URL") { var link = new LinkLabel { Text = "Open" }; link.LinkClicked += (sender, args) => WinUtil.OpenUrl(box.Text ?? "", form.EntryRef); link.Location = new Point(box.Left + box.Width + 10, control_offset_y); link.Width = 50; et_to_control2[t] = link; } } else if (t.type == "Popout" || t.type == "Protected Popout") { Button btn = new Button(); btn.Text = "View/Edit"; if (t.type == "Protected Popout") { btn.Text = "View/Edit Secure"; } btn.Tag = t; btn.Width = CONTROL_WIDTH; btn.Left = LEFT_CONTROL_OFFSET; //btn.Height = 20; btn.Top = control_offset_y; btn.Click += btn_popout_Click; et_to_control[t] = btn; } control_offset_y += 30; } client_remove_button = new Button(); client_remove_button.Text = "Remove As Template Child"; client_remove_button.Width = CONTROL_WIDTH; client_remove_button.Left = LEFT_CONTROL_OFFSET; //client_remove_button.Height = 20; client_remove_button.Top = control_offset_y; client_remove_button.Click += client_remove_button_Click; if (entry_pass_confirm != null && entry_pass != null) { } add_child_items_to_tab(page); return(true); }
private void OnFormLoad(object sender, EventArgs e) { // Can be invoked by tray command; don't use CenterParent Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen); GlobalWindowManager.AddWindow(this); m_strAdvControlText = m_tabAdvanced.Text; BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Gen, KPRes.PasswordOptions, KPRes.PasswordOptionsDesc); this.Icon = Properties.Resources.KeePass; UIUtil.SetButtonImage(m_btnProfileAdd, Properties.Resources.B16x16_FileSaveAs, false); UIUtil.SetButtonImage(m_btnProfileRemove, Properties.Resources.B16x16_EditDelete, true); FontUtil.AssignDefaultBold(m_rbStandardCharSet); FontUtil.AssignDefaultBold(m_rbPattern); FontUtil.AssignDefaultBold(m_rbCustom); FontUtil.AssignDefaultMono(m_tbPreview, true); m_ttMain.SetToolTip(m_btnProfileAdd, KPRes.GenProfileSaveDesc); m_ttMain.SetToolTip(m_btnProfileRemove, KPRes.GenProfileRemoveDesc); m_bBlockUIUpdate = true; m_cbUpperCase.Text += @" (A, B, C, ...)"; m_cbLowerCase.Text += @" (a, b, c, ...)"; m_cbDigits.Text += @" (0, 1, 2, ...)"; m_cbMinus.Text += @" (-)"; m_cbUnderline.Text += @" (_)"; m_cbSpace.Text += @" ( )"; m_cbSpecial.Text += @" (!, $, %, &&, ...)"; m_cbBrackets.Text += @" ([, ], {, }, (, ), <, >)"; m_cbNoRepeat.Text += @" *"; m_cbExcludeLookAlike.Text += @" (l|1I, O0) *"; m_lblExcludeChars.Text += @" *"; m_lblSecRedInfo.Text = @"* " + m_lblSecRedInfo.Text; m_cmbCustomAlgo.Items.Add(NoCustomAlgo); foreach (CustomPwGenerator pwg in Program.PwGeneratorPool) { m_cmbCustomAlgo.Items.Add(pwg.Name); } SelectCustomGenerator((m_optInitial != null) ? m_optInitial.CustomAlgorithmUuid : null, null); if (m_optInitial != null) { CustomPwGenerator pwg = GetPwGenerator(); if (pwg != null) { m_dictCustomOptions[pwg] = m_optInitial.CustomAlgorithmOptions; } } m_cmbProfiles.Items.Add(CustomMeta); if (m_optInitial != null) { m_cmbProfiles.Items.Add(DeriveFromPrevious); SetGenerationOptions(m_optInitial); } m_rbStandardCharSet.CheckedChanged += this.UpdateUIProc; m_rbPattern.CheckedChanged += this.UpdateUIProc; m_rbCustom.CheckedChanged += this.UpdateUIProc; m_numGenChars.ValueChanged += this.UpdateUIProc; m_cbUpperCase.CheckedChanged += this.UpdateUIProc; m_cbLowerCase.CheckedChanged += this.UpdateUIProc; m_cbDigits.CheckedChanged += this.UpdateUIProc; m_cbMinus.CheckedChanged += this.UpdateUIProc; m_cbUnderline.CheckedChanged += this.UpdateUIProc; m_cbSpace.CheckedChanged += this.UpdateUIProc; m_cbSpecial.CheckedChanged += this.UpdateUIProc; m_cbBrackets.CheckedChanged += this.UpdateUIProc; m_cbHighAnsi.CheckedChanged += this.UpdateUIProc; m_tbCustomChars.TextChanged += this.UpdateUIProc; m_tbPattern.TextChanged += this.UpdateUIProc; m_cbPatternPermute.CheckedChanged += this.UpdateUIProc; m_cbNoRepeat.CheckedChanged += this.UpdateUIProc; m_cbExcludeLookAlike.CheckedChanged += this.UpdateUIProc; m_tbExcludeChars.TextChanged += this.UpdateUIProc; m_cmbCustomAlgo.SelectedIndexChanged += this.UpdateUIProc; m_cmbProfiles.Items.Add(AutoGeneratedMeta); m_cmbProfiles.SelectedIndex = ((m_optInitial == null) ? 0 : 1); foreach (PwProfile ppw in PwGeneratorUtil.GetAllProfiles(true)) { m_cmbProfiles.Items.Add(ppw.Name); if (ppw.GeneratorType == PasswordGeneratorType.Custom) { CustomPwGenerator pwg = Program.PwGeneratorPool.Find(new PwUuid(Convert.FromBase64String(ppw.CustomAlgorithmUuid))); if (pwg != null) { m_dictCustomOptions[pwg] = ppw.CustomAlgorithmOptions; } } } if (m_optInitial == null) { // int nIndex = m_cmbProfiles.FindString(Program.Config.PasswordGenerator.LastUsedProfile.Name); // if(nIndex >= 0) m_cmbProfiles.SelectedIndex = nIndex; SetGenerationOptions(Program.Config.PasswordGenerator.LastUsedProfile); } if (m_bCanAccept == false) { m_btnOK.Visible = false; m_btnCancel.Text = KPRes.CloseButton; m_tabPreview.Text = KPRes.Generate; m_lblPreview.Visible = false; UIUtil.SetChecked(m_cbEntropy, false); m_cbEntropy.Enabled = false; } // Debug.Assert(this.ShowInTaskbar == false); // if(m_bForceInTaskbar) this.ShowInTaskbar = true; CustomizeForScreenReader(); m_bBlockUIUpdate = false; EnableControlsEx(false); }
private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); if (m_bRedirectActivation) { Program.MainForm.RedirectActivationPush(this); } m_bInitializing = true; string strBannerDesc = WinUtil.CompactPath(m_ioInfo.Path, 45); m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width, m_bannerImage.Height, BannerStyle.Default, Properties.Resources.B48x48_KGPG_Key2, KPRes.EnterCompositeKey, strBannerDesc); this.Icon = Properties.Resources.KeePass; FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileSelect); string strNameEx = UrlUtil.GetFileName(m_ioInfo.Path); if (strNameEx.Length > 0) { this.Text += " - " + strNameEx; } m_tbPassword.Text = string.Empty; m_secPassword.Attach(m_tbPassword, ProcessTextChangedPassword, true); m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta); m_cmbKeyFile.SelectedIndex = 0; if ((Program.CommandLineArgs.FileName != null) && (m_ioInfo.Path == Program.CommandLineArgs.FileName)) { string str; str = Program.CommandLineArgs[AppDefs.CommandLineOptions.Password]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = str; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PasswordEncrypted]; if (str != null) { m_cbPassword.Checked = true; m_tbPassword.Text = StrUtil.DecryptString(str); } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.KeyFile]; if (str != null) { m_cbKeyFile.Checked = true; m_cmbKeyFile.Items.Add(str); m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1; } str = Program.CommandLineArgs[AppDefs.CommandLineOptions.PreSelect]; if (str != null) { m_cbKeyFile.Checked = true; m_cmbKeyFile.Items.Add(str); m_cmbKeyFile.SelectedIndex = m_cmbKeyFile.Items.Count - 1; } } m_cbHidePassword.Checked = true; OnCheckedHidePassword(sender, e); Debug.Assert(m_cmbKeyFile.Text.Length != 0); m_btnExit.Enabled = m_bCanExit; m_btnExit.Visible = m_bCanExit; UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyPromptFlags, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if ((Program.Config.UI.KeyPromptFlags & (ulong)AceKeyUIFlags.DisableKeyFile) != 0) { UIUtil.SetEnabled(m_cmbKeyFile, m_cbKeyFile.Checked); UIUtil.SetEnabled(m_btnOpenKeyFile, m_cbKeyFile.Checked); } CustomizeForScreenReader(); EnableUserControls(); m_bInitializing = false; // Local, but thread will continue to run anyway Thread th = new Thread(new ThreadStart(this.AsyncFormLoad)); th.Start(); this.BringToFront(); this.Activate(); m_tbPassword.Focus(); }
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 }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pgDataSource != null); if (m_pgDataSource == null) { throw new ArgumentException(); } GlobalWindowManager.AddWindow(this); this.Icon = Properties.Resources.KeePass; CreateDialogBanner(); List <Image> lTabImg = new List <Image>(); lTabImg.Add(Properties.Resources.B16x16_XMag); lTabImg.Add(Properties.Resources.B16x16_Configure); m_ilTabIcons = UIUtil.BuildImageListUnscaled(lTabImg, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16)); m_tabMain.ImageList = m_ilTabIcons; m_tabPreview.ImageIndex = 0; m_tabDataLayout.ImageIndex = 1; UIUtil.SetButtonImage(m_btnConfigPrinter, Properties.Resources.B16x16_EditCopy, true); UIUtil.SetButtonImage(m_btnPrintPreview, Properties.Resources.B16x16_FileQuickPrint, true); FontUtil.AssignDefaultBold(m_rbTabular); FontUtil.AssignDefaultBold(m_rbDetails); if (!m_bPrintMode) { m_btnOK.Text = KPRes.Export; } m_bBlockPreviewRefresh = true; m_rbTabular.Checked = true; m_cmbSortEntries.Items.Add("(" + KPRes.None + ")"); m_cmbSortEntries.Items.Add(KPRes.Title); m_cmbSortEntries.Items.Add(KPRes.UserName); m_cmbSortEntries.Items.Add(KPRes.Password); m_cmbSortEntries.Items.Add(KPRes.Url); m_cmbSortEntries.Items.Add(KPRes.Notes); AceColumnType colType = AceColumnType.Count; List <AceColumn> vCols = Program.Config.MainWindow.EntryListColumns; if ((m_nDefaultSortColumn >= 0) && (m_nDefaultSortColumn < vCols.Count)) { colType = vCols[m_nDefaultSortColumn].Type; } int nSortSel = 0; if (colType == AceColumnType.Title) { nSortSel = 1; } else if (colType == AceColumnType.UserName) { nSortSel = 2; } else if (colType == AceColumnType.Password) { nSortSel = 3; } else if (colType == AceColumnType.Url) { nSortSel = 4; } else if (colType == AceColumnType.Notes) { nSortSel = 5; } m_cmbSortEntries.SelectedIndex = nSortSel; m_bBlockPreviewRefresh = false; if (!m_bPrintMode) // Export to HTML { m_btnConfigPrinter.Visible = m_btnPrintPreview.Visible = false; m_lblPreviewHint.Visible = false; } if (!NativeLib.IsUnix()) { // MSHTML may create and forget temporary files under // C:\\Users\\USER\\AppData\\Local\\Temp\\*.htm // (e.g. when printing fails); we delete these later Program.TempFilesPool.AddContent("*.htm", false); } UpdateHtmlDocument(); UpdateUIState(); }
private void InitAdvancedTab() { IocProperties p = m_ioc.Properties; Dictionary <string, List <IocPropertyInfo> > dProps = GetPropertyInfos(); const int d = 7; int hLabel = m_lblUrl.Height; int hTextBox = m_tbUrl.Height; int hComboBox = m_cmbCredSaveMode.Height; Font f = m_lblUrl.Font; Debug.Assert(m_pnlAdv.AutoScroll); m_pnlAdv.AutoScrollMargin = new Size(1, d); int wPanel = m_pnlAdv.ClientSize.Width - UIUtil.GetVScrollBarWidth() - 1; int wGroup = wPanel - (2 * d); int wCell = (wPanel - (3 * d)) / 2; int xText = d - 1; int xInput = d + wCell + d - 1; int xGroup = xText; if (this.RightToLeft == RightToLeft.Yes) { int iTemp = xText; xText = xInput; xInput = iTemp; } int y = 1; int iID = 0; m_pnlAdv.SuspendLayout(); foreach (KeyValuePair <string, List <IocPropertyInfo> > kvp in dProps) { string strGroup = kvp.Key; y += d; Label lblGroup = new Label(); lblGroup.Name = "cGroup" + iID.ToString(NumberFormatInfo.InvariantInfo); ++iID; lblGroup.AutoEllipsis = true; lblGroup.AutoSize = false; lblGroup.Dock = DockStyle.None; lblGroup.Location = new Point(xGroup, y); lblGroup.Size = new Size(wGroup, hLabel); lblGroup.Text = strGroup; lblGroup.TextAlign = ContentAlignment.MiddleLeft; // lblGroup.BackColor = Color.Red; FontUtil.AssignDefaultBold(lblGroup); m_pnlAdv.Controls.Add(lblGroup); y += hLabel; foreach (IocPropertyInfo pi in kvp.Value) { string strName = pi.Name; string strText = pi.DisplayName + ":"; Type t = pi.Type; y += d; int hText = hLabel; int wRem = TextRenderer.MeasureText(strText, f).Width; while (wRem >= wCell) { hText += (hLabel + 1); wRem -= wCell; } Label lblText = new Label(); lblText.Name = "cText" + iID.ToString(NumberFormatInfo.InvariantInfo); ++iID; lblText.AutoEllipsis = true; lblText.AutoSize = false; lblText.Dock = DockStyle.None; lblText.Size = new Size(wCell, hText); lblText.Text = strText; lblText.TextAlign = ContentAlignment.MiddleLeft; // lblText.BackColor = Color.Green; Control cInput = null; if ((t == typeof(string)) || (t == typeof(long))) { TextBox tb = new TextBox(); tb.Size = new Size(wCell, hTextBox); tb.Text = (p.Get(strName) ?? string.Empty); cInput = tb; } else if (t == typeof(bool)) { ComboBox cmb = new ComboBox(); cmb.DropDownStyle = ComboBoxStyle.DropDownList; cmb.Size = new Size(wCell, hComboBox); cmb.Items.Add(KPRes.Auto); cmb.Items.Add(KPRes.Yes); cmb.Items.Add(KPRes.No); bool?ob = p.GetBool(strName); if (ob.HasValue) { cmb.SelectedIndex = (ob.Value ? 1 : 2); } else { cmb.SelectedIndex = 0; } cInput = cmb; } else { Debug.Assert(false); continue; } cInput.Dock = DockStyle.None; cInput.Name = "cInput" + iID.ToString(NumberFormatInfo.InvariantInfo); ++iID; int hDiff = lblText.Height - cInput.Height; if (hDiff >= 0) { lblText.Location = new Point(xText, y); cInput.Location = new Point(xInput, y + (hDiff / 2)); y += lblText.Height; } else { lblText.Location = new Point(xText, y - (hDiff / 2)); cInput.Location = new Point(xInput, y); y += cInput.Height; } m_pnlAdv.Controls.Add(lblText); m_pnlAdv.Controls.Add(cInput); m_lProps.Add(new KeyValuePair <IocPropertyInfo, Control>( pi, cInput)); } } m_pnlAdv.ResumeLayout(true); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null) { throw new InvalidOperationException(); } m_bInitializing = true; GlobalWindowManager.AddWindow(this); IOConnectionInfo ioc = m_pwDatabase.IOConnectionInfo; string strDisp = ioc.GetDisplayName(); string strDesc = KPRes.DatabaseSettingsDesc; if (!string.IsNullOrEmpty(strDisp)) { strDesc = strDisp; } BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings, strDesc); this.Icon = AppIcons.Default; FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo); FontUtil.AssignDefaultItalic(m_lblHeaderCp); FontUtil.AssignDefaultItalic(m_lblHeaderPerf); FontUtil.AssignDefaultBold(m_rbNone); FontUtil.AssignDefaultBold(m_rbGZip); UIUtil.ConfigureToolTip(m_ttRect); m_ttRect.SetToolTip(m_btnKdf1Sec, KPRes.KdfParams1Sec); m_tbDbName.PromptText = KPRes.DatabaseNamePrompt; m_tbDbDesc.PromptText = KPRes.DatabaseDescPrompt; if (m_bCreatingNew) { this.Text = KPRes.ConfigureOnNewDatabase2; } else { this.Text = KPRes.DatabaseSettings; } m_tbDbName.Text = m_pwDatabase.Name; UIUtil.SetMultilineText(m_tbDbDesc, m_pwDatabase.Description); m_tbDefaultUser.Text = m_pwDatabase.DefaultUserName; m_clr = m_pwDatabase.Color; if (m_clr != Color.Empty) { m_clr = AppIcons.RoundColor(m_clr); UIUtil.OverwriteButtonImage(m_btnColor, ref m_imgColor, UIUtil.CreateColorBitmap24(m_btnColor, m_clr)); } m_cbColor.Checked = (m_clr != Color.Empty); for (int inx = 0; inx < CipherPool.GlobalPool.EngineCount; ++inx) { m_cmbEncAlgo.Items.Add(CipherPool.GlobalPool[inx].DisplayName); } if (m_cmbEncAlgo.Items.Count > 0) { int nIndex = CipherPool.GlobalPool.GetCipherIndex(m_pwDatabase.DataCipherUuid); m_cmbEncAlgo.SelectedIndex = ((nIndex >= 0) ? nIndex : 0); } Debug.Assert(m_cmbKdf.Items.Count == 0); foreach (KdfEngine kdf in KdfPool.Engines) { m_cmbKdf.Items.Add(kdf.Name); } m_numKdfIt.Minimum = ulong.MinValue; m_numKdfIt.Maximum = ulong.MaxValue; m_numKdfMem.Minimum = ulong.MinValue; m_numKdfMem.Maximum = ulong.MaxValue; Debug.Assert(m_cmbKdfMem.Items.Count == 0); Debug.Assert(!m_cmbKdfMem.Sorted); m_cmbKdfMem.Items.Add("B"); m_cmbKdfMem.Items.Add("KB"); m_cmbKdfMem.Items.Add("MB"); m_cmbKdfMem.Items.Add("GB"); m_numKdfPar.Minimum = uint.MinValue; m_numKdfPar.Maximum = uint.MaxValue; SetKdfParameters(m_pwDatabase.KdfParameters); // m_lbMemProt.Items.Add(KPRes.Title, m_pwDatabase.MemoryProtection.ProtectTitle); // m_lbMemProt.Items.Add(KPRes.UserName, m_pwDatabase.MemoryProtection.ProtectUserName); // m_lbMemProt.Items.Add(KPRes.Password, m_pwDatabase.MemoryProtection.ProtectPassword); // m_lbMemProt.Items.Add(KPRes.Url, m_pwDatabase.MemoryProtection.ProtectUrl); // m_lbMemProt.Items.Add(KPRes.Notes, m_pwDatabase.MemoryProtection.ProtectNotes); // m_cbAutoEnableHiding.Checked = m_pwDatabase.MemoryProtection.AutoEnableVisualHiding; // m_cbAutoEnableHiding.Checked = false; if (m_pwDatabase.Compression == PwCompressionAlgorithm.None) { m_rbNone.Checked = true; } else if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip) { m_rbGZip.Checked = true; } else { Debug.Assert(false); } InitRecycleBinTab(); InitAdvancedTab(); m_bInitializing = false; EnableControlsEx(); UIUtil.SetFocus(m_tbDbName, this); }
private bool InitializeChildView(TabPage page, String uuid) { if (et_to_label != null) { add_child_items_to_tab(page); return(true); } SetBaseSizes(page); init_pwgen_button(); et_to_label = new Dictionary <EntryTemplate, Label>(); et_to_control = new Dictionary <EntryTemplate, Control>(); et_to_secure_edit = new Dictionary <EntryTemplate, SecureTextBoxEx>(); et_to_control2 = new Dictionary <EntryTemplate, Control>(); SecureTextBoxEx entry_pass = null; SecureTextBoxEx entry_pass_confirm = null; int control_offset_y = DpiUtil.ScaleIntY(10); PwUuid par_uuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(uuid)); PwEntry par_template = m_host.Database.RootGroup.FindEntry(par_uuid, true); if (par_template == null) { return(false); } if (par_template.Strings.Get("_etm_template") == null) { return(false); } List <EntryTemplate> cur = parse_entry(par_template.Strings); foreach (EntryTemplate t in cur) { Label label = new Label(); label.Text = t.title + ":"; //label.AutoSize = false; label.Top = control_offset_y; label.AutoSize = false; SetControlSizing(null, label); label.AutoEllipsis = true; label.TextAlign = ContentAlignment.MiddleRight; FontUtil.AssignDefaultBold(label); et_to_label[t] = label; if (t.type == "Divider") { label.Font = new Font(label.Font.FontFamily, label.Font.Size * 1.1f, FontStyle.Bold | FontStyle.Underline); label.TextAlign = ContentAlignment.BottomLeft; label.Text = t.title; //remove : et_to_control[t] = null; } else if (t.type == "Checkbox") { CheckBox checkbox = new CheckBox(); checkbox.Top = control_offset_y; et_to_control[t] = checkbox; } else if (t.type == "Listbox") { ComboBox combobox = new ComboBox(); combobox.Top = control_offset_y; et_to_control[t] = combobox; if (!String.IsNullOrEmpty(t.options)) { String[] opts = t.options.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (String opt in opts) { combobox.Items.Add(opt.Trim()); } } } else if (t.type == "Date" || t.type == "Time" || t.type == "Date Time") { DateTimePicker picker = new DateTimePicker(); picker.Top = control_offset_y; picker.CustomFormat = ""; picker.Format = DateTimePickerFormat.Custom; if (t.type == "Date" || t.type == "Date Time") { picker.CustomFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern; } if (t.type == "Date Time") { picker.CustomFormat += " "; } if (t.type == "Time" || t.type == "Date Time") { picker.CustomFormat += System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern; } if (t.fieldName == "@exp_date") { picker.ShowCheckBox = true; } et_to_control[t] = picker; } else if (t.type == "RichTextbox") { var box = new CustomRichTextBoxEx(); box.Top = control_offset_y; int lines = LinesFromOption(t.options); box.Multiline = lines > 1; box.Height = DpiUtil.ScaleIntY(13) * lines + DpiUtil.ScaleIntY(10); box.CtrlEnterAccepts = true; box.ScrollBars = RichTextBoxScrollBars.Both; control_offset_y += DpiUtil.ScaleIntY(13) * (lines - 1); UIUtil.PrepareStandardMultilineControl(box, true, lines > 1); et_to_control[t] = box; } else if (t.type == "Inline" || t.type == "Protected Inline" || t.type == "Inline URL") { var box = new TextBox(); int lines = LinesFromOption(t.options); if (t.type == "Inline URL") { lines = 1; } if (t.type == "Protected Inline") { box = new SecureTextBoxEx(); } box.Top = control_offset_y; if (lines > 1) { box.Multiline = true; box.AcceptsReturn = true; box.Height = DpiUtil.ScaleIntY(13) * lines + DpiUtil.ScaleIntY(10); box.ScrollBars = ScrollBars.Both; control_offset_y += DpiUtil.ScaleIntY(13) * (lines - 1); } et_to_control[t] = box; if (t.type == "Protected Inline") { et_to_secure_edit[t] = box as SecureTextBoxEx; if (t.fieldName != "@confirm") { CheckBox chk = new CheckBox(); chk.Appearance = Appearance.Button; chk.Image = DpiUtil.ScaleImage(Resources.Resources.B17x05_3BlackDots, false); chk.Size = new Size(DpiUtil.ScaleIntX(32), DpiUtil.ScaleIntY(23)); chk.TextAlign = ContentAlignment.MiddleCenter; chk.UseVisualStyleBackColor = true; chk.Top = control_offset_y; chk.Checked = true; chk.CheckedChanged += chk_CheckedChanged; et_to_control2[t] = chk; } else { et_to_control2[t] = m_btnGenPw; et_to_control2[t].Top = control_offset_y; current_password_confirm_field = box as SecureTextBoxEx; current_password_confirm_field_txt = box; entry_pass_confirm = box as SecureTextBoxEx; } if (t.fieldName == PwDefs.PasswordField) { entry_pass = current_password_field = box as SecureTextBoxEx; } } else if (t.type == "Inline URL") { var link = new LinkLabel { Text = "Open" }; link.LinkClicked += (sender, args) => WinUtil.OpenUrl(box.Text ?? "", form.EntryRef); link.Top = control_offset_y; link.Width = DpiUtil.ScaleIntY(50); et_to_control2[t] = link; } } else if (t.type == "Popout" || t.type == "Protected Popout") { Button btn = new Button(); btn.Text = "View/Edit"; if (t.type == "Protected Popout") { btn.Text = "View/Edit Secure"; } btn.Height = BUTTON_HEIGHT; btn.Top = control_offset_y; btn.Click += btn_popout_Click; et_to_control[t] = btn; } control_offset_y += DpiUtil.ScaleIntY(30); if (et_to_control[t] != null) //only the divider does not { et_to_control[t].Tag = t; SetControlSizing(t, et_to_control[t]); } if (et_to_control2.ContainsKey(t)) { et_to_control2[t].Tag = t; SetControlSizing(t, et_to_control2[t]); } } client_remove_button = new Button(); client_remove_button.Text = "Remove As Template Child"; client_remove_button.Height = BUTTON_HEIGHT; SetControlSizing(null, client_remove_button); //client_remove_button.Height = 20; client_remove_button.Top = control_offset_y; client_remove_button.Click += client_remove_button_Click; add_child_items_to_tab(page); return(true); }
private void OnFormLoad(object sender, EventArgs e) { if (m_ilIcons == null) { Debug.Assert(false); throw new InvalidOperationException(); } if (m_pd == null) { Debug.Assert(false); throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); this.Icon = AppIcons.Default; FontUtil.AssignDefaultBold(m_radioStandard); FontUtil.AssignDefaultBold(m_radioCustom); // With the Explorer theme, item selection rectangles are larger // and thus (gray/inactive) selections are easier to see UIUtil.SetExplorerTheme(m_lvIcons, false); UIUtil.SetExplorerTheme(m_lvCustomIcons, false); if (m_ilIcons.Images.Count < (long)m_uNumberOfStandardIcons) { Debug.Assert(false); m_uNumberOfStandardIcons = (uint)m_ilIcons.Images.Count; } m_lvIcons.BeginUpdate(); m_lvIcons.SmallImageList = m_ilIcons; for (uint i = 0; i < m_uNumberOfStandardIcons; ++i) { m_lvIcons.Items.Add(i.ToString(), (int)i); } m_lvIcons.EndUpdate(); if (m_uDefaultIcon < m_uNumberOfStandardIcons) { m_lvIcons.EnsureVisible((int)m_uDefaultIcon); UIUtil.SetFocusedItem(m_lvIcons, m_lvIcons.Items[ (int)m_uDefaultIcon], true); } else { Debug.Assert(false); } RecreateCustomIconList(m_puDefaultCustomIcon); if (!m_puDefaultCustomIcon.Equals(PwUuid.Zero)) { m_radioCustom.Checked = true; UIUtil.SetFocus(m_lvCustomIcons, this); } else { m_radioStandard.Checked = true; UIUtil.SetFocus(m_lvIcons, this); } EnableControlsEx(); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pgDataSource != null); if (m_pgDataSource == null) { throw new ArgumentException(); } GlobalWindowManager.AddWindow(this); this.Icon = Properties.Resources.KeePass; CreateDialogBanner(); UIUtil.SetButtonImage(m_btnConfigPrinter, Properties.Resources.B16x16_EditCopy, true); UIUtil.SetButtonImage(m_btnPrintPreview, Properties.Resources.B16x16_FileQuickPrint, true); FontUtil.AssignDefaultBold(m_rbTabular); FontUtil.AssignDefaultBold(m_rbDetails); if (!m_bPrintMode) { m_btnOK.Text = KPRes.Export; } m_bBlockPreviewRefresh = true; m_rbTabular.Checked = true; m_cmbSortEntries.Items.Add("(" + KPRes.None + ")"); m_cmbSortEntries.Items.Add(KPRes.Title); m_cmbSortEntries.Items.Add(KPRes.UserName); m_cmbSortEntries.Items.Add(KPRes.Password); m_cmbSortEntries.Items.Add(KPRes.Url); m_cmbSortEntries.Items.Add(KPRes.Notes); AceColumnType colType = AceColumnType.Count; List <AceColumn> vCols = Program.Config.MainWindow.EntryListColumns; if ((m_nDefaultSortColumn >= 0) && (m_nDefaultSortColumn < vCols.Count)) { colType = vCols[m_nDefaultSortColumn].Type; } int nSortSel = 0; if (colType == AceColumnType.Title) { nSortSel = 1; } else if (colType == AceColumnType.UserName) { nSortSel = 2; } else if (colType == AceColumnType.Password) { nSortSel = 3; } else if (colType == AceColumnType.Url) { nSortSel = 4; } else if (colType == AceColumnType.Notes) { nSortSel = 5; } m_cmbSortEntries.SelectedIndex = nSortSel; m_bBlockPreviewRefresh = false; if (!m_bPrintMode) // Export to HTML { m_btnConfigPrinter.Visible = m_btnPrintPreview.Visible = false; m_lblPreviewHint.Visible = false; } UpdateHtmlDocument(); UpdateUIState(); }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Ark, KPRes.DatabaseSettings, KPRes.DatabaseSettingsDesc); this.Icon = Properties.Resources.KeePass; m_bInitializing = true; FontUtil.AssignDefaultItalic(m_lblHeaderCpAlgo); FontUtil.AssignDefaultItalic(m_lblHeaderCp); FontUtil.AssignDefaultItalic(m_lblHeaderPerf); FontUtil.AssignDefaultBold(m_rbNone); FontUtil.AssignDefaultBold(m_rbGZip); m_ttRect.SetToolTip(m_lnkCompute1SecDelay, KPRes.TransformationRounds1SecHint); m_tbDbName.PromptText = KPRes.DatabaseNamePrompt; m_tbDbDesc.PromptText = KPRes.DatabaseDescPrompt; if (m_bCreatingNew) { this.Text = KPRes.ConfigureOnNewDatabase; } else { this.Text = KPRes.DatabaseSettings; } m_tbDbName.Text = m_pwDatabase.Name; m_tbDbDesc.Text = m_pwDatabase.Description; m_tbDefaultUser.Text = m_pwDatabase.DefaultUserName; m_clr = m_pwDatabase.Color; if (m_clr != Color.Empty) { UIUtil.SetButtonImage(m_btnColor, PwEntryForm.CreateColorButtonImage( m_btnColor, m_clr), false); } m_cbColor.Checked = (m_clr != Color.Empty); for (int inx = 0; inx < CipherPool.GlobalPool.EngineCount; ++inx) { m_cmbEncAlgo.Items.Add(CipherPool.GlobalPool[inx].DisplayName); } if (m_cmbEncAlgo.Items.Count > 0) { int nIndex = CipherPool.GlobalPool.GetCipherIndex(m_pwDatabase.DataCipherUuid); m_cmbEncAlgo.SelectedIndex = ((nIndex >= 0) ? nIndex : 0); } m_numEncRounds.Minimum = ulong.MinValue; m_numEncRounds.Maximum = ulong.MaxValue; m_numEncRounds.Value = m_pwDatabase.KeyEncryptionRounds; // m_lbMemProt.Items.Add(KPRes.Title, m_pwDatabase.MemoryProtection.ProtectTitle); // m_lbMemProt.Items.Add(KPRes.UserName, m_pwDatabase.MemoryProtection.ProtectUserName); // m_lbMemProt.Items.Add(KPRes.Password, m_pwDatabase.MemoryProtection.ProtectPassword); // m_lbMemProt.Items.Add(KPRes.Url, m_pwDatabase.MemoryProtection.ProtectUrl); // m_lbMemProt.Items.Add(KPRes.Notes, m_pwDatabase.MemoryProtection.ProtectNotes); // m_cbAutoEnableHiding.Checked = m_pwDatabase.MemoryProtection.AutoEnableVisualHiding; // m_cbAutoEnableHiding.Checked = false; if (m_pwDatabase.Compression == PwCompressionAlgorithm.None) { m_rbNone.Checked = true; } else if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip) { m_rbGZip.Checked = true; } else { Debug.Assert(false); } InitRecycleBinTab(); InitAdvancedTab(); m_bInitializing = false; EnableControlsEx(); }
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 }