Commit 848e474e authored by Enrique Melendez's avatar Enrique Melendez Committed by Jan Grulich

Add hints to the argument list; pass hints inside the vpnSetting argument to askUser

parent a1db6d31
......@@ -40,7 +40,7 @@
using namespace NetworkManager;
PasswordDialog::PasswordDialog(const NetworkManager::ConnectionSettings::Ptr &connectionSettings, SecretAgent::GetSecretsFlags flags,
const QString &setting_name, QWidget *parent) :
const QString &setting_name, const QStringList &hints, QWidget *parent) :
QDialog(parent),
m_ui(nullptr),
m_hasError(false),
......@@ -49,6 +49,7 @@ PasswordDialog::PasswordDialog(const NetworkManager::ConnectionSettings::Ptr &co
m_error(SecretAgent::NoSecrets),
m_flags(flags),
m_vpnWidget(nullptr)
m_hints(hints)
{
setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-password")));
......@@ -135,6 +136,13 @@ void PasswordDialog::initializeUi()
this, QVariantList(), &error);
if (vpnUiPlugin && error.isEmpty()) {
const QString shortName = serviceType.section('.', -1);
NMStringMap data = vpnSetting->data();
// If we have hints, make the user have them through the widget
if (!m_hints.isEmpty() && m_hints.size() == 2) {
data.insert("hint", m_hints[0]);
data.insert("hint-msg", m_hints[1]);
vpnSetting->setData(data);
}
m_vpnWidget = vpnUiPlugin->askUser(vpnSetting, this);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(m_vpnWidget);
......@@ -152,6 +160,13 @@ void PasswordDialog::initializeUi()
setFocusProxy(m_vpnWidget);
m_vpnWidget->setFocus(Qt::OtherFocusReason);
// Delete hins from vpnSetting
if (!m_hints.isEmpty()) {
data.remove("hint");
data.remove("hint-msg");
vpnSetting->setData(data);
}
} else {
qCWarning(PLASMA_NM) << error << ", serviceType == " << serviceType;
m_hasError = true;
......
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