public SettingsFieldMapper(IQuickConnectPluginSettings settings) { this.settings = settings; }
public FormOptions(String pluginName, IQuickConnectPluginSettings settings, ICollection <String> dbFields) { InitializeComponent(); this.settings = settings; this.Text = this.Text.Replace("{title}", pluginName); this.checkBoxEnable.Checked = settings.Enabled; this.checkBoxCompatibleMode.Checked = settings.CompatibleMode; this.checkBoxAddChangePasswordItem.Checked = settings.AddChangePasswordMenuItem; this.textBoxSSHClientPath.Text = settings.SSHClientPath; this.textBoxSSHClientPath.Select(this.textBoxSSHClientPath.Text.Length, 0); this.textBoxWinScpPath.Text = settings.WinScpPath; this.textBoxWinScpPath.Select(this.textBoxWinScpPath.Text.Length, 0); this.textBoxPsPasswdPath.Text = settings.PsPasswdPath; this.textBoxPsPasswdPath.Select(this.textBoxPsPasswdPath.Text.Length, 0); // Always add empty items. this.comboBoxHostAddressMapFieldName.Items.Add(String.Empty); this.comboBoxConnectionMethodMapFieldName.Items.Add(String.Empty); this.comboBoxAdditionalOptionsMapFieldName.Items.Add(String.Empty); if (dbFields == null) { this.labelWarningMessage.Visible = true; this.comboBoxHostAddressMapFieldName.Enabled = false; this.comboBoxConnectionMethodMapFieldName.Enabled = false; this.comboBoxAdditionalOptionsMapFieldName.Enabled = false; if (!String.IsNullOrEmpty(settings.HostAddressMapFieldName)) { this.comboBoxHostAddressMapFieldName.Items.Add(settings.HostAddressMapFieldName); } if (!String.IsNullOrEmpty(settings.ConnectionMethodMapFieldName)) { this.comboBoxConnectionMethodMapFieldName.Items.Add(settings.ConnectionMethodMapFieldName); } if (!String.IsNullOrEmpty(settings.AdditionalOptionsMapFieldName)) { this.comboBoxAdditionalOptionsMapFieldName.Items.Add(settings.AdditionalOptionsMapFieldName); } this.comboBoxHostAddressMapFieldName.SelectedValue = settings.HostAddressMapFieldName; this.comboBoxConnectionMethodMapFieldName.SelectedValue = settings.ConnectionMethodMapFieldName; this.comboBoxAdditionalOptionsMapFieldName.SelectedValue = settings.AdditionalOptionsMapFieldName; } else { this.labelWarningMessage.Visible = false; foreach (var field in dbFields) { this.comboBoxHostAddressMapFieldName.Items.Add(field); this.comboBoxConnectionMethodMapFieldName.Items.Add(field); this.comboBoxAdditionalOptionsMapFieldName.Items.Add(field); } } if (String.IsNullOrEmpty(settings.HostAddressMapFieldName)) { this.comboBoxHostAddressMapFieldName.SelectedIndex = this.comboBoxHostAddressMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxHostAddressMapFieldName.SelectedIndex = this.comboBoxHostAddressMapFieldName.FindStringExact(this.settings.HostAddressMapFieldName); } if (String.IsNullOrEmpty(settings.ConnectionMethodMapFieldName)) { this.comboBoxConnectionMethodMapFieldName.SelectedIndex = this.comboBoxConnectionMethodMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxConnectionMethodMapFieldName.SelectedIndex = this.comboBoxConnectionMethodMapFieldName.FindStringExact(this.settings.ConnectionMethodMapFieldName); } if (String.IsNullOrEmpty(settings.AdditionalOptionsMapFieldName)) { this.comboBoxAdditionalOptionsMapFieldName.SelectedIndex = this.comboBoxAdditionalOptionsMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxAdditionalOptionsMapFieldName.SelectedIndex = this.comboBoxAdditionalOptionsMapFieldName.FindStringExact(this.settings.AdditionalOptionsMapFieldName); } // Add handlers. this.checkBoxEnable.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxCompatibleMode.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxAddChangePasswordItem.CheckedChanged += new EventHandler(settingsChanged); this.textBoxSSHClientPath.TextChanged += new EventHandler(settingsChanged); this.textBoxWinScpPath.TextChanged += new EventHandler(settingsChanged); this.textBoxPsPasswdPath.TextChanged += new EventHandler(settingsChanged); this.comboBoxHostAddressMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.comboBoxConnectionMethodMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.comboBoxAdditionalOptionsMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.buttonApply.Enabled = false; // Check if VMware VSphere PowerCLI is installed. this.checkVSpherePowerCLIStatus(); // Force settings validation. this.validateSettings(); }
internal static bool CanOpenPutty(IQuickConnectPluginSettings settings, IHostPwEntry hostPwEntry, out string puttyPath) { puttyPath = !String.IsNullOrEmpty(settings.PuttyPath) ? settings.PuttyPath : QuickConnectUtils.GetPuttyPath(); return(hostPwEntry.HasIPAddress && !String.IsNullOrEmpty(puttyPath)); }
internal static bool CanOpenWinScp(IQuickConnectPluginSettings settings, IHostPwEntry hostPwEntry, out string winScpPath) { winScpPath = !String.IsNullOrEmpty(settings.WinScpPath) ? settings.WinScpPath : QuickConnectUtils.GetWinScpPath(); return(hostPwEntry.HasIPAddress && !String.IsNullOrEmpty(winScpPath)); }
public FormOptions(String pluginName, IQuickConnectPluginSettings settings, ICollection <String> dbFields) { InitializeComponent(); this.settings = settings; this.Text = this.Text.Replace("{title}", pluginName); this.checkBoxEnable.Checked = settings.Enabled; this.checkBoxCompatibleMode.Checked = settings.CompatibleMode; this.checkBoxAddChangePasswordItem.Checked = settings.AddChangePasswordMenuItem; this.checkBoxDisableCLIPasswordForPutty.Checked = settings.DisableCLIPasswordForPutty; this.textBoxPuttyPath.Text = settings.PuttyPath; this.textBoxPuttyPath.Select(this.textBoxPuttyPath.Text.Length, 0); this.textBoxWinScpPath.Text = settings.WinScpPath; this.textBoxWinScpPath.Select(this.textBoxWinScpPath.Text.Length, 0); this.textBoxPsPasswdPath.Text = settings.PsPasswdPath; this.textBoxPsPasswdPath.Select(this.textBoxPsPasswdPath.Text.Length, 0); // Always add empty items. this.comboBoxHostAddressMapFieldName.Items.Add(String.Empty); this.comboBoxConnectionMethodMapFieldName.Items.Add(String.Empty); this.comboBoxAdditionalOptionsMapFieldName.Items.Add(String.Empty); if (dbFields == null) { this.labelWarningMessage.Visible = true; this.comboBoxHostAddressMapFieldName.Enabled = false; this.comboBoxConnectionMethodMapFieldName.Enabled = false; this.comboBoxAdditionalOptionsMapFieldName.Enabled = false; if (!String.IsNullOrEmpty(settings.HostAddressMapFieldName)) { this.comboBoxHostAddressMapFieldName.Items.Add(settings.HostAddressMapFieldName); } if (!String.IsNullOrEmpty(settings.ConnectionMethodMapFieldName)) { this.comboBoxConnectionMethodMapFieldName.Items.Add(settings.ConnectionMethodMapFieldName); } if (!String.IsNullOrEmpty(settings.AdditionalOptionsMapFieldName)) { this.comboBoxAdditionalOptionsMapFieldName.Items.Add(settings.AdditionalOptionsMapFieldName); } this.comboBoxHostAddressMapFieldName.SelectedValue = settings.HostAddressMapFieldName; this.comboBoxConnectionMethodMapFieldName.SelectedValue = settings.ConnectionMethodMapFieldName; this.comboBoxAdditionalOptionsMapFieldName.SelectedValue = settings.AdditionalOptionsMapFieldName; } else { this.labelWarningMessage.Visible = false; foreach (var field in dbFields) { this.comboBoxHostAddressMapFieldName.Items.Add(field); this.comboBoxConnectionMethodMapFieldName.Items.Add(field); this.comboBoxAdditionalOptionsMapFieldName.Items.Add(field); } } if (String.IsNullOrEmpty(settings.HostAddressMapFieldName)) { this.comboBoxHostAddressMapFieldName.SelectedIndex = this.comboBoxHostAddressMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxHostAddressMapFieldName.SelectedIndex = this.comboBoxHostAddressMapFieldName.FindStringExact(this.settings.HostAddressMapFieldName); } if (String.IsNullOrEmpty(settings.ConnectionMethodMapFieldName)) { this.comboBoxConnectionMethodMapFieldName.SelectedIndex = this.comboBoxConnectionMethodMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxConnectionMethodMapFieldName.SelectedIndex = this.comboBoxConnectionMethodMapFieldName.FindStringExact(this.settings.ConnectionMethodMapFieldName); } if (String.IsNullOrEmpty(settings.AdditionalOptionsMapFieldName)) { this.comboBoxAdditionalOptionsMapFieldName.SelectedIndex = this.comboBoxAdditionalOptionsMapFieldName.FindStringExact(String.Empty); } else { this.comboBoxAdditionalOptionsMapFieldName.SelectedIndex = this.comboBoxAdditionalOptionsMapFieldName.FindStringExact(this.settings.AdditionalOptionsMapFieldName); } // Shortcut Keys. checkBoxEnableShortcutKeys.Checked = settings.EnableShortcutKeys ?? false; shortcutKeysSettingWasChanged = settings.EnableShortcutKeys ?? false; // KeePass v2.42 API breaking change. shortcutKeyControlRemoteDesktop = HotKeyControlEx.ReplaceTextBox(this.textBoxRDShortcutKey.Parent, this.textBoxRDShortcutKey, false); shortcutKeyControlRemoteDesktop.HotKey = (settings.EnableShortcutKeys.HasValue ? settings.RemoteDesktopShortcutKey : QuickConnectPluginSettings.DefaultRemoteDesktopShortcutKey) & Keys.KeyCode; shortcutKeyControlRemoteDesktop.HotKeyModifiers = (settings.EnableShortcutKeys.HasValue ? settings.RemoteDesktopShortcutKey : QuickConnectPluginSettings.DefaultRemoteDesktopShortcutKey) & Keys.Modifiers; shortcutKeyControlRemoteDesktop.RenderHotKey(); shortcutKeyControlRemoteDesktop.Enabled = settings.EnableShortcutKeys ?? false; shortcutKeyControlRemoteDesktop.Show(); shortcutKeyControlPutty = HotKeyControlEx.ReplaceTextBox(this.textBoxPuttyShortcutKey.Parent, this.textBoxPuttyShortcutKey, false); shortcutKeyControlPutty.HotKey = (settings.EnableShortcutKeys.HasValue ? settings.PuttyShortcutKey : QuickConnectPluginSettings.DefaultPuttyShortcutKey) & Keys.KeyCode; shortcutKeyControlPutty.HotKeyModifiers = (settings.EnableShortcutKeys.HasValue ? settings.PuttyShortcutKey : QuickConnectPluginSettings.DefaultPuttyShortcutKey) & Keys.Modifiers; shortcutKeyControlPutty.RenderHotKey(); shortcutKeyControlPutty.Enabled = settings.EnableShortcutKeys ?? false; shortcutKeyControlPutty.Show(); shortcutKeyControlWinScp = HotKeyControlEx.ReplaceTextBox(this.textBoxWinScpShortcutKey.Parent, this.textBoxWinScpShortcutKey, false); shortcutKeyControlWinScp.HotKey = (settings.EnableShortcutKeys.HasValue ? settings.WinScpShortcutKey : QuickConnectPluginSettings.DefaultWinScpShortcutKey) & Keys.KeyCode; shortcutKeyControlWinScp.HotKeyModifiers = (settings.EnableShortcutKeys.HasValue ? settings.WinScpShortcutKey : QuickConnectPluginSettings.DefaultWinScpShortcutKey) & Keys.Modifiers; shortcutKeyControlWinScp.RenderHotKey(); shortcutKeyControlWinScp.Enabled = settings.EnableShortcutKeys ?? false; shortcutKeyControlWinScp.Show(); // Add handlers. this.checkBoxEnable.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxCompatibleMode.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxAddChangePasswordItem.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxDisableCLIPasswordForPutty.CheckedChanged += new EventHandler(settingsChanged); this.textBoxPuttyPath.TextChanged += new EventHandler(settingsChanged); this.textBoxWinScpPath.TextChanged += new EventHandler(settingsChanged); this.textBoxPsPasswdPath.TextChanged += new EventHandler(settingsChanged); this.comboBoxHostAddressMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.comboBoxConnectionMethodMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.comboBoxAdditionalOptionsMapFieldName.SelectedIndexChanged += new EventHandler(settingsChanged); this.checkBoxEnableShortcutKeys.CheckedChanged += new EventHandler(settingsChanged); this.checkBoxEnableShortcutKeys.CheckedChanged += (o, e) => { shortcutKeysSettingWasChanged = true; }; this.shortcutKeyControlRemoteDesktop.KeyUp += (s, e) => { settingsChanged(s, e); }; this.shortcutKeyControlPutty.KeyUp += (s, e) => { settingsChanged(s, e); }; this.shortcutKeyControlWinScp.KeyUp += (s, e) => { settingsChanged(s, e); }; this.buttonApply.Enabled = false; // Check if VMware VSphere PowerCLI is installed. this.checkVSpherePowerCLIStatus(); // Force settings validation. this.validateSettings(); }