Exemplo n.º 1
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            if (m_aceOvr == null)
            {
                throw new InvalidOperationException();
            }
            m_aceTmp = m_aceOvr.CloneDeep();

            GlobalWindowManager.AddWindow(this);

            this.Icon = Properties.Resources.KeePass;
            this.Text = KPRes.UrlOverrides;

            UIUtil.SetExplorerTheme(m_lvOverrides, false);

            int nWidth = m_lvOverrides.ClientSize.Width - UIUtil.GetVScrollBarWidth();

            m_lvOverrides.Columns.Add(KPRes.Scheme, nWidth / 4);
            m_lvOverrides.Columns.Add(KPRes.UrlOverride, (nWidth * 3) / 4);

            m_bEnfSch = AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlSchemeOverrides");
            m_bEnfAll = AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlOverride");

            UpdateOverridesList(false, false);

            m_cbOverrideAll.Checked = (m_strUrlOverrideAll.Length > 0);
            m_tbOverrideAll.Text    = m_strUrlOverrideAll;
            EnableControlsEx();
        }
Exemplo n.º 2
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            if (m_triggers == null)
            {
                Debug.Assert(false); return;
            }

            GlobalWindowManager.AddWindow(this);
            GlobalWindowManager.CustomizeControl(m_ctxTools);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Make_KDevelop, KPRes.Triggers,
                                         KPRes.TriggersDesc);
            this.Text = KPRes.Triggers;
            this.Icon = AppIcons.Default;

            int nWidth = (m_lvTriggers.ClientSize.Width - UIUtil.GetVScrollBarWidth() - 1);

            m_lvTriggers.Columns.Add(KPRes.Triggers, nWidth);

            m_lvTriggers.SmallImageList = m_ilIcons;

            m_cbEnableTriggers.Checked = m_triggers.Enabled;
            UpdateTriggerListEx(false);

            EcasTriggerSystem ts    = Program.TriggerSystem;
            EcasTriggerSystem tsCfg = Program.Config.Application.TriggerSystem;

            if (object.ReferenceEquals(m_triggersInOut, ts) &&
                AppConfigEx.IsOptionEnforced(tsCfg, "Enabled"))
            {
                m_cbEnableTriggers.Enabled = false;
            }
        }
Exemplo n.º 3
0
        private void LoadIntegrationOptions()
        {
            Keys kAT = (Keys)Program.Config.Integration.HotKeyGlobalAutoType;

            m_hkGlobalAutoType.HotKey          = (kAT & Keys.KeyCode);
            m_hkGlobalAutoType.HotKeyModifiers = (kAT & Keys.Modifiers);
            m_hkGlobalAutoType.RenderHotKey();
            m_kPrevATHKKey = (m_hkGlobalAutoType.HotKey | m_hkGlobalAutoType.HotKeyModifiers);
            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "HotKeyGlobalAutoType"))
            {
                m_hkGlobalAutoType.Enabled = false;
            }

            Keys kATS = (Keys)Program.Config.Integration.HotKeySelectedAutoType;

            m_hkSelectedAutoType.HotKey          = (kATS & Keys.KeyCode);
            m_hkSelectedAutoType.HotKeyModifiers = (kATS & Keys.Modifiers);
            m_hkSelectedAutoType.RenderHotKey();
            m_kPrevATSHKKey = (m_hkSelectedAutoType.HotKey | m_hkSelectedAutoType.HotKeyModifiers);
            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "HotKeySelectedAutoType"))
            {
                m_hkSelectedAutoType.Enabled = false;
            }

            Keys kSW = (Keys)Program.Config.Integration.HotKeyShowWindow;

            m_hkShowWindow.HotKey          = (kSW & Keys.KeyCode);
            m_hkShowWindow.HotKeyModifiers = (kSW & Keys.Modifiers);
            m_hkShowWindow.RenderHotKey();
            m_kPrevSWHKKey = (m_hkShowWindow.HotKey | m_hkShowWindow.HotKeyModifiers);
            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "HotKeyShowWindow"))
            {
                m_hkShowWindow.Enabled = false;
            }

            m_cbAutoRun.Checked = ShellUtil.GetStartWithWindows(AppDefs.AutoRunName);

            m_cbSingleClickTrayAction.Checked = Program.Config.UI.TrayIcon.SingleClickDefault;
            if (AppConfigEx.IsOptionEnforced(Program.Config.UI.TrayIcon, "SingleClickDefault"))
            {
                m_cbSingleClickTrayAction.Enabled = false;
            }

            string strOverride = Program.Config.Integration.UrlOverride;

            m_cbUrlOverride.Checked = (strOverride.Length > 0);
            m_tbUrlOverride.Text    = strOverride;
            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlOverride"))
            {
                m_cbUrlOverride.Enabled = false;
            }

            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "UrlSchemeOverrides"))
            {
                m_btnSchemeOverrides.Enabled = false;
            }
        }
Exemplo n.º 4
0
        private void DetermineReadOnlyState(ClviInfo clvi)
        {
            if (clvi == null)
            {
                Debug.Assert(false); return;
            }

            if (!m_bUseEnforcedConfig)
            {
                clvi.ReadOnly = false;
            }
            else
            {
                clvi.ReadOnly = AppConfigEx.IsOptionEnforced(clvi.Object,
                                                             clvi.PropertyInfo);
            }
        }
Exemplo n.º 5
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            GlobalWindowManager.AddWindow(this, this);

            BannerFactory.CreateBannerEx(this, m_bannerImage,
                                         Properties.Resources.B48x48_Folder_Download, KPRes.HelpSourceSelection,
                                         KPRes.HelpSourceSelectionDesc);
            this.Icon = AppIcons.Default;
            this.Text = KPRes.HelpSourceSelection;

            FontUtil.AssignDefaultBold(m_radioLocal);
            FontUtil.AssignDefaultBold(m_radioOnline);

            Debug.Assert(!m_lblLocal.AutoSize);             // For RTL support
            if (!AppHelp.LocalHelpAvailable)
            {
                UIUtil.SetEnabledFast(false, m_radioLocal, m_lblLocal);
                m_lblLocal.Text = KPRes.HelpSourceNoLocalOption;

                AppHelp.PreferredHelpSource = AppHelpSource.Online;
            }

            bool bOverride = !string.IsNullOrEmpty(Program.Config.Application.HelpUrl);
            bool bEnforced = AppConfigEx.IsOptionEnforced(Program.Config.Application,
                                                          "HelpUseLocal");

            if (!bOverride)
            {
                if (AppHelp.PreferredHelpSource == AppHelpSource.Local)
                {
                    m_radioLocal.Checked = true;
                }
                else
                {
                    m_radioOnline.Checked = true;
                }
            }

            if (bOverride || bEnforced)
            {
                UIUtil.SetEnabledFast(false, m_radioLocal, m_lblLocal,
                                      m_radioOnline, m_lblOnline, m_btnOK);
                UIUtil.SetFocus(m_btnCancel, this);
            }
        }
