SSH Agent: Fix Windows agent selection, radio buttons

This commit is contained in:
Toni Spets 2022-04-01 20:39:47 -07:00 committed by Jonathan White
parent aca197a96f
commit 2b8d670f17
4 changed files with 23 additions and 10 deletions

View File

@ -152,6 +152,10 @@
<source>SSH Agent connection is working!</source> <source>SSH Agent connection is working!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Use both agents</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ApplicationSettingsWidget</name> <name>ApplicationSettingsWidget</name>

View File

@ -170,7 +170,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
// SSHAgent // SSHAgent
{Config::SSHAgent_Enabled, {QS("SSHAgent/Enabled"), Roaming, false}}, {Config::SSHAgent_Enabled, {QS("SSHAgent/Enabled"), Roaming, false}},
{Config::SSHAgent_UseOpenSSH, {QS("SSHAgent/UseOpenSSH"), 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_AuthSockOverride, {QS("SSHAgent/AuthSockOverride"), Local, {}}},
{Config::SSHAgent_SecurityKeyProviderOverride, {QS("SSHAgent/SecurityKeyProviderOverride"), Local, {}}}, {Config::SSHAgent_SecurityKeyProviderOverride, {QS("SSHAgent/SecurityKeyProviderOverride"), Local, {}}},

View File

@ -26,8 +26,9 @@ AgentSettingsWidget::AgentSettingsWidget(QWidget* parent)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
m_ui->usePageantCheckBox->setVisible(false); m_ui->usePageantRadioButton->setVisible(false);
m_ui->useOpenSSHCheckBox->setVisible(false); m_ui->useOpenSSHRadioButton->setVisible(false);
m_ui->useBothRadioButton->setVisible(false);
#else #else
m_ui->sshAuthSockWidget->setVisible(false); m_ui->sshAuthSockWidget->setVisible(false);
#endif #endif
@ -47,8 +48,9 @@ void AgentSettingsWidget::loadSettings()
m_ui->enableSSHAgentCheckBox->setChecked(sshAgentEnabled); m_ui->enableSSHAgentCheckBox->setChecked(sshAgentEnabled);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
m_ui->usePageantCheckBox->setChecked(sshAgent()->usePageant()); m_ui->usePageantRadioButton->setChecked(sshAgent()->usePageant());
m_ui->useOpenSSHCheckBox->setChecked(sshAgent()->useOpenSSH()); m_ui->useOpenSSHRadioButton->setChecked(sshAgent()->useOpenSSH());
m_ui->useBothRadioButton->setChecked(sshAgent()->usePageant() && sshAgent()->useOpenSSH());
sshAgentEnabled = sshAgentEnabled && (sshAgent()->usePageant() || sshAgent()->useOpenSSH()); sshAgentEnabled = sshAgentEnabled && (sshAgent()->usePageant() || sshAgent()->useOpenSSH());
#else #else
auto sshAuthSock = sshAgent()->socketPath(false); auto sshAuthSock = sshAgent()->socketPath(false);
@ -93,8 +95,8 @@ void AgentSettingsWidget::saveSettings()
auto sshSecurityKeyProviderOverride = m_ui->sshSecurityKeyProviderOverrideEdit->text(); auto sshSecurityKeyProviderOverride = m_ui->sshSecurityKeyProviderOverrideEdit->text();
sshAgent()->setSecurityKeyProviderOverride(sshSecurityKeyProviderOverride); sshAgent()->setSecurityKeyProviderOverride(sshSecurityKeyProviderOverride);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
sshAgent()->setUsePageant(m_ui->usePageantCheckBox->isChecked()); sshAgent()->setUsePageant(m_ui->usePageantRadioButton->isChecked() || m_ui->useBothRadioButton->isChecked());
sshAgent()->setUseOpenSSH(m_ui->useOpenSSHCheckBox->isChecked()); sshAgent()->setUseOpenSSH(m_ui->useOpenSSHRadioButton->isChecked() || m_ui->useBothRadioButton->isChecked());
#endif #endif
sshAgent()->setEnabled(m_ui->enableSSHAgentCheckBox->isChecked()); sshAgent()->setEnabled(m_ui->enableSSHAgentCheckBox->isChecked());
} }

View File

@ -73,19 +73,26 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QCheckBox" name="usePageantCheckBox"> <widget class="QRadioButton" name="usePageantRadioButton">
<property name="text"> <property name="text">
<string>Use Pageant</string> <string>Use Pageant</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="useOpenSSHCheckBox"> <widget class="QRadioButton" name="useOpenSSHRadioButton">
<property name="text"> <property name="text">
<string>Use OpenSSH</string> <string>Use OpenSSH</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QRadioButton" name="useBothRadioButton">
<property name="text">
<string>Use both agents</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QGridLayout" name="agentValues"> <layout class="QGridLayout" name="agentValues">
<property name="topMargin"> <property name="topMargin">