void form_Resize(object sender, EventArgs e) { PwEntryForm form = sender as PwEntryForm; TabControl tabControl = null; foreach (Control c in form.Controls) { if (c is TabControl) { tabControl = c as TabControl; break; } } if (tabControl == null) { return; } TabPage tmplPage = tabControl.TabPages[0]; if (tmplPage.Text != "Template") { return; } EntryTemplateManager.SetBaseSizes(tmplPage); foreach (Control c in tmplPage.Controls) { EntryTemplateManager.UpdateControlSize(c); } }
void EntryContextMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) { m_tsmi_set_template_parent.Enabled = m_host.MainWindow.GetSelectedEntriesCount() != 0; m_tsmi_copy_template_string.Visible = show_copy_menu(); if (show_copy_menu()) { m_dynCustomStrings.Clear(); PwEntry pe = m_host.MainWindow.GetSelectedEntry(true); Dictionary <string, string> title_to_field = EntryTemplateManager.get_template_title_to_field_dict(m_host, EntryTemplateManager.get_entry_template_parent_uuid(pe)); foreach (KeyValuePair <string, string> kvp in title_to_field) { m_dynCustomStrings.AddItem(kvp.Key, Resources.Resources.B16x16_KGPG_Info, kvp.Value); } } }
void m_tsmi_set_template_parent_Click(object sender, EventArgs e) { if (EntryTemplateManager.entry_is_in_template_group(m_host, m_host.MainWindow.GetSelectedGroup())) { MessageBox.Show("Cannot set the template parent on a template"); return; } PwEntry parent = EntryTemplateManager.show_parent_template_chooser(m_host); if (parent == null) { return; } PwEntry[] entries = m_host.MainWindow.GetSelectedEntries(); foreach (PwEntry entry in entries) { EntryTemplateManager.set_entry_template_parent(m_host.Database, entry, parent); } m_host.MainWindow.UpdateUI(false, null, false, m_host.MainWindow.GetSelectedGroup(), false, null, true); }
private bool show_copy_menu() { return(m_host.MainWindow.GetSelectedEntriesCount() == 1 && EntryTemplateManager.is_template_child(m_host.MainWindow.GetSelectedEntry(false))); }
void EntryTemplates_EntryCreating(object sender, TemplateEntryEventArgs e) { EntryTemplateManager.InitChildEntry(e.TemplateEntry, e.Entry); }