Commit 6bea01ea authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Add a button to find the SSH Key

parent 08e17260
......@@ -24,6 +24,7 @@
#include <QAction>
#include <QDebug>
#include <QFileDialog>
#include <QIntValidator>
#include <QItemSelectionModel>
#include <QMenu>
......@@ -32,6 +33,7 @@
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include <QSortFilterProxyModel>
#include <QStandardPaths>
#include <KMessageBox>
......@@ -70,6 +72,15 @@ SSHManagerTreeWidget::SSHManagerTreeWidget(QWidget *parent)
connect(ui->btnRemove, &QPushButton::clicked, this, &SSHManagerTreeWidget::triggerRemove);
connect(ui->btnInvertFilter, &QPushButton::clicked, d->filterModel, &SSHManagerFilterModel::setInvertFilter);
connect(ui->btnFindSshKey, &QPushButton::clicked, this, [this] {
const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
const QString sshFile = QFileDialog::getOpenFileName(this, i18n("SSH Key"), homeFolder + QStringLiteral("/.ssh"));
if (sshFile.isEmpty()) {
return;
}
ui->sshkey->setText(sshFile);
});
connect(ui->filterText, &QLineEdit::textChanged, this, [this] {
d->filterModel->setFilterRegularExpression(ui->filterText->text());
d->filterModel->invalidate();
......
......@@ -110,15 +110,56 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="sshkey">
<property name="toolTip">
<string>The private key to be used for this connection</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="sshkey">
<property name="toolTip">
<string>The private key to be used for this connection</string>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>The private key</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnFindSshKey">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="folder-open"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
<string>Username</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="username">
<property name="toolTip">
<string>The username for the connection</string>
</property>
<property name="placeholderText">
<string>The private key</string>
<string>Your username</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="useSshConfig">
<property name="toolTip">
<string>If this is set, we don't rely on the SSH key set above, but on the configuration on ~/.ssh/config</string>
</property>
<property name="text">
<string>Use ~/.ssh/config for key</string>
</property>
</widget>
</item>
......@@ -168,33 +209,6 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="username">
<property name="toolTip">
<string>The username for the connection</string>
</property>
<property name="placeholderText">
<string>Your username</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Username</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="useSshConfig">
<property name="toolTip">
<string>If this is set, we don't rely on the SSH key set above, but on the configuration on ~/.ssh/config</string>
</property>
<property name="text">
<string>Use ~/.ssh/config for key</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
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