Skip to content

Commit

Permalink
SSH Agent: Fix Windows agent selection, radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
hifi committed Apr 2, 2022
1 parent aca197a commit 8ad6a30
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> 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, {}}},

Expand Down
10 changes: 6 additions & 4 deletions src/sshagent/AgentSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ AgentSettingsWidget::AgentSettingsWidget(QWidget* parent)
#ifndef Q_OS_WIN
m_ui->usePageantCheckBox->setVisible(false);
m_ui->useOpenSSHCheckBox->setVisible(false);
m_ui->useBothCheckBox->setVisible(false);
#else
m_ui->sshAuthSockWidget->setVisible(false);
#endif
Expand All @@ -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);
Expand Down Expand Up @@ -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());
}
Expand Down
13 changes: 10 additions & 3 deletions src/sshagent/AgentSettingsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,27 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="usePageantCheckBox">
<item>
<widget class="QRadioButton" name="usePageantRadioButton">
<property name="text">
<string>Use Pageant</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useOpenSSHCheckBox">
<widget class="QRadioButton" name="useOpenSSHRadioButton">
<property name="text">
<string>Use OpenSSH</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="useBothRadioButton">
<property name="text">
<string>Use both agents</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="agentValues">
<property name="topMargin">
Expand Down

0 comments on commit 8ad6a30

Please sign in to comment.