From 2b8d670f17e22722b44c1718a02322893de43418 Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Fri, 1 Apr 2022 20:39:47 -0700 Subject: [PATCH] SSH Agent: Fix Windows agent selection, radio buttons --- share/translations/keepassxc_en.ts | 4 ++++ src/core/Config.cpp | 2 +- src/sshagent/AgentSettingsWidget.cpp | 14 ++++++++------ src/sshagent/AgentSettingsWidget.ui | 13 ++++++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index 2a9c7b335..85c3307ca 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -152,6 +152,10 @@ SSH Agent connection is working! + + Use both agents + + ApplicationSettingsWidget diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 6bdef2f4a..98bbeeea0 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -170,7 +170,7 @@ static const QHash configStrings = { // SSHAgent {Config::SSHAgent_Enabled, {QS("SSHAgent/Enabled"), Roaming, false}}, {Config::SSHAgent_UseOpenSSH, {QS("SSHAgent/UseOpenSSH"), Roaming, false}}, - {Config::SSHAgent_UsePageant, {QS("SSHAgent/UsePageant"), Roaming, false} }, + {Config::SSHAgent_UsePageant, {QS("SSHAgent/UsePageant"), Roaming, true} }, {Config::SSHAgent_AuthSockOverride, {QS("SSHAgent/AuthSockOverride"), Local, {}}}, {Config::SSHAgent_SecurityKeyProviderOverride, {QS("SSHAgent/SecurityKeyProviderOverride"), Local, {}}}, diff --git a/src/sshagent/AgentSettingsWidget.cpp b/src/sshagent/AgentSettingsWidget.cpp index 1183198ab..1a55e14fa 100644 --- a/src/sshagent/AgentSettingsWidget.cpp +++ b/src/sshagent/AgentSettingsWidget.cpp @@ -26,8 +26,9 @@ AgentSettingsWidget::AgentSettingsWidget(QWidget* parent) { m_ui->setupUi(this); #ifndef Q_OS_WIN - m_ui->usePageantCheckBox->setVisible(false); - m_ui->useOpenSSHCheckBox->setVisible(false); + m_ui->usePageantRadioButton->setVisible(false); + m_ui->useOpenSSHRadioButton->setVisible(false); + m_ui->useBothRadioButton->setVisible(false); #else m_ui->sshAuthSockWidget->setVisible(false); #endif @@ -47,8 +48,9 @@ void AgentSettingsWidget::loadSettings() m_ui->enableSSHAgentCheckBox->setChecked(sshAgentEnabled); #ifdef Q_OS_WIN - m_ui->usePageantCheckBox->setChecked(sshAgent()->usePageant()); - m_ui->useOpenSSHCheckBox->setChecked(sshAgent()->useOpenSSH()); + m_ui->usePageantRadioButton->setChecked(sshAgent()->usePageant()); + m_ui->useOpenSSHRadioButton->setChecked(sshAgent()->useOpenSSH()); + m_ui->useBothRadioButton->setChecked(sshAgent()->usePageant() && sshAgent()->useOpenSSH()); sshAgentEnabled = sshAgentEnabled && (sshAgent()->usePageant() || sshAgent()->useOpenSSH()); #else auto sshAuthSock = sshAgent()->socketPath(false); @@ -93,8 +95,8 @@ void AgentSettingsWidget::saveSettings() auto sshSecurityKeyProviderOverride = m_ui->sshSecurityKeyProviderOverrideEdit->text(); sshAgent()->setSecurityKeyProviderOverride(sshSecurityKeyProviderOverride); #ifdef Q_OS_WIN - sshAgent()->setUsePageant(m_ui->usePageantCheckBox->isChecked()); - sshAgent()->setUseOpenSSH(m_ui->useOpenSSHCheckBox->isChecked()); + sshAgent()->setUsePageant(m_ui->usePageantRadioButton->isChecked() || m_ui->useBothRadioButton->isChecked()); + sshAgent()->setUseOpenSSH(m_ui->useOpenSSHRadioButton->isChecked() || m_ui->useBothRadioButton->isChecked()); #endif sshAgent()->setEnabled(m_ui->enableSSHAgentCheckBox->isChecked()); } diff --git a/src/sshagent/AgentSettingsWidget.ui b/src/sshagent/AgentSettingsWidget.ui index a961736e3..abd056c8a 100644 --- a/src/sshagent/AgentSettingsWidget.ui +++ b/src/sshagent/AgentSettingsWidget.ui @@ -72,20 +72,27 @@ 0 - - + + Use Pageant - + Use OpenSSH + + + + Use both agents + + +