Inheritance: System.Windows.Forms.Form
コード例 #1
0
 public KeeFoxEntryUserControl(KeePassRPCExt keePassRPCPlugin, PwEntry entry,
     CustomListViewEx advancedListView, PwEntryForm pwEntryForm, ProtectedStringDictionary strings)
 {
     KeePassRPCPlugin = keePassRPCPlugin;
     _entry = entry;
     InitializeComponent();
     _advancedListView = advancedListView;
     _pwEntryForm = pwEntryForm;
     _strings = strings;
 }
コード例 #2
0
ファイル: RPCClientManagers.cs プロジェクト: halotron/KeeFox
 public override void AttachToEntryDialog(KeePassRPCExt plugin, PwEntry entry, TabControl mainTabControl, PwEntryForm form, CustomListViewEx advancedListView, ProtectedStringDictionary strings)
 {
     KeeFoxEntryUserControl entryControl = new KeeFoxEntryUserControl(plugin, entry, advancedListView, form, strings);
     TabPage keefoxTabPage = new TabPage("KeeFox");
     entryControl.Dock = DockStyle.Fill;
     keefoxTabPage.Controls.Add(entryControl);
     if (mainTabControl.ImageList == null)
         mainTabControl.ImageList = new ImageList();
     int imageIndex = mainTabControl.ImageList.Images.Add(global::KeePassRPC.Properties.Resources.KeeFox16, Color.Transparent);
     keefoxTabPage.ImageIndex = imageIndex;
     mainTabControl.TabPages.Add(keefoxTabPage);
 }
コード例 #3
0
ファイル: EntryPanel.cs プロジェクト: xenithorb/KeeAgent
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
       pwEntryForm = ParentForm as PwEntryForm;
       if (pwEntryForm != null) {
     IntialSettings =
       pwEntryForm.EntryRef.GetKeeAgentSettings();
     CurrentSettings = (EntrySettings)IntialSettings.Clone ();
     entrySettingsBindingSource.DataSource = CurrentSettings;
     keyLocationPanel.KeyLocationChanged += delegate {
       UpdateKeyInfoDelayed();
     };
     pwEntryForm.FormClosing += delegate {
       while (delayedUpdateKeyInfoTimer.Enabled)
     Application.DoEvents();
     };
       } else {
     Debug.Fail("Don't have settings to bind to");
       }
       UpdateControlStates();
 }
コード例 #4
0
        public EntryTemplateManager(IPluginHost host, PwEntryForm form)
        {
            m_host = host;
            this.form = form;
            our_page = new TabPage("Template");
            our_page.AutoScroll = true;

            form_tab_control = get_control_from_form(form, "m_tabMain") as TabControl;
            Debug.Assert(form_tab_control != null);
            form_tab_control.Selecting += main_tabs_control_Selecting;
            _entry_is_template = form.EntryStrings.Get("_etm_template") != null;
            ProtectedString str = form.EntryStrings.Get("_etm_template_uuid");
            entry_is_child = str != null;
            if (entry_is_child)
                child_template_uuid = str.ReadString();
            form.EntrySaving += form_EntrySaving;
            our_page.UseVisualStyleBackColor = true;
            form_tab_control.TabPages.Insert(0, our_page);
            if (entry_is_child || entry_is_template)
                form_tab_control.SelectTab(0);
        }
コード例 #5
0
 public KeeFoxEntryUserControl(KeePassRPCExt keePassRPCPlugin, PwEntry entry,
     CustomListViewEx advancedListView, PwEntryForm pwEntryForm, ProtectedStringDictionary strings)
 {
     KeePassRPCPlugin = keePassRPCPlugin;
     _entry = entry;
     InitializeComponent();
     _pwEntryForm = pwEntryForm;
     _strings = strings;
     string json = strings.ReadSafe("KPRPC JSON");
     if (string.IsNullOrEmpty(json))
         _conf = new EntryConfig();
     else
     {
         try
         {
             _conf = (EntryConfig)Jayrock.Json.Conversion.JsonConvert.Import(typeof(EntryConfig), json);
         }
         catch (Exception)
         {
             MessageBox.Show("There are configuration errors in this entry. To fix the entry and prevent this warning message appearing, please edit the value of the 'KeePassRPC JSON config' advanced string. Please ask for help on http://keefox.org/help/forum if you're not sure how to fix this.", "Warning: Configuration errors", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
コード例 #6
0
ファイル: EntryTemplates.cs プロジェクト: earthday/keepass2
        private static void CreateEntry(PwEntry peTemplate)
        {
            if(peTemplate == null) { Debug.Assert(false); return; }

            PwDatabase pd = Program.MainForm.ActiveDatabase;
            if(pd == null) { Debug.Assert(false); return; }
            if(pd.IsOpen == false) { Debug.Assert(false); return; }

            PwGroup pgContainer = Program.MainForm.GetSelectedGroup();
            if(pgContainer == null) pgContainer = pd.RootGroup;

            PwEntry pe = peTemplate.Duplicate();

            if(EntryTemplates.EntryCreating != null)
                EntryTemplates.EntryCreating(null, new TemplateEntryEventArgs(
                    peTemplate.CloneDeep(), pe));

            PwEntryForm pef = new PwEntryForm();
            pef.InitEx(pe, PwEditMode.AddNewEntry, pd, Program.MainForm.ClientIcons,
                false, true);

            if(UIUtil.ShowDialogAndDestroy(pef) == DialogResult.OK)
            {
                pgContainer.AddEntry(pe, true, true);

                MainForm mf = Program.MainForm;
                if(mf != null)
                {
                    mf.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
                        true, null, true);

                    PwObjectList<PwEntry> vSelect = new PwObjectList<PwEntry>();
                    vSelect.Add(pe);
                    mf.SelectEntries(vSelect, true, true);

                    mf.EnsureVisibleEntry(pe.Uuid);
                    mf.UpdateUI(false, null, false, null, false, null, false);
                }
                else { Debug.Assert(false); }

                if(EntryTemplates.EntryCreated != null)
                    EntryTemplates.EntryCreated(null, new TemplateEntryEventArgs(
                        peTemplate.CloneDeep(), pe));
            }
            else Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
                pd.UINeedsIconUpdate, null, false);
        }
コード例 #7
0
		private void EditSelectedEntry(bool bSwitchToHistoryTab)
		{
			PwEntry pe = GetSelectedEntry(false);
			if(pe == null) return; // Do not assert

			PwDatabase pwDb = m_docMgr.ActiveDatabase;
			PwEntryForm pForm = new PwEntryForm();
			pForm.InitEx(pe, PwEditMode.EditExistingEntry, pwDb, m_ilCurrentIcons,
				false, false);

			pForm.InitSwitchToHistoryTab = bSwitchToHistoryTab;

			if(pForm.ShowDialog() == DialogResult.OK)
			{
				bool bUpdImg = pwDb.UINeedsIconUpdate;
				RefreshEntriesList(); // Update entry
				UpdateUI(false, null, bUpdImg, null, false, null, pForm.HasModifiedEntry);
			}
			else
			{
				bool bUpdImg = pwDb.UINeedsIconUpdate;
				RefreshEntriesList(); // Update last access time
				UpdateUI(false, null, bUpdImg, null, false, null, false);
			}
			UIUtil.DestroyForm(pForm);
		}
コード例 #8
0
ファイル: MainForm.cs プロジェクト: amiryal/keepass2
        private void OnEntryAdd(object sender, EventArgs e)
        {
            PwGroup pg = GetSelectedGroup();
            Debug.Assert(pg != null); if(pg == null) return;

            if(pg.IsVirtual)
            {
                MessageService.ShowWarning(KPRes.GroupCannotStoreEntries,
                    KPRes.SelectDifferentGroup);
                return;
            }

            PwDatabase pwDb = m_docMgr.ActiveDatabase;
            PwEntry pwe = new PwEntry(true, true);
            pwe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
                pwDb.MemoryProtection.ProtectUserName,
                pwDb.DefaultUserName));

            ProtectedString psAutoGen = new ProtectedString(
                pwDb.MemoryProtection.ProtectPassword);
            PwGenerator.Generate(psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
                null, Program.PwGeneratorPool);
            pwe.Strings.Set(PwDefs.PasswordField, psAutoGen);

            int nExpireDays = Program.Config.Defaults.NewEntryExpiresInDays;
            if(nExpireDays >= 0)
            {
                pwe.Expires = true;
                pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
            }

            if((pg.IconId != PwIcon.Folder) && (pg.IconId != PwIcon.FolderOpen) &&
                (pg.IconId != PwIcon.FolderPackage))
            {
                pwe.IconId = pg.IconId; // Inherit icon from group
            }
            pwe.CustomIconUuid = pg.CustomIconUuid;

            // Temporarily assume that the entry is in pg; required for retrieving
            // the default auto-type sequence
            pwe.ParentGroup = pg;

            PwEntryForm pForm = new PwEntryForm();
            pForm.InitEx(pwe, PwEditMode.AddNewEntry, pwDb, m_ilCurrentIcons,
                false, false);
            if(UIUtil.ShowDialogAndDestroy(pForm) == DialogResult.OK)
            {
                pg.AddEntry(pwe, true);
                UpdateUI(false, null, pwDb.UINeedsIconUpdate, null, true,
                    null, true, m_lvEntries);

                PwObjectList<PwEntry> vSelect = new PwObjectList<PwEntry>();
                vSelect.Add(pwe);
                SelectEntries(vSelect, true, true);

                EnsureVisibleEntry(pwe.Uuid);
            }
            else UpdateUI(false, null, pwDb.UINeedsIconUpdate, null,
                pwDb.UINeedsIconUpdate, null, false);
        }
コード例 #9
0
ファイル: PwEntryForm.cs プロジェクト: rdealexb/keepass
        private void OnBtnHistoryView(object sender, EventArgs e)
        {
            Debug.Assert(m_vHistory.UCount == m_lvHistory.Items.Count);

            ListView.SelectedIndexCollection lvsi = m_lvHistory.SelectedIndices;
            if(lvsi.Count != 1) { Debug.Assert(false); return; }

            PwEntry pe = m_vHistory.GetAt((uint)lvsi[0]);
            if(pe == null) { Debug.Assert(false); return; }

            PwEntryForm pwf = new PwEntryForm();
            pwf.InitEx(pe, PwEditMode.ViewReadOnlyEntry, m_pwDatabase,
                m_ilIcons, false, false);

            UIUtil.ShowDialogAndDestroy(pwf);
        }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: jonbws/strengthreport
        private void OnEntryEdit(object sender, EventArgs e)
        {
            PwEntry pe = GetSelectedEntry(false);
            if(pe == null) return; // Do not assert

            PwEntryForm pForm = new PwEntryForm();
            pForm.InitEx(pe, PwEditMode.EditExistingEntry, m_docMgr.ActiveDatabase,
                m_ilCurrentIcons, false);

            if(pForm.ShowDialog() == DialogResult.OK)
            {
                RefreshEntriesList(); // Update entry
                UpdateUIState(pForm.HasModifiedEntry);
            }
            else
            {
                RefreshEntriesList(); // Update last access time
                UpdateUIState(false);
            }
        }
コード例 #11
0
ファイル: KeePassRPCService.cs プロジェクト: krbvroc1/KeeFox
        void OpenLoginEditorWindow(PwEntry pe, PwDatabase db)
        {
            PwEntryForm ef = new PwEntryForm();
            ef.InitEx(pe, PwEditMode.EditExistingEntry, host.Database, host.MainWindow.ClientIcons, false, false);

            ef.BringToFront();
            ef.ShowInTaskbar = true;

            host.MainWindow.Focus();
            ef.TopMost = true;
            ef.Focus();
            ef.Activate();

            if (ef.ShowDialog() == DialogResult.OK)
                saveDB(db);
        }
コード例 #12
0
ファイル: EntryTemplates.cs プロジェクト: rassilon/keepass
        private static void CreateEntry(PwEntry peTemplate)
        {
            if(peTemplate == null) { Debug.Assert(false); return; }

            PwDatabase pd = Program.MainForm.ActiveDatabase;
            if(pd == null) { Debug.Assert(false); return; }
            if(pd.IsOpen == false) { Debug.Assert(false); return; }

            PwGroup pgContainer = Program.MainForm.GetSelectedGroup();
            if(pgContainer == null) pgContainer = pd.RootGroup;

            PwEntry pe = peTemplate.CloneDeep();
            pe.SetUuid(new PwUuid(true), true);
            pe.CreationTime = pe.LastModificationTime = pe.LastAccessTime = DateTime.Now;

            if(EntryTemplates.EntryCreating != null)
                EntryTemplates.EntryCreating(null, new TemplateEntryEventArgs(
                    peTemplate.CloneDeep(), pe));

            PwEntryForm pef = new PwEntryForm();
            pef.InitEx(pe, PwEditMode.AddNewEntry, pd, Program.MainForm.ClientIcons,
                false, true);

            if(UIUtil.ShowDialogAndDestroy(pef) == DialogResult.OK)
            {
                pgContainer.AddEntry(pe, true, true);

                if(EntryTemplates.EntryCreated != null)
                    EntryTemplates.EntryCreated(null, new TemplateEntryEventArgs(
                        peTemplate.CloneDeep(), pe));

                // Program.MainForm.UpdateEntryList(null, true);
                // Program.MainForm.UpdateUIState(true);
                Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
                    true, null, true);
            }
            else Program.MainForm.UpdateUI(false, null, pd.UINeedsIconUpdate, null,
                pd.UINeedsIconUpdate, null, false);
        }
