Commit 1d784139 authored by Marco Martin's avatar Marco Martin

Configuration to never show the passwors dialog

Summary:
on Plasma mobile, not qwidget dialogs should be ever shown at any time.
the networkmanager KCM includes its own password field, so the password dialog can be safely
be never shown

Test Plan: fails silently

Reviewers: #plasma, jgrulich

Reviewed By: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18588
parent 32d76665
......@@ -25,6 +25,8 @@
#include "debug.h"
#include "configuration.h"
#include <NetworkManagerQt/Settings>
#include <NetworkManagerQt/ConnectionSettings>
#include <NetworkManagerQt/GenericTypes>
......@@ -404,7 +406,10 @@ bool SecretAgent::processGetSecrets(SecretsRequest &request) const
}
}
if (requestNew || (allowInteraction && !setting->needSecrets(requestNew).isEmpty()) || (allowInteraction && userRequested) || (isVpn && allowInteraction)) {
if (!Configuration::showPasswordDialog()) {
sendError(SecretAgent::NoSecrets, "Cannot authenticate", request.message);
return true;
} else if (requestNew || (allowInteraction && !setting->needSecrets(requestNew).isEmpty()) || (allowInteraction && userRequested) || (isVpn && allowInteraction)) {
m_dialog = new PasswordDialog(connectionSettings, request.flags, request.setting_name);
connect(m_dialog, &PasswordDialog::accepted, this, &SecretAgent::dialogAccepted);
connect(m_dialog, &PasswordDialog::rejected, this, &SecretAgent::dialogRejected);
......
......@@ -66,3 +66,16 @@ void Configuration::setManageVirtualConnections(bool manage)
grp.writeEntry(QLatin1String("ManageVirtualConnections"), manage);
}
}
bool Configuration::showPasswordDialog()
{
KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("plasma-nm"));
KConfigGroup grp(config, QLatin1String("General"));
if (grp.isValid()) {
return grp.readEntry(QLatin1String("ShowPasswordDialog"), true);
}
return true;
}
......@@ -29,6 +29,8 @@ class Q_DECL_EXPORT Configuration : public QObject
{
Q_PROPERTY(bool unlockModemOnDetection READ unlockModemOnDetection WRITE setUnlockModemOnDetection)
Q_PROPERTY(bool manageVirtualConnections READ manageVirtualConnections WRITE setManageVirtualConnections)
//Readonly constant property, as this value should only be set by the platform
Q_PROPERTY(bool showPasswordDialog READ showPasswordDialog CONSTANT)
Q_OBJECT
public:
static bool unlockModemOnDetection();
......@@ -36,6 +38,8 @@ public:
static bool manageVirtualConnections();
static void setManageVirtualConnections(bool manage);
static bool showPasswordDialog();
};
#endif // PLAMA_NM_CONFIGURATION_H
......
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