Commit dc27daee authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Allow to edit some elements of an imported ssh config

It makes no sense to block edition of all elements from
imported data from ssh config, we forbid people to select
a profile for those cases :(

So, allow to change the identifier and the profile.
parent 6bea01ea
......@@ -216,8 +216,6 @@ void SSHManagerTreeWidget::editSshInfo()
ui->username->setText(data.username);
ui->useSshConfig->setCheckState(data.useSshConfig ? Qt::Checked : Qt::Unchecked);
setEditComponentsEnabled(!data.importedFromSshConfig);
// This is just for add. To edit the folder, the user will drag & drop.
ui->folder->setCurrentText(QStringLiteral("not-used-here"));
ui->folderLabel->hide();
......@@ -231,12 +229,14 @@ void SSHManagerTreeWidget::editSshInfo()
void SSHManagerTreeWidget::handleImportedData(bool isImported)
{
QList<QWidget *> elements = {ui->hostname, ui->port, ui->username, ui->sshkey, ui->useSshConfig};
if (isImported) {
ui->errorPanel->setText(QStringLiteral("You are currently viewing an imported SSH Profile, those are read only."));
ui->errorPanel->setText(QStringLiteral("Imported SSH Profile <br/> Some settings are read only."));
ui->errorPanel->show();
ui->btnAdd->hide();
} else {
ui->errorPanel->hide();
}
for (auto *element : elements) {
element->setEnabled(!isImported);
}
}
......@@ -378,7 +378,7 @@ void SSHManagerTreeWidget::handleTreeClick(Qt::MouseButton btn, const QModelInde
} else {
const auto item = d->model->itemFromIndex(sourceIdx);
const auto data = item->data(SSHManagerModel::SSHRole).value<SSHConfigurationData>();
ui->btnEdit->setEnabled(!data.importedFromSshConfig);
ui->btnEdit->setEnabled(true);
if (ui->sshInfoPane->isVisible()) {
handleImportedData(data.importedFromSshConfig);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment