예제 #1
0
        private bool GetSelectedEntry()
        {
            ListView.SelectedListViewItemCollection slvic = m_lvItems.SelectedItems;
            if (slvic.Count == 1)
            {
                m_atcSel = (slvic[0].Tag as AutoTypeCtx);
                return(m_atcSel != null);
            }

            return(false);
        }
예제 #2
0
        private void CellClick(object sender, MouseEventArgs e)
        {
            Form f = (sender as Control).FindForm();
            ListViewHitTestInfo info = (sender as ListView).HitTest(e.X, e.Y);
            int col = info.Item.SubItems.IndexOf(info.SubItem);

            if ((col < 0) || ((sender as ListView).Columns.Count <= col))
            {
                return;
            }
            string column   = (sender as ListView).Columns[col].Text;
            string sequence = string.Empty;

            if (column == KeePass.Resources.KPRes.UserName)
            {
                sequence = "{USERNAME}";
            }
            else if (column == KeePass.Resources.KPRes.Password || column == Config.PWColumnHeader)
            {
                sequence = "{PASSWORD}";
                if (Config.SpecialColumnsRespectPWEnter && Config.PWEnter)
                {
                    sequence += "{ENTER}";
                }
            }
            else
            {
                return;
            }
            AutoTypeCtx ctx = info.Item.Tag as AutoTypeCtx;

            if (ctx == null)
            {
                return;
            }
            if (Config.KeepATOpen)
            {
                (sender as ListView).SelectedItems.Clear();                 //ugly hack to avoid KeePass performing the standard behaviour
                f.DialogResult = DialogResult.None;
                AutoType.PerformIntoPreviousWindow(f, ctx.Entry, m_host.MainWindow.DocumentManager.SafeFindContainerOf(ctx.Entry), sequence);
                f.Activate();
            }
            else
            {
                ctx.Sequence = sequence;
            }
        }