Exemple #1
0
        private void ShowPCAFormFromEntry(object sender, EventArgs e)
        {
            m_pcaForm = new PCADialog();
            m_pweForm.UpdateEntryStrings(true, true, true);
            PCAInitData        pcadata = new PCAInitData(m_pweForm.EntryRef);
            ExpiryControlGroup ecg     = (ExpiryControlGroup)Tools.GetField("m_cgExpiry", m_pweForm);

            pcadata.Strings = m_pweForm.EntryStrings;
            if (ecg != null)
            {
                pcadata.Expires   = ecg.Checked;
                pcadata.Expiry    = ecg.Value;
                pcadata.SetExpiry = (pcadata.Expires != m_pweForm.EntryRef.Expires) || (pcadata.Expiry != m_pweForm.EntryRef.ExpiryTime);
            }
            pcadata.URL2 = pcadata.Strings.ReadSafe(Config.PCAURLField);
            DerefStrings(pcadata, m_pweForm.EntryRef);
            m_pcaForm.Init(pcadata, ProfilesOpening);
            if (m_pcaForm.ShowDialog(m_pweForm) == DialogResult.OK)
            {
                m_pweForm.EntryStrings.Set(PwDefs.PasswordField, m_pcaForm.NewPassword);
                if (ecg != null)
                {
                    ecg.Checked = m_pcaForm.EntryExpiry.Checked;
                    if (ecg.Checked)
                    {
                        ecg.Value = m_pcaForm.EntryExpiry.Value.ToUniversalTime();
                    }
                }
                if (string.IsNullOrEmpty(m_pcaForm.Sequence))
                {
                    m_pweForm.EntryStrings.Remove(Config.PCASequence);
                }
                else
                {
                    m_pweForm.EntryStrings.Set(Config.PCASequence, new ProtectedString(false, m_pcaForm.Sequence));
                }
                if (string.IsNullOrEmpty(m_pcaForm.URL2))
                {
                    m_pweForm.EntryStrings.Remove(Config.PCAURLField);
                }
                else
                {
                    m_pweForm.EntryStrings.Set(Config.PCAURLField, new ProtectedString(false, m_pcaForm.URL2));
                }
                m_pweForm.UpdateEntryStrings(false, true, true);
            }
            m_pcaForm.CleanupEx();
            m_pcaForm = null;
        }
Exemple #2
0
        private void OnPEDCalcEntryForm(object sender, QuickActionEventArgs e)
        {
            ToolStripDropDown tsdd = (sender as PEDValue_QuickAction).DropDown;

            if (tsdd == null)
            {
                return;
            }

            m_pweForm.EntryStrings.Remove(Configuration.DaysField);
            if (e.Value.Inherit)
            {
                m_pweForm.EntryStrings.Remove(Configuration.Interval);
            }
            else if (e.Value.unit != PEDC.SetExpired)
            {
                m_pweForm.EntryStrings.Set(Configuration.Interval, new ProtectedString(false, e.Value.ToString()));
            }
            m_pweForm.UpdateEntryStrings(false, true);
            if (e.Value.Off)
            {
                return;
            }
            ExpiryControlGroup ecg = (ExpiryControlGroup)Tools.GetField("m_cgExpiry", m_pweForm);
            PEDCalcValue       pcv = e.Value;

            if (!e.Value.Specific)
            {
                pcv = m_pweForm.EntryRef.GetPEDValueInherit();
            }
            if (!pcv.Off)
            {
                ecg.Checked = true;
                if (e.Value.unit == PEDC.SetExpired)
                {
                    ecg.Value = PEDCalcValue.UnixStart;
                }
                else
                {
                    ecg.Value = pcv.NewExpiryDateUtc;
                }
            }
        }
        public ModifyEntryTimestampsForm(DateTime creationTime, DateTime lastModificationTime, DateTime lastAccessTime)
        {
            InitializeComponent();

            Icon = AppIcons.Default;

            BannerFactory.CreateBannerEx(this, bannerImage, Properties.Resources.clock_48x48, "Timestamps", "Modify the entry timestamps.");

            createdDateTimePicker.Value      = TimeUtil.ToLocal(creationTime, true);
            lastModifiedDateTimePicker.Value = TimeUtil.ToLocal(lastModificationTime, true);
            lastAccessedDateTimePicker.Value = TimeUtil.ToLocal(lastAccessTime, true);

            creationTimeControlGroup = new ExpiryControlGroup();
            creationTimeControlGroup.Attach(createdCheckBox, createdDateTimePicker);
            lastModificationTimeControlGroup = new ExpiryControlGroup();
            lastModificationTimeControlGroup.Attach(lastModifiedCheckBox, lastModifiedDateTimePicker);
            lastAccessTimeControlGroup = new ExpiryControlGroup();
            lastAccessTimeControlGroup.Attach(lastAccessedCheckBox, lastAccessedDateTimePicker);
        }