示例#1
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            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_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);
            m_cmbBannerStyle.SelectedIndex = (int)BannerStyle.Default;

            int nWidth = m_lvPolicy.ClientRectangle.Width - 36;

            m_lvPolicy.Columns.Add(KPRes.Feature, nWidth / 4);
            m_lvPolicy.Columns.Add(KPRes.Description, (nWidth * 3) / 4);

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

            LoadOptions();

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

            UpdateUIState();
        }
示例#2
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();
        }
示例#3
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();
        }