SSH Agent: Update available attachments immediately

The list of available attachments for SSH agent is now updated
immediately when adding or removing file attachments.

Closes #1668.
This commit is contained in:
Thomas Luzat 2018-03-08 03:35:06 +01:00 committed by Jonathan White
parent dc1aead2a2
commit 46099fdd71
2 changed files with 26 additions and 18 deletions

View File

@ -281,6 +281,8 @@ void EditEntryWidget::setupSSHAgent()
connect(m_sshAgentUi->decryptButton, SIGNAL(clicked()), SLOT(decryptPrivateKey())); connect(m_sshAgentUi->decryptButton, SIGNAL(clicked()), SLOT(decryptPrivateKey()));
connect(m_sshAgentUi->copyToClipboardButton, SIGNAL(clicked()), SLOT(copyPublicKey())); connect(m_sshAgentUi->copyToClipboardButton, SIGNAL(clicked()), SLOT(copyPublicKey()));
connect(m_advancedUi->attachmentsWidget->entryAttachments(), SIGNAL(modified()), SLOT(updateAttachments()));
addPage(tr("SSH Agent"), FilePath::instance()->icon("apps", "utilities-terminal"), m_sshAgentWidget); addPage(tr("SSH Agent"), FilePath::instance()->icon("apps", "utilities-terminal"), m_sshAgentWidget);
} }
@ -299,6 +301,27 @@ void EditEntryWidget::updateSSHAgent()
m_sshAgentUi->removeFromAgentButton->setEnabled(false); m_sshAgentUi->removeFromAgentButton->setEnabled(false);
m_sshAgentUi->copyToClipboardButton->setEnabled(false); m_sshAgentUi->copyToClipboardButton->setEnabled(false);
m_sshAgentSettings = settings;
updateSSHAgentAttachments();
if (settings.selectedType() == "attachment") {
m_sshAgentUi->attachmentRadioButton->setChecked(true);
} else {
m_sshAgentUi->externalFileRadioButton->setChecked(true);
}
updateSSHAgentKeyInfo();
}
void EditEntryWidget::updateSSHAgentAttachment()
{
m_sshAgentUi->attachmentRadioButton->setChecked(true);
updateSSHAgentKeyInfo();
}
void EditEntryWidget::updateSSHAgentAttachments()
{
m_sshAgentUi->attachmentComboBox->clear();
m_sshAgentUi->attachmentComboBox->addItem(""); m_sshAgentUi->attachmentComboBox->addItem("");
auto attachments = m_advancedUi->attachmentsWidget->entryAttachments(); auto attachments = m_advancedUi->attachmentsWidget->entryAttachments();
@ -310,24 +333,8 @@ void EditEntryWidget::updateSSHAgent()
m_sshAgentUi->attachmentComboBox->addItem(fileName); m_sshAgentUi->attachmentComboBox->addItem(fileName);
} }
m_sshAgentUi->attachmentComboBox->setCurrentText(settings.attachmentName()); m_sshAgentUi->attachmentComboBox->setCurrentText(m_sshAgentSettings.attachmentName());
m_sshAgentUi->externalFileEdit->setText(settings.fileName()); m_sshAgentUi->externalFileEdit->setText(m_sshAgentSettings.fileName());
if (settings.selectedType() == "attachment") {
m_sshAgentUi->attachmentRadioButton->setChecked(true);
} else {
m_sshAgentUi->externalFileRadioButton->setChecked(true);
}
m_sshAgentSettings = settings;
updateSSHAgentKeyInfo();
}
void EditEntryWidget::updateSSHAgentAttachment()
{
m_sshAgentUi->attachmentRadioButton->setChecked(true);
updateSSHAgentKeyInfo();
} }
void EditEntryWidget::updateSSHAgentKeyInfo() void EditEntryWidget::updateSSHAgentKeyInfo()

View File

@ -103,6 +103,7 @@ private slots:
#ifdef WITH_XC_SSHAGENT #ifdef WITH_XC_SSHAGENT
void updateSSHAgent(); void updateSSHAgent();
void updateSSHAgentAttachment(); void updateSSHAgentAttachment();
void updateSSHAgentAttachments();
void updateSSHAgentKeyInfo(); void updateSSHAgentKeyInfo();
void browsePrivateKey(); void browsePrivateKey();
void addKeyToAgent(); void addKeyToAgent();