Exemplo n.º 1
0
        public EntryView(MainForm mainForm, Options options)
        {
            InitializeComponent();

            mMainForm = mainForm;
            mOptions  = options;

            mFieldsGrid.Initialise(mMainForm, mOptions);
            mMultipleSelectionFields.Initialise(mMainForm, mOptions);

            // KeePass 2.24 and above deprecates last access time
            mShowAccessTime = (PwDefs.FileVersion64 < 0x0002001800000000UL) || ((KeePass.Program.Config.UI.UIFlags & 0x20000) != 0);

            mAccessTimeLabel.Visible = mAccessTime.Visible = mShowAccessTime;

            // HACK: MainForm doesn't expose HandleMainWindowKeyMessage, so grab it via reflection
            mHandleMainWindowKeyMessageMethod = mMainForm.GetType().GetMethod("HandleMainWindowKeyMessage", BindingFlags.Instance | BindingFlags.NonPublic);
            if (mHandleMainWindowKeyMessageMethod != null)
            {
                mTabs.KeyDown += HandleMainWindowShortcutKeyDown;
                mTabs.KeyUp   += HandleMainWindowShortcutKeyUp;
            }

            mNotesContextMenu = new RichTextBoxContextMenu();
            mNotesContextMenu.Attach(mNotes, mMainForm);
            mNotes.SimpleTextOnly = true;

            SetLabel(mCreationTimeLabel, KPRes.CreationTime);
            if (mShowAccessTime)
            {
                SetLabel(mAccessTimeLabel, KPRes.LastAccessTime);
            }
            SetLabel(mModificationTimeLabel, KPRes.LastModificationTime);
            SetLabel(mExpiryTimeLabel, KPRes.ExpiryTime);
            SetLabel(mTagsLabel, KPRes.Tags);
            SetLabel(mOverrideUrlLabel, KPRes.UrlOverride);
            SetLabel(mUUIDLabel, KPRes.Uuid);

            TranslatePwEntryFormControls(m_lblIcon, m_cbCustomForegroundColor, m_cbCustomBackgroundColor);

            mEditFieldCommand.ShortcutKeyDisplayString   = KPRes.KeyboardKeyReturn;
            mDeleteFieldCommand.ShortcutKeyDisplayString = UIUtil.GetKeysName(Keys.Delete);
            mCopyCommand.ShortcutKeys = Keys.Control | Keys.C;

            mURLDropDownMenu = new OpenWithMenu(mURLDropDown);
            CustomizeOnClick(mURLDropDownMenu);

            mSplitGridPanels.SplitRatio        = mOptions.FieldsNotesSplitPosition;
            mSplitNotesAttachements.SplitRatio = mOptions.NotesAttachmentsSplitPosition;
        }