Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
@@ -32,11 +32,14 @@ ProfileDialog::ProfileDialog(QWidget* parent)
|
||||
m_hostInput(new QLineEdit(this)),
|
||||
m_portInput(new QSpinBox(this)),
|
||||
m_usernameInput(new QLineEdit(this)),
|
||||
m_domainInput(new QLineEdit(this)),
|
||||
m_protocolInput(new QComboBox(this)),
|
||||
m_authModeInput(new QComboBox(this)),
|
||||
m_privateKeyPathInput(new QLineEdit(this)),
|
||||
m_browsePrivateKeyButton(new QPushButton(QStringLiteral("Browse"), this)),
|
||||
m_knownHostsPolicyInput(new QComboBox(this))
|
||||
m_knownHostsPolicyInput(new QComboBox(this)),
|
||||
m_rdpSecurityModeInput(new QComboBox(this)),
|
||||
m_rdpPerformanceProfileInput(new QComboBox(this))
|
||||
{
|
||||
resize(520, 340);
|
||||
|
||||
@@ -48,11 +51,18 @@ ProfileDialog::ProfileDialog(QWidget* parent)
|
||||
m_portInput->setRange(1, 65535);
|
||||
m_portInput->setValue(22);
|
||||
m_usernameInput->setPlaceholderText(QStringLiteral("deploy"));
|
||||
m_domainInput->setPlaceholderText(QStringLiteral("CONTOSO"));
|
||||
|
||||
m_protocolInput->addItems({QStringLiteral("SSH"), QStringLiteral("RDP"), QStringLiteral("VNC")});
|
||||
m_authModeInput->addItems({QStringLiteral("Password"), QStringLiteral("Private Key")});
|
||||
m_knownHostsPolicyInput->addItems(
|
||||
{QStringLiteral("Ask"), QStringLiteral("Strict"), QStringLiteral("Accept New"), QStringLiteral("Ignore")});
|
||||
m_rdpSecurityModeInput->addItems(
|
||||
{QStringLiteral("Negotiate"), QStringLiteral("NLA"), QStringLiteral("TLS"), QStringLiteral("RDP")});
|
||||
m_rdpPerformanceProfileInput->addItems({QStringLiteral("Balanced"),
|
||||
QStringLiteral("Best Quality"),
|
||||
QStringLiteral("Best Performance"),
|
||||
QStringLiteral("Auto Detect")});
|
||||
|
||||
m_privateKeyPathInput->setPlaceholderText(QStringLiteral("/home/user/.ssh/id_ed25519"));
|
||||
|
||||
@@ -80,6 +90,10 @@ ProfileDialog::ProfileDialog(QWidget* parent)
|
||||
this,
|
||||
[this](const QString& protocol) {
|
||||
m_portInput->setValue(standardPortForProtocol(protocol));
|
||||
if (protocol != QStringLiteral("SSH")) {
|
||||
const QSignalBlocker blocker(m_authModeInput);
|
||||
m_authModeInput->setCurrentText(QStringLiteral("Password"));
|
||||
}
|
||||
refreshAuthFields();
|
||||
});
|
||||
|
||||
@@ -92,10 +106,13 @@ ProfileDialog::ProfileDialog(QWidget* parent)
|
||||
form->addRow(QStringLiteral("Host"), m_hostInput);
|
||||
form->addRow(QStringLiteral("Port"), m_portInput);
|
||||
form->addRow(QStringLiteral("Username"), m_usernameInput);
|
||||
form->addRow(QStringLiteral("Domain"), m_domainInput);
|
||||
form->addRow(QStringLiteral("Protocol"), m_protocolInput);
|
||||
form->addRow(QStringLiteral("Auth Mode"), m_authModeInput);
|
||||
form->addRow(QStringLiteral("Private Key"), privateKeyRow);
|
||||
form->addRow(QStringLiteral("Known Hosts"), m_knownHostsPolicyInput);
|
||||
form->addRow(QStringLiteral("RDP Security"), m_rdpSecurityModeInput);
|
||||
form->addRow(QStringLiteral("RDP Performance"), m_rdpPerformanceProfileInput);
|
||||
|
||||
auto* note = new QLabel(
|
||||
QStringLiteral("Passwords are requested at connect time and are not stored."),
|
||||
@@ -124,6 +141,7 @@ void ProfileDialog::setProfile(const Profile& profile)
|
||||
m_hostInput->setText(profile.host);
|
||||
m_portInput->setValue(profile.port > 0 ? profile.port : 22);
|
||||
m_usernameInput->setText(profile.username);
|
||||
m_domainInput->setText(profile.domain);
|
||||
m_privateKeyPathInput->setText(profile.privateKeyPath);
|
||||
|
||||
const int protocolIndex = m_protocolInput->findText(profile.protocol);
|
||||
@@ -138,6 +156,12 @@ void ProfileDialog::setProfile(const Profile& profile)
|
||||
|
||||
const int knownHostsIndex = m_knownHostsPolicyInput->findText(profile.knownHostsPolicy);
|
||||
m_knownHostsPolicyInput->setCurrentIndex(knownHostsIndex >= 0 ? knownHostsIndex : 0);
|
||||
const int securityModeIndex = m_rdpSecurityModeInput->findText(profile.rdpSecurityMode);
|
||||
m_rdpSecurityModeInput->setCurrentIndex(securityModeIndex >= 0 ? securityModeIndex : 0);
|
||||
const int performanceProfileIndex =
|
||||
m_rdpPerformanceProfileInput->findText(profile.rdpPerformanceProfile);
|
||||
m_rdpPerformanceProfileInput->setCurrentIndex(performanceProfileIndex >= 0 ? performanceProfileIndex
|
||||
: 0);
|
||||
|
||||
refreshAuthFields();
|
||||
}
|
||||
@@ -150,10 +174,13 @@ Profile ProfileDialog::profile() const
|
||||
profile.host = m_hostInput->text().trimmed();
|
||||
profile.port = m_portInput->value();
|
||||
profile.username = m_usernameInput->text().trimmed();
|
||||
profile.domain = m_domainInput->text().trimmed();
|
||||
profile.protocol = m_protocolInput->currentText();
|
||||
profile.authMode = m_authModeInput->currentText();
|
||||
profile.privateKeyPath = m_privateKeyPathInput->text().trimmed();
|
||||
profile.knownHostsPolicy = m_knownHostsPolicyInput->currentText();
|
||||
profile.rdpSecurityMode = m_rdpSecurityModeInput->currentText();
|
||||
profile.rdpPerformanceProfile = m_rdpPerformanceProfileInput->currentText();
|
||||
return profile;
|
||||
}
|
||||
|
||||
@@ -173,11 +200,12 @@ void ProfileDialog::accept()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_protocolInput->currentText() == QStringLiteral("SSH")
|
||||
const QString protocol = m_protocolInput->currentText();
|
||||
if ((protocol == QStringLiteral("SSH") || protocol == QStringLiteral("RDP"))
|
||||
&& m_usernameInput->text().trimmed().isEmpty()) {
|
||||
QMessageBox::warning(this,
|
||||
QStringLiteral("Validation Error"),
|
||||
QStringLiteral("Username is required for SSH profiles."));
|
||||
QStringLiteral("Username is required for %1 profiles.").arg(protocol));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,10 +215,14 @@ void ProfileDialog::accept()
|
||||
void ProfileDialog::refreshAuthFields()
|
||||
{
|
||||
const bool isSsh = m_protocolInput->currentText() == QStringLiteral("SSH");
|
||||
const bool isRdp = m_protocolInput->currentText() == QStringLiteral("RDP");
|
||||
const bool isPrivateKey = m_authModeInput->currentText() == QStringLiteral("Private Key");
|
||||
|
||||
m_authModeInput->setEnabled(isSsh);
|
||||
m_privateKeyPathInput->setEnabled(isSsh && isPrivateKey);
|
||||
m_browsePrivateKeyButton->setEnabled(isSsh && isPrivateKey);
|
||||
m_knownHostsPolicyInput->setEnabled(isSsh);
|
||||
m_domainInput->setEnabled(isRdp);
|
||||
m_rdpSecurityModeInput->setEnabled(isRdp);
|
||||
m_rdpPerformanceProfileInput->setEnabled(isRdp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user