Exemplo n.º 6
0
        private void LoadAdvancedOptions()
        {
            bool?obNoMin = null;

            if (MonoWorkarounds.IsRequired(1418))
            {
                obNoMin = true;
            }

            m_lvAdvanced.Columns.Add(string.Empty);             // Resize below

            m_cdxAdvanced = new CheckedLVItemDXList(m_lvAdvanced, true);

            ListViewGroup lvg = new ListViewGroup(KPRes.StartAndExit);

            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "OpenLastFile",
                                     lvg, KPRes.AutoRememberOpenLastFile);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "LimitToSingleInstance",
                                     lvg, KPRes.LimitSingleInstance);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "CheckForUpdate",
                                     lvg, KPRes.CheckForUpdAtStart);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "MinimizedAndLocked",
                                     lvg, KPRes.StartMinimizedAndLocked, obNoMin);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileClosing, "AutoSave",
                                     lvg, KPRes.AutoSaveAtExit);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "AutoSaveAfterEntryEdit",
                                     lvg, KPRes.AutoSaveAfterEntryEdit);

            lvg = new ListViewGroup(KPRes.AfterDatabaseOpen);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileOpening, "ShowExpiredEntries",
                                     lvg, KPRes.AutoShowExpiredEntries);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileOpening, "ShowSoonToExpireEntries",
                                     lvg, KPRes.AutoShowSoonToExpireEntries);

            lvg = new ListViewGroup(KPRes.AutoType);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByTitle",
                                     lvg, KPRes.AutoTypeMatchByTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByUrlInTitle",
                                     lvg, KPRes.AutoTypeMatchByUrlInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByUrlHostInTitle",
                                     lvg, KPRes.AutoTypeMatchByUrlHostInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByTagInTitle",
                                     lvg, KPRes.AutoTypeMatchByTagInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeExpiredCanMatch",
                                     lvg, KPRes.ExpiredEntriesCanMatch);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeAlwaysShowSelDialog",
                                     lvg, KPRes.AutoTypeAlwaysShowSelDialog);

            lvg = new ListViewGroup(KPRes.AutoType + " - " + KPRes.SendingNoun);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypePrependInitSequenceForIE",
                                     lvg, KPRes.AutoTypePrependInitSeqForIE);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeReleaseAltWithKeyPress",
                                     lvg, KPRes.AutoTypeReleaseAltWithKeyPress);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeAdjustKeyboardLayout",
                                     lvg, KPRes.SameKeybLayout);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeAllowInterleaved",
                                     lvg, KPRes.InterleavedKeySending);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeCancelOnWindowChange",
                                     lvg, KPRes.AutoTypeCancelOnWindowChange);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeCancelOnTitleChange",
                                     lvg, KPRes.AutoTypeCancelOnTitleChange);

            lvg = new ListViewGroup(KPRes.IOConnectionLong);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "VerifyWrittenFileAfterSaving",
                                     lvg, KPRes.VerifyWrittenFileAfterSave);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "UseTransactedFileWrites",
                                     lvg, KPRes.UseTransactedDatabaseWrites);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "FileTxExtra",
                                     lvg, KPRes.FileTxExtra + " (" + KPRes.Slow + ")");
            m_cdxAdvanced.CreateItem(Program.Config.Application, "UseFileLocks",
                                     lvg, KPRes.UseFileLocks + " " + KPRes.NotRecommended);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "SaveForceSync",
                                     lvg, KPRes.SaveForceSync);
            m_cdxAdvanced.CreateItem(Program.Config.Security, "SslCertsAcceptInvalid",
                                     lvg, KPRes.SslCertsAcceptInvalid);

            lvg = new ListViewGroup(KPRes.Advanced);
            m_lvAdvanced.Groups.Add(lvg);

            if (!Program.Config.Integration.SearchKeyFiles)
            {
                Program.Config.Integration.SearchKeyFilesOnRemovableMedia = false;
            }
            ListViewItem lviSearch = m_cdxAdvanced.CreateItem(
                Program.Config.Integration, "SearchKeyFiles",
                lvg, KPRes.SearchKeyFiles);
            ListViewItem lviSearchRmv = m_cdxAdvanced.CreateItem(
                Program.Config.Integration, "SearchKeyFilesOnRemovableMedia",
                lvg, KPRes.SearchKeyFilesAlsoOnRemovable);

            m_cdxAdvanced.AddLink(lviSearch, lviSearchRmv, CheckItemLinkType.UncheckedUnchecked);
            m_cdxAdvanced.AddLink(lviSearchRmv, lviSearch, CheckItemLinkType.CheckedChecked);

            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "RememberKeySources",
                                     lvg, KPRes.RememberKeySources);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "RememberWorkingDirectories",
                                     lvg, KPRes.RememberWorkingDirectories);
            m_cdxAdvanced.CreateItem(Program.Config.UI.Hiding, "SeparateHidingSettings",
                                     lvg, KPRes.RememberHidingSettings);
            m_cdxAdvanced.CreateItem(Program.Config.UI.Hiding, "UnhideButtonAlsoUnhidesSource",
                                     lvg, KPRes.UnhideSourceCharactersToo);
            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "TanExpiresOnUse",
                                     lvg, KPRes.TanExpiresOnUse);
            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "RecycleBinCollapse",
                                     lvg, KPRes.RecycleBinCollapse);
            m_cdxAdvanced.CreateItem(Program.Config.UI, "SecureDesktopPlaySound",
                                     lvg, KPRes.SecDeskPlaySound);
            m_cdxAdvanced.CreateItem(Program.Config.UI, "OptimizeForScreenReader",
                                     lvg, KPRes.OptimizeForScreenReader);

            m_cdxAdvanced.UpdateData(false);
            UIUtil.ResizeColumns(m_lvAdvanced, true);

            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "ProxyType") ||
                AppConfigEx.IsOptionEnforced(Program.Config.Integration, "ProxyAddress"))
            {
                m_btnProxy.Enabled = false;
            }
        }
Exemplo n.º 7
0
        private void LoadGuiOptions()
        {
            m_strInitialTsRenderer = Program.Config.UI.ToolStripRenderer;

            bool?obNoMin = null;

            if (MonoWorkarounds.IsRequired(1418))
            {
                obNoMin = true;
            }

            m_lvGuiOptions.Columns.Add(KPRes.Options);             // Resize below

            ListViewGroup lvg = new ListViewGroup(KPRes.MainWindow);

            m_lvGuiOptions.Groups.Add(lvg);
            Debug.Assert(lvg.ListView == m_lvGuiOptions);

            m_cdxGuiOptions = new CheckedLVItemDXList(m_lvGuiOptions, true);

            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeToTray",
                                       lvg, KPRes.MinimizeToTray);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "DropToBackAfterClipboardCopy",
                                       lvg, KPRes.DropToBackOnCopy);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterClipboardCopy",
                                       lvg, KPRes.MinimizeAfterCopy);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterAutoType",
                                       lvg, KPRes.MinimizeAfterAutoType);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterLocking",
                                       lvg, KPRes.MinimizeAfterLocking);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterOpeningDatabase",
                                       lvg, KPRes.MinimizeAfterOpeningDatabase, obNoMin);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "CloseButtonMinimizesWindow",
                                       lvg, KPRes.CloseButtonMinimizes);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EscMinimizesToTray",
                                       lvg, KPRes.EscMinimizesToTray);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "ShowFullPathInTitle",
                                       lvg, KPRes.ShowFullPathInTitleBar);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "DisableSaveIfNotModified",
                                       lvg, KPRes.DisableSaveIfNotModified);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "HideCloseDatabaseButton",
                                       lvg, KPRes.HideCloseDatabaseTb);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowAdvAutoTypeCommands",
                                       lvg, KPRes.ShowAdvAutoTypeCommands);

            lvg = new ListViewGroup(KPRes.EntryList);
            m_lvGuiOptions.Groups.Add(lvg);
            // m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "ShowGridLines",
            //	m_lvGuiOptions, lvg, KPRes.ShowGridLines);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntryListAutoResizeColumns",
                                       lvg, KPRes.EntryListAutoResizeColumns);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntryListAlternatingBgColors",
                                       lvg, KPRes.AlternatingBgColors);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "CopyUrlsInsteadOfOpening",
                                       lvg, KPRes.CopyUrlsInsteadOfOpening);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntrySelGroupSel",
                                       lvg, KPRes.EntrySelGroupSel);

            if (!Program.Config.MainWindow.EntryListShowDerefData)
            {
                Debug.Assert(!Program.Config.MainWindow.EntryListShowDerefDataAsync);
                Program.Config.MainWindow.EntryListShowDerefDataAsync = false;
            }
            ListViewItem lviDeref = m_cdxGuiOptions.CreateItem(
                Program.Config.MainWindow, "EntryListShowDerefData",
                lvg, KPRes.ShowDerefData + " (" + KPRes.Slow + ")");
            ListViewItem lviDerefAsync = m_cdxGuiOptions.CreateItem(
                Program.Config.MainWindow, "EntryListShowDerefDataAsync",
                lvg, KPRes.ShowDerefDataAsync + " (" + KPRes.IncompatibleWithSorting + ")");

            m_cdxGuiOptions.AddLink(lviDeref, lviDerefAsync, CheckItemLinkType.UncheckedUnchecked);
            m_cdxGuiOptions.AddLink(lviDerefAsync, lviDeref, CheckItemLinkType.CheckedChecked);

            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntryListShowDerefDataAndRefs",
                                       lvg, KPRes.ShowDerefDataAndRefs);

            // lvg = new ListViewGroup(KPRes.EntryView);
            // m_lvGuiOptions.Groups.Add(lvg);
            // m_cdxGuiOptions.CreateItem(Program.Config.MainWindow.EntryView, "HideProtectedCustomStrings",
            //	lvg, KPRes.EntryViewHideProtectedCustomStrings);

            lvg = new ListViewGroup(KPRes.QuickSearchTb);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindSearchInPasswords",
                                       lvg, KPRes.QuickSearchInPwFields);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindExcludeExpired",
                                       lvg, KPRes.QuickSearchExclExpired);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindDerefData",
                                       lvg, KPRes.QuickSearchDerefData + " (" + KPRes.Slow + ")");
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusResultsAfterQuickFind",
                                       lvg, KPRes.FocusResultsAfterQuickSearch);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusQuickFindOnRestore",
                                       lvg, KPRes.FocusQuickFindOnRestore);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusQuickFindOnUntray",
                                       lvg, KPRes.FocusQuickFindOnUntray);

            lvg = new ListViewGroup(KPRes.TrayIcon);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "ShowOnlyIfTrayed",
                                       lvg, KPRes.ShowTrayOnlyIfTrayed);
            m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "GrayIcon",
                                       lvg, KPRes.TrayIconGray);
            m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "SingleClickDefault",
                                       lvg, KPRes.TrayIconSingleClick);

            lvg = new ListViewGroup(KPRes.Dialogs);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowRecycleConfirmDialog",
                                       lvg, KPRes.RecycleShowConfirm);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowDbMntncResultsDialog",
                                       lvg, KPRes.DbMntncResults);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowEmSheetDialog",
                                       lvg, KPRes.EmergencySheetAsk);

            lvg = new ListViewGroup(KPRes.Advanced);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "RepeatPasswordOnlyWhenHidden",
                                       lvg, KPRes.RepeatOnlyWhenHidden);
            // m_cdxGuiOptions.CreateItem(Program.Config.UI, "UseCustomToolStripRenderer",
            //	lvg, KPRes.UseCustomToolStripRenderer);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "TreeViewShowLines",
                                       lvg, KPRes.TreeViewShowLines);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ForceSystemFontUnix",
                                       lvg, KPRes.ForceSystemFontUnix);

            m_cdxGuiOptions.UpdateData(false);
            UIUtil.ResizeColumns(m_lvGuiOptions, true);

            try { m_numMruCount.Value = Program.Config.Application.MostRecentlyUsed.MaxItemCount; }
            catch (Exception) { Debug.Assert(false); m_numMruCount.Value = AceMru.DefaultMaxItemCount; }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Application.MostRecentlyUsed, "MaxItemCount"))
            {
                m_lblMruCount.Enabled = false;
                m_numMruCount.Enabled = false;
            }

            m_argbAltItemBg            = Program.Config.MainWindow.EntryListAlternatingBgColor;
            m_cbCustomAltColor.Checked = (m_argbAltItemBg != 0);
            UpdateButtonImages();

            if (AppConfigEx.IsOptionEnforced(Program.Config.UI, "StandardFont"))
            {
                m_btnSelFont.Enabled = false;
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.UI, "PasswordFont") ||
                MonoWorkarounds.IsRequired(5795))
            {
                m_btnSelPwFont.Enabled = false;
            }
        }
