Ejemplo n.º 1
0
 public CancelEntryEventArgs(PwEntry pe, AppDefs.ColumnId colId)
 {
     m_pwEntry = pe;
     m_nColumn = colId;
 }
Ejemplo n.º 2
0
        private void ShowColumn(AppDefs.ColumnId colID, bool bShow)
        {
            m_vShowColumns[(int)colID] = bShow;

            if(bShow && (m_lvEntries.Columns[(int)colID].Width == 0))
            {
                m_lvEntries.Columns[(int)colID].Width = 100;
                RefreshEntriesList();
            }
            else if(!bShow && (m_lvEntries.Columns[(int)colID].Width != 0))
            {
                m_lvEntries.Columns[(int)colID].Width = 0;
            }

            switch(colID)
            {
                case AppDefs.ColumnId.Title: m_menuViewColumnsShowTitle.Checked = bShow; break;
                case AppDefs.ColumnId.UserName: m_menuViewColumnsShowUserName.Checked = bShow; break;
                case AppDefs.ColumnId.Password: m_menuViewColumnsShowPassword.Checked = bShow; break;
                case AppDefs.ColumnId.Url: m_menuViewColumnsShowUrl.Checked = bShow; break;
                case AppDefs.ColumnId.Notes: m_menuViewColumnsShowNotes.Checked = bShow; break;
                case AppDefs.ColumnId.CreationTime: m_menuViewColumnsShowCreation.Checked = bShow; break;
                case AppDefs.ColumnId.LastAccessTime: m_menuViewColumnsShowLastAccess.Checked = bShow; break;
                case AppDefs.ColumnId.LastModificationTime: m_menuViewColumnsShowLastMod.Checked = bShow; break;
                case AppDefs.ColumnId.ExpiryTime: m_menuViewColumnsShowExpire.Checked = bShow; break;
                case AppDefs.ColumnId.Uuid: m_menuViewColumnsShowUuid.Checked = bShow; break;
                case AppDefs.ColumnId.Attachment: m_menuViewColumnsShowAttachs.Checked = bShow; break;
                default: Debug.Assert(false); break;
            }
        }
Ejemplo n.º 3
0
        private void RestoreDisplayIndex(AceMainWindow mw, string strColID,
            AppDefs.ColumnId colID)
        {
            try
            {
                int nIndex = mw.ColumnsDict[strColID].DisplayIndex;

                if((nIndex >= 0) && (nIndex < (int)AppDefs.ColumnId.Count))
                    m_lvEntries.Columns[(int)colID].DisplayIndex = nIndex;
            }
            catch(Exception) { Debug.Assert(false); }
        }
Ejemplo n.º 4
0
 private void SaveDisplayIndex(AceMainWindow mw, string strColID,
     AppDefs.ColumnId colID)
 {
     mw.ColumnsDict[strColID].DisplayIndex =
         m_lvEntries.Columns[(int)colID].DisplayIndex;
 }
Ejemplo n.º 5
0
        private void PerformDefaultAction(object sender, EventArgs e, PwEntry pe, AppDefs.ColumnId colID)
        {
            Debug.Assert(pe != null); if(pe == null) return;

            if(this.DefaultEntryAction != null)
            {
                CancelEntryEventArgs args = new CancelEntryEventArgs(pe, colID);
                this.DefaultEntryAction(sender, args);
                if(args.Cancel) return;
            }

            bool bMinimize = Program.Config.MainWindow.MinimizeAfterClipboardCopy;
            Form frmMin = (bMinimize ? this : null);

            switch(colID)
            {
                case AppDefs.ColumnId.Title:
                    if(PwDefs.IsTanEntry(pe))
                        OnEntryCopyPassword(sender, e);
                    else
                        OnEntryEdit(sender, e);
                    break;
                case AppDefs.ColumnId.UserName:
                    OnEntryCopyUserName(sender, e);
                    break;
                case AppDefs.ColumnId.Password:
                    OnEntryCopyPassword(sender, e);
                    break;
                case AppDefs.ColumnId.Url:
                    OnEntryOpenUrl(sender, e);
                    break;
                case AppDefs.ColumnId.Notes:
                    ClipboardUtil.CopyAndMinimize(pe.Strings.ReadSafe(PwDefs.NotesField),
                        true, frmMin, pe, m_docMgr.ActiveDatabase);
                    StartClipboardCountdown();
                    break;
                case AppDefs.ColumnId.CreationTime:
                    ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(pe.CreationTime),
                        true, frmMin, null, null);
                    StartClipboardCountdown();
                    break;
                case AppDefs.ColumnId.LastAccessTime:
                    ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(pe.LastAccessTime),
                        true, frmMin, null, null);
                    StartClipboardCountdown();
                    break;
                case AppDefs.ColumnId.LastModificationTime:
                    ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(pe.LastModificationTime),
                        true, frmMin, null, null);
                    StartClipboardCountdown();
                    break;
                case AppDefs.ColumnId.ExpiryTime:
                    if(pe.Expires)
                        ClipboardUtil.CopyAndMinimize(TimeUtil.ToDisplayString(pe.ExpiryTime),
                            true, frmMin, null, null);
                    else
                        ClipboardUtil.CopyAndMinimize(KPRes.NeverExpires,
                            true, frmMin, null, null);
                    StartClipboardCountdown();
                    break;
                case AppDefs.ColumnId.Attachment:
                    break;
                case AppDefs.ColumnId.Uuid:
                    ClipboardUtil.CopyAndMinimize(pe.Uuid.ToHexString(),
                        true, frmMin, null, null);
                    StartClipboardCountdown();
                    break;
                default:
                    Debug.Assert(false);
                    break;
            }
        }