Ejemplo n.º 1
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_pgRoot != null); if (m_pgRoot == null)
            {
                throw new InvalidOperationException();
            }

            GlobalWindowManager.AddWindow(this, this);

            string strTitle = KPRes.SearchTitle;

            if ((m_pgRoot != null) && (m_pgRoot.ParentGroup != null))
            {
                strTitle += " - " + m_pgRoot.Name;
            }

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_XMag, strTitle, KPRes.SearchDesc2);
            this.Icon = AppIcons.Default;

            m_bUpdating = true;

            UIUtil.SetText(m_cbDerefData, m_cbDerefData.Text + " (" + KPRes.Slow + ")");

            SearchParameters sp = Program.Config.Defaults.SearchParameters;

            m_cbTitle.Checked       = sp.SearchInTitles;
            m_cbUserName.Checked    = sp.SearchInUserNames;
            m_cbURL.Checked         = sp.SearchInUrls;
            m_cbPassword.Checked    = sp.SearchInPasswords;
            m_cbNotes.Checked       = sp.SearchInNotes;
            m_cbOtherFields.Checked = sp.SearchInOther;
            m_cbStringName.Checked  = sp.SearchInStringNames;
            m_cbTags.Checked        = sp.SearchInTags;
            m_cbUuid.Checked        = sp.SearchInUuids;
            m_cbGroupPath.Checked   = sp.SearchInGroupPaths;
            m_cbGroupName.Checked   = sp.SearchInGroupNames;

            StringComparison sc = sp.ComparisonMode;

            m_cbCaseSensitive.Checked = ((sc != StringComparison.CurrentCultureIgnoreCase) &&
                                         (sc != StringComparison.InvariantCultureIgnoreCase) &&
                                         (sc != StringComparison.OrdinalIgnoreCase));

            m_cbRegEx.Checked               = sp.RegularExpression;
            m_cbExcludeExpired.Checked      = sp.ExcludeExpired;
            m_cbIgnoreGroupSettings.Checked = !sp.RespectEntrySearchingDisabled;

            string strTrf = SearchUtil.GetTransformation(sp);

            m_cbDerefData.Checked = (strTrf == SearchUtil.StrTrfDeref);

            m_bUpdating = false;

            EnableControlsEx();
            UIUtil.SetFocus(m_tbSearch, this);
        }
Ejemplo n.º 2
0
        private void SetSearchParameters(SearchParameters sp)
        {
            if (sp == null)
            {
                Debug.Assert(false); sp = new SearchParameters();
            }

            ++m_uBlockProfileAuto;

            Debug.Assert((m_cmbProfiles.Text == ProfileCustom) ||
                         (m_cmbProfiles.Text == sp.Name));

            m_tbSearch.Text = sp.SearchString;

            if (sp.SearchMode == PwSearchMode.Regular)
            {
                m_rbModeRegular.Checked = true;
            }
            else if (sp.SearchMode == PwSearchMode.XPath)
            {
                m_rbModeXPath.Checked = true;
            }
            else
            {
                Debug.Assert(sp.SearchMode == PwSearchMode.Simple);
                m_rbModeSimple.Checked = true;
            }

            m_cbTitle.Checked        = sp.SearchInTitles;
            m_cbUserName.Checked     = sp.SearchInUserNames;
            m_cbPassword.Checked     = sp.SearchInPasswords;
            m_cbUrl.Checked          = sp.SearchInUrls;
            m_cbNotes.Checked        = sp.SearchInNotes;
            m_cbStringsOther.Checked = sp.SearchInOther;
            m_cbStringName.Checked   = sp.SearchInStringNames;
            m_cbTags.Checked         = sp.SearchInTags;
            m_cbUuid.Checked         = sp.SearchInUuids;
            m_cbGroupPath.Checked    = sp.SearchInGroupPaths;
            m_cbGroupName.Checked    = sp.SearchInGroupNames;
            m_cbHistory.Checked      = sp.SearchInHistory;

            StringComparison sc = sp.ComparisonMode;

            m_cbCaseSensitive.Checked = ((sc != StringComparison.CurrentCultureIgnoreCase) &&
                                         (sc != StringComparison.InvariantCultureIgnoreCase) &&
                                         (sc != StringComparison.OrdinalIgnoreCase));

            m_cbExcludeExpired.Checked      = sp.ExcludeExpired;
            m_cbIgnoreGroupSettings.Checked = !sp.RespectEntrySearchingDisabled;

            string strTrf = SearchUtil.GetTransformation(sp);

            m_cbDerefData.Checked = (strTrf == SearchUtil.StrTrfDeref);

            --m_uBlockProfileAuto;
        }