Exemplo n.º 8
0
        private void LoadSecurityOptions()
        {
            AceWorkspaceLocking aceWL = Program.Config.Security.WorkspaceLocking;

            uint uLockTime = aceWL.LockAfterTime;
            bool bLockTime = (uLockTime > 0);

            m_numLockAfterTime.Value  = (bLockTime ? uLockTime : 300);
            m_cbLockAfterTime.Checked = bLockTime;
            if (AppConfigEx.IsOptionEnforced(aceWL, "LockAfterTime"))
            {
                m_cbLockAfterTime.Enabled = false;
            }

            uLockTime = aceWL.LockAfterGlobalTime;
            bLockTime = (uLockTime > 0);
            m_numLockAfterGlobalTime.Value  = (bLockTime ? uLockTime : 240);
            m_cbLockAfterGlobalTime.Checked = bLockTime;
            if (AppConfigEx.IsOptionEnforced(aceWL, "LockAfterGlobalTime"))
            {
                m_cbLockAfterGlobalTime.Enabled = false;
            }

            int nDefaultExpireDays = Program.Config.Defaults.NewEntryExpiresInDays;

            if (nDefaultExpireDays < 0)
            {
                m_cbDefaultExpireDays.Checked = false;
            }
            else
            {
                m_cbDefaultExpireDays.Checked = true;
                try { m_numDefaultExpireDays.Value = nDefaultExpireDays; }
                catch (Exception) { Debug.Assert(false); }
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Defaults, "NewEntryExpiresInDays"))
            {
                m_cbDefaultExpireDays.Enabled = false;
            }

            int nClipClear = Program.Config.Security.ClipboardClearAfterSeconds;

            if (nClipClear >= 0)
            {
                m_cbClipClearTime.Checked = true;
                m_numClipClearTime.Value  = nClipClear;
            }
            else
            {
                m_cbClipClearTime.Checked = false;
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Security, "ClipboardClearAfterSeconds"))
            {
                m_cbClipClearTime.Enabled = false;
            }

            m_lvSecurityOptions.Columns.Add(string.Empty);             // Resize below

            ListViewGroup lvg = new ListViewGroup(KPRes.Options);

            m_lvSecurityOptions.Groups.Add(lvg);
            Debug.Assert(lvg.ListView == m_lvSecurityOptions);

            m_cdxSecurityOptions = new CheckedLVItemDXList(m_lvSecurityOptions, true);

            bool?  obNoSEv      = null;       // Allow read-only by enforced config
            string strSEvSuffix = string.Empty;

            if (MonoWorkarounds.IsRequired(1378))
            {
                obNoSEv      = true;
                strSEvSuffix = " (" + KPRes.UnsupportedByMono + ")";
            }

            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnWindowMinimize",
                                            lvg, KPRes.LockOnMinimizeTaskbar);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnWindowMinimizeToTray",
                                            lvg, KPRes.LockOnMinimizeTray);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnSessionSwitch",
                                            lvg, KPRes.LockOnSessionSwitch + strSEvSuffix, obNoSEv);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnSuspend",
                                            lvg, KPRes.LockOnSuspend + strSEvSuffix, obNoSEv);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnRemoteControlChange",
                                            lvg, KPRes.LockOnRemoteControlChange + strSEvSuffix, obNoSEv);
            m_cdxSecurityOptions.CreateItem(aceWL, "ExitInsteadOfLockingAfterTime",
                                            lvg, KPRes.ExitInsteadOfLockingAfterTime);
            m_cdxSecurityOptions.CreateItem(aceWL, "AlwaysExitInsteadOfLocking",
                                            lvg, KPRes.ExitInsteadOfLockingAlways);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "ClipboardClearOnExit",
                                            lvg, KPRes.ClipboardClearOnExit);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security,
                                            "UseClipboardViewerIgnoreFormat", lvg,
                                            KPRes.ClipboardViewerIgnoreFormat + " " + KPRes.NotRecommended);

            if (NativeLib.IsLibraryInstalled())
            {
                m_cdxSecurityOptions.CreateItem(Program.Config.Native, "NativeKeyTransformations",
                                                lvg, KPRes.NativeLibUse);
            }

            bool?obNoWin = null;              // Allow read-only by enforced config

            if (NativeLib.IsUnix())
            {
                obNoWin = true;
            }

            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "MasterKeyOnSecureDesktop",
                                            lvg, KPRes.MasterKeyOnSecureDesktop, obNoWin);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "ClearKeyCommandLineParams",
                                            lvg, KPRes.ClearKeyCmdLineParams);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security.MasterPassword,
                                            "RememberWhileOpen", lvg, KPRes.MasterPasswordRmbWhileOpen);

            m_cdxSecurityOptions.UpdateData(false);
            UIUtil.ResizeColumns(m_lvSecurityOptions, true);
        }