コード例 #13
0
ファイル: EntryTemplates.cs プロジェクト: elitak/keepass
        private static void CreateEntry(EntryTemplate et)
        {
            if(Program.MainForm.ActiveDatabase.IsOpen == false)
            {
                Debug.Assert(false);
                return;
            }

            PwGroup pgContainer = Program.MainForm.GetSelectedGroup();
            if(pgContainer == null)
                pgContainer = Program.MainForm.ActiveDatabase.RootGroup;

            PwEntry pe = new PwEntry(true, true);

            // pe.Strings.Set(PwDefs.TitleField, new ProtectedString(
            //	Program.MainForm.Database.MemoryProtection.ProtectTitle,
            //	et.Name));

            foreach(EntryTemplateItem eti in et.Items)
                pe.Strings.Set(eti.Name, new ProtectedString(eti.Protected, string.Empty));

            PwEntryForm pef = new PwEntryForm();
            pef.InitEx(pe, PwEditMode.AddNewEntry, Program.MainForm.ActiveDatabase,
                Program.MainForm.ClientIcons, true);

            if(pef.ShowDialog() == DialogResult.OK)
            {
                pgContainer.AddEntry(pe, true);

                // Program.MainForm.UpdateEntryList(null, true);
                // Program.MainForm.UpdateUIState(true);
                Program.MainForm.UpdateUI(false, null, false, null, true, null, true);
            }
            else Program.MainForm.UpdateUI(false, null, false, null, false, null, false);
        }
コード例 #14
0
        private void miItem_Edit(object sender, EventArgs e)
        {
            ToolStripMenuItem Item = (ToolStripMenuItem)sender;
            PwEntry Entry = (PwEntry)Item.Tag;
            PwEntryForm myForm = new PwEntryForm();
            myForm.InitEx(Entry, PwEditMode.EditExistingEntry, Host.MainWindow.DocumentManager.ActiveDatabase, Host.MainWindow.ClientIcons, false, true);

            if ((myForm.ShowDialog() == DialogResult.OK))
                Host.MainWindow.UpdateUI(false, null, Host.MainWindow.DocumentManager.ActiveDatabase.UINeedsIconUpdate, null, true, null, true);
            Host.MainWindow.RefreshEntriesList();
        }
コード例 #15
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
       if (DesignMode) { return; }
       mPwEntryForm = ParentForm as PwEntryForm;
       ParentForm.FormClosing += delegate {
     while (populateComboBoxTimer.Enabled)
       Application.DoEvents();
       };
       UpdateControlStates();
 }
コード例 #16
0
ファイル: RPCClientManagers.cs プロジェクト: halotron/KeeFox
 public virtual void AttachToEntryDialog(KeePassRPCExt plugin, PwEntry entry, TabControl mainTabControl, PwEntryForm form, CustomListViewEx advancedListView, ProtectedStringDictionary strings)
 {
     return;
 }
コード例 #17
0
 private void write_entry(PwEntryForm form, IEnumerable<EntryTemplate> to_add)
 {
     erase_entry_template_items(form.EntryStrings);
     foreach (EntryTemplate t in to_add) {
         form.EntryStrings.Set("_etm_title_" + t.fieldName, new ProtectedString(false, t.title));
         form.EntryStrings.Set("_etm_type_" + t.fieldName, new ProtectedString(false, t.type));
         form.EntryStrings.Set("_etm_position_" + t.fieldName, new ProtectedString(false, t.position.ToString()));
         form.EntryStrings.Set("_etm_options_" + t.fieldName, new ProtectedString(false, t.options ?? ""));
     }
 }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: jonbws/strengthreport
        private void OnEntryAdd(object sender, EventArgs e)
        {
            PwEntryForm pForm = new PwEntryForm();

            PwGroup pg = GetSelectedGroup();
            Debug.Assert(pg != null); if(pg == null) return;

            if(pg.IsVirtual)
            {
                MessageService.ShowWarning(KPRes.GroupCannotStoreEntries,
                    KPRes.SelectDifferentGroup);
                return;
            }

            PwDatabase pwDb = m_docMgr.ActiveDatabase;
            PwEntry pwe = new PwEntry(true, true);
            pwe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
                pwDb.MemoryProtection.ProtectUserName,
                pwDb.DefaultUserName));

            ProtectedString psAutoGen = new ProtectedString(
                pwDb.MemoryProtection.ProtectPassword);
            PwGenerator.Generate(psAutoGen, Program.Config.PasswordGenerator.AutoGeneratedPasswordsProfile,
                null);
            pwe.Strings.Set(PwDefs.PasswordField, psAutoGen);

            int nExpireDays = Program.Config.Defaults.NewEntryExpiresInDays;
            if(nExpireDays >= 0)
            {
                pwe.Expires = true;
                pwe.ExpiryTime = DateTime.Now.AddDays(nExpireDays);
            }

            if((pg.IconId != PwIcon.Folder) && (pg.IconId != PwIcon.FolderOpen) &&
                (pg.IconId != PwIcon.FolderPackage))
            {
                pwe.IconId = pg.IconId; // Inherit icon from group
            }

            pForm.InitEx(pwe, PwEditMode.AddNewEntry, pwDb, m_ilCurrentIcons, false);
            if(pForm.ShowDialog() == DialogResult.OK)
            {
                pg.AddEntry(pwe, true);
                UpdateUI(false, null, false, null, true, null, true);
                EnsureVisibleEntry(pwe.Uuid);
            }
        }