private void InitExpiryDate() { EntryExpiry.Attach(m_cbExpires, dtExpire); dtExpire.Format = DateTimePickerFormat.Custom; if (m_pcadata.SetExpiry) { EntryExpiry.Value = m_pcadata.Expiry.ToLocalTime(); EntryExpiry.Checked = m_pcadata.Expires; return; } else if (m_pcadata.Expires) { if (Program.Config.Defaults.NewEntryExpiresInDays > -1) { EntryExpiry.Value = DateTime.Now.AddDays(Program.Config.Defaults.NewEntryExpiresInDays).ToLocalTime(); } else { EntryExpiry.Value = DateTime.Now.AddMonths(6).ToLocalTime(); } EntryExpiry.Checked = true; } else { return; } //Let's see whether PEDCalc is installed and active CheckPEDCalc(); }
public ModifyEntryTimestampsForm(DateTime creationTime, DateTime lastModificationTime, DateTime lastAccessTime) { InitializeComponent(); Icon = AppIcons.Default; BannerFactory.CreateBannerEx(this, bannerImage, Properties.Resources.clock_48x48, "Timestamps", "Modify the entry timestamps."); createdDateTimePicker.Value = TimeUtil.ToLocal(creationTime, true); lastModifiedDateTimePicker.Value = TimeUtil.ToLocal(lastModificationTime, true); lastAccessedDateTimePicker.Value = TimeUtil.ToLocal(lastAccessTime, true); creationTimeControlGroup = new ExpiryControlGroup(); creationTimeControlGroup.Attach(createdCheckBox, createdDateTimePicker); lastModificationTimeControlGroup = new ExpiryControlGroup(); lastModificationTimeControlGroup.Attach(lastModifiedCheckBox, lastModifiedDateTimePicker); lastAccessTimeControlGroup = new ExpiryControlGroup(); lastAccessTimeControlGroup.Attach(lastAccessedCheckBox, lastAccessedDateTimePicker); }
private void OnFormLoad(object sender, EventArgs e) { if (m_pwGroup == null) { Debug.Assert(false); throw new InvalidOperationException(); } if (m_pwDatabase == null) { Debug.Assert(false); throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); string strTitle = (m_bCreatingNew ? KPRes.AddGroup : KPRes.EditGroup); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Txt, strTitle, (m_bCreatingNew ? KPRes.AddGroupDesc : KPRes.EditGroupDesc)); this.Icon = AppIcons.Default; this.Text = strTitle; UIUtil.ConfigureToolTip(m_ttRect); UIUtil.SetToolTip(m_ttRect, m_btnIcon, KPRes.SelectIcon, true); UIUtil.SetToolTip(m_ttRect, m_btnAutoTypeEdit, KPRes.ConfigureKeystrokeSeq, true); UIUtil.AccSetName(m_dtExpires, m_cbExpires); UIUtil.AccSetName(m_tbDefaultAutoTypeSeq, m_rbAutoTypeOverride); m_tbName.Text = m_pwGroup.Name; m_pwIconIndex = m_pwGroup.IconId; m_pwCustomIconID = m_pwGroup.CustomIconUuid; if (!m_pwCustomIconID.Equals(PwUuid.Zero)) { UIUtil.SetButtonImage(m_btnIcon, DpiUtil.GetIcon( m_pwDatabase, m_pwCustomIconID), true); } else { UIUtil.SetButtonImage(m_btnIcon, m_ilClientIcons.Images[ (int)m_pwIconIndex], true); } UIUtil.SetMultilineText(m_tbNotes, m_pwGroup.Notes); if (m_pwGroup.Expires) { m_dtExpires.Value = TimeUtil.ToLocal(m_pwGroup.ExpiryTime, true); m_cbExpires.Checked = true; } else // Does not expire { m_dtExpires.Value = DateTime.Now.Date; m_cbExpires.Checked = false; } m_cgExpiry.Attach(m_cbExpires, m_dtExpires); TagUtil.MakeInheritedTagsLink(m_linkTagsInh, m_pwGroup.ParentGroup, this); m_tbTags.Text = StrUtil.TagsToString(m_pwGroup.Tags, true); TagUtil.MakeTagsButton(m_btnTags, m_tbTags, m_ttRect, m_pwGroup.ParentGroup, ((m_pwDatabase != null) ? m_pwDatabase.RootGroup : null)); m_tbUuid.Text = m_pwGroup.Uuid.ToHexString() + ", " + Convert.ToBase64String(m_pwGroup.Uuid.UuidBytes); PwGroup pgParent = m_pwGroup.ParentGroup; bool bParentSearching = ((pgParent != null) ? pgParent.GetSearchingEnabledInherited() : PwGroup.DefaultSearchingEnabled); UIUtil.MakeInheritableBoolComboBox(m_cmbEnableSearching, m_pwGroup.EnableSearching, bParentSearching); bool bParentAutoType = ((pgParent != null) ? pgParent.GetAutoTypeEnabledInherited() : PwGroup.DefaultAutoTypeEnabled); UIUtil.MakeInheritableBoolComboBox(m_cmbEnableAutoType, m_pwGroup.EnableAutoType, bParentAutoType); m_tbDefaultAutoTypeSeq.Text = m_pwGroup.GetAutoTypeSequenceInherited(); if (m_pwGroup.DefaultAutoTypeSequence.Length == 0) { m_rbAutoTypeInherit.Checked = true; } else { m_rbAutoTypeOverride.Checked = true; } UIUtil.SetButtonImage(m_btnAutoTypeEdit, Properties.Resources.B16x16_Wizard, true); m_sdCustomData = m_pwGroup.CustomData.CloneDeep(); UIUtil.StrDictListInit(m_lvCustomData); UIUtil.StrDictListUpdate(m_lvCustomData, m_sdCustomData, false); EnableControlsEx(); ThreadPool.QueueUserWorkItem(delegate(object state) { try { string[] vSeq = m_pwDatabase.RootGroup.GetAutoTypeSequences(true); // Do not append, because long suggestions hide the start UIUtil.EnableAutoCompletion(m_tbDefaultAutoTypeSeq, false, vSeq); // Invokes } catch (Exception) { Debug.Assert(false); } }); UIUtil.SetFocus(m_tbName, this); switch (m_gftInit) { case GroupFormTab.Properties: m_tabMain.SelectedTab = m_tabProperties; break; case GroupFormTab.AutoType: m_tabMain.SelectedTab = m_tabAutoType; break; case GroupFormTab.CustomData: m_tabMain.SelectedTab = m_tabCustomData; break; default: break; } }
private void OnFormLoad(object sender, EventArgs e) { Debug.Assert(m_pwGroup != null); if (m_pwGroup == null) { throw new InvalidOperationException(); } Debug.Assert(m_pwDatabase != null); if (m_pwDatabase == null) { throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); string strTitle = (m_bCreatingNew ? KPRes.AddGroup : KPRes.EditGroup); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_Folder_Txt, strTitle, (m_bCreatingNew ? KPRes.AddGroupDesc : KPRes.EditGroupDesc)); this.Icon = Properties.Resources.KeePass; this.Text = strTitle; UIUtil.SetButtonImage(m_btnAutoTypeEdit, Properties.Resources.B16x16_Wizard, true); m_pwIconIndex = m_pwGroup.IconId; m_pwCustomIconID = m_pwGroup.CustomIconUuid; m_tbName.Text = m_pwGroup.Name; UIUtil.SetMultilineText(m_tbNotes, m_pwGroup.Notes); if (!m_pwCustomIconID.Equals(PwUuid.Zero)) { UIUtil.SetButtonImage(m_btnIcon, m_pwDatabase.GetCustomIcon( m_pwCustomIconID), true); } else { UIUtil.SetButtonImage(m_btnIcon, m_ilClientIcons.Images[ (int)m_pwIconIndex], true); } if (m_pwGroup.Expires) { m_dtExpires.Value = m_pwGroup.ExpiryTime; m_cbExpires.Checked = true; } else // Does not expire { m_dtExpires.Value = DateTime.Now.Date; m_cbExpires.Checked = false; } m_cgExpiry.Attach(m_cbExpires, m_dtExpires); PwGroup pgParent = m_pwGroup.ParentGroup; bool bParentAutoType = ((pgParent != null) ? pgParent.GetAutoTypeEnabledInherited() : PwGroup.DefaultAutoTypeEnabled); UIUtil.MakeInheritableBoolComboBox(m_cmbEnableAutoType, m_pwGroup.EnableAutoType, bParentAutoType); bool bParentSearching = ((pgParent != null) ? pgParent.GetSearchingEnabledInherited() : PwGroup.DefaultSearchingEnabled); UIUtil.MakeInheritableBoolComboBox(m_cmbEnableSearching, m_pwGroup.EnableSearching, bParentSearching); m_tbDefaultAutoTypeSeq.Text = m_pwGroup.GetAutoTypeSequenceInherited(); if (m_pwGroup.DefaultAutoTypeSequence.Length == 0) { m_rbAutoTypeInherit.Checked = true; } else { m_rbAutoTypeOverride.Checked = true; } CustomizeForScreenReader(); EnableControlsEx(); UIUtil.SetFocus(m_tbName, this); }