Exemplo n.º 9
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            // Can be invoked by tray command; don't use CenterParent
            Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen);

            // When multiline is enabled, tabs added by plugins can result
            // in multiple tab rows, cropping the tab content at the bottom;
            // https://sourceforge.net/p/keepass/discussion/329220/thread/a17a2734/
            Debug.Assert(!m_tabMain.Multiline);

            GlobalWindowManager.AddWindow(this);

            this.Icon = AppIcons.Default;

            Debug.Assert(m_ilIcons != null);
            if (m_ilIcons != null)
            {
                m_tabMain.ImageList = m_ilIcons;

                m_tabSecurity.ImageIndex    = (int)PwIcon.TerminalEncrypted;
                m_tabPolicy.ImageIndex      = (int)PwIcon.List;
                m_tabGui.ImageIndex         = (int)PwIcon.Screen;
                m_tabIntegration.ImageIndex = (int)PwIcon.Console;
                m_tabAdvanced.ImageIndex    = (int)PwIcon.ClipboardReady;
            }

            uint uTab = Program.Config.Defaults.OptionsTabIndex;

            if (uTab < (uint)m_tabMain.TabPages.Count)
            {
                m_tabMain.SelectedTab = m_tabMain.TabPages[(int)uTab];
            }

            m_aceUrlSchemeOverrides = Program.Config.Integration.UrlSchemeOverrides.CloneDeep();
            m_strUrlOverrideAll     = Program.Config.Integration.UrlOverride;

            Debug.Assert(!m_cmbMenuStyle.Sorted);
            m_cmbMenuStyle.Items.Add(KPRes.Auto + " (" + KPRes.Recommended + ")");
            m_cmbMenuStyle.Items.Add(new string('-', 24));
            int nTsrs = 2, iTsrSel = 0, nSuffixes = 0;

            foreach (TsrFactory fTsr in TsrPool.Factories)
            {
                string strSuffix = string.Empty;
                if (!fTsr.IsSupported())
                {
                    strSuffix = " (" + KPRes.IncompatibleEnv + ")";
                    ++nSuffixes;
                }

                string strUuid = Convert.ToBase64String(fTsr.Uuid.UuidBytes);
                if (Program.Config.UI.ToolStripRenderer == strUuid)
                {
                    iTsrSel = nTsrs;
                }

                m_cmbMenuStyle.Items.Add((fTsr.Name ?? string.Empty) + strSuffix);
                m_dTsrUuids[nTsrs] = strUuid;
                ++nTsrs;
            }
            Debug.Assert(m_cmbMenuStyle.Items.Count == nTsrs);
            m_cmbMenuStyle.SelectedIndex = iTsrSel;
            if (nSuffixes > 0)
            {
                m_cmbMenuStyle.DropDownWidth = m_cmbMenuStyle.Width * 2;
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.UI, "ToolStripRenderer"))
            {
                m_lblMenuStyle.Enabled = false;
                m_cmbMenuStyle.Enabled = false;
            }

            Debug.Assert(!m_cmbBannerStyle.Sorted);
            m_cmbBannerStyle.Items.Add("(" + KPRes.CurrentStyle + ")");
            m_cmbBannerStyle.Items.Add("Windows XP Login");
            m_cmbBannerStyle.Items.Add("Windows Vista Black");
            m_cmbBannerStyle.Items.Add("KeePass Win32");
            m_cmbBannerStyle.Items.Add("Blue Carbon");

            CreateDialogBanner(BannerStyle.Default);             // Default forces generation
            m_cmbBannerStyle.SelectedIndex = (int)BannerStyle.Default;
            if ((BannerFactory.CustomGenerator != null) ||
                AppConfigEx.IsOptionEnforced(Program.Config.UI, "BannerStyle"))
            {
                m_lblBannerStyle.Enabled = false;
                m_cmbBannerStyle.Enabled = false;
            }

            int nWidth = m_lvPolicy.ClientSize.Width - UIUtil.GetVScrollBarWidth();

            m_lvPolicy.Columns.Add(KPRes.Feature, (nWidth * 10) / 29);
            m_lvPolicy.Columns.Add(KPRes.Description, (nWidth * 19) / 29);

            m_hkGlobalAutoType = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                                m_tbGlobalAutoType, false);
            m_hkSelectedAutoType = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                                  m_tbSelAutoTypeHotKey, false);
            m_hkShowWindow = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                            m_tbShowWindowHotKey, false);

            if (!NativeLib.IsUnix())
            {
                UIUtil.SetShield(m_btnFileExtCreate, true);
                UIUtil.SetShield(m_btnFileExtRemove, true);

                m_linkHotKeyHelp.Visible = false;
            }
            else             // Unix
            {
                m_hkGlobalAutoType.TextNone   = KPRes.External;
                m_hkSelectedAutoType.TextNone = KPRes.External;
                m_hkShowWindow.TextNone       = KPRes.External;

                m_hkGlobalAutoType.Enabled = m_hkSelectedAutoType.Enabled =
                    m_hkShowWindow.Enabled = false;
                m_btnFileExtCreate.Enabled = m_btnFileExtRemove.Enabled = false;
                m_cbAutoRun.Enabled        = false;
            }

            UIUtil.SetExplorerTheme(m_lvSecurityOptions, false);
            UIUtil.SetExplorerTheme(m_lvPolicy, false);
            UIUtil.SetExplorerTheme(m_lvGuiOptions, false);
            UIUtil.SetExplorerTheme(m_lvAdvanced, false);

            AppConfigEx.ClearXmlPathCache();

            LoadOptions();

            // if(Program.Config.Meta.IsEnforcedConfiguration)
            //	m_lvPolicy.Enabled = false;

            UpdateUIState();
        }
