Ejemplo n.º 1
0
        public OptionsForm(Options options, MainForm mainWindow)
        {
            this.mainWindow = mainWindow;
            this.options = options;
            this.filterSettings = options.getGroupFilter();

            InitializeComponent();

            checkBox_showEmpty.Checked = options.showEmptyGroups;
            checkBox_showExpired.Checked = options.showExpiredEntries;
            checkBox_showRecycleBin.Checked = options.showRecycleBin;
            checkBox_clearClipboard.Checked = options.clearClipboard;
            numericUpDown_clearClipboard.Value = options.clearClipboardTime;
            comboBox_location.SelectedIndex = options.location;
            buttonclear.Enabled = !options.isOptionsEmpty();
            checkBox_closeQAUserPw.Checked = options.closeAfterCopy;
            checkBox_closeQAAutoType.Checked = options.closeAfterAutoType;
            checkBox_closeQAAfterTime.Checked = options.closeAfterTime;
            numericUpDown_closeQATime.Value = options.closeTime;

            checkBoxTreeView_groupFilter.ImageList = mainWindow.ClientIcons;
            PwDatabase db = mainWindow.ActiveDatabase;
            if (db != null && db.IsOpen)
            {
                createTree(checkBoxTreeView_groupFilter.Nodes, db.RootGroup);
            }
            else {
                checkBoxTreeView_groupFilter.Enabled = false;
            }
            checkBoxTreeView_groupFilter.ExpandAll();
            checkBoxTreeView_groupFilter.AfterCheck += TreeView_groupFilter_AfterCheck;
        }
Ejemplo n.º 2
0
        public QuickAccessForm(IPluginHost host, PwEntry entry, Options options, bool tan)
        {
            this.host = host;
            this.entry = entry;
            this.tan = tan;
            this.options = options;

            host.MainWindow.FileClosingPre += MainWindow_FileClosingPre;

            InitializeComponent();

            if (options.location != (int)Options.Locations.Center)
            {
                this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
                Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
                if (options.location == (int)Options.Locations.LowerRight)
                {
                    this.Left = workingArea.Right - this.Width;
                    this.Top = workingArea.Bottom - this.Height;
                }
                else if (options.location == (int)Options.Locations.UpperRight)
                {
                    this.Left = workingArea.Right - this.Width;
                    this.Top = workingArea.Top;
                }
                else if (options.location == (int)Options.Locations.LowerLeft)
                {
                    this.Left = workingArea.Left;
                    this.Top = workingArea.Bottom - this.Height;
                }
                else if (options.location == (int)Options.Locations.UpperLeft)
                {
                    this.Left = workingArea.Left;
                    this.Top = workingArea.Top;
                }
            }

            host.MainWindow.FileClosingPre += MainWindow_FileClosingPre;
            string title = entry.Strings.ReadSafe(PwDefs.TitleField);
            if (title != null) this.Text = title;

            imgList = new ImageList();
            imgList.Images.Add((System.Drawing.Bitmap)host.Resources.GetObject("B16x16_KTouch"));
            imgList.Images.Add((System.Drawing.Bitmap)host.Resources.GetObject("B16x16_Browser"));
            imgList.Images.Add((System.Drawing.Bitmap)host.Resources.GetObject("B16x16_Personal"));
            imgList.Images.Add((System.Drawing.Bitmap)host.Resources.GetObject("B16x16_KGPG_Info"));
            imgList.Images.Add(host.MainWindow.ClientIcons.Images[(int)PwIcon.Notepad]);
            imgList.Images.Add(host.MainWindow.ClientIcons.Images[(int)PwIcon.List]);
            imgList.Images.Add((System.Drawing.Bitmap)host.Resources.GetObject("B16x16_KeePass"));

            this.Icon = host.MainWindow.Icon;
            buttonAutoType.Image = imgList.Images[0];
            buttonUrl.Image = imgList.Images[1];
            buttonCopyUser.Image = tan ? imgList.Images[3] : imgList.Images[2];
            buttonCopyPw.Image = imgList.Images[3];
            buttonCopyNotes.Image = imgList.Images[4];
            buttonCopyFields.Image = imgList.Images[5];
            buttonMainWindow.Image = imgList.Images[6];

            buttonAutoType.Enabled = entry.GetAutoTypeEnabled();
            buttonUrl.Enabled = !entry.Strings.GetSafe(PwDefs.UrlField).IsEmpty;
            buttonCopyUser.Enabled = (!entry.Strings.GetSafe(PwDefs.UserNameField).IsEmpty && !tan) || (!entry.Strings.GetSafe(PwDefs.PasswordField).IsEmpty && tan);
            buttonCopyPw.Enabled = !entry.Strings.GetSafe(PwDefs.PasswordField).IsEmpty && !tan;
            buttonCopyNotes.Enabled = !entry.Strings.GetSafe(PwDefs.NotesField).IsEmpty;
            buttonCopyFields.Enabled = Util.hasFields(entry);

            if (tan) buttonCopyUser.Text = "Copy TAN";
            buttonCopyPw.Visible = !tan;

            this.panel.Select();

            userCopied = !buttonCopyUser.Enabled;
            pwCopied = !buttonCopyPw.Enabled;

            this.Activated += QuickAccessForm_Activated;
            this.Deactivate += QuickAccessForm_Deactivate;
            this.FormClosing += QuickAccessForm_FormClosing;
        }