Merge branch 'release/2.3.2' into develop

This commit is contained in:
Janek Bevendorff 2018-03-18 01:14:42 +01:00
commit e92d5e80ee
No known key found for this signature in database
GPG key ID: 2FDEB0D40BCA5E11
18 changed files with 180 additions and 70 deletions

View file

@ -281,6 +281,8 @@ void EditEntryWidget::setupSSHAgent()
connect(m_sshAgentUi->decryptButton, SIGNAL(clicked()), SLOT(decryptPrivateKey()));
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);
}
@ -299,6 +301,27 @@ void EditEntryWidget::updateSSHAgent()
m_sshAgentUi->removeFromAgentButton->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("");
auto attachments = m_advancedUi->attachmentsWidget->entryAttachments();
@ -310,24 +333,8 @@ void EditEntryWidget::updateSSHAgent()
m_sshAgentUi->attachmentComboBox->addItem(fileName);
}
m_sshAgentUi->attachmentComboBox->setCurrentText(settings.attachmentName());
m_sshAgentUi->externalFileEdit->setText(settings.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();
m_sshAgentUi->attachmentComboBox->setCurrentText(m_sshAgentSettings.attachmentName());
m_sshAgentUi->externalFileEdit->setText(m_sshAgentSettings.fileName());
}
void EditEntryWidget::updateSSHAgentKeyInfo()
@ -420,12 +427,16 @@ void EditEntryWidget::browsePrivateKey()
bool EditEntryWidget::getOpenSSHKey(OpenSSHKey& key, bool decrypt)
{
QString fileName;
QByteArray privateKeyData;
if (m_sshAgentUi->attachmentRadioButton->isChecked()) {
privateKeyData = m_advancedUi->attachmentsWidget->getAttachment(m_sshAgentUi->attachmentComboBox->currentText());
fileName = m_sshAgentUi->attachmentComboBox->currentText();
privateKeyData = m_advancedUi->attachmentsWidget->getAttachment(fileName);
} else {
QFile localFile(m_sshAgentUi->externalFileEdit->text());
QFileInfo localFileInfo(localFile);
fileName = localFileInfo.fileName();
if (localFile.fileName().isEmpty()) {
return false;
@ -464,6 +475,10 @@ bool EditEntryWidget::getOpenSSHKey(OpenSSHKey& key, bool decrypt)
key.setComment(m_entry->username());
}
if (key.comment().isEmpty()) {
key.setComment(fileName);
}
return true;
}