Exemplo n.º 10
0
        private void LoadAdvancedOptions()
        {
            m_lvAdvanced.Columns.Add(string.Empty, 200);             // Resize below

            m_cdxAdvanced = new CheckedLVItemDXList(m_lvAdvanced, true);

            ListViewGroup lvg = new ListViewGroup(KPRes.StartAndExit);

            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "OpenLastFile",
                                     lvg, KPRes.AutoRememberOpenLastFile);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "LimitToSingleInstance",
                                     lvg, KPRes.LimitSingleInstance);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "CheckForUpdate",
                                     lvg, KPRes.CheckForUpdAtStart);
            m_cdxAdvanced.CreateItem(Program.Config.Application.Start, "MinimizedAndLocked",
                                     lvg, KPRes.StartMinimizedAndLocked);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileClosing, "AutoSave",
                                     lvg, KPRes.AutoSaveAtExit);

            lvg = new ListViewGroup(KPRes.AfterDatabaseOpen);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileOpening, "ShowExpiredEntries",
                                     lvg, KPRes.AutoShowExpiredEntries);
            m_cdxAdvanced.CreateItem(Program.Config.Application.FileOpening, "ShowSoonToExpireEntries",
                                     lvg, KPRes.AutoShowSoonToExpireEntries);

            lvg = new ListViewGroup(KPRes.AutoType);
            m_lvAdvanced.Groups.Add(lvg);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByTitle",
                                     lvg, KPRes.AutoTypeMatchByTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByUrlInTitle",
                                     lvg, KPRes.AutoTypeMatchByUrlInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByUrlHostInTitle",
                                     lvg, KPRes.AutoTypeMatchByUrlHostInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeMatchByTagInTitle",
                                     lvg, KPRes.AutoTypeMatchByTagInTitle);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypePrependInitSequenceForIE",
                                     lvg, KPRes.AutoTypePrependInitSeqForIE);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeReleaseAltWithKeyPress",
                                     lvg, KPRes.AutoTypeReleaseAltWithKeyPress);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeAdjustKeyboardLayout",
                                     lvg, KPRes.SameKeybLayout);
            m_cdxAdvanced.CreateItem(Program.Config.Integration, "AutoTypeCancelOnWindowChange",
                                     lvg, KPRes.AutoTypeCancelOnWindowChange);

            lvg = new ListViewGroup(KPRes.Advanced);
            m_lvAdvanced.Groups.Add(lvg);

            if (!Program.Config.Integration.SearchKeyFiles)
            {
                Program.Config.Integration.SearchKeyFilesOnRemovableMedia = false;
            }
            ListViewItem lviSearch = m_cdxAdvanced.CreateItem(
                Program.Config.Integration, "SearchKeyFiles",
                lvg, KPRes.SearchKeyFiles);
            ListViewItem lviSearchRmv = m_cdxAdvanced.CreateItem(
                Program.Config.Integration, "SearchKeyFilesOnRemovableMedia",
                lvg, KPRes.SearchKeyFilesAlsoOnRemovable);

            m_cdxAdvanced.AddLink(lviSearch, lviSearchRmv, CheckItemLinkType.UncheckedUnchecked);
            m_cdxAdvanced.AddLink(lviSearchRmv, lviSearch, CheckItemLinkType.CheckedChecked);

            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "RememberKeySources",
                                     lvg, KPRes.RememberKeySources);
            m_cdxAdvanced.CreateItem(Program.Config.UI.Hiding, "SeparateHidingSettings",
                                     lvg, KPRes.RememberHidingSettings);
            m_cdxAdvanced.CreateItem(Program.Config.UI.Hiding, "UnhideButtonAlsoUnhidesSource",
                                     lvg, KPRes.UnhideSourceCharactersToo);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "VerifyWrittenFileAfterSaving",
                                     lvg, KPRes.VerifyWrittenFileAfterSave);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "UseTransactedFileWrites",
                                     lvg, KPRes.UseTransactedDatabaseWrites);
            m_cdxAdvanced.CreateItem(Program.Config.Application, "UseFileLocks",
                                     lvg, KPRes.UseFileLocks + " " + KPRes.NotRecommended);
            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "TanExpiresOnUse",
                                     lvg, KPRes.TanExpiresOnUse);
            m_cdxAdvanced.CreateItem(Program.Config.Defaults, "RecycleBinCollapse",
                                     lvg, KPRes.RecycleBinCollapse);
            m_cdxAdvanced.CreateItem(Program.Config.UI, "SecureDesktopPlaySound",
                                     lvg, KPRes.SecDeskPlaySound);
            m_cdxAdvanced.CreateItem(Program.Config.UI, "OptimizeForScreenReader",
                                     lvg, KPRes.OptimizeForScreenReader);

            m_cdxAdvanced.UpdateData(false);
            m_lvAdvanced.Columns[0].Width = m_lvAdvanced.ClientRectangle.Width -
                                            UIUtil.GetVScrollBarWidth() - 1;

            if (AppConfigEx.IsOptionEnforced(Program.Config.Integration, "ProxyType") ||
                AppConfigEx.IsOptionEnforced(Program.Config.Integration, "ProxyAddress"))
            {
                m_btnProxy.Enabled = false;
            }
        }
Exemplo n.º 11
0
        private void LoadGuiOptions()
        {
            m_bInitialTsRenderer = Program.Config.UI.UseCustomToolStripRenderer;

            m_lvGuiOptions.Columns.Add(KPRes.Options, 200);             // Resize below

            ListViewGroup lvg = new ListViewGroup(KPRes.MainWindow);

            m_lvGuiOptions.Groups.Add(lvg);
            Debug.Assert(lvg.ListView == m_lvGuiOptions);

            m_cdxGuiOptions = new CheckedLVItemDXList(m_lvGuiOptions, true);

            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "CloseButtonMinimizesWindow",
                                       lvg, KPRes.CloseButtonMinimizes);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeToTray",
                                       lvg, KPRes.MinimizeToTray);
            m_cdxGuiOptions.CreateItem(Program.Config.UI.TrayIcon, "ShowOnlyIfTrayed",
                                       lvg, KPRes.ShowTrayOnlyIfTrayed);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "ShowFullPathInTitle",
                                       lvg, KPRes.ShowFullPathInTitleBar);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "DropToBackAfterClipboardCopy",
                                       lvg, KPRes.DropToBackOnCopy);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterClipboardCopy",
                                       lvg, KPRes.MinimizeAfterCopy);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterLocking",
                                       lvg, KPRes.MinimizeAfterLocking);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "MinimizeAfterOpeningDatabase",
                                       lvg, KPRes.MinimizeAfterOpeningDatabase);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "DisableSaveIfNotModified",
                                       lvg, KPRes.DisableSaveIfNotModified);

            lvg = new ListViewGroup(KPRes.EntryList);
            m_lvGuiOptions.Groups.Add(lvg);
            // m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "ShowGridLines",
            //	m_lvGuiOptions, lvg, KPRes.ShowGridLines);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntryListAutoResizeColumns",
                                       lvg, KPRes.EntryListAutoResizeColumns);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "EntryListAlternatingBgColors",
                                       lvg, KPRes.AlternatingBgColors);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "CopyUrlsInsteadOfOpening",
                                       lvg, KPRes.CopyUrlsInsteadOfOpening);

            if (!Program.Config.MainWindow.EntryListShowDerefData)
            {
                Debug.Assert(!Program.Config.MainWindow.EntryListShowDerefDataAsync);
                Program.Config.MainWindow.EntryListShowDerefDataAsync = false;
            }
            ListViewItem lviDeref = m_cdxGuiOptions.CreateItem(
                Program.Config.MainWindow, "EntryListShowDerefData",
                lvg, KPRes.ShowDerefData + " (" + KPRes.Slow + ")");
            ListViewItem lviDerefAsync = m_cdxGuiOptions.CreateItem(
                Program.Config.MainWindow, "EntryListShowDerefDataAsync",
                lvg, KPRes.ShowDerefDataAsync + " (" + KPRes.IncompatibleWithSorting + ")");

            m_cdxGuiOptions.AddLink(lviDeref, lviDerefAsync, CheckItemLinkType.UncheckedUnchecked);
            m_cdxGuiOptions.AddLink(lviDerefAsync, lviDeref, CheckItemLinkType.CheckedChecked);

            // lvg = new ListViewGroup(KPRes.EntryView);
            // m_lvGuiOptions.Groups.Add(lvg);
            // m_cdxGuiOptions.CreateItem(Program.Config.MainWindow.EntryView, "HideProtectedCustomStrings",
            //	lvg, KPRes.EntryViewHideProtectedCustomStrings);

            lvg = new ListViewGroup(KPRes.QuickSearchTb);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindSearchInPasswords",
                                       lvg, KPRes.QuickSearchInPwFields);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindExcludeExpired",
                                       lvg, KPRes.QuickSearchExclExpired);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "QuickFindDerefData",
                                       lvg, KPRes.QuickSearchDerefData + " (" + KPRes.Slow + ")");
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusResultsAfterQuickFind",
                                       lvg, KPRes.FocusResultsAfterQuickSearch);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusQuickFindOnRestore",
                                       lvg, KPRes.FocusQuickFindOnRestore);
            m_cdxGuiOptions.CreateItem(Program.Config.MainWindow, "FocusQuickFindOnUntray",
                                       lvg, KPRes.FocusQuickFindOnUntray);

            lvg = new ListViewGroup(KPRes.Advanced);
            m_lvGuiOptions.Groups.Add(lvg);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "RepeatPasswordOnlyWhenHidden",
                                       lvg, KPRes.RepeatOnlyWhenHidden);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "UseCustomToolStripRenderer",
                                       lvg, KPRes.UseCustomToolStripRenderer);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ForceSystemFontUnix",
                                       lvg, KPRes.ForceSystemFontUnix);
            m_cdxGuiOptions.CreateItem(Program.Config.UI, "ShowDbMntncResultsDialog",
                                       lvg, KPRes.DbMntncResults);

            m_cdxGuiOptions.UpdateData(false);
            m_lvGuiOptions.Columns[0].Width = m_lvGuiOptions.ClientRectangle.Width -
                                              UIUtil.GetVScrollBarWidth() - 1;

            try { m_numMruCount.Value = Program.Config.Application.MostRecentlyUsed.MaxItemCount; }
            catch (Exception) { Debug.Assert(false); m_numMruCount.Value = AceMru.DefaultMaxItemCount; }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Application.MostRecentlyUsed, "MaxItemCount"))
            {
                m_lblMruCount.Enabled = false;
                m_numMruCount.Enabled = false;
            }

            if (AppConfigEx.IsOptionEnforced(Program.Config.UI, "StandardFont"))
            {
                m_btnSelFont.Enabled = false;
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.UI, "PasswordFont"))
            {
                m_btnSelPwFont.Enabled = false;
            }
        }
Exemplo n.º 12
0
        private void LoadSecurityOptions()
        {
            AceWorkspaceLocking aceWL = Program.Config.Security.WorkspaceLocking;

            uint uLockTime = aceWL.LockAfterTime;
            bool bLockTime = (uLockTime > 0);

            m_numLockAfterTime.Value  = (bLockTime ? uLockTime : 300);
            m_cbLockAfterTime.Checked = bLockTime;
            if (AppConfigEx.IsOptionEnforced(aceWL, "LockAfterTime"))
            {
                m_cbLockAfterTime.Enabled = false;
            }

            uLockTime = aceWL.LockAfterGlobalTime;
            bLockTime = (uLockTime > 0);
            m_numLockAfterGlobalTime.Value  = (bLockTime ? uLockTime : 240);
            m_cbLockAfterGlobalTime.Checked = bLockTime;
            if (AppConfigEx.IsOptionEnforced(aceWL, "LockAfterGlobalTime"))
            {
                m_cbLockAfterGlobalTime.Enabled = false;
            }

            int nDefaultExpireDays = Program.Config.Defaults.NewEntryExpiresInDays;

            if (nDefaultExpireDays < 0)
            {
                m_cbDefaultExpireDays.Checked = false;
            }
            else
            {
                m_cbDefaultExpireDays.Checked = true;
                try { m_numDefaultExpireDays.Value = nDefaultExpireDays; }
                catch (Exception) { Debug.Assert(false); }
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Defaults, "NewEntryExpiresInDays"))
            {
                m_cbDefaultExpireDays.Enabled = false;
            }

            int nClipClear = Program.Config.Security.ClipboardClearAfterSeconds;

            if (nClipClear >= 0)
            {
                m_cbClipClearTime.Checked = true;
                m_numClipClearTime.Value  = nClipClear;
            }
            else
            {
                m_cbClipClearTime.Checked = false;
            }
            if (AppConfigEx.IsOptionEnforced(Program.Config.Security, "ClipboardClearAfterSeconds"))
            {
                m_cbClipClearTime.Enabled = false;
            }

            m_lvSecurityOptions.Columns.Add(string.Empty, 200);             // Resize below

            ListViewGroup lvg = new ListViewGroup(KPRes.Options);

            m_lvSecurityOptions.Groups.Add(lvg);
            Debug.Assert(lvg.ListView == m_lvSecurityOptions);

            m_cdxSecurityOptions = new CheckedLVItemDXList(m_lvSecurityOptions, true);

            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnWindowMinimize",
                                            lvg, KPRes.LockOnMinimize);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnSessionSwitch",
                                            lvg, KPRes.LockOnSessionSwitch);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnSuspend",
                                            lvg, KPRes.LockOnSuspend);
            m_cdxSecurityOptions.CreateItem(aceWL, "LockOnRemoteControlChange",
                                            lvg, KPRes.LockOnRemoteControlChange);
            m_cdxSecurityOptions.CreateItem(aceWL, "ExitInsteadOfLockingAfterTime",
                                            lvg, KPRes.ExitInsteadOfLockingAfterTime);
            m_cdxSecurityOptions.CreateItem(aceWL, "AlwaysExitInsteadOfLocking",
                                            lvg, KPRes.ExitInsteadOfLockingAlways);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "ClipboardClearOnExit",
                                            lvg, KPRes.ClipboardClearOnExit);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security,
                                            "UseClipboardViewerIgnoreFormat", lvg,
                                            KPRes.ClipboardViewerIgnoreFormat + " " + KPRes.NotRecommended);

            if (NativeLib.IsLibraryInstalled())
            {
                m_cdxSecurityOptions.CreateItem(Program.Config.Native, "NativeKeyTransformations",
                                                lvg, KPRes.NativeLibUse);
            }

            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "MasterKeyOnSecureDesktop",
                                            lvg, KPRes.MasterKeyOnSecureDesktop);
            m_cdxSecurityOptions.CreateItem(Program.Config.Security, "ClearKeyCommandLineParams",
                                            lvg, KPRes.ClearKeyCmdLineParams);

            m_cdxSecurityOptions.UpdateData(false);
            m_lvSecurityOptions.Columns[0].Width = m_lvSecurityOptions.ClientRectangle.Width -
                                                   UIUtil.GetVScrollBarWidth() - 1;
        }
Exemplo n.º 13
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            // Can be invoked by tray command; don't use CenterParent
            Debug.Assert(this.StartPosition == FormStartPosition.CenterScreen);

            GlobalWindowManager.AddWindow(this);

            this.Icon = Properties.Resources.KeePass;

            Debug.Assert(m_ilIcons != null);
            if (m_ilIcons != null)
            {
                m_tabMain.ImageList = m_ilIcons;

                m_tabSecurity.ImageIndex    = (int)PwIcon.TerminalEncrypted;
                m_tabPolicy.ImageIndex      = (int)PwIcon.List;
                m_tabGui.ImageIndex         = (int)PwIcon.Screen;
                m_tabIntegration.ImageIndex = (int)PwIcon.Console;
                m_tabAdvanced.ImageIndex    = (int)PwIcon.ClipboardReady;
            }

            uint uTab = Program.Config.Defaults.OptionsTabIndex;

            if (uTab < (uint)m_tabMain.TabPages.Count)
            {
                m_tabMain.SelectedTab = m_tabMain.TabPages[(int)uTab];
            }

            m_aceUrlSchemeOverrides = Program.Config.Integration.UrlSchemeOverrides.CloneDeep();

            m_cmbBannerStyle.Items.Add("(" + KPRes.CurrentStyle + ")");
            m_cmbBannerStyle.Items.Add("WinXP Login");
            m_cmbBannerStyle.Items.Add("WinVista Black");
            m_cmbBannerStyle.Items.Add("KeePass Win32");
            m_cmbBannerStyle.Items.Add("Blue Carbon");

            CreateDialogBanner(BannerStyle.Default);             // Default forces generation
            m_cmbBannerStyle.SelectedIndex = (int)BannerStyle.Default;
            if ((BannerFactory.CustomGenerator != null) ||
                AppConfigEx.IsOptionEnforced(Program.Config.UI, "BannerStyle"))
            {
                m_lblBannerStyle.Enabled = false;
                m_cmbBannerStyle.Enabled = false;
            }

            int nWidth = m_lvPolicy.ClientRectangle.Width - UIUtil.GetVScrollBarWidth() - 1;

            m_lvPolicy.Columns.Add(KPRes.Feature, (nWidth * 10) / 29);
            m_lvPolicy.Columns.Add(KPRes.Description, (nWidth * 19) / 29);

            m_hkGlobalAutoType = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                                m_tbGlobalAutoType, true);
            m_hkSelectedAutoType = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                                  m_tbSelAutoTypeHotKey, true);
            m_hkShowWindow = HotKeyControlEx.ReplaceTextBox(m_grpHotKeys,
                                                            m_tbShowWindowHotKey, true);

            if (!NativeLib.IsUnix())
            {
                UIUtil.SetShield(m_btnFileExtCreate, true);
                UIUtil.SetShield(m_btnFileExtRemove, true);

                m_linkHotKeyHelp.Visible = false;
            }
            else             // Unix
            {
                Program.Config.Integration.HotKeyGlobalAutoType   = (ulong)Keys.None;
                Program.Config.Integration.HotKeySelectedAutoType = (ulong)Keys.None;
                Program.Config.Integration.HotKeyShowWindow       = (ulong)Keys.None;

                m_hkGlobalAutoType.Enabled = m_hkSelectedAutoType.Enabled =
                    m_hkShowWindow.Enabled = false;
                m_btnFileExtCreate.Enabled = m_btnFileExtRemove.Enabled = false;
                m_cbAutoRun.Enabled        = false;
            }

            UIUtil.SetExplorerTheme(m_lvSecurityOptions, false);
            UIUtil.SetExplorerTheme(m_lvPolicy, false);
            UIUtil.SetExplorerTheme(m_lvGuiOptions, false);
            UIUtil.SetExplorerTheme(m_lvAdvanced, false);

            AppConfigEx.ClearXmlPathCache();

            LoadOptions();

            // if(Program.Config.Meta.IsEnforcedConfiguration)
            //	m_lvPolicy.Enabled = false;

            UpdateUIState